mirror of
https://github.com/element-hq/element-android
synced 2024-11-24 02:15:35 +03:00
Rename some classes after new feature implemented
This commit is contained in:
parent
306e3cf055
commit
75fb026289
14 changed files with 75 additions and 68 deletions
|
@ -36,7 +36,7 @@ import org.matrix.android.sdk.api.session.file.FileService
|
|||
import org.matrix.android.sdk.api.session.group.GroupService
|
||||
import org.matrix.android.sdk.api.session.homeserver.HomeServerCapabilitiesService
|
||||
import org.matrix.android.sdk.api.session.identity.IdentityService
|
||||
import org.matrix.android.sdk.api.session.initsync.InitialSyncProgressService
|
||||
import org.matrix.android.sdk.api.session.initsync.SyncStatusService
|
||||
import org.matrix.android.sdk.api.session.integrationmanager.IntegrationManagerService
|
||||
import org.matrix.android.sdk.api.session.media.MediaService
|
||||
import org.matrix.android.sdk.api.session.openid.OpenIdService
|
||||
|
@ -75,7 +75,7 @@ interface Session :
|
|||
ProfileService,
|
||||
PushRuleService,
|
||||
PushersService,
|
||||
InitialSyncProgressService,
|
||||
SyncStatusService,
|
||||
HomeServerCapabilitiesService,
|
||||
SecureStorageService,
|
||||
AccountService {
|
||||
|
|
|
@ -17,18 +17,25 @@ package org.matrix.android.sdk.api.session.initsync
|
|||
|
||||
import androidx.lifecycle.LiveData
|
||||
|
||||
// TODO Rename or since we also observe classical sync here
|
||||
interface InitialSyncProgressService {
|
||||
interface SyncStatusService {
|
||||
|
||||
fun getInitialSyncProgressStatus(): LiveData<Status>
|
||||
fun getSyncStatusLive(): LiveData<Status>
|
||||
|
||||
sealed class Status {
|
||||
object Idle : Status()
|
||||
/**
|
||||
* For initial sync
|
||||
*/
|
||||
abstract class InitialSyncStatus: Status()
|
||||
|
||||
object Idle : InitialSyncStatus()
|
||||
data class Progressing(
|
||||
val initSyncStep: InitSyncStep,
|
||||
val percentProgress: Int = 0
|
||||
) : Status()
|
||||
) : InitialSyncStatus()
|
||||
|
||||
/**
|
||||
* For incremental sync
|
||||
*/
|
||||
abstract class IncrementalSyncStatus: Status()
|
||||
|
||||
object IncrementalSyncIdle : IncrementalSyncStatus()
|
|
@ -40,7 +40,7 @@ import org.matrix.android.sdk.api.session.file.ContentDownloadStateTracker
|
|||
import org.matrix.android.sdk.api.session.file.FileService
|
||||
import org.matrix.android.sdk.api.session.group.GroupService
|
||||
import org.matrix.android.sdk.api.session.homeserver.HomeServerCapabilitiesService
|
||||
import org.matrix.android.sdk.api.session.initsync.InitialSyncProgressService
|
||||
import org.matrix.android.sdk.api.session.initsync.SyncStatusService
|
||||
import org.matrix.android.sdk.api.session.integrationmanager.IntegrationManagerService
|
||||
import org.matrix.android.sdk.api.session.media.MediaService
|
||||
import org.matrix.android.sdk.api.session.openid.OpenIdService
|
||||
|
@ -115,7 +115,7 @@ internal class DefaultSession @Inject constructor(
|
|||
private val contentUploadProgressTracker: ContentUploadStateTracker,
|
||||
private val typingUsersTracker: TypingUsersTracker,
|
||||
private val contentDownloadStateTracker: ContentDownloadStateTracker,
|
||||
private val initialSyncProgressService: Lazy<InitialSyncProgressService>,
|
||||
private val syncStatusService: Lazy<SyncStatusService>,
|
||||
private val homeServerCapabilitiesService: Lazy<HomeServerCapabilitiesService>,
|
||||
private val accountDataService: Lazy<SessionAccountDataService>,
|
||||
private val _sharedSecretStorageService: Lazy<SharedSecretStorageService>,
|
||||
|
@ -141,7 +141,7 @@ internal class DefaultSession @Inject constructor(
|
|||
PushersService by pushersService.get(),
|
||||
EventService by eventService.get(),
|
||||
TermsService by termsService.get(),
|
||||
InitialSyncProgressService by initialSyncProgressService.get(),
|
||||
SyncStatusService by syncStatusService.get(),
|
||||
SecureStorageService by secureStorageService.get(),
|
||||
HomeServerCapabilitiesService by homeServerCapabilitiesService.get(),
|
||||
ProfileService by profileService.get(),
|
||||
|
|
|
@ -37,7 +37,7 @@ import org.matrix.android.sdk.api.session.SessionLifecycleObserver
|
|||
import org.matrix.android.sdk.api.session.accountdata.SessionAccountDataService
|
||||
import org.matrix.android.sdk.api.session.events.EventService
|
||||
import org.matrix.android.sdk.api.session.homeserver.HomeServerCapabilitiesService
|
||||
import org.matrix.android.sdk.api.session.initsync.InitialSyncProgressService
|
||||
import org.matrix.android.sdk.api.session.initsync.SyncStatusService
|
||||
import org.matrix.android.sdk.api.session.openid.OpenIdService
|
||||
import org.matrix.android.sdk.api.session.permalinks.PermalinkService
|
||||
import org.matrix.android.sdk.api.session.securestorage.SecureStorageService
|
||||
|
@ -81,7 +81,7 @@ import org.matrix.android.sdk.internal.session.download.DownloadProgressIntercep
|
|||
import org.matrix.android.sdk.internal.session.events.DefaultEventService
|
||||
import org.matrix.android.sdk.internal.session.homeserver.DefaultHomeServerCapabilitiesService
|
||||
import org.matrix.android.sdk.internal.session.identity.DefaultIdentityService
|
||||
import org.matrix.android.sdk.internal.session.initsync.DefaultInitialSyncProgressService
|
||||
import org.matrix.android.sdk.internal.session.initsync.DefaultSyncStatusService
|
||||
import org.matrix.android.sdk.internal.session.integrationmanager.IntegrationManager
|
||||
import org.matrix.android.sdk.internal.session.openid.DefaultOpenIdService
|
||||
import org.matrix.android.sdk.internal.session.permalinks.DefaultPermalinkService
|
||||
|
@ -355,7 +355,7 @@ internal abstract class SessionModule {
|
|||
abstract fun bindEventSenderProcessorAsSessionLifecycleObserver(processor: EventSenderProcessorCoroutine): SessionLifecycleObserver
|
||||
|
||||
@Binds
|
||||
abstract fun bindInitialSyncProgressService(service: DefaultInitialSyncProgressService): InitialSyncProgressService
|
||||
abstract fun bindSyncStatusService(service: DefaultSyncStatusService): SyncStatusService
|
||||
|
||||
@Binds
|
||||
abstract fun bindSecureStorageService(service: DefaultSecureStorageService): SecureStorageService
|
||||
|
|
|
@ -18,25 +18,25 @@ package org.matrix.android.sdk.internal.session.initsync
|
|||
import androidx.lifecycle.LiveData
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
import org.matrix.android.sdk.api.session.initsync.InitSyncStep
|
||||
import org.matrix.android.sdk.api.session.initsync.InitialSyncProgressService
|
||||
import org.matrix.android.sdk.api.session.initsync.SyncStatusService
|
||||
import org.matrix.android.sdk.internal.session.SessionScope
|
||||
import javax.inject.Inject
|
||||
|
||||
@SessionScope
|
||||
internal class DefaultInitialSyncProgressService @Inject constructor()
|
||||
: InitialSyncProgressService,
|
||||
internal class DefaultSyncStatusService @Inject constructor()
|
||||
: SyncStatusService,
|
||||
ProgressReporter {
|
||||
|
||||
private val status = MutableLiveData<InitialSyncProgressService.Status>()
|
||||
private val status = MutableLiveData<SyncStatusService.Status>()
|
||||
|
||||
private var rootTask: TaskInfo? = null
|
||||
|
||||
override fun getInitialSyncProgressStatus(): LiveData<InitialSyncProgressService.Status> {
|
||||
override fun getSyncStatusLive(): LiveData<SyncStatusService.Status> {
|
||||
return status
|
||||
}
|
||||
|
||||
// Only to be used for incremental sync
|
||||
fun setStatus(newStatus: InitialSyncProgressService.Status) {
|
||||
fun setStatus(newStatus: SyncStatusService.Status.IncrementalSyncStatus) {
|
||||
status.postValue(newStatus)
|
||||
}
|
||||
|
||||
|
@ -72,7 +72,7 @@ internal class DefaultInitialSyncProgressService @Inject constructor()
|
|||
// Update the progress of the leaf and all its parents
|
||||
leaf.setProgress(progress)
|
||||
// Then update the live data using leaf wording and root progress
|
||||
status.postValue(InitialSyncProgressService.Status.Progressing(leaf.initSyncStep, root.currentProgress.toInt()))
|
||||
status.postValue(SyncStatusService.Status.Progressing(leaf.initSyncStep, root.currentProgress.toInt()))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -87,13 +87,13 @@ internal class DefaultInitialSyncProgressService @Inject constructor()
|
|||
// And close it
|
||||
endedTask.parent.child = null
|
||||
} else {
|
||||
status.postValue(InitialSyncProgressService.Status.Idle)
|
||||
status.postValue(SyncStatusService.Status.Idle)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun endAll() {
|
||||
rootTask = null
|
||||
status.postValue(InitialSyncProgressService.Status.Idle)
|
||||
status.postValue(SyncStatusService.Status.Idle)
|
||||
}
|
||||
}
|
|
@ -19,7 +19,7 @@ package org.matrix.android.sdk.internal.session.sync
|
|||
import okhttp3.ResponseBody
|
||||
import org.matrix.android.sdk.api.logger.LoggerTag
|
||||
import org.matrix.android.sdk.api.session.initsync.InitSyncStep
|
||||
import org.matrix.android.sdk.api.session.initsync.InitialSyncProgressService
|
||||
import org.matrix.android.sdk.api.session.initsync.SyncStatusService
|
||||
import org.matrix.android.sdk.internal.di.SessionFilesDirectory
|
||||
import org.matrix.android.sdk.internal.di.UserId
|
||||
import org.matrix.android.sdk.internal.network.GlobalErrorReceiver
|
||||
|
@ -28,7 +28,7 @@ import org.matrix.android.sdk.internal.network.executeRequest
|
|||
import org.matrix.android.sdk.internal.network.toFailure
|
||||
import org.matrix.android.sdk.internal.session.filter.FilterRepository
|
||||
import org.matrix.android.sdk.internal.session.homeserver.GetHomeServerCapabilitiesTask
|
||||
import org.matrix.android.sdk.internal.session.initsync.DefaultInitialSyncProgressService
|
||||
import org.matrix.android.sdk.internal.session.initsync.DefaultSyncStatusService
|
||||
import org.matrix.android.sdk.internal.session.initsync.reportSubtask
|
||||
import org.matrix.android.sdk.internal.session.sync.model.LazyRoomSyncEphemeral
|
||||
import org.matrix.android.sdk.internal.session.sync.parsing.InitialSyncResponseParser
|
||||
|
@ -57,7 +57,7 @@ internal class DefaultSyncTask @Inject constructor(
|
|||
@UserId private val userId: String,
|
||||
private val filterRepository: FilterRepository,
|
||||
private val syncResponseHandler: SyncResponseHandler,
|
||||
private val initialSyncProgressService: DefaultInitialSyncProgressService,
|
||||
private val defaultSyncStatusService: DefaultSyncStatusService,
|
||||
private val syncTokenStore: SyncTokenStore,
|
||||
private val getHomeServerCapabilitiesTask: GetHomeServerCapabilitiesTask,
|
||||
private val userStore: UserStore,
|
||||
|
@ -96,7 +96,7 @@ internal class DefaultSyncTask @Inject constructor(
|
|||
if (isInitialSync) {
|
||||
// We might want to get the user information in parallel too
|
||||
userStore.createOrUpdate(userId)
|
||||
initialSyncProgressService.startRoot(InitSyncStep.ImportingAccount, 100)
|
||||
defaultSyncStatusService.startRoot(InitSyncStep.ImportingAccount, 100)
|
||||
}
|
||||
// Maybe refresh the homeserver capabilities data we know
|
||||
getHomeServerCapabilitiesTask.execute(GetHomeServerCapabilitiesTask.Params(forceRefresh = false))
|
||||
|
@ -111,7 +111,7 @@ internal class DefaultSyncTask @Inject constructor(
|
|||
roomSyncEphemeralTemporaryStore.reset()
|
||||
workingDir.mkdirs()
|
||||
val file = downloadInitSyncResponse(requestParams)
|
||||
reportSubtask(initialSyncProgressService, InitSyncStep.ImportingAccount, 1, 0.7F) {
|
||||
reportSubtask(defaultSyncStatusService, InitSyncStep.ImportingAccount, 1, 0.7F) {
|
||||
handleSyncFile(file, initSyncStrategy)
|
||||
}
|
||||
// Delete all files
|
||||
|
@ -127,14 +127,14 @@ internal class DefaultSyncTask @Inject constructor(
|
|||
}
|
||||
|
||||
logDuration("INIT_SYNC Database insertion", loggerTag) {
|
||||
syncResponseHandler.handleResponse(syncResponse, token, initialSyncProgressService)
|
||||
syncResponseHandler.handleResponse(syncResponse, token, defaultSyncStatusService)
|
||||
}
|
||||
}
|
||||
}
|
||||
initialSyncProgressService.endAll()
|
||||
defaultSyncStatusService.endAll()
|
||||
} else {
|
||||
Timber.tag(loggerTag.value).d("Start incremental sync request")
|
||||
initialSyncProgressService.setStatus(InitialSyncProgressService.Status.IncrementalSyncIdle)
|
||||
defaultSyncStatusService.setStatus(SyncStatusService.Status.IncrementalSyncIdle)
|
||||
val syncResponse = try {
|
||||
executeRequest(globalErrorReceiver) {
|
||||
syncAPI.sync(
|
||||
|
@ -144,19 +144,19 @@ internal class DefaultSyncTask @Inject constructor(
|
|||
}
|
||||
} catch (throwable: Throwable) {
|
||||
Timber.tag(loggerTag.value).e(throwable, "Incremental sync request error")
|
||||
initialSyncProgressService.setStatus(InitialSyncProgressService.Status.IncrementalSyncError)
|
||||
defaultSyncStatusService.setStatus(SyncStatusService.Status.IncrementalSyncError)
|
||||
throw throwable
|
||||
}
|
||||
val nbRooms = syncResponse.rooms?.invite.orEmpty().size + syncResponse.rooms?.join.orEmpty().size + syncResponse.rooms?.leave.orEmpty().size
|
||||
val nbToDevice = syncResponse.toDevice?.events.orEmpty().size
|
||||
Timber.tag(loggerTag.value).d("Incremental sync request parsing, $nbRooms room(s) $nbToDevice toDevice(s)")
|
||||
initialSyncProgressService.setStatus(InitialSyncProgressService.Status.IncrementalSyncParsing(
|
||||
defaultSyncStatusService.setStatus(SyncStatusService.Status.IncrementalSyncParsing(
|
||||
rooms = nbRooms,
|
||||
toDevice = nbToDevice
|
||||
))
|
||||
syncResponseHandler.handleResponse(syncResponse, token, null)
|
||||
Timber.tag(loggerTag.value).d("Incremental sync done")
|
||||
initialSyncProgressService.setStatus(InitialSyncProgressService.Status.IncrementalSyncDone)
|
||||
defaultSyncStatusService.setStatus(SyncStatusService.Status.IncrementalSyncDone)
|
||||
}
|
||||
Timber.tag(loggerTag.value).d("Sync task finished on Thread: ${Thread.currentThread().name}")
|
||||
}
|
||||
|
@ -166,20 +166,20 @@ internal class DefaultSyncTask @Inject constructor(
|
|||
val status = initialSyncStatusRepository.getStep()
|
||||
if (workingFile.exists() && status >= InitialSyncStatus.STEP_DOWNLOADED) {
|
||||
Timber.tag(loggerTag.value).d("INIT_SYNC file is already here")
|
||||
reportSubtask(initialSyncProgressService, InitSyncStep.Downloading, 1, 0.3f) {
|
||||
reportSubtask(defaultSyncStatusService, InitSyncStep.Downloading, 1, 0.3f) {
|
||||
// Empty task
|
||||
}
|
||||
} else {
|
||||
initialSyncStatusRepository.setStep(InitialSyncStatus.STEP_DOWNLOADING)
|
||||
val syncResponse = logDuration("INIT_SYNC Perform server request", loggerTag) {
|
||||
reportSubtask(initialSyncProgressService, InitSyncStep.ServerComputing, 1, 0.2f) {
|
||||
reportSubtask(defaultSyncStatusService, InitSyncStep.ServerComputing, 1, 0.2f) {
|
||||
getSyncResponse(requestParams, MAX_NUMBER_OF_RETRY_AFTER_TIMEOUT)
|
||||
}
|
||||
}
|
||||
|
||||
if (syncResponse.isSuccessful) {
|
||||
logDuration("INIT_SYNC Download and save to file", loggerTag) {
|
||||
reportSubtask(initialSyncProgressService, InitSyncStep.Downloading, 1, 0.1f) {
|
||||
reportSubtask(defaultSyncStatusService, InitSyncStep.Downloading, 1, 0.1f) {
|
||||
syncResponse.body()?.byteStream()?.use { inputStream ->
|
||||
workingFile.outputStream().use { outputStream ->
|
||||
inputStream.copyTo(outputStream)
|
||||
|
@ -227,7 +227,7 @@ internal class DefaultSyncTask @Inject constructor(
|
|||
Timber.tag(loggerTag.value).d("INIT_SYNC $nbOfJoinedRooms rooms, $nbOfJoinedRoomsInFile ephemeral stored into files")
|
||||
|
||||
logDuration("INIT_SYNC Database insertion", loggerTag) {
|
||||
syncResponseHandler.handleResponse(syncResponse, null, initialSyncProgressService)
|
||||
syncResponseHandler.handleResponse(syncResponse, null, defaultSyncStatusService)
|
||||
}
|
||||
initialSyncStatusRepository.setStep(InitialSyncStatus.STEP_SUCCESS)
|
||||
}
|
||||
|
|
|
@ -70,7 +70,7 @@ import im.vector.app.features.workers.signout.ServerBackupStatusViewState
|
|||
import im.vector.app.push.fcm.FcmHelper
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers
|
||||
import kotlinx.parcelize.Parcelize
|
||||
import org.matrix.android.sdk.api.session.initsync.InitialSyncProgressService
|
||||
import org.matrix.android.sdk.api.session.initsync.SyncStatusService
|
||||
import org.matrix.android.sdk.api.session.permalinks.PermalinkService
|
||||
import org.matrix.android.sdk.api.util.MatrixItem
|
||||
import org.matrix.android.sdk.internal.session.sync.InitialSyncStrategy
|
||||
|
@ -308,11 +308,11 @@ class HomeActivity :
|
|||
}
|
||||
|
||||
private fun renderState(state: HomeActivityViewState) {
|
||||
when (val status = state.initialSyncProgressServiceStatus) {
|
||||
is InitialSyncProgressService.Status.Idle -> {
|
||||
when (val status = state.syncStatusServiceStatus) {
|
||||
is SyncStatusService.Status.Idle -> {
|
||||
views.waitingView.root.isVisible = false
|
||||
}
|
||||
is InitialSyncProgressService.Status.Progressing -> {
|
||||
is SyncStatusService.Status.Progressing -> {
|
||||
val initSyncStepStr = initSyncStepFormatter.format(status.initSyncStep)
|
||||
Timber.v("$initSyncStepStr ${status.percentProgress}")
|
||||
views.waitingView.root.setOnClickListener {
|
||||
|
@ -330,7 +330,7 @@ class HomeActivity :
|
|||
}
|
||||
views.waitingView.root.isVisible = true
|
||||
}
|
||||
is InitialSyncProgressService.Status.IncrementalSyncStatus -> Unit
|
||||
is SyncStatusService.Status.IncrementalSyncStatus -> Unit
|
||||
}.exhaustive
|
||||
}
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ import org.matrix.android.sdk.api.auth.registration.RegistrationFlowResponse
|
|||
import org.matrix.android.sdk.api.auth.registration.nextUncompletedStage
|
||||
import org.matrix.android.sdk.api.extensions.tryOrNull
|
||||
import org.matrix.android.sdk.api.pushrules.RuleIds
|
||||
import org.matrix.android.sdk.api.session.initsync.InitialSyncProgressService
|
||||
import org.matrix.android.sdk.api.session.initsync.SyncStatusService
|
||||
import org.matrix.android.sdk.api.session.room.model.Membership
|
||||
import org.matrix.android.sdk.api.session.room.roomSummaryQueryParams
|
||||
import org.matrix.android.sdk.api.util.toMatrixItem
|
||||
|
@ -122,26 +122,26 @@ class HomeActivityViewModel @AssistedInject constructor(
|
|||
private fun observeInitialSync() {
|
||||
val session = activeSessionHolder.getSafeActiveSession() ?: return
|
||||
|
||||
session.getInitialSyncProgressStatus()
|
||||
session.getSyncStatusLive()
|
||||
.asObservable()
|
||||
.subscribe { status ->
|
||||
when (status) {
|
||||
is InitialSyncProgressService.Status.Progressing -> {
|
||||
is SyncStatusService.Status.Progressing -> {
|
||||
// Schedule a check of the bootstrap when the init sync will be finished
|
||||
checkBootstrap = true
|
||||
}
|
||||
is InitialSyncProgressService.Status.Idle -> {
|
||||
is SyncStatusService.Status.Idle -> {
|
||||
if (checkBootstrap) {
|
||||
checkBootstrap = false
|
||||
maybeBootstrapCrossSigningAfterInitialSync()
|
||||
}
|
||||
}
|
||||
else -> Unit
|
||||
else -> Unit
|
||||
}
|
||||
|
||||
setState {
|
||||
copy(
|
||||
initialSyncProgressServiceStatus = status
|
||||
syncStatusServiceStatus = status
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,8 +17,8 @@
|
|||
package im.vector.app.features.home
|
||||
|
||||
import com.airbnb.mvrx.MvRxState
|
||||
import org.matrix.android.sdk.api.session.initsync.InitialSyncProgressService
|
||||
import org.matrix.android.sdk.api.session.initsync.SyncStatusService
|
||||
|
||||
data class HomeActivityViewState(
|
||||
val initialSyncProgressServiceStatus: InitialSyncProgressService.Status = InitialSyncProgressService.Status.Idle
|
||||
val syncStatusServiceStatus: SyncStatusService.Status = SyncStatusService.Status.Idle
|
||||
) : MvRxState
|
||||
|
|
|
@ -42,7 +42,7 @@ import kotlinx.coroutines.launch
|
|||
import org.matrix.android.sdk.api.query.ActiveSpaceFilter
|
||||
import org.matrix.android.sdk.api.query.RoomCategoryFilter
|
||||
import org.matrix.android.sdk.api.session.Session
|
||||
import org.matrix.android.sdk.api.session.initsync.InitialSyncProgressService
|
||||
import org.matrix.android.sdk.api.session.initsync.SyncStatusService
|
||||
import org.matrix.android.sdk.api.session.room.RoomSortOrder
|
||||
import org.matrix.android.sdk.api.session.room.model.Membership
|
||||
import org.matrix.android.sdk.api.session.room.roomSummaryQueryParams
|
||||
|
@ -191,10 +191,10 @@ class HomeDetailViewModel @AssistedInject constructor(@Assisted initialState: Ho
|
|||
}
|
||||
.disposeOnClear()
|
||||
|
||||
session.getInitialSyncProgressStatus()
|
||||
session.getSyncStatusLive()
|
||||
.asObservable()
|
||||
.subscribe {
|
||||
if (it is InitialSyncProgressService.Status.IncrementalSyncStatus) {
|
||||
if (it is SyncStatusService.Status.IncrementalSyncStatus) {
|
||||
setState {
|
||||
copy(incrementalSyncStatus = it)
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ import com.airbnb.mvrx.MvRxState
|
|||
import com.airbnb.mvrx.Uninitialized
|
||||
import im.vector.app.R
|
||||
import im.vector.app.RoomGroupingMethod
|
||||
import org.matrix.android.sdk.api.session.initsync.InitialSyncProgressService
|
||||
import org.matrix.android.sdk.api.session.initsync.SyncStatusService
|
||||
import org.matrix.android.sdk.api.session.room.model.RoomSummary
|
||||
import org.matrix.android.sdk.api.session.sync.SyncState
|
||||
import org.matrix.android.sdk.api.util.MatrixItem
|
||||
|
@ -40,7 +40,7 @@ data class HomeDetailViewState(
|
|||
val notificationHighlightRooms: Boolean = false,
|
||||
val hasUnreadMessages: Boolean = false,
|
||||
val syncState: SyncState = SyncState.Idle,
|
||||
val incrementalSyncStatus: InitialSyncProgressService.Status.IncrementalSyncStatus = InitialSyncProgressService.Status.IncrementalSyncIdle,
|
||||
val incrementalSyncStatus: SyncStatusService.Status.IncrementalSyncStatus = SyncStatusService.Status.IncrementalSyncIdle,
|
||||
val pushCounter: Int = 0,
|
||||
val showDialPadTab: Boolean = false
|
||||
) : MvRxState
|
||||
|
|
|
@ -82,7 +82,7 @@ import org.matrix.android.sdk.api.session.events.model.isTextMessage
|
|||
import org.matrix.android.sdk.api.session.events.model.toContent
|
||||
import org.matrix.android.sdk.api.session.events.model.toModel
|
||||
import org.matrix.android.sdk.api.session.file.FileService
|
||||
import org.matrix.android.sdk.api.session.initsync.InitialSyncProgressService
|
||||
import org.matrix.android.sdk.api.session.initsync.SyncStatusService
|
||||
import org.matrix.android.sdk.api.session.room.members.ChangeMembershipState
|
||||
import org.matrix.android.sdk.api.session.room.members.roomMemberQueryParams
|
||||
import org.matrix.android.sdk.api.session.room.model.Membership
|
||||
|
@ -1512,10 +1512,10 @@ class RoomDetailViewModel @AssistedInject constructor(
|
|||
}
|
||||
.disposeOnClear()
|
||||
|
||||
session.getInitialSyncProgressStatus()
|
||||
session.getSyncStatusLive()
|
||||
.asObservable()
|
||||
.subscribe { it ->
|
||||
if(it is InitialSyncProgressService.Status.IncrementalSyncStatus) {
|
||||
if(it is SyncStatusService.Status.IncrementalSyncStatus) {
|
||||
setState {
|
||||
copy(incrementalSyncStatus = it)
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ import com.airbnb.mvrx.MvRxState
|
|||
import com.airbnb.mvrx.Uninitialized
|
||||
import org.matrix.android.sdk.api.extensions.orFalse
|
||||
import org.matrix.android.sdk.api.session.events.model.Event
|
||||
import org.matrix.android.sdk.api.session.initsync.InitialSyncProgressService
|
||||
import org.matrix.android.sdk.api.session.initsync.SyncStatusService
|
||||
import org.matrix.android.sdk.api.session.room.members.ChangeMembershipState
|
||||
import org.matrix.android.sdk.api.session.room.model.RoomMemberSummary
|
||||
import org.matrix.android.sdk.api.session.room.model.RoomSummary
|
||||
|
@ -78,7 +78,7 @@ data class RoomDetailViewState(
|
|||
val tombstoneEvent: Event? = null,
|
||||
val joinUpgradedRoomAsync: Async<String> = Uninitialized,
|
||||
val syncState: SyncState = SyncState.Idle,
|
||||
val incrementalSyncStatus: InitialSyncProgressService.Status.IncrementalSyncStatus = InitialSyncProgressService.Status.IncrementalSyncIdle,
|
||||
val incrementalSyncStatus: SyncStatusService.Status.IncrementalSyncStatus = SyncStatusService.Status.IncrementalSyncIdle,
|
||||
val pushCounter: Int = 0,
|
||||
val highlightedEventId: String? = null,
|
||||
val unreadState: UnreadState = UnreadState.Unknown,
|
||||
|
|
|
@ -24,7 +24,7 @@ import androidx.core.view.isVisible
|
|||
import im.vector.app.R
|
||||
import im.vector.app.core.utils.isAirplaneModeOn
|
||||
import im.vector.app.databinding.ViewSyncStateBinding
|
||||
import org.matrix.android.sdk.api.session.initsync.InitialSyncProgressService
|
||||
import org.matrix.android.sdk.api.session.initsync.SyncStatusService
|
||||
import org.matrix.android.sdk.api.session.sync.SyncState
|
||||
|
||||
class SyncStateView @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null, defStyle: Int = 0)
|
||||
|
@ -40,7 +40,7 @@ class SyncStateView @JvmOverloads constructor(context: Context, attrs: Attribute
|
|||
|
||||
@SuppressLint("SetTextI18n")
|
||||
fun render(newState: SyncState,
|
||||
incrementalSyncStatus: InitialSyncProgressService.Status.IncrementalSyncStatus,
|
||||
incrementalSyncStatus: SyncStatusService.Status.IncrementalSyncStatus,
|
||||
pushCounter: Int,
|
||||
showDebugInfo: Boolean
|
||||
) {
|
||||
|
@ -75,13 +75,13 @@ class SyncStateView @JvmOverloads constructor(context: Context, attrs: Attribute
|
|||
}
|
||||
}
|
||||
|
||||
private fun InitialSyncProgressService.Status.IncrementalSyncStatus.toHumanReadable(): String {
|
||||
private fun SyncStatusService.Status.IncrementalSyncStatus.toHumanReadable(): String {
|
||||
return when (this) {
|
||||
InitialSyncProgressService.Status.IncrementalSyncIdle -> "Idle"
|
||||
is InitialSyncProgressService.Status.IncrementalSyncParsing -> "Parsing ${this.rooms} room(s) ${this.toDevice} toDevice(s)"
|
||||
InitialSyncProgressService.Status.IncrementalSyncError -> "Error"
|
||||
InitialSyncProgressService.Status.IncrementalSyncDone -> "Done"
|
||||
else -> "?"
|
||||
SyncStatusService.Status.IncrementalSyncIdle -> "Idle"
|
||||
is SyncStatusService.Status.IncrementalSyncParsing -> "Parsing ${this.rooms} room(s) ${this.toDevice} toDevice(s)"
|
||||
SyncStatusService.Status.IncrementalSyncError -> "Error"
|
||||
SyncStatusService.Status.IncrementalSyncDone -> "Done"
|
||||
else -> "?"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue