MOBILE-2431 localnotif: Fix local notification clicks
parent
cfabc24545
commit
fa744ca7f2
|
@ -58,7 +58,7 @@ export class AddonCalendarModule {
|
|||
return;
|
||||
}
|
||||
|
||||
loginHelper.redirect('AddonCalendarListPage', {eventid: data.eventid}, data.siteId);
|
||||
loginHelper.redirect('AddonCalendarListPage', {eventId: data.eventid}, data.siteId);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
|
@ -78,7 +78,7 @@ export class AddonCalendarListPage implements OnDestroy {
|
|||
}, sitesProvider.getCurrentSiteId());
|
||||
}
|
||||
|
||||
this.eventId = navParams.get('eventid') || false;
|
||||
this.eventId = navParams.get('eventId') || false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue