Reformats after merging

This commit is contained in:
ericdecanini 2022-06-08 13:01:26 +02:00
parent 6df88fba59
commit 87053f2c70
8 changed files with 83 additions and 83 deletions

View File

@ -51,7 +51,7 @@ internal class GroupSyncHandler @Inject constructor() {
private fun handleGroupSync(realm: Realm, handlingStrategy: HandlingStrategy, reporter: ProgressReporter?) { private fun handleGroupSync(realm: Realm, handlingStrategy: HandlingStrategy, reporter: ProgressReporter?) {
val groups = when (handlingStrategy) { val groups = when (handlingStrategy) {
is HandlingStrategy.JOINED -> is HandlingStrategy.JOINED ->
handlingStrategy.data.mapWithProgress(reporter, InitialSyncStep.ImportingAccountGroups, 0.6f) { handlingStrategy.data.mapWithProgress(reporter, InitialSyncStep.ImportingAccountGroups, 0.6f) {
handleJoinedGroup(realm, it.key) handleJoinedGroup(realm, it.key)
} }
@ -61,7 +61,7 @@ internal class GroupSyncHandler @Inject constructor() {
handleInvitedGroup(realm, it.key) handleInvitedGroup(realm, it.key)
} }
is HandlingStrategy.LEFT -> is HandlingStrategy.LEFT ->
handlingStrategy.data.mapWithProgress(reporter, InitialSyncStep.ImportingAccountGroups, 0.1f) { handlingStrategy.data.mapWithProgress(reporter, InitialSyncStep.ImportingAccountGroups, 0.1f) {
handleLeftGroup(realm, it.key) handleLeftGroup(realm, it.key)
} }

View File

@ -140,7 +140,7 @@ internal class RoomSyncHandler @Inject constructor(
} }
val syncLocalTimeStampMillis = clock.epochMillis() val syncLocalTimeStampMillis = clock.epochMillis()
val rooms = when (handlingStrategy) { val rooms = when (handlingStrategy) {
is HandlingStrategy.JOINED -> { is HandlingStrategy.JOINED -> {
if (isInitialSync && initialSyncStrategy is InitialSyncStrategy.Optimized) { if (isInitialSync && initialSyncStrategy is InitialSyncStrategy.Optimized) {
insertJoinRoomsFromInitSync(realm, handlingStrategy, syncLocalTimeStampMillis, aggregator, reporter) insertJoinRoomsFromInitSync(realm, handlingStrategy, syncLocalTimeStampMillis, aggregator, reporter)
// Rooms are already inserted, return an empty list // Rooms are already inserted, return an empty list
@ -156,7 +156,7 @@ internal class RoomSyncHandler @Inject constructor(
handleInvitedRoom(realm, it.key, it.value, insertType, syncLocalTimeStampMillis) handleInvitedRoom(realm, it.key, it.value, insertType, syncLocalTimeStampMillis)
} }
is HandlingStrategy.LEFT -> { is HandlingStrategy.LEFT -> {
handlingStrategy.data.mapWithProgress(reporter, InitialSyncStep.ImportingAccountLeftRooms, 0.3f) { handlingStrategy.data.mapWithProgress(reporter, InitialSyncStep.ImportingAccountLeftRooms, 0.3f) {
handleLeftRoom(realm, it.key, it.value, insertType, syncLocalTimeStampMillis) handleLeftRoom(realm, it.key, it.value, insertType, syncLocalTimeStampMillis)
} }
@ -578,12 +578,12 @@ internal class RoomSyncHandler @Inject constructor(
readReceiptHandler.handle(realm, roomId, readReceiptContent, isInitialSync, aggregator) readReceiptHandler.handle(realm, roomId, readReceiptContent, isInitialSync, aggregator)
} }
} }
EventType.TYPING -> { EventType.TYPING -> {
event.content.toModel<TypingEventContent>()?.let { typingEventContent -> event.content.toModel<TypingEventContent>()?.let { typingEventContent ->
result = result.copy(typingUserIds = typingEventContent.typingUserIds) result = result.copy(typingUserIds = typingEventContent.typingUserIds)
} }
} }
else -> Timber.w("Ephemeral event type '${event.type}' not yet supported") else -> Timber.w("Ephemeral event type '${event.type}' not yet supported")
} }
} }

View File

@ -199,15 +199,15 @@ class HomeActivity :
.stream() .stream()
.onEach { sharedAction -> .onEach { sharedAction ->
when (sharedAction) { when (sharedAction) {
is HomeActivitySharedAction.OpenDrawer -> views.drawerLayout.openDrawer(GravityCompat.START) is HomeActivitySharedAction.OpenDrawer -> views.drawerLayout.openDrawer(GravityCompat.START)
is HomeActivitySharedAction.CloseDrawer -> views.drawerLayout.closeDrawer(GravityCompat.START) is HomeActivitySharedAction.CloseDrawer -> views.drawerLayout.closeDrawer(GravityCompat.START)
is HomeActivitySharedAction.OpenGroup -> openGroup(sharedAction.shouldClearFragment) is HomeActivitySharedAction.OpenGroup -> openGroup(sharedAction.shouldClearFragment)
is HomeActivitySharedAction.OpenSpacePreview -> startActivity(SpacePreviewActivity.newIntent(this, sharedAction.spaceId)) is HomeActivitySharedAction.OpenSpacePreview -> startActivity(SpacePreviewActivity.newIntent(this, sharedAction.spaceId))
is HomeActivitySharedAction.AddSpace -> createSpaceResultLauncher.launch(SpaceCreationActivity.newIntent(this)) is HomeActivitySharedAction.AddSpace -> createSpaceResultLauncher.launch(SpaceCreationActivity.newIntent(this))
is HomeActivitySharedAction.ShowSpaceSettings -> showSpaceSettings(sharedAction.spaceId) is HomeActivitySharedAction.ShowSpaceSettings -> showSpaceSettings(sharedAction.spaceId)
is HomeActivitySharedAction.OpenSpaceInvite -> openSpaceInvite(sharedAction.spaceId) is HomeActivitySharedAction.OpenSpaceInvite -> openSpaceInvite(sharedAction.spaceId)
HomeActivitySharedAction.SendSpaceFeedBack -> bugReporter.openBugReportScreen(this, ReportType.SPACE_BETA_FEEDBACK) HomeActivitySharedAction.SendSpaceFeedBack -> bugReporter.openBugReportScreen(this, ReportType.SPACE_BETA_FEEDBACK)
HomeActivitySharedAction.CloseGroup -> closeGroup() HomeActivitySharedAction.CloseGroup -> closeGroup()
} }
} }
.launchIn(lifecycleScope) .launchIn(lifecycleScope)
@ -226,20 +226,20 @@ class HomeActivity :
homeActivityViewModel.observeViewEvents { homeActivityViewModel.observeViewEvents {
when (it) { when (it) {
is HomeActivityViewEvents.AskPasswordToInitCrossSigning -> handleAskPasswordToInitCrossSigning(it) is HomeActivityViewEvents.AskPasswordToInitCrossSigning -> handleAskPasswordToInitCrossSigning(it)
is HomeActivityViewEvents.OnNewSession -> handleOnNewSession(it) is HomeActivityViewEvents.OnNewSession -> handleOnNewSession(it)
HomeActivityViewEvents.PromptToEnableSessionPush -> handlePromptToEnablePush() HomeActivityViewEvents.PromptToEnableSessionPush -> handlePromptToEnablePush()
HomeActivityViewEvents.StartRecoverySetupFlow -> handleStartRecoverySetup() HomeActivityViewEvents.StartRecoverySetupFlow -> handleStartRecoverySetup()
is HomeActivityViewEvents.ForceVerification -> { is HomeActivityViewEvents.ForceVerification -> {
if (it.sendRequest) { if (it.sendRequest) {
navigator.requestSelfSessionVerification(this) navigator.requestSelfSessionVerification(this)
} else { } else {
navigator.waitSessionVerification(this) navigator.waitSessionVerification(this)
} }
} }
is HomeActivityViewEvents.OnCrossSignedInvalidated -> handleCrossSigningInvalidated(it) is HomeActivityViewEvents.OnCrossSignedInvalidated -> handleCrossSigningInvalidated(it)
HomeActivityViewEvents.ShowAnalyticsOptIn -> handleShowAnalyticsOptIn() HomeActivityViewEvents.ShowAnalyticsOptIn -> handleShowAnalyticsOptIn()
HomeActivityViewEvents.NotifyUserForThreadsMigration -> handleNotifyUserForThreadsMigration() HomeActivityViewEvents.NotifyUserForThreadsMigration -> handleNotifyUserForThreadsMigration()
is HomeActivityViewEvents.MigrateThreads -> migrateThreadsIfNeeded(it.checkSession) is HomeActivityViewEvents.MigrateThreads -> migrateThreadsIfNeeded(it.checkSession)
} }
} }
homeActivityViewModel.onEach { renderState(it) } homeActivityViewModel.onEach { renderState(it) }
@ -337,12 +337,12 @@ class HomeActivity :
when { when {
deepLink.startsWith(USER_LINK_PREFIX) -> deepLink.substring(USER_LINK_PREFIX.length) deepLink.startsWith(USER_LINK_PREFIX) -> deepLink.substring(USER_LINK_PREFIX.length)
deepLink.startsWith(ROOM_LINK_PREFIX) -> deepLink.substring(ROOM_LINK_PREFIX.length) deepLink.startsWith(ROOM_LINK_PREFIX) -> deepLink.substring(ROOM_LINK_PREFIX.length)
else -> null else -> null
}?.let { permalinkId -> }?.let { permalinkId ->
activeSessionHolder.getSafeActiveSession()?.permalinkService()?.createPermalink(permalinkId) activeSessionHolder.getSafeActiveSession()?.permalinkService()?.createPermalink(permalinkId)
} }
} }
else -> deepLink else -> deepLink
} }
lifecycleScope.launch { lifecycleScope.launch {
@ -392,7 +392,7 @@ class HomeActivity :
} }
views.waitingView.root.isVisible = true views.waitingView.root.isVisible = true
} }
else -> { else -> {
// Idle or Incremental sync status // Idle or Incremental sync status
views.waitingView.root.isVisible = false views.waitingView.root.isVisible = false
} }
@ -544,15 +544,15 @@ class HomeActivity :
override fun onOptionsItemSelected(item: MenuItem): Boolean { override fun onOptionsItemSelected(item: MenuItem): Boolean {
when (item.itemId) { when (item.itemId) {
R.id.menu_home_suggestion -> { R.id.menu_home_suggestion -> {
bugReporter.openBugReportScreen(this, ReportType.SUGGESTION) bugReporter.openBugReportScreen(this, ReportType.SUGGESTION)
return true return true
} }
R.id.menu_home_report_bug -> { R.id.menu_home_report_bug -> {
bugReporter.openBugReportScreen(this, ReportType.BUG_REPORT) bugReporter.openBugReportScreen(this, ReportType.BUG_REPORT)
return true return true
} }
R.id.menu_home_init_sync_legacy -> { R.id.menu_home_init_sync_legacy -> {
// Configure the SDK // Configure the SDK
initialSyncStrategy = InitialSyncStrategy.Legacy initialSyncStrategy = InitialSyncStrategy.Legacy
// And clear cache // And clear cache
@ -566,11 +566,11 @@ class HomeActivity :
MainActivity.restartApp(this, MainActivityArgs(clearCache = true)) MainActivity.restartApp(this, MainActivityArgs(clearCache = true))
return true return true
} }
R.id.menu_home_filter -> { R.id.menu_home_filter -> {
navigator.openRoomsFiltering(this) navigator.openRoomsFiltering(this)
return true return true
} }
R.id.menu_home_setting -> { R.id.menu_home_setting -> {
navigator.openSettings(this) navigator.openSettings(this)
return true return true
} }

View File

@ -131,10 +131,10 @@ class HomeActivityViewModel @AssistedInject constructor(
} }
} }
} }
AuthenticationDescription.Login -> { AuthenticationDescription.Login -> {
// do nothing // do nothing
} }
null -> { null -> {
// do nothing // do nothing
} }
} }
@ -198,7 +198,7 @@ class HomeActivityViewModel @AssistedInject constructor(
vectorPreferences.userNotifiedAboutThreads() vectorPreferences.userNotifiedAboutThreads()
} }
// Migrate users with enabled lab settings // Migrate users with enabled lab settings
vectorPreferences.shouldNotifyUserAboutThreads() && vectorPreferences.shouldMigrateThreads() -> { vectorPreferences.shouldNotifyUserAboutThreads() && vectorPreferences.shouldMigrateThreads() -> {
Timber.i("----> Migrate threads with enabled labs") Timber.i("----> Migrate threads with enabled labs")
// If user had io.element.thread enabled then enable the new thread support, // If user had io.element.thread enabled then enable the new thread support,
// clear cache to sync messages appropriately // clear cache to sync messages appropriately
@ -208,7 +208,7 @@ class HomeActivityViewModel @AssistedInject constructor(
_viewEvents.post(HomeActivityViewEvents.MigrateThreads(checkSession = false)) _viewEvents.post(HomeActivityViewEvents.MigrateThreads(checkSession = false))
} }
// Enable all users // Enable all users
vectorPreferences.shouldMigrateThreads() && vectorPreferences.areThreadMessagesEnabled() -> { vectorPreferences.shouldMigrateThreads() && vectorPreferences.areThreadMessagesEnabled() -> {
Timber.i("----> Try to migrate threads") Timber.i("----> Try to migrate threads")
_viewEvents.post(HomeActivityViewEvents.MigrateThreads(checkSession = true)) _viewEvents.post(HomeActivityViewEvents.MigrateThreads(checkSession = true))
} }
@ -225,7 +225,7 @@ class HomeActivityViewModel @AssistedInject constructor(
is SyncRequestState.Idle -> { is SyncRequestState.Idle -> {
maybeVerifyOrBootstrapCrossSigning() maybeVerifyOrBootstrapCrossSigning()
} }
else -> Unit else -> Unit
} }
setState { setState {
@ -426,7 +426,7 @@ class HomeActivityViewModel @AssistedInject constructor(
HomeActivityViewActions.PushPromptHasBeenReviewed -> { HomeActivityViewActions.PushPromptHasBeenReviewed -> {
vectorPreferences.setDidAskUserToEnableSessionPush() vectorPreferences.setDidAskUserToEnableSessionPush()
} }
HomeActivityViewActions.ViewStarted -> { HomeActivityViewActions.ViewStarted -> {
initialize() initialize()
} }
} }

View File

@ -27,16 +27,16 @@ class InitSyncStepFormatter @Inject constructor(
fun format(initialSyncStep: InitialSyncStep): String { fun format(initialSyncStep: InitialSyncStep): String {
return stringProvider.getString( return stringProvider.getString(
when (initialSyncStep) { when (initialSyncStep) {
InitialSyncStep.ServerComputing -> R.string.initial_sync_start_server_computing InitialSyncStep.ServerComputing -> R.string.initial_sync_start_server_computing
InitialSyncStep.Downloading -> R.string.initial_sync_start_downloading InitialSyncStep.Downloading -> R.string.initial_sync_start_downloading
InitialSyncStep.ImportingAccount -> R.string.initial_sync_start_importing_account InitialSyncStep.ImportingAccount -> R.string.initial_sync_start_importing_account
InitialSyncStep.ImportingAccountCrypto -> R.string.initial_sync_start_importing_account_crypto InitialSyncStep.ImportingAccountCrypto -> R.string.initial_sync_start_importing_account_crypto
InitialSyncStep.ImportingAccountRoom -> R.string.initial_sync_start_importing_account_rooms InitialSyncStep.ImportingAccountRoom -> R.string.initial_sync_start_importing_account_rooms
InitialSyncStep.ImportingAccountGroups -> R.string.initial_sync_start_importing_account_groups InitialSyncStep.ImportingAccountGroups -> R.string.initial_sync_start_importing_account_groups
InitialSyncStep.ImportingAccountData -> R.string.initial_sync_start_importing_account_data InitialSyncStep.ImportingAccountData -> R.string.initial_sync_start_importing_account_data
InitialSyncStep.ImportingAccountJoinedRooms -> R.string.initial_sync_start_importing_account_joined_rooms InitialSyncStep.ImportingAccountJoinedRooms -> R.string.initial_sync_start_importing_account_joined_rooms
InitialSyncStep.ImportingAccountInvitedRooms -> R.string.initial_sync_start_importing_account_invited_rooms InitialSyncStep.ImportingAccountInvitedRooms -> R.string.initial_sync_start_importing_account_invited_rooms
InitialSyncStep.ImportingAccountLeftRooms -> R.string.initial_sync_start_importing_account_left_rooms InitialSyncStep.ImportingAccountLeftRooms -> R.string.initial_sync_start_importing_account_left_rooms
} }
) )
} }

View File

@ -200,18 +200,18 @@ class MessageItemFactory @Inject constructor(
// val all = event.root.toContent() // val all = event.root.toContent()
// val ev = all.toModel<Event>() // val ev = all.toModel<Event>()
val messageItem = when (messageContent) { val messageItem = when (messageContent) {
is MessageEmoteContent -> buildEmoteMessageItem(messageContent, informationData, highlight, callback, attributes) is MessageEmoteContent -> buildEmoteMessageItem(messageContent, informationData, highlight, callback, attributes)
is MessageTextContent -> buildItemForTextContent(messageContent, informationData, highlight, callback, attributes) is MessageTextContent -> buildItemForTextContent(messageContent, informationData, highlight, callback, attributes)
is MessageImageInfoContent -> buildImageMessageItem(messageContent, informationData, highlight, callback, attributes) is MessageImageInfoContent -> buildImageMessageItem(messageContent, informationData, highlight, callback, attributes)
is MessageNoticeContent -> buildNoticeMessageItem(messageContent, informationData, highlight, callback, attributes) is MessageNoticeContent -> buildNoticeMessageItem(messageContent, informationData, highlight, callback, attributes)
is MessageVideoContent -> buildVideoMessageItem(messageContent, informationData, highlight, callback, attributes) is MessageVideoContent -> buildVideoMessageItem(messageContent, informationData, highlight, callback, attributes)
is MessageFileContent -> buildFileMessageItem(messageContent, highlight, attributes) is MessageFileContent -> buildFileMessageItem(messageContent, highlight, attributes)
is MessageAudioContent -> buildAudioContent(params, messageContent, informationData, highlight, attributes) is MessageAudioContent -> buildAudioContent(params, messageContent, informationData, highlight, attributes)
is MessageVerificationRequestContent -> buildVerificationRequestMessageItem(messageContent, informationData, highlight, callback, attributes) is MessageVerificationRequestContent -> buildVerificationRequestMessageItem(messageContent, informationData, highlight, callback, attributes)
is MessagePollContent -> buildPollItem(messageContent, informationData, highlight, callback, attributes) is MessagePollContent -> buildPollItem(messageContent, informationData, highlight, callback, attributes)
is MessageLocationContent -> buildLocationItem(messageContent, informationData, highlight, attributes) is MessageLocationContent -> buildLocationItem(messageContent, informationData, highlight, attributes)
is MessageBeaconInfoContent -> liveLocationShareMessageItemFactory.create(params.event, highlight, attributes) is MessageBeaconInfoContent -> liveLocationShareMessageItemFactory.create(params.event, highlight, attributes)
else -> buildNotHandledMessageItem(messageContent, informationData, highlight, callback, attributes) else -> buildNotHandledMessageItem(messageContent, informationData, highlight, callback, attributes)
} }
return messageItem?.apply { return messageItem?.apply {
layout(informationData.messageLayout.layoutRes) layout(informationData.messageLayout.layoutRes)
@ -277,11 +277,11 @@ class MessageItemFactory @Inject constructor(
pollResponseSummary: PollResponseData?, pollResponseSummary: PollResponseData?,
pollContent: MessagePollContent, pollContent: MessagePollContent,
): PollState = when { ): PollState = when {
!informationData.sendState.isSent() -> Sending !informationData.sendState.isSent() -> Sending
pollResponseSummary?.isClosed.orFalse() -> Ended pollResponseSummary?.isClosed.orFalse() -> Ended
pollContent.getBestPollCreationInfo()?.kind == PollType.UNDISCLOSED -> Undisclosed pollContent.getBestPollCreationInfo()?.kind == PollType.UNDISCLOSED -> Undisclosed
pollResponseSummary?.myVote?.isNotEmpty().orFalse() -> Voted(pollResponseSummary?.totalVotes ?: 0) pollResponseSummary?.myVote?.isNotEmpty().orFalse() -> Voted(pollResponseSummary?.totalVotes ?: 0)
else -> Ready else -> Ready
} }
private fun List<PollAnswer>.mapToOptions( private fun List<PollAnswer>.mapToOptions(
@ -299,11 +299,11 @@ class MessageItemFactory @Inject constructor(
val isWinner = winnerVoteCount != 0 && voteCount == winnerVoteCount val isWinner = winnerVoteCount != 0 && voteCount == winnerVoteCount
when (pollState) { when (pollState) {
Sending -> PollSending(optionId, optionAnswer) Sending -> PollSending(optionId, optionAnswer)
Ready -> PollReady(optionId, optionAnswer) Ready -> PollReady(optionId, optionAnswer)
is Voted -> PollVoted(optionId, optionAnswer, voteCount, votePercentage, isMyVote) is Voted -> PollVoted(optionId, optionAnswer, voteCount, votePercentage, isMyVote)
Undisclosed -> PollUndisclosed(optionId, optionAnswer, isMyVote) Undisclosed -> PollUndisclosed(optionId, optionAnswer, isMyVote)
Ended -> PollEnded(optionId, optionAnswer, voteCount, votePercentage, isWinner) Ended -> PollEnded(optionId, optionAnswer, voteCount, votePercentage, isWinner)
} }
} }
@ -323,11 +323,11 @@ class MessageItemFactory @Inject constructor(
): String { ): String {
val votes = pollResponseSummary?.totalVotes ?: 0 val votes = pollResponseSummary?.totalVotes ?: 0
return when { return when {
pollState is Ended -> stringProvider.getQuantityString(R.plurals.poll_total_vote_count_after_ended, votes, votes) pollState is Ended -> stringProvider.getQuantityString(R.plurals.poll_total_vote_count_after_ended, votes, votes)
pollState is Undisclosed -> "" pollState is Undisclosed -> ""
pollState is Voted -> stringProvider.getQuantityString(R.plurals.poll_total_vote_count_before_ended_and_voted, votes, votes) pollState is Voted -> stringProvider.getQuantityString(R.plurals.poll_total_vote_count_before_ended_and_voted, votes, votes)
votes == 0 -> stringProvider.getString(R.string.poll_no_votes_cast) votes == 0 -> stringProvider.getString(R.string.poll_no_votes_cast)
else -> stringProvider.getQuantityString(R.plurals.poll_total_vote_count_before_ended_and_not_voted, votes, votes) else -> stringProvider.getQuantityString(R.plurals.poll_total_vote_count_before_ended_and_not_voted, votes, votes)
} }
} }

View File

@ -151,15 +151,15 @@ class TimelineMessageLayoutFactory @Inject constructor(
private fun MessageContent?.timestampInsideMessage(): Boolean { private fun MessageContent?.timestampInsideMessage(): Boolean {
return when { return when {
this == null -> false this == null -> false
else -> msgType in MSG_TYPES_WITH_TIMESTAMP_INSIDE_MESSAGE else -> msgType in MSG_TYPES_WITH_TIMESTAMP_INSIDE_MESSAGE
} }
} }
private fun MessageContent?.shouldAddMessageOverlay(): Boolean { private fun MessageContent?.shouldAddMessageOverlay(): Boolean {
return when { return when {
this == null || msgType == MessageType.MSGTYPE_BEACON_INFO -> false this == null || msgType == MessageType.MSGTYPE_BEACON_INFO -> false
else -> msgType in MSG_TYPES_WITH_TIMESTAMP_INSIDE_MESSAGE else -> msgType in MSG_TYPES_WITH_TIMESTAMP_INSIDE_MESSAGE
} }
} }
@ -210,10 +210,10 @@ class TimelineMessageLayoutFactory @Inject constructor(
return when (event?.root?.getClearType()) { return when (event?.root?.getClearType()) {
EventType.KEY_VERIFICATION_DONE, EventType.KEY_VERIFICATION_DONE,
EventType.KEY_VERIFICATION_CANCEL -> true EventType.KEY_VERIFICATION_CANCEL -> true
EventType.MESSAGE -> { EventType.MESSAGE -> {
event.getLastMessageContent() is MessageVerificationRequestContent event.getLastMessageContent() is MessageVerificationRequestContent
} }
else -> false else -> false
} }
} }
} }

View File

@ -66,23 +66,23 @@ class SyncStateView @JvmOverloads constructor(context: Context, attrs: Attribute
private fun SyncState.toHumanReadable(): String { private fun SyncState.toHumanReadable(): String {
return when (this) { return when (this) {
SyncState.Idle -> "Idle" SyncState.Idle -> "Idle"
SyncState.InvalidToken -> "InvalidToken" SyncState.InvalidToken -> "InvalidToken"
SyncState.Killed -> "Killed" SyncState.Killed -> "Killed"
SyncState.Killing -> "Killing" SyncState.Killing -> "Killing"
SyncState.NoNetwork -> "NoNetwork" SyncState.NoNetwork -> "NoNetwork"
SyncState.Paused -> "Paused" SyncState.Paused -> "Paused"
is SyncState.Running -> "$this" is SyncState.Running -> "$this"
} }
} }
private fun SyncRequestState.IncrementalSyncRequestState.toHumanReadable(): String { private fun SyncRequestState.IncrementalSyncRequestState.toHumanReadable(): String {
return when (this) { return when (this) {
SyncRequestState.IncrementalSyncIdle -> "Idle" SyncRequestState.IncrementalSyncIdle -> "Idle"
is SyncRequestState.IncrementalSyncParsing -> "Parsing ${this.rooms} room(s) ${this.toDevice} toDevice(s)" is SyncRequestState.IncrementalSyncParsing -> "Parsing ${this.rooms} room(s) ${this.toDevice} toDevice(s)"
SyncRequestState.IncrementalSyncError -> "Error" SyncRequestState.IncrementalSyncError -> "Error"
SyncRequestState.IncrementalSyncDone -> "Done" SyncRequestState.IncrementalSyncDone -> "Done"
else -> "?" else -> "?"
} }
} }
} }