Fix crash about several DataStores using the same file (#2312)

* Fix crash about several DataStores using the same file

- Create `@SessionCoroutineScope` annotation to pass a session-managed coroutine scope to the DI.
- Expose this scope from `MatrixClient`.
- Rework DataStore file creation a bit.
- Centralise session preference creation through `DefaultSessionPreferencesStoreFactory` until we figure out what went wrong with the scoping
This commit is contained in:
Jorge Martin Espinosa 2024-01-30 11:10:46 +01:00 committed by GitHub
parent 76369391af
commit ede1dc0fab
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 137 additions and 15 deletions

View file

@ -0,0 +1,27 @@
/*
* Copyright (c) 2024 New Vector Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.element.android.libraries.di.annotations
import javax.inject.Qualifier
/**
* Qualifies a [CoroutineScope] object which represents the base coroutine scope to use for an active session.
*/
@Retention(AnnotationRetention.RUNTIME)
@MustBeDocumented
@Qualifier
annotation class SessionCoroutineScope