Initial sync dialog will now come later. It allows to unignore several user without performing an initial sync each time.

This commit is contained in:
Benoit Marty 2022-04-15 12:43:57 +02:00 committed by Benoit Marty
parent 6b9f2965da
commit a39516534a
6 changed files with 8 additions and 28 deletions

View file

@ -119,8 +119,6 @@ import im.vector.app.core.utils.startInstallFromSourceIntent
import im.vector.app.core.utils.toast
import im.vector.app.databinding.DialogReportContentBinding
import im.vector.app.databinding.FragmentTimelineBinding
import im.vector.app.features.MainActivity
import im.vector.app.features.MainActivityArgs
import im.vector.app.features.analytics.extensions.toAnalyticsInteraction
import im.vector.app.features.analytics.plan.Interaction
import im.vector.app.features.analytics.plan.MobileScreen
@ -1730,14 +1728,10 @@ class TimelineFragment @Inject constructor(
dismissLoadingDialog()
views.composerLayout.setTextIfDifferent("")
when (parsedCommand) {
is ParsedCommand.SetMarkdown -> {
is ParsedCommand.SetMarkdown -> {
showSnackWithMessage(getString(if (parsedCommand.enable) R.string.markdown_has_been_enabled else R.string.markdown_has_been_disabled))
}
is ParsedCommand.UnignoreUser -> {
// A user has been un-ignored, perform a initial sync
MainActivity.restartApp(requireActivity(), MainActivityArgs(clearCache = true))
}
else -> Unit
else -> Unit
}
}

View file

@ -47,8 +47,6 @@ import im.vector.app.databinding.DialogBaseEditTextBinding
import im.vector.app.databinding.DialogShareQrCodeBinding
import im.vector.app.databinding.FragmentMatrixProfileBinding
import im.vector.app.databinding.ViewStubRoomMemberProfileHeaderBinding
import im.vector.app.features.MainActivity
import im.vector.app.features.MainActivityArgs
import im.vector.app.features.analytics.plan.MobileScreen
import im.vector.app.features.crypto.verification.VerificationBottomSheet
import im.vector.app.features.displayname.getBestName
@ -133,20 +131,13 @@ class RoomMemberProfileFragment @Inject constructor(
is RoomMemberProfileViewEvents.OnKickActionSuccess -> Unit
is RoomMemberProfileViewEvents.OnSetPowerLevelSuccess -> Unit
is RoomMemberProfileViewEvents.OnBanActionSuccess -> Unit
is RoomMemberProfileViewEvents.OnIgnoreActionSuccess -> handleOnIgnoreActionSuccess(it)
is RoomMemberProfileViewEvents.OnIgnoreActionSuccess -> Unit
is RoomMemberProfileViewEvents.OnInviteActionSuccess -> Unit
}
}
setupLongClicks()
}
private fun handleOnIgnoreActionSuccess(action: RoomMemberProfileViewEvents.OnIgnoreActionSuccess) {
if (action.shouldPerformInitialSync) {
// A user has been un-ignored, perform a initial sync
MainActivity.restartApp(requireActivity(), MainActivityArgs(clearCache = true))
}
}
private fun setupLongClicks() {
headerViews.memberProfileNameView.copyOnLongClick()
headerViews.memberProfileIdView.copyOnLongClick()

View file

@ -25,7 +25,7 @@ sealed class RoomMemberProfileViewEvents : VectorViewEvents {
data class Loading(val message: CharSequence? = null) : RoomMemberProfileViewEvents()
data class Failure(val throwable: Throwable) : RoomMemberProfileViewEvents()
data class OnIgnoreActionSuccess(val shouldPerformInitialSync: Boolean) : RoomMemberProfileViewEvents()
object OnIgnoreActionSuccess : RoomMemberProfileViewEvents()
object OnSetPowerLevelSuccess : RoomMemberProfileViewEvents()
object OnInviteActionSuccess : RoomMemberProfileViewEvents()
object OnKickActionSuccess : RoomMemberProfileViewEvents()

View file

@ -390,7 +390,7 @@ class RoomMemberProfileViewModel @AssistedInject constructor(
} else {
session.ignoreUserIds(listOf(state.userId))
}
RoomMemberProfileViewEvents.OnIgnoreActionSuccess(isIgnored)
RoomMemberProfileViewEvents.OnIgnoreActionSuccess
} catch (failure: Throwable) {
RoomMemberProfileViewEvents.Failure(failure)
}

View file

@ -62,16 +62,11 @@ class VectorSettingsIgnoredUsersFragment @Inject constructor(
when (it) {
is IgnoredUsersViewEvents.Loading -> showLoading(it.message)
is IgnoredUsersViewEvents.Failure -> showFailure(it.throwable)
IgnoredUsersViewEvents.Success -> handleSuccess()
IgnoredUsersViewEvents.Success -> Unit
}
}
}
private fun handleSuccess() {
// A user has been un-ignored, perform a initial sync
MainActivity.restartApp(requireActivity(), MainActivityArgs(clearCache = true))
}
override fun onDestroyView() {
ignoredUsersController.callback = null
views.genericRecyclerView.cleanup()

View file

@ -637,7 +637,7 @@
<string name="room_participants_action_ignore">Ignore</string>
<string name="room_participants_action_unignore_title">Unignore user</string>
<string name="room_participants_action_unignore_prompt_msg">Unignoring this user will show all messages from them again.\n\nNote that this action will restart the app and it may take some time.</string>
<string name="room_participants_action_unignore_prompt_msg">Unignoring this user will show all messages from them again.</string>
<string name="room_participants_action_unignore">Unignore</string>
<string name="room_participants_action_cancel_invite_title">Cancel invite</string>
@ -1035,7 +1035,7 @@
<string name="settings_fail_to_update_password">Failed to update password</string>
<string name="settings_fail_to_update_password_invalid_current_password">The password is not valid</string>
<string name="settings_password_updated">Your password has been updated</string>
<string name="settings_unignore_user">Show all messages from %s?\n\nNote that this action will restart the app and it may take some time.</string>
<string name="settings_unignore_user">Show all messages from %s?</string>
<string name="settings_emails_and_phone_numbers_title">Emails and phone numbers</string>
<string name="settings_emails_and_phone_numbers_summary">Manage emails and phone numbers linked to your Matrix account</string>