MOBILE-2567 core: Fix local notification events

main
Dani Palou 2018-09-04 16:16:19 +02:00
parent ba46373873
commit b67a2900eb
2 changed files with 12 additions and 10 deletions

View File

@ -122,7 +122,7 @@
</plugin>
<plugin name="ionic-plugin-keyboard" spec="^2.2.1" />
<plugin name="cordova-plugin-zip" spec="^3.1.0" />
<plugin name="cordova-plugin-local-notifications-mm" spec="^1.0.10" />
<plugin name="cordova-plugin-local-notifications-mm" spec="^1.0.11" />
<plugin name="cordova-plugin-file-opener2" spec="^2.0.19" />
<plugin name="com-darryncampbell-cordova-plugin-intent" spec="^1.1.0" />
<plugin name="cordova-sqlite-evcore-extbuild-free" spec="^0.9.7" />

View File

@ -125,17 +125,19 @@ export class CoreLocalNotificationsProvider {
this.appDB = appProvider.getDB();
this.appDB.createTablesFromSchema(this.tablesSchema);
localNotifications.on('trigger', (notification, state) => {
this.trigger(notification);
});
platform.ready().then(() => {
localNotifications.on('trigger', (notification, state) => {
this.trigger(notification);
});
localNotifications.on('click', (notification, state) => {
if (notification && notification.data) {
this.logger.debug('Notification clicked: ', notification.data);
localNotifications.on('click', (notification, state) => {
if (notification && notification.data) {
this.logger.debug('Notification clicked: ', notification.data);
const data = textUtils.parseJSON(notification.data);
this.notifyClick(data);
}
const data = textUtils.parseJSON(notification.data);
this.notifyClick(data);
}
});
});
eventsProvider.on(CoreEventsProvider.SITE_DELETED, (site) => {