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

View File

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

View File

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