This commit is contained in:
Benoit Marty 2021-04-26 15:54:38 +02:00 committed by Benoit Marty
parent 80b155e042
commit e073563a67
4 changed files with 7 additions and 7 deletions

View File

@ -81,7 +81,6 @@ import javax.inject.Provider
@SessionScope
internal class DefaultSession @Inject constructor(
override val sessionParams: SessionParams,
private val sessionCoroutineScopeHolder: SessionCoroutineScopeHolder,
private val workManagerProvider: WorkManagerProvider,
private val globalErrorHandler: GlobalErrorHandler,
@SessionId
@ -165,7 +164,9 @@ internal class DefaultSession @Inject constructor(
isOpen = true
cryptoService.get().ensureDevice()
uiHandler.post {
lifecycleObservers.forEach { it.onSessionStarted(this) }
lifecycleObservers.forEach {
it.onSessionStarted(this)
}
sessionListeners.dispatch {
it.onSessionStarted(this)
}
@ -237,7 +238,9 @@ internal class DefaultSession @Inject constructor(
stopSync()
stopAnyBackgroundSync()
uiHandler.post {
lifecycleObservers.forEach { it.onClearCache(this) }
lifecycleObservers.forEach {
it.onClearCache(this)
}
sessionListeners.dispatch {
it.onClearCache(this)
}

View File

@ -37,8 +37,7 @@ internal class SessionCoroutineScopeHolder @Inject constructor(): SessionLifecyc
scope.cancelChildren()
}
private fun CoroutineScope.cancelChildren(){
private fun CoroutineScope.cancelChildren() {
coroutineContext.cancelChildren(CancellationException("Closing session"))
}
}

View File

@ -1745,7 +1745,6 @@ class RoomDetailFragment @Inject constructor(
}
private fun onSaveActionClicked(action: EventSharedAction.Save) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.Q
&& !checkPermissions(PERMISSIONS_FOR_WRITING_FILES, requireActivity(), saveActionActivityResultLauncher)) {
sharedActionViewModel.pendingAction = action

View File

@ -44,5 +44,4 @@ class SessionListener @Inject constructor() : Session.Listener {
override fun onClearCache(session: Session) {
session.coroutineScope.coroutineContext.cancelChildren()
}
}