Skip to content

Commit

Permalink
[flutter_local_notifications] remove redundant commit to shared prefs…
Browse files Browse the repository at this point in the history
… logic and checks for commit during initialisation (#1389)

* remove redundant commit

* update commit logic for initialisation
  • Loading branch information
MaikuB committed Nov 14, 2021
1 parent 0942ce5 commit b0da08e
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -366,10 +366,6 @@ private static void saveScheduledNotifications(
}

private static void commitAsync(final SharedPreferences.Editor editor, final Result result) {
if (executor == null || handler == null) {
editor.commit();
return;
}
executor.execute(
new Runnable() {
@Override
Expand Down Expand Up @@ -1411,7 +1407,11 @@ private void initialize(MethodCall call, Result result) {
applicationContext.getSharedPreferences(SHARED_PREFERENCES_KEY, Context.MODE_PRIVATE);
SharedPreferences.Editor editor = sharedPreferences.edit();
editor.putString(DEFAULT_ICON, defaultIcon);
commitAsync(editor, result);
if (executor != null && handler != null) {
commitAsync(editor, result);
} else {
editor.commit();
}
}

/// Extracts the details of the notifications passed from the Flutter side and also validates that
Expand Down

0 comments on commit b0da08e

Please sign in to comment.