SES-4753 - Manage Admins (Promotion and leaving group)#2
SES-4753 - Manage Admins (Promotion and leaving group)#2jbsession wants to merge 24 commits intoses-4753/invite-membersfrom
Conversation
| onClick = { | ||
| (address as? Address.Group)?.let { | ||
| navigateTo(ConversationSettingsDestination.RouteManageMembers(it)) | ||
| navigateTo(ConversationSettingsDestination.RouteManageAdmins(it)) |
There was a problem hiding this comment.
You might want to update the qaTag above by creating a new one so QA can have automated tests linking to this button, because right now you are reusing the manage members one.
|
|
||
| val context = LocalContext.current | ||
|
|
||
| LaunchedEffect(showingError) { |
There was a problem hiding this comment.
You can send toast directly from your viewmodels. This can simplify your logic a lot.
| } | ||
| LaunchedEffect(showingOngoingAction) { | ||
| if (showingOngoingAction != null) { | ||
| Toast.makeText(context, showingOngoingAction, Toast.LENGTH_SHORT).show() |
There was a problem hiding this comment.
Can simplify all this logic form the VM as well
|
|
||
| LaunchedEffect(uiState.toast) { | ||
| if (!uiState.toast.isNullOrEmpty()) { | ||
| Toast.makeText(context, uiState.toast, Toast.LENGTH_SHORT).show() |
There was a problem hiding this comment.
Can simplify all this logic form the VM as well
| /** | ||
| * Shared helper for group operations (same pattern with ManageGroupMembersViewModel). | ||
| */ | ||
| private fun performGroupOperation( |
There was a problem hiding this comment.
If we are starting to re-use this pattern could be extracted somewhere meaningful and re-used?
There was a problem hiding this comment.
Hmm, can this be put inside the BaseGroupMemberViewModel as both vm's extend it?
| try { | ||
| task.await() | ||
| } catch (e: CancellationException) { | ||
| return@launch |
There was a problem hiding this comment.
You can't return here. You do need to catch it though, but rethrow the error instead of returning.
If you don't catch it here specifically the cancellation will go in the next catch and isn't rethrown which breaks your coroutine lifecycle
| val groupName: StateFlow<String> = groupInfo | ||
| .map { it?.first?.name.orEmpty() } | ||
| .stateIn(viewModelScope, SharingStarted.WhileSubscribed(), "") |
There was a problem hiding this comment.
it seems like this name flow is used by multiple viewModels now, should it be moved to the BaseGroupMembersViewModel for reuse?
This PR adds member promotion screen and resending admin promotions
This PR also includes handling how admins can leave groups.