From e073563a67e06fc3a7df31b34ba4ed923aca0d3e Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Mon, 26 Apr 2021 15:54:38 +0200 Subject: [PATCH] Cleanup --- .../android/sdk/internal/session/DefaultSession.kt | 9 ++++++--- .../sdk/internal/session/SessionCoroutineScopeHolder.kt | 3 +-- .../app/features/home/room/detail/RoomDetailFragment.kt | 1 - .../im/vector/app/features/session/SessionListener.kt | 1 - 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/DefaultSession.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/DefaultSession.kt index 7199fc0bfe..53e13c14ec 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/DefaultSession.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/DefaultSession.kt @@ -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) } diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/SessionCoroutineScopeHolder.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/SessionCoroutineScopeHolder.kt index 29368debc3..82a8f79fd5 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/SessionCoroutineScopeHolder.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/SessionCoroutineScopeHolder.kt @@ -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")) } - } diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/RoomDetailFragment.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/RoomDetailFragment.kt index 82187ecdd3..31a589ce3f 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/RoomDetailFragment.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/RoomDetailFragment.kt @@ -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 diff --git a/vector/src/main/java/im/vector/app/features/session/SessionListener.kt b/vector/src/main/java/im/vector/app/features/session/SessionListener.kt index aaed15f12f..7b7be550cb 100644 --- a/vector/src/main/java/im/vector/app/features/session/SessionListener.kt +++ b/vector/src/main/java/im/vector/app/features/session/SessionListener.kt @@ -44,5 +44,4 @@ class SessionListener @Inject constructor() : Session.Listener { override fun onClearCache(session: Session) { session.coroutineScope.coroutineContext.cancelChildren() } - }