mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-11-02 21:05:28 +00:00
Rename UserPushStoreFactory.create to UserPushStoreFactory.getOrCreate for code clarity.
This commit is contained in:
committed by
Benoit Marty
parent
e18e5f1cc5
commit
52c039d676
+1
-1
@@ -35,7 +35,7 @@ class DefaultGetCurrentPushProvider @Inject constructor(
|
||||
.value
|
||||
.navigationState
|
||||
.currentSessionId()
|
||||
?.let { pushStoreFactory.create(it) }
|
||||
?.let { pushStoreFactory.getOrCreate(it) }
|
||||
?.getPushProviderName()
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -49,7 +49,7 @@ class DefaultPushService @Inject constructor(
|
||||
* Get current push provider, compare with provided one, then unregister and register if different, and store change.
|
||||
*/
|
||||
override suspend fun registerWith(matrixClient: MatrixClient, pushProvider: PushProvider, distributor: Distributor) {
|
||||
val userPushStore = userPushStoreFactory.create(matrixClient.sessionId)
|
||||
val userPushStore = userPushStoreFactory.getOrCreate(matrixClient.sessionId)
|
||||
val currentPushProviderName = userPushStore.getPushProviderName()
|
||||
if (currentPushProviderName != pushProvider.name) {
|
||||
// Unregister previous one if any
|
||||
|
||||
+1
-1
@@ -63,7 +63,7 @@ class PushersManager @Inject constructor(
|
||||
* Register a pusher to the server if not done yet.
|
||||
*/
|
||||
override suspend fun registerPusher(matrixClient: MatrixClient, pushKey: String, gateway: String) {
|
||||
val userDataStore = userPushStoreFactory.create(matrixClient.sessionId)
|
||||
val userDataStore = userPushStoreFactory.getOrCreate(matrixClient.sessionId)
|
||||
if (userDataStore.getCurrentRegisteredPushKey() == pushKey) {
|
||||
Timber.tag(loggerTag.value)
|
||||
.d("Unnecessary to register again the same pusher, but do it in case the pusher has been removed from the server")
|
||||
|
||||
+1
-1
@@ -122,7 +122,7 @@ class DefaultPushHandler @Inject constructor(
|
||||
return
|
||||
}
|
||||
|
||||
val userPushStore = userPushStoreFactory.create(userId)
|
||||
val userPushStore = userPushStoreFactory.getOrCreate(userId)
|
||||
if (!userPushStore.getNotificationEnabledForDevice().first()) {
|
||||
// TODO We need to check if this is an incoming call
|
||||
Timber.tag(loggerTag.value).i("Notification are disabled for this device, ignore push.")
|
||||
|
||||
Reference in New Issue
Block a user