Fix coroutine scope (#4820)

* Inject the session scope instead of the application scope where it's possible.

* Create AppCoroutineScope annotation to let developers explicitly choose the appropriate CoroutineScope when injecting one.
This commit is contained in:
Benoit Marty 2025-06-04 17:33:51 +02:00 committed by GitHub
parent 88124cd770
commit 03e23477b7
58 changed files with 172 additions and 72 deletions

View file

@ -11,6 +11,7 @@ import com.squareup.anvil.annotations.ContributesBinding
import io.element.android.libraries.core.log.logger.LoggerTag
import io.element.android.libraries.di.AppScope
import io.element.android.libraries.di.SingleIn
import io.element.android.libraries.di.annotations.AppCoroutineScope
import io.element.android.libraries.matrix.api.core.RoomId
import io.element.android.libraries.matrix.api.core.SessionId
import io.element.android.libraries.matrix.api.core.SpaceId
@ -36,7 +37,8 @@ private val loggerTag = LoggerTag("Navigation")
@SingleIn(AppScope::class)
class DefaultAppNavigationStateService @Inject constructor(
private val appForegroundStateService: AppForegroundStateService,
private val coroutineScope: CoroutineScope,
@AppCoroutineScope
coroutineScope: CoroutineScope,
) : AppNavigationStateService {
private val state = MutableStateFlow(
AppNavigationState(