MOBILE-2567 pushnotifications: Fix redirect when app is open

main
Albert Gasset 2018-09-10 11:37:39 +02:00
parent e3243ee17b
commit 3fd0500286
3 changed files with 7 additions and 5 deletions

View File

@ -102,7 +102,7 @@ export class AddonMessagesModule {
return;
}
messagesProvider.invalidateDiscussionsCache().finally(() => {
messagesProvider.invalidateDiscussionsCache(notification.site).finally(() => {
linkHelper.goInSite(undefined, 'AddonMessagesIndexPage', undefined, notification.site);
});
});

View File

@ -344,9 +344,11 @@ export class AddonPushNotificationsProvider {
// Execute the callback in the Angular zone, so change detection doesn't stop working.
this.zone.run(() => {
this.pushID = data.registrationId;
this.registerDeviceOnMoodle().catch((error) => {
this.logger.warn('Can\'t register device', error);
});
if (this.sitesProvider.isLoggedIn()) {
this.registerDeviceOnMoodle().catch((error) => {
this.logger.warn('Can\'t register device', error);
});
}
});
});

View File

@ -70,7 +70,7 @@ export class AddonPushNotificationsModule {
// Listen for local notification clicks (generated by the app).
localNotificationsProvider.registerClick(AddonPushNotificationsProvider.COMPONENT,
pushNotificationsProvider.notificationClicked);
pushNotificationsProvider.notificationClicked.bind(pushNotificationsProvider));
// Allow migrating the table from the old app to the new schema.
updateManager.registerAppTableMigration({