diff --git a/src/addon/calendar/calendar.module.ts b/src/addon/calendar/calendar.module.ts index f82454173..85aa71eb2 100644 --- a/src/addon/calendar/calendar.module.ts +++ b/src/addon/calendar/calendar.module.ts @@ -58,7 +58,7 @@ export class AddonCalendarModule { return; } - loginHelper.redirect('AddonCalendarListPage', {eventid: data.eventid}, data.siteId); + loginHelper.redirect('AddonCalendarListPage', {eventId: data.eventid}, data.siteId); }); }); } diff --git a/src/addon/calendar/pages/list/list.ts b/src/addon/calendar/pages/list/list.ts index 8f82a3258..4fe69c33e 100644 --- a/src/addon/calendar/pages/list/list.ts +++ b/src/addon/calendar/pages/list/list.ts @@ -78,7 +78,7 @@ export class AddonCalendarListPage implements OnDestroy { }, sitesProvider.getCurrentSiteId()); } - this.eventId = navParams.get('eventid') || false; + this.eventId = navParams.get('eventId') || false; } /** diff --git a/src/core/mainmenu/pages/menu/menu.ts b/src/core/mainmenu/pages/menu/menu.ts index 043cf3965..a2393ed8a 100644 --- a/src/core/mainmenu/pages/menu/menu.ts +++ b/src/core/mainmenu/pages/menu/menu.ts @@ -89,8 +89,10 @@ export class CoreMainMenuPage implements OnDestroy { this.initialTab = 0; for (let i = 0; i < this.tabs.length; i++) { - if (this.tabs[i].page == this.redirectPage) { + const tab = this.tabs[i]; + if (tab.page == this.redirectPage) { this.initialTab = i + 1; + tab.pageParams = Object.assign(tab.pageParams || {}, this.redirectParams); break; } } diff --git a/src/providers/local-notifications.ts b/src/providers/local-notifications.ts index 7afa1db58..4002a066d 100644 --- a/src/providers/local-notifications.ts +++ b/src/providers/local-notifications.ts @@ -18,6 +18,7 @@ import { LocalNotifications, ILocalNotification } from '@ionic-native/local-noti import { TranslateService } from '@ngx-translate/core'; import { CoreAppProvider } from './app'; import { CoreConfigProvider } from './config'; +import { CoreEventsProvider } from './events'; import { CoreLoggerProvider } from './logger'; import { CoreTextUtilsProvider } from './utils/text'; import { CoreUtilsProvider } from './utils/utils'; @@ -117,10 +118,31 @@ export class CoreLocalNotificationsProvider { constructor(logger: CoreLoggerProvider, private localNotifications: LocalNotifications, private platform: Platform, private appProvider: CoreAppProvider, private utils: CoreUtilsProvider, private configProvider: CoreConfigProvider, - private textUtils: CoreTextUtilsProvider, private translate: TranslateService, private alertCtrl: AlertController) { + private textUtils: CoreTextUtilsProvider, private translate: TranslateService, private alertCtrl: AlertController, + eventsProvider: CoreEventsProvider) { + this.logger = logger.getInstance('CoreLocalNotificationsProvider'); this.appDB = appProvider.getDB(); this.appDB.createTablesFromSchema(this.tablesSchema); + + localNotifications.on('trigger', (notification, state) => { + this.trigger(notification); + }); + + 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); + } + }); + + eventsProvider.on(CoreEventsProvider.SITE_DELETED, (site) => { + if (site) { + this.cancelSiteNotifications(site.id); + } + }); } /**