Perform an initial sync after un-ignoring a user, from the room member screen (#3439)

This commit is contained in:
Benoit Marty 2022-04-14 15:26:36 +02:00
parent 6d741c3844
commit 9c132a3244
4 changed files with 13 additions and 4 deletions

View File

@ -47,6 +47,8 @@ import im.vector.app.databinding.DialogBaseEditTextBinding
import im.vector.app.databinding.DialogShareQrCodeBinding import im.vector.app.databinding.DialogShareQrCodeBinding
import im.vector.app.databinding.FragmentMatrixProfileBinding import im.vector.app.databinding.FragmentMatrixProfileBinding
import im.vector.app.databinding.ViewStubRoomMemberProfileHeaderBinding 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.analytics.plan.MobileScreen
import im.vector.app.features.crypto.verification.VerificationBottomSheet import im.vector.app.features.crypto.verification.VerificationBottomSheet
import im.vector.app.features.displayname.getBestName import im.vector.app.features.displayname.getBestName
@ -131,13 +133,20 @@ class RoomMemberProfileFragment @Inject constructor(
is RoomMemberProfileViewEvents.OnKickActionSuccess -> Unit is RoomMemberProfileViewEvents.OnKickActionSuccess -> Unit
is RoomMemberProfileViewEvents.OnSetPowerLevelSuccess -> Unit is RoomMemberProfileViewEvents.OnSetPowerLevelSuccess -> Unit
is RoomMemberProfileViewEvents.OnBanActionSuccess -> Unit is RoomMemberProfileViewEvents.OnBanActionSuccess -> Unit
is RoomMemberProfileViewEvents.OnIgnoreActionSuccess -> Unit is RoomMemberProfileViewEvents.OnIgnoreActionSuccess -> handleOnIgnoreActionSuccess(it)
is RoomMemberProfileViewEvents.OnInviteActionSuccess -> Unit is RoomMemberProfileViewEvents.OnInviteActionSuccess -> Unit
} }
} }
setupLongClicks() 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() { private fun setupLongClicks() {
headerViews.memberProfileNameView.copyOnLongClick() headerViews.memberProfileNameView.copyOnLongClick()
headerViews.memberProfileIdView.copyOnLongClick() headerViews.memberProfileIdView.copyOnLongClick()

View File

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

View File

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

View File

@ -634,7 +634,7 @@
<string name="room_participants_action_ignore">Ignore</string> <string name="room_participants_action_ignore">Ignore</string>
<string name="room_participants_action_unignore_title">Unignore user</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.</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">Unignore</string> <string name="room_participants_action_unignore">Unignore</string>
<string name="room_participants_action_cancel_invite_title">Cancel invite</string> <string name="room_participants_action_cancel_invite_title">Cancel invite</string>