Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(LocalNotifications): return proper LocalNotificationScheduleResult on schedule #2490

Merged
merged 1 commit into from
Feb 25, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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