Skip to content

Commit

Permalink
Minor fixes to restore receiver.
Browse files Browse the repository at this point in the history
- Remove clear.  No reason to clear a notification on restart.
- Remove duplicate rescheduling logic.
- If alarm is triggered on restore, performNotification reschedules it.
  • Loading branch information
timkellypa committed May 7, 2020
1 parent 802963c commit bda9b6e
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions src/android/RestoreReceiver.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,16 +57,18 @@ public void onRestore (Request request, Notification toast) {
if (!after && toast.isHighPrio()) {
performNotification(toast);
} else {
toast.clear();
}

Context ctx = toast.getContext();
Manager mgr = Manager.getInstance(ctx);
// reschedule if we aren't firing here.
// If we do fire, performNotification takes care of
// next schedule.

Context ctx = toast.getContext();
Manager mgr = Manager.getInstance(ctx);

if (after || toast.isRepeating()) {
mgr.schedule(request, TriggerReceiver.class);
if (after || toast.isRepeating()) {
mgr.schedule(request, TriggerReceiver.class);
}
}
}
}

@Override
public void dispatchAppEvent(String key, Notification notification) {
Expand Down

0 comments on commit bda9b6e

Please sign in to comment.