Dagger: fix no session

This commit is contained in:
ganfra
2019-06-27 19:12:46 +02:00
parent f91959ea96
commit f18bc9bd00
3 changed files with 10 additions and 4 deletions

View File

@ -105,7 +105,7 @@ class VectorFirebaseMessagingService : FirebaseMessagingService() {
if (refreshedToken == null) {
Timber.w("onNewToken:received null token")
} else {
if (PreferencesManager.areNotificationEnabledForDevice(applicationContext)) {
if (PreferencesManager.areNotificationEnabledForDevice(applicationContext) && activeSessionHolder.hasActiveSession()) {
pusherManager.registerPusherWithFcmKey(refreshedToken)
}
}

View File

@ -36,7 +36,7 @@ class PushersManager @Inject constructor(
}
fun unregisterPusher(pushKey: String, callback: MatrixCallback<Unit>) {
val currentSession = activeSessionHolder.getActiveSession()
val currentSession = activeSessionHolder.getSafeActiveSession() ?: return
currentSession.removeHttpPusher(pushKey, stringProvider.getString(R.string.pusher_app_id), callback)
}
}