Skip to content

Commit bf7c046

Browse files
authored
Merge pull request #330 from cleverpush/feature/cp-10779-implement-removeallnotifications
feature/cp-10779-implement-removeallnotifications
2 parents 0335952 + 631a1de commit bf7c046

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

cleverpush/src/main/java/com/cleverpush/CleverPush.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2963,6 +2963,18 @@ private void removeGroupSummaries(String removedNotificationGroupKey, String rem
29632963
}
29642964
}
29652965

2966+
public void removeAllNotifications() {
2967+
try {
2968+
getSharedPreferences(getContext())
2969+
.edit()
2970+
.remove(CleverPushPreferences.NOTIFICATIONS_JSON)
2971+
.remove(CleverPushPreferences.NOTIFICATIONS) // Remove deprecated storage to prevent fallback reads
2972+
.apply();
2973+
} catch (Exception e) {
2974+
Logger.e(LOG_TAG, "Error while removing all notifications", e);
2975+
}
2976+
}
2977+
29662978
public void trackEvent(String eventName) {
29672979
this.trackEvent(eventName, (Map<String, Object>) null);
29682980
}

0 commit comments

Comments
 (0)