Rename UserPushStoreFactory.create to UserPushStoreFactory.getOrCreate for code clarity.

This commit is contained in:
Benoit Marty 2024-04-02 16:23:57 +02:00 committed by Benoit Marty
parent e18e5f1cc5
commit 52c039d676
11 changed files with 13 additions and 13 deletions

View file

@ -35,7 +35,7 @@ class DefaultGetCurrentPushProvider @Inject constructor(
.value
.navigationState
.currentSessionId()
?.let { pushStoreFactory.create(it) }
?.let { pushStoreFactory.getOrCreate(it) }
?.getPushProviderName()
}
}

View file

@ -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

View file

@ -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")

View file

@ -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.")