Fix notification settings getting reset on app update
This commit is contained in:
parent
f73849dbb7
commit
620bc2285c
|
@ -121,10 +121,6 @@ public class PushSubscriptionManager{
|
||||||
return !TextUtils.isEmpty(deviceToken);
|
return !TextUtils.isEmpty(deviceToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void registerAccountForPush(){
|
|
||||||
registerAccountForPush(null);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void registerAccountForPush(PushSubscription subscription){
|
public void registerAccountForPush(PushSubscription subscription){
|
||||||
if(TextUtils.isEmpty(deviceToken))
|
if(TextUtils.isEmpty(deviceToken))
|
||||||
throw new IllegalStateException("No device push token available");
|
throw new IllegalStateException("No device push token available");
|
||||||
|
@ -367,7 +363,7 @@ public class PushSubscriptionManager{
|
||||||
private static void registerAllAccountsForPush(boolean forceReRegister){
|
private static void registerAllAccountsForPush(boolean forceReRegister){
|
||||||
for(AccountSession session:AccountSessionManager.getInstance().getLoggedInAccounts()){
|
for(AccountSession session:AccountSessionManager.getInstance().getLoggedInAccounts()){
|
||||||
if(session.pushSubscription==null || forceReRegister)
|
if(session.pushSubscription==null || forceReRegister)
|
||||||
session.getPushSubscriptionManager().registerAccountForPush();
|
session.getPushSubscriptionManager().registerAccountForPush(session.pushSubscription);
|
||||||
else if(session.needUpdatePushSettings)
|
else if(session.needUpdatePushSettings)
|
||||||
session.getPushSubscriptionManager().updatePushSettings(session.pushSubscription);
|
session.getPushSubscriptionManager().updatePushSettings(session.pushSubscription);
|
||||||
}
|
}
|
||||||
|
|
|
@ -100,7 +100,7 @@ public class AccountSessionManager{
|
||||||
writeAccountsFile();
|
writeAccountsFile();
|
||||||
updateInstanceEmojis(instance, instance.uri);
|
updateInstanceEmojis(instance, instance.uri);
|
||||||
if(PushSubscriptionManager.arePushNotificationsAvailable()){
|
if(PushSubscriptionManager.arePushNotificationsAvailable()){
|
||||||
session.getPushSubscriptionManager().registerAccountForPush();
|
session.getPushSubscriptionManager().registerAccountForPush(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue