diff options
author | Christian Schneppe <christian@pix-art.de> | 2018-09-13 19:19:22 +0200 |
---|---|---|
committer | Christian Schneppe <christian@pix-art.de> | 2018-09-13 19:19:22 +0200 |
commit | 7a42c388ce9363de0a7cc668fc098aebc23d0ce6 (patch) | |
tree | 4aee0eae2e4d88e5c4c6ee135b9d29fe69916377 /src/main/java/de/pixart/messenger/services | |
parent | 09536137d432002752726c669beea717b7d2e6ea (diff) |
properly clear file adding notification if forground service channel is disabled
Diffstat (limited to 'src/main/java/de/pixart/messenger/services')
-rw-r--r-- | src/main/java/de/pixart/messenger/services/NotificationService.java | 7 | ||||
-rw-r--r-- | src/main/java/de/pixart/messenger/services/XmppConnectionService.java | 1 |
2 files changed, 8 insertions, 0 deletions
diff --git a/src/main/java/de/pixart/messenger/services/NotificationService.java b/src/main/java/de/pixart/messenger/services/NotificationService.java index fdf48258f..e37dc14f4 100644 --- a/src/main/java/de/pixart/messenger/services/NotificationService.java +++ b/src/main/java/de/pixart/messenger/services/NotificationService.java @@ -934,6 +934,7 @@ public class NotificationService { mBuilder.setProgress(100, current, false); mBuilder.setSmallIcon(R.drawable.ic_hourglass_empty_white_24dp); mBuilder.setContentIntent(createContentIntent(message.getConversation())); + mBuilder.setOngoing(true); if (Compatibility.twentySix()) { mBuilder.setChannelId(VIDEOCOMPRESSION_CHANNEL_ID); } @@ -941,12 +942,17 @@ public class NotificationService { notify(FOREGROUND_NOTIFICATION_ID, notification); } + public void dismissForcedForegroundNotification() { + cancel(FOREGROUND_NOTIFICATION_ID); + } + public Notification exportLogsNotification() { Notification.Builder mBuilder = new Notification.Builder(mXmppConnectionService); mBuilder.setContentTitle(mXmppConnectionService.getString(R.string.app_name)); mBuilder.setContentText(mXmppConnectionService.getString(R.string.notification_export_logs_title)); mBuilder.setProgress(0, 0, true); mBuilder.setSmallIcon(R.drawable.ic_import_export_white_24dp); + mBuilder.setOngoing(true); if (Compatibility.twentySix()) { mBuilder.setChannelId(BACKUP_CHANNEL_ID); } @@ -964,6 +970,7 @@ public class NotificationService { mBuilder.setContentText(String.format(mXmppConnectionService.getString(R.string.update_available), version, filesize)); mBuilder.setSmallIcon(R.drawable.ic_update_notification); mBuilder.setContentIntent(intent); + mBuilder.setOngoing(true); if (Compatibility.twentySix()) { mBuilder.setChannelId(UPDATE_CHANNEL_ID); } diff --git a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java index d9181aa95..01295c242 100644 --- a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java +++ b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java @@ -428,6 +428,7 @@ public class XmppConnectionService extends Service { public void stopForcingForegroundNotification() { mForceForegroundService.set(false); toggleForegroundService(); + mNotificationService.dismissForcedForegroundNotification(); } public boolean areMessagesInitialized() { |