Enable Offline mode of the SyncService, so that the sync starts automatically when the network is back.
Also rely on the sync state to render the "Offline" banner.
This commit is contained in:
+1
@@ -74,6 +74,7 @@ class RustMatrixClientFactory @Inject constructor(
|
||||
|
||||
val syncService = client.syncService()
|
||||
.withUtdHook(UtdTracker(analyticsService))
|
||||
.withOfflineMode()
|
||||
.finish()
|
||||
|
||||
return RustMatrixClient(
|
||||
|
||||
+6
@@ -19,6 +19,7 @@ import io.element.android.libraries.matrix.api.notificationsettings.Notification
|
||||
import io.element.android.libraries.matrix.api.room.RoomMembershipObserver
|
||||
import io.element.android.libraries.matrix.api.roomdirectory.RoomDirectoryService
|
||||
import io.element.android.libraries.matrix.api.roomlist.RoomListService
|
||||
import io.element.android.libraries.matrix.api.sync.SyncService
|
||||
import io.element.android.libraries.matrix.api.verification.SessionVerificationService
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
|
||||
@@ -45,6 +46,11 @@ object SessionMatrixModule {
|
||||
return matrixClient.roomListService
|
||||
}
|
||||
|
||||
@Provides
|
||||
fun providesSyncService(matrixClient: MatrixClient): SyncService {
|
||||
return matrixClient.syncService()
|
||||
}
|
||||
|
||||
@Provides
|
||||
fun providesEncryptionService(matrixClient: MatrixClient): EncryptionService {
|
||||
return matrixClient.encryptionService()
|
||||
|
||||
+1
@@ -14,5 +14,6 @@ import org.matrix.rustcomponents.sdk.UnableToDecryptDelegate
|
||||
|
||||
class FakeRustSyncServiceBuilder : SyncServiceBuilder(NoPointer) {
|
||||
override suspend fun withUtdHook(delegate: UnableToDecryptDelegate): SyncServiceBuilder = this
|
||||
override fun withOfflineMode(): SyncServiceBuilder = this
|
||||
override suspend fun finish(): SyncService = FakeRustSyncService()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user