From fe999830e9d557ea5ec460f8737ada396c93082c Mon Sep 17 00:00:00 2001 From: spaced4ndy <8711996+spaced4ndy@users.noreply.github.com> Date: Thu, 12 Nov 2026 13:33:50 +0000 Subject: [PATCH] android, desktop: keep the channel name after Configure relays (#8051) * android, desktop: keep the channel name after Configure relays * android, desktop: prevent a second channel after Configure relays * android, desktop: keep the relays state after Configure relays * android, desktop: keep only the channel name and the running creation --------- Co-authored-by: spaced4ndy-agents <342056592+spaced4ndy-agents@users.noreply.github.com> --- .../simplex/common/views/newchat/AddChannelView.kt | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/newchat/AddChannelView.kt b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/newchat/AddChannelView.kt index 7ad3076640..fe85a32e65 100644 --- a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/newchat/AddChannelView.kt +++ b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/newchat/AddChannelView.kt @@ -38,20 +38,20 @@ import dev.icerock.moko.resources.compose.painterResource import kotlinx.coroutines.* @Composable -fun AddChannelView(chatModel: ChatModel, rh: RemoteHostInfo?, close: () -> Unit, closeAll: () -> Unit) { +fun ModalData.AddChannelView(chatModel: ChatModel, rh: RemoteHostInfo?, close: () -> Unit, closeAll: () -> Unit) { val rhId = rh?.remoteHostId val view = LocalMultiplatformView() val bottomSheetModalState = rememberModalBottomSheetState(initialValue = ModalBottomSheetValue.Hidden) val scope = rememberCoroutineScope() - val displayName = rememberSaveable { mutableStateOf("") } + val displayName = remember { stateGetOrPut("displayName") { "" } } val chosenImage = rememberSaveable { mutableStateOf(null) } val profileImage = rememberSaveable { mutableStateOf(null) } val focusRequester = remember { FocusRequester() } val hasRelays = rememberSaveable { mutableStateOf(true) } - val groupInfo = remember { mutableStateOf(null) } - val groupLink = rememberSaveable(stateSaver = GroupLink.nullableStateSaver) { mutableStateOf(null) } + val groupInfo = remember { stateGetOrPutNullable("groupInfo") { null } } + val groupLink = remember { stateGetOrPutNullable("groupLink") { null } } val groupRelays = remember { mutableStateOf>(emptyList()) } - val creationInProgress = rememberSaveable { mutableStateOf(false) } + val creationInProgress = remember { stateGetOrPut("creationInProgress") { false } } val showLinkStep = rememberSaveable { mutableStateOf(false) } val relayListExpanded = rememberSaveable { mutableStateOf(false) } @@ -664,6 +664,6 @@ fun RelayProgressIndicator(active: Int, total: Int) { @Composable fun PreviewAddChannelView() { SimpleXTheme { - AddChannelView(chatModel = ChatModel, rh = null, close = {}, closeAll = {}) + ModalData().AddChannelView(chatModel = ChatModel, rh = null, close = {}, closeAll = {}) } }