From 322087b83d82e8149cb199e373a9918913f26d24 Mon Sep 17 00:00:00 2001 From: nielsandriesse Date: Tue, 4 Aug 2020 15:41:10 +1000 Subject: [PATCH] Unregister the user from FCM when they clear their data --- src/org/thoughtcrime/securesms/ApplicationContext.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/org/thoughtcrime/securesms/ApplicationContext.java b/src/org/thoughtcrime/securesms/ApplicationContext.java index bf7963bd91..ae30fce7b2 100644 --- a/src/org/thoughtcrime/securesms/ApplicationContext.java +++ b/src/org/thoughtcrime/securesms/ApplicationContext.java @@ -570,6 +570,10 @@ public class ApplicationContext extends MultiDexApplication implements Dependenc } public void clearData() { + String token = TextSecurePreferences.getFCMToken(this); + if (token != null && !token.isEmpty()) { + LokiPushNotificationManager.unregister(token, this); + } boolean wasUnlinked = TextSecurePreferences.getWasUnlinked(this); TextSecurePreferences.clearAll(this); TextSecurePreferences.setWasUnlinked(this, wasUnlinked);