MOBILE-2567: Fix local notifications on Android 8

main
Albert Gasset 2018-09-07 10:20:40 +02:00
parent 35908f776f
commit 8f91a34c11
3 changed files with 17 additions and 3 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.11" />
<plugin name="cordova-plugin-local-notifications-mm" spec="^1.0.13" />
<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

@ -13,6 +13,7 @@
// limitations under the License.
import { Injectable } from '@angular/core';
import { TranslateService } from '@ngx-translate/core';
import { CoreLoggerProvider } from '@providers/logger';
import { CoreSitesProvider } from '@providers/sites';
import { CoreSite } from '@classes/site';
@ -131,7 +132,8 @@ export class AddonCalendarProvider {
constructor(logger: CoreLoggerProvider, private sitesProvider: CoreSitesProvider, private groupsProvider: CoreGroupsProvider,
private coursesProvider: CoreCoursesProvider, private timeUtils: CoreTimeUtilsProvider,
private localNotificationsProvider: CoreLocalNotificationsProvider, private configProvider: CoreConfigProvider) {
private localNotificationsProvider: CoreLocalNotificationsProvider, private configProvider: CoreConfigProvider,
private translate: TranslateService) {
this.logger = logger.getInstance('AddonCalendarProvider');
this.sitesProvider.createTablesFromSchema(this.tablesSchema);
}
@ -460,6 +462,11 @@ export class AddonCalendarProvider {
title: event.name,
text: startDate.toLocaleString(),
at: dateTriggered,
channelParams: {
channelID: 'notifications',
channelName: this.translate.instant('addon.notifications.notifications'),
importance: 4 // IMPORTANCE_HIGH
},
data: {
eventid: event.id,
siteid: siteId

View File

@ -13,6 +13,7 @@
// limitations under the License.
import { Injectable, NgZone } from '@angular/core';
import { TranslateService } from '@ngx-translate/core';
import { Platform } from 'ionic-angular';
import { Badge } from '@ionic-native/badge';
import { Push, PushObject, PushOptions } from '@ionic-native/push';
@ -65,7 +66,8 @@ export class AddonPushNotificationsProvider {
protected pushNotificationsDelegate: AddonPushNotificationsDelegate, protected sitesProvider: CoreSitesProvider,
private badge: Badge, private localNotificationsProvider: CoreLocalNotificationsProvider,
private utils: CoreUtilsProvider, private textUtils: CoreTextUtilsProvider, private push: Push,
private configProvider: CoreConfigProvider, private device: Device, private zone: NgZone) {
private configProvider: CoreConfigProvider, private device: Device, private zone: NgZone,
private translate: TranslateService) {
this.logger = logger.getInstance('AddonPushNotificationsProvider');
this.appDB = appProvider.getDB();
this.appDB.createTablesFromSchema(this.tablesSchema);
@ -154,6 +156,11 @@ export class AddonPushNotificationsProvider {
const localNotif = {
id: 1,
at: new Date(),
channelParams: {
channelID: 'notifications',
channelName: this.translate.instant('addon.notifications.notifications'),
importance: 4 // IMPORTANCE_HIGH
},
data: {
notif: data.notif,
site: data.site