MOBILE-2795 notifications: Check is triggered on plugin
This commit is contained in:
		
							parent
							
								
									6727325d8e
								
							
						
					
					
						commit
						f4d3ab4c6c
					
				@ -298,7 +298,7 @@ export class CoreLocalNotificationsProvider {
 | 
				
			|||||||
        return this.appDB.getRecord(this.TRIGGERED_TABLE, { id: notification.id }).then((stored) => {
 | 
					        return this.appDB.getRecord(this.TRIGGERED_TABLE, { id: notification.id }).then((stored) => {
 | 
				
			||||||
            return stored.at === notification.at.getTime() / 1000;
 | 
					            return stored.at === notification.at.getTime() / 1000;
 | 
				
			||||||
        }).catch(() => {
 | 
					        }).catch(() => {
 | 
				
			||||||
            return false;
 | 
					            return this.localNotifications.isTriggered(notification.id);
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -478,6 +478,8 @@ export class CoreLocalNotificationsProvider {
 | 
				
			|||||||
    protected scheduleNotification(notification: CoreILocalNotification): Promise<any> {
 | 
					    protected scheduleNotification(notification: CoreILocalNotification): Promise<any> {
 | 
				
			||||||
        // Check if the notification has been triggered already.
 | 
					        // Check if the notification has been triggered already.
 | 
				
			||||||
        return this.isTriggered(notification).then((triggered) => {
 | 
					        return this.isTriggered(notification).then((triggered) => {
 | 
				
			||||||
 | 
					            // Cancel the current notification in case it gets scheduled twice.
 | 
				
			||||||
 | 
					            return this.localNotifications.cancel(notification.id).finally(() => {
 | 
				
			||||||
                if (!triggered) {
 | 
					                if (!triggered) {
 | 
				
			||||||
                    // Check if sound is enabled for notifications.
 | 
					                    // Check if sound is enabled for notifications.
 | 
				
			||||||
                    return this.configProvider.get(CoreConstants.SETTINGS_NOTIFICATION_SOUND, true).then((soundEnabled) => {
 | 
					                    return this.configProvider.get(CoreConstants.SETTINGS_NOTIFICATION_SOUND, true).then((soundEnabled) => {
 | 
				
			||||||
@ -489,12 +491,11 @@ export class CoreLocalNotificationsProvider {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
                        // Remove from triggered, since the notification could be in there with a different time.
 | 
					                        // Remove from triggered, since the notification could be in there with a different time.
 | 
				
			||||||
                        this.removeTriggered(notification.id);
 | 
					                        this.removeTriggered(notification.id);
 | 
				
			||||||
                    this.localNotifications.cancel(notification.id).finally(() => {
 | 
					 | 
				
			||||||
                        this.localNotifications.schedule(notification);
 | 
					                        this.localNotifications.schedule(notification);
 | 
				
			||||||
                    });
 | 
					                    });
 | 
				
			||||||
                });
 | 
					 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            });
 | 
					            });
 | 
				
			||||||
 | 
					        });
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user