Skip to content
Snippets Groups Projects
Commit a375f189 authored by Adrien Béraud's avatar Adrien Béraud
Browse files

JamiApplication: avoid overriding token with empty string on startup

Change-Id: Ie4e3c4ef753f28462db2442fef35d4a8ebb3d6bf
parent 3c2635f2
Branches
Tags
No related merge requests found
...@@ -159,7 +159,7 @@ abstract class JamiApplication : Application() { ...@@ -159,7 +159,7 @@ abstract class JamiApplication : Application() {
// load accounts from Daemon // load accounts from Daemon
mAccountService.loadAccountsFromDaemon(mPreferencesService.hasNetworkConnected()) mAccountService.loadAccountsFromDaemon(mPreferencesService.hasNetworkConnected())
if (mPreferencesService.settings.enablePushNotifications) { if (mPreferencesService.settings.enablePushNotifications) {
pushToken.let { token -> JamiService.setPushNotificationToken(token) } pushToken.let { token -> if (!token.isEmpty()) JamiService.setPushNotificationToken(token) }
} else { } else {
JamiService.setPushNotificationToken("") JamiService.setPushNotificationToken("")
} }
......
...@@ -42,7 +42,7 @@ abstract class PreferencesService( ...@@ -42,7 +42,7 @@ abstract class PreferencesService(
val allowPush = settings.enablePushNotifications val allowPush = settings.enablePushNotifications
val previousSettings = userSettings val previousSettings = userSettings
if (previousSettings == null || previousSettings.enablePushNotifications != allowPush) { if (previousSettings == null || previousSettings.enablePushNotifications != allowPush) {
mAccountService.setPushNotificationToken(if (allowPush) mDeviceService.pushToken ?: "" else "") mAccountService.setPushNotificationToken(if (allowPush) mDeviceService.pushToken else "")
mAccountService.setProxyEnabled(allowPush) mAccountService.setProxyEnabled(allowPush)
} }
userSettings = settings userSettings = settings
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment