drop the cosmetic progress additions and one more pre-existing fix

showProgress existed to skip the picker's 500ms grace while a profile was being created,
because the recomposition that follows the form closing restarts that timer. But the rows
are disabled by busy the whole time, so nothing incorrect can be done - the gap is purely
that the spinner appears late, and a 500ms grace before showing it is what this picker
already chose for every other switch. Same for the two alpha modifiers added to the
compose picker, which had no progress indication before this branch and does not need to
gain one here.

appPreferences.incognito.set(false) goes back where it was. Moving it after the
connection change fixes a real failure-path bug - a reassignment that fails no longer
clears the app-wide default - but that bug is master's and is reachable from the ordinary
row tap, which this branch does not otherwise touch.

Kept the profileChangeProhibited guard on the new row even though ProfilePicker only
renders when the flag is false: it is live state the receiver loop flips, so it can turn
true between the row being laid out and the tap landing, and five lines to avoid creating
an orphan profile in that window is worth it.
This commit is contained in:
Narasimha-sc
2026-08-06 18:50:45 +00:00
parent 767db0af21
commit 5db2ac054d
2 changed files with 10 additions and 19 deletions
@@ -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),
@@ -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("")
}
}