Skip to content

Commit

Permalink
fix(android): ensure alarmManager notifications are cancelled
Browse files Browse the repository at this point in the history
  • Loading branch information
Mkolakoglu authored Mar 24, 2022
1 parent cc61581 commit e145a7c
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions android/src/main/java/app/notifee/core/NotificationManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
import app.notifee.core.utility.ResourceUtils;
import app.notifee.core.utility.TextUtils;
import com.google.android.gms.tasks.Continuation;
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.Task;
import com.google.android.gms.tasks.Tasks;
import java.util.ArrayList;
Expand Down Expand Up @@ -467,9 +468,14 @@ static Task<Void> cancelAllNotifications(@NonNull int notificationType) {
task -> {
if (notificationType == NOTIFICATION_TYPE_TRIGGER
|| notificationType == NOTIFICATION_TYPE_ALL) {
NotifeeAlarmManager.cancelAllNotifications();
// delete all from database
WorkDataRepository.getInstance(getApplicationContext()).deleteAll();
task.continueWith(NotifeeAlarmManager.cancelAllNotifications()).addOnSuccessListener(t -> {
t.continueWith(a -> {
// delete all from database after canceling the alarms
WorkDataRepository.getInstance(getApplicationContext()).deleteAll();
return null;
});
});

}
return null;
});
Expand Down

0 comments on commit e145a7c

Please sign in to comment.