bug: LocalNotification.schedule does not return a LocalNotificationScheduleResult on iOS or Android #2152
Closed
2 of 4 tasks
Labels
Milestone
Bug Report
Capacitor Version
npx cap doctor
output:Latest Dependencies:
@capacitor/cli: 1.3.0
@capacitor/core: 1.3.0
@capacitor/android: 1.3.0
@capacitor/ios: 1.3.0
Installed Dependencies:
@capacitor/cli 1.3.0
@capacitor/core 1.3.0
@capacitor/ios 1.3.0
@capacitor/android 1.3.0
[success] Android looking great! 👌
Found 2 Capacitor plugins for ios:
cordova-plugin-safariviewcontroller (1.6.0)
cordova-plugin-whitelist (1.3.4)
[success] iOS looking great! 👌
Affected Platform(s)
Current Behavior
The type definitions for
core-plugin-definitions.ts
says that the result of LocalNotifications.schedule should bePromise<LocalNotificationScheduleResult>
, whereLocalNotificationScheduleResult
simply extendsLocalNotificationPendingList
.LocalNotificationPendingList
is an object containing a key ofnotifications
which is a list ofLocalNotificationRequest
.When I call
LocalNotifications.schedule
on iOS or Android, I get an object containing a keyids
, mapped to a list ofLocalNotificationRequest
. Looking at the source code (links below), one can see that the implementation ofschedule
on iOS and Android is returning the wrong type of object. The web implementation is returning the correct shape.Expected Behavior
Calling
LocalNotification.schedule
should produce a result that matches its type definition, especially since that type definition is exported.Reproduction Steps
Comparing these 3 URLs is enough to see that the return type is incorrect:
https://github.com/ionic-team/capacitor/blob/master/ios/Capacitor/Capacitor/Plugins/LocalNotifications.swift#L90
https://github.com/ionic-team/capacitor/blob/master/android/capacitor/src/main/java/com/getcapacitor/plugin/LocalNotifications.java#L74
https://github.com/ionic-team/capacitor/blob/master/core/src/core-plugin-definitions.ts#L974
Other Technical Details
npm --version
output: 6.9.0node --version
output: v10.16.3pod --version
output (iOS issues only): 1.7.1Other Information
The type definition can be updated to match the shape returned by iOS and Android, but that means also updating the web implementation of the plugin to return that shape as well. I think it's preferable to update the iOS and Android implementations to return the correct type.
The text was updated successfully, but these errors were encountered: