Clear thread notification automatically after blocking new ones

This commit is contained in:
Torsten Grote
2021-01-26 15:42:18 -03:00
parent 635008fb60
commit e5d78a858d
6 changed files with 7 additions and 16 deletions

View File

@@ -79,12 +79,6 @@ public class ForumActivity extends
} }
} }
@Override
public void onStart() {
super.onStart();
viewModel.clearForumPostNotification();
}
@Override @Override
protected void onActivityResult(int request, int result, protected void onActivityResult(int request, int result,
@Nullable Intent data) { @Nullable Intent data) {

View File

@@ -116,7 +116,7 @@ class ForumViewModel extends ThreadListViewModel<ForumPostItem> {
} }
} }
void clearForumPostNotification() { protected void clearNotifications() {
notificationManager.clearForumPostNotification(groupId); notificationManager.clearForumPostNotification(groupId);
} }

View File

@@ -84,12 +84,6 @@ public class GroupActivity extends
}); });
} }
@Override
public void onStart() {
super.onStart();
viewModel.clearGroupMessageNotifications();
}
@Override @Override
public boolean onCreateOptionsMenu(Menu menu) { public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu items for use in the action bar // Inflate the menu items for use in the action bar

View File

@@ -138,7 +138,7 @@ class GroupViewModel extends ThreadListViewModel<GroupMessageItem> {
loadPrivateGroup(groupId); loadPrivateGroup(groupId);
} }
public void clearGroupMessageNotifications() { protected void clearNotifications() {
notificationManager.clearGroupMessageNotification(groupId); notificationManager.clearGroupMessageNotification(groupId);
} }

View File

@@ -110,7 +110,7 @@ public abstract class ThreadListActivity<I extends ThreadItem, A extends ThreadI
@Override @Override
public void onStart() { public void onStart() {
super.onStart(); super.onStart();
getViewModel().blockNotifications(); getViewModel().blockAndClearNotifications();
list.startPeriodicUpdate(); list.startPeriodicUpdate();
} }

View File

@@ -124,8 +124,11 @@ public abstract class ThreadListViewModel<I extends ThreadItem>
loadSharingContacts(); loadSharingContacts();
} }
public void blockNotifications() { protected abstract void clearNotifications();
public void blockAndClearNotifications() {
notificationManager.blockNotification(groupId); notificationManager.blockNotification(groupId);
clearNotifications();
} }
public void unblockNotifications() { public void unblockNotifications() {