Skip to content

Commit

Permalink
fix(LocalNotifications): return proper LocalNotificationScheduleResul…
Browse files Browse the repository at this point in the history
…t on schedule (#2490)
  • Loading branch information
jcesarmobile committed Feb 25, 2020
1 parent 53211a3 commit b89fb15
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,17 @@ public void schedule(PluginCall call) {
}
JSONArray ids = manager.schedule(call, localNotifications);
notificationStorage.appendNotificationIds(localNotifications);
call.success(new JSObject().put("ids", ids));
JSObject result = new JSObject();
JSArray jsArray = new JSArray();
for (int i=0; i < ids.length(); i++) {
try {
JSObject notification = new JSObject().put("id", ids.getString(i));
jsArray.put(notification);
} catch (Exception ex) {
}
}
result.put("notifications", jsArray);
call.success(result);
}

@PluginMethod()
Expand Down
2 changes: 1 addition & 1 deletion core/src/web/local-notifications.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export class LocalNotificationsPluginWeb extends WebPlugin implements LocalNotif
});

return Promise.resolve({
notifications: notifications.map(_ => { return { id: '' }; })
notifications: options.notifications.map(notification => { return { id: '' + notification.id }; })
});
}

Expand Down
7 changes: 6 additions & 1 deletion ios/Capacitor/Capacitor/Plugins/LocalNotifications.swift
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,13 @@ public class CAPLocalNotificationsPlugin : CAPPlugin {
ids.append(request.identifier)
}

let ret = ids.map({ (id) -> [String:String] in
return [
"id": id,
]
})
call.success([
"ids": ids
"notifications": ret
])
}

Expand Down

0 comments on commit b89fb15

Please sign in to comment.