Block forum post notifications while viewing forum list

This commit is contained in:
Torsten Grote
2021-01-05 12:03:38 -03:00
parent e2e67edbbe
commit 3b02797639
3 changed files with 19 additions and 4 deletions

View File

@@ -109,7 +109,8 @@ class AndroidNotificationManagerImpl implements AndroidNotificationManager,
@Nullable
private GroupId blockedGroup = null;
private boolean blockSignInReminder = false;
private boolean blockGroups = false, blockBlogs = false;
private boolean blockForums = false, blockGroups = false,
blockBlogs = false;
private long lastSound = 0;
private volatile Settings settings = new Settings();
@@ -453,6 +454,7 @@ class AndroidNotificationManagerImpl implements AndroidNotificationManager,
@UiThread
private void showForumPostNotification(GroupId g) {
if (blockForums) return;
if (g.equals(blockedGroup)) return;
forumCounts.add(g);
updateForumPostNotification(true);
@@ -682,10 +684,19 @@ class AndroidNotificationManagerImpl implements AndroidNotificationManager,
});
}
@Override
public void blockAllForumPostNotifications() {
androidExecutor.runOnUiThread((Runnable) () -> blockForums = true);
}
@Override
public void unblockAllForumPostNotifications() {
androidExecutor.runOnUiThread((Runnable) () -> blockForums = false);
}
@Override
public void blockAllGroupMessageNotifications() {
androidExecutor.runOnUiThread((Runnable) () -> blockGroups = true);
}
@Override

View File

@@ -92,11 +92,11 @@ class ForumListViewModel extends DbViewModel implements EventListener {
}
void blockAllForumPostNotifications() {
// TODO
notificationManager.blockAllForumPostNotifications();
}
void unblockAllForumPostNotifications() {
// TODO
notificationManager.unblockAllForumPostNotifications();
}
@Override

View File

@@ -82,6 +82,10 @@ public interface AndroidNotificationManager {
void unblockNotification(GroupId g);
void blockAllForumPostNotifications();
void unblockAllForumPostNotifications();
void blockAllGroupMessageNotifications();
void unblockAllGroupMessageNotifications();