Use Session.myUserId whereas it's possible

This commit is contained in:
Benoit Marty
2019-07-16 15:50:07 +02:00
parent 6bbc784c29
commit 0f7a56d005
20 changed files with 38 additions and 38 deletions

View File

@ -57,6 +57,9 @@ interface Session :
*/
val sessionParams: SessionParams
/**
* Useful shortcut to get access to the userId
*/
val myUserId: String
get() = sessionParams.credentials.userId

View File

@ -58,7 +58,7 @@ internal class SessionManager @Inject constructor(private val matrixComponent: M
.factory()
.create(matrixComponent, sessionParams)
.also {
sessionComponents[sessionParams.credentials.userId] = it
sessionComponents[userId] = it
}
}

View File

@ -94,11 +94,11 @@ internal class DefaultSession @Inject constructor(override val sessionParams: Se
}
override fun requireBackgroundSync() {
SyncWorker.requireBackgroundSync(context, sessionParams.credentials.userId)
SyncWorker.requireBackgroundSync(context, myUserId)
}
override fun startAutomaticBackgroundSync(repeatDelay: Long) {
SyncWorker.automaticallyBackgroundSync(context, sessionParams.credentials.userId, 0, repeatDelay)
SyncWorker.automaticallyBackgroundSync(context, myUserId, 0, repeatDelay)
}
override fun stopAnyBackgroundSync() {