From 557e8ddbe49e4967d31eff0fbd7b146db248d229 Mon Sep 17 00:00:00 2001 From: spaced4ndy <8711996+spaced4ndy@users.noreply.github.com> Date: Tue, 1 Jul 2025 12:35:21 +0000 Subject: [PATCH] ios: fix accepting contact request incognito; android, desktop: fix showing incognito auto-accept toggle when short link data is not set (#6026) * ios: fix accepting contact request incognito * kotlin: fix incognito toggle --- .../ComposeMessage/ContextContactRequestActionsView.swift | 2 +- .../commonMain/kotlin/chat/simplex/common/model/ChatModel.kt | 2 +- .../views/chat/ComposeContextContactRequestActionsView.kt | 2 +- .../chat/simplex/common/views/chatlist/ChatListNavLinkView.kt | 4 ++-- .../chat/simplex/common/views/usersettings/UserAddressView.kt | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/apps/ios/Shared/Views/Chat/ComposeMessage/ContextContactRequestActionsView.swift b/apps/ios/Shared/Views/Chat/ComposeMessage/ContextContactRequestActionsView.swift index dc9fbff9f6..9c299ebc42 100644 --- a/apps/ios/Shared/Views/Chat/ComposeMessage/ContextContactRequestActionsView.swift +++ b/apps/ios/Shared/Views/Chat/ComposeMessage/ContextContactRequestActionsView.swift @@ -69,7 +69,7 @@ struct ContextContactRequestActionsView: View { private func acceptRequest(incognito: Bool = false) { inProgress = true Task { - await acceptContactRequest(incognito: false, contactRequestId: contactRequestId) + await acceptContactRequest(incognito: incognito, contactRequestId: contactRequestId) await MainActor.run { inProgress = false } } } diff --git a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/model/ChatModel.kt b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/model/ChatModel.kt index ffabd5e1bc..c4328a6016 100644 --- a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/model/ChatModel.kt +++ b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/model/ChatModel.kt @@ -171,7 +171,7 @@ object ChatModel { // return true if you handled the click var centerPanelBackgroundClickHandler: (() -> Boolean)? = null - var addressShortLinkDataSet: Boolean = userAddress.value?.shortLinkDataSet ?: true + fun addressShortLinkDataSet(): Boolean = userAddress.value?.shortLinkDataSet ?: true fun getUser(userId: Long): User? = if (currentUser.value?.userId == userId) { currentUser.value diff --git a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chat/ComposeContextContactRequestActionsView.kt b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chat/ComposeContextContactRequestActionsView.kt index fe7e34a902..2938cdd5c3 100644 --- a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chat/ComposeContextContactRequestActionsView.kt +++ b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chat/ComposeContextContactRequestActionsView.kt @@ -63,7 +63,7 @@ fun ComposeContextContactRequestActionsView( .fillMaxHeight() .weight(1F) .clickable { - if (chatModel.addressShortLinkDataSet) { + if (chatModel.addressShortLinkDataSet()) { acceptContactRequest(rhId, incognito = false, contactRequestId, isCurrentUser = true, chatModel) } else { showAcceptRequestAlert(rhId, contactRequestId) diff --git a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chatlist/ChatListNavLinkView.kt b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chatlist/ChatListNavLinkView.kt index 1c8a40f925..feba9acd79 100644 --- a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chatlist/ChatListNavLinkView.kt +++ b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chatlist/ChatListNavLinkView.kt @@ -523,7 +523,7 @@ fun ContactRequestMenuItems(rhId: Long?, contactRequestId: Long, chatModel: Chat showMenu.value = false } ) - if (!chatModel.addressShortLinkDataSet) { + if (!chatModel.addressShortLinkDataSet()) { ItemAction( stringResource(MR.strings.accept_contact_incognito_button), painterResource(MR.images.ic_theater_comedy), @@ -675,7 +675,7 @@ fun contactRequestAlertDialog(rhId: Long?, contactRequest: ChatInfo.ContactReque }) { Text(generalGetString(MR.strings.accept_contact_button), Modifier.fillMaxWidth(), textAlign = TextAlign.Center, color = MaterialTheme.colors.primary) } - if (!chatModel.addressShortLinkDataSet) { + if (!chatModel.addressShortLinkDataSet()) { SectionItemView({ AlertManager.shared.hideAlert() acceptContactRequest(rhId, incognito = true, contactRequest.apiId, true, chatModel, onSucess) diff --git a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/usersettings/UserAddressView.kt b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/usersettings/UserAddressView.kt index c33e8e09a2..12ee2faafe 100644 --- a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/usersettings/UserAddressView.kt +++ b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/usersettings/UserAddressView.kt @@ -575,7 +575,7 @@ private class AddressSettingsState { @Composable private fun AutoAcceptSection(addressSettingsState: MutableState) { SectionView(stringResource(MR.strings.auto_accept_contact).uppercase()) { - if (!chatModel.addressShortLinkDataSet && !addressSettingsState.value.businessAddress) { + if (!chatModel.addressShortLinkDataSet() && !addressSettingsState.value.businessAddress) { AcceptIncognitoToggle(addressSettingsState) } // TODO v6.4.1 show this message editor even with auto-accept disabled