Fix notification settings getting reset on app update

This commit is contained in:
Grishka 2022-04-28 23:32:43 +03:00
parent f73849dbb7
commit 620bc2285c
2 changed files with 2 additions and 6 deletions

View File

@ -121,10 +121,6 @@ public class PushSubscriptionManager{
return !TextUtils.isEmpty(deviceToken);
}
public void registerAccountForPush(){
registerAccountForPush(null);
}
public void registerAccountForPush(PushSubscription subscription){
if(TextUtils.isEmpty(deviceToken))
throw new IllegalStateException("No device push token available");
@ -367,7 +363,7 @@ public class PushSubscriptionManager{
private static void registerAllAccountsForPush(boolean forceReRegister){
for(AccountSession session:AccountSessionManager.getInstance().getLoggedInAccounts()){
if(session.pushSubscription==null || forceReRegister)
session.getPushSubscriptionManager().registerAccountForPush();
session.getPushSubscriptionManager().registerAccountForPush(session.pushSubscription);
else if(session.needUpdatePushSettings)
session.getPushSubscriptionManager().updatePushSettings(session.pushSubscription);
}

View File

@ -100,7 +100,7 @@ public class AccountSessionManager{
writeAccountsFile();
updateInstanceEmojis(instance, instance.uri);
if(PushSubscriptionManager.arePushNotificationsAvailable()){
session.getPushSubscriptionManager().registerAccountForPush();
session.getPushSubscriptionManager().registerAccountForPush(null);
}
}