diff --git a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chat/ComposeContextProfilePickerView.kt b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chat/ComposeContextProfilePickerView.kt index 277fee61f5..fff96a1df0 100644 --- a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chat/ComposeContextProfilePickerView.kt +++ b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chat/ComposeContextProfilePickerView.kt @@ -11,7 +11,6 @@ import androidx.compose.material.* import androidx.compose.runtime.* import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier -import androidx.compose.ui.draw.alpha import androidx.compose.ui.draw.clip import androidx.compose.ui.platform.LocalDensity import androidx.compose.ui.text.font.FontWeight @@ -42,8 +41,8 @@ fun ComposeContextProfilePickerView( val incognitoDefault = chatModel.controller.appPrefs.incognito.get() val users = chatModel.users.map { it.user }.filter { u -> u.activeUser || !u.hidden } val listExpanded = remember { mutableStateOf(false) } - // Stays set until the invitation has been moved onto the new profile, which is after - // the form has closed and this picker is interactive again + // Set until the invitation has moved onto the new profile, which is after the form has + // closed and this picker is interactive again val busy = chatModel.creatingProfileForInvitation.value val maxHeightInPx = with(LocalDensity.current) { windowHeight().toPx() } @@ -277,8 +276,7 @@ fun ComposeContextProfilePickerView( LazyColumnWithScrollBarNoAppBar( Modifier .heightIn(max = MAX_USER_PICKER_HEIGHT) - .background(MaterialTheme.colors.surface) - .alpha(if (busy) 0.6f else 1f), + .background(MaterialTheme.colors.surface), reverseLayout = true, maxHeight = remember { mutableStateOf(MAX_USER_PICKER_HEIGHT) }, containerAlignment = Alignment.BottomEnd @@ -332,8 +330,7 @@ fun ComposeContextProfilePickerView( fun CurrentSelection() { Column( Modifier - .background(MaterialTheme.colors.surface) - .alpha(if (busy) 0.6f else 1f), + .background(MaterialTheme.colors.surface), ) { Text( generalGetString(MR.strings.context_user_picker_your_profile), diff --git a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/newchat/NewChatView.kt b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/newchat/NewChatView.kt index fcc053a09d..d46bd169c3 100644 --- a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/newchat/NewChatView.kt +++ b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/newchat/NewChatView.kt @@ -318,15 +318,13 @@ fun ActiveProfilePicker( false } } - // Creating skips the 500ms grace: the picker is recomposed when the form closes, so - // progressByTimeout restarts from false and the rows would look idle - val showProgress = progressByTimeout || chatModel.creatingProfileForInvitation.value - suspend fun selectProfileAsync(user: User) { switchingProfile.value = true try { var updatedConn: PendingContactConnection? = null + appPreferences.incognito.set(false) + if (contactConnection != null) { updatedConn = controller.apiChangeConnectionUser(rhId, contactConnection.pccConnId, user.userId) // Not moved - leave the picker open rather than stranding a profile just created @@ -337,8 +335,6 @@ fun ActiveProfilePicker( updateShownConnection(updatedConn) } } - // Only once the connection has moved, or a failure silently clears the app-wide default - appPreferences.incognito.set(false) controller.changeActiveUser_( rhId = user.remoteHostId, @@ -441,7 +437,7 @@ fun ActiveProfilePicker( Column( Modifier .fillMaxSize() - .alpha(if (showProgress) 0.6f else 1f) + .alpha(if (progressByTimeout) 0.6f else 1f) ) { LazyColumnWithScrollBar(Modifier.padding(top = topPaddingToContent(false)), userScrollEnabled = !busy) { item { @@ -486,10 +482,8 @@ fun ActiveProfilePicker( ProfilePickerUserOption(p) } } - // Outside the branch above: inside it, the row would disappear whenever the - // active profile is filtered out by the search text. Only offered when there - // is a connection to move to the new profile - in the share list there is - // nothing for a brand new profile to share into. + // Outside the branch above, or the row disappears when search filters the active + // profile out. Only with a connection to move - the share list has none. if (contactConnection != null) { item { NewProfileOption() @@ -500,7 +494,7 @@ fun ActiveProfilePicker( } } } - if (showProgress) { + if (progressByTimeout) { DefaultProgressView("") } }