diff --git a/apps/ios/Shared/Views/UserSettings/UserAddressView.swift b/apps/ios/Shared/Views/UserSettings/UserAddressView.swift index 9f1377e4d5..3d554fc5cc 100644 --- a/apps/ios/Shared/Views/UserSettings/UserAddressView.swift +++ b/apps/ios/Shared/Views/UserSettings/UserAddressView.swift @@ -461,7 +461,7 @@ struct UserAddressSettingsView: View { } // TODO v6.4.1 move auto-reply editor here - messageEditor(placeholder: NSLocalizedString("Enter welcome message… (optional)", comment: "placeholder"), text: $settings.autoReply) + // messageEditor(placeholder: NSLocalizedString("Enter welcome message… (optional)", comment: "placeholder"), text: $settings.autoReply) if settings.autoAccept { autoAcceptSection() 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 c35261138a..fe7e34a902 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 @@ -1,6 +1,7 @@ package chat.simplex.common.views.chat import SectionItemView +import TextIconSpaced import androidx.compose.foundation.background import androidx.compose.foundation.clickable import androidx.compose.foundation.layout.* @@ -16,6 +17,7 @@ import chat.simplex.common.views.chatlist.acceptContactRequest import chat.simplex.common.views.chatlist.rejectContactRequest import chat.simplex.common.views.helpers.* import chat.simplex.res.MR +import dev.icerock.moko.resources.compose.painterResource import dev.icerock.moko.resources.compose.stringResource @Composable @@ -35,7 +37,7 @@ fun ComposeContextContactRequestActionsView( .fillMaxWidth(), horizontalArrangement = Arrangement.SpaceEvenly, ) { - Column( + Row( Modifier .fillMaxWidth() .fillMaxHeight() @@ -43,23 +45,39 @@ fun ComposeContextContactRequestActionsView( .clickable { showRejectRequestAlert(rhId, contactRequestId) }, - verticalArrangement = Arrangement.Center, - horizontalAlignment = Alignment.CenterHorizontally + verticalAlignment = Alignment.CenterVertically, + horizontalArrangement = Arrangement.Center ) { + Icon( + painterResource(MR.images.ic_close), + contentDescription = null, + tint = Color.Red, + ) + TextIconSpaced(false) Text(stringResource(MR.strings.reject_contact_button), color = Color.Red) } - Column( + Row( Modifier .fillMaxWidth() .fillMaxHeight() .weight(1F) .clickable { - showAcceptRequestAlert(rhId, contactRequestId) + if (chatModel.addressShortLinkDataSet) { + acceptContactRequest(rhId, incognito = false, contactRequestId, isCurrentUser = true, chatModel) + } else { + showAcceptRequestAlert(rhId, contactRequestId) + } }, - verticalArrangement = Arrangement.Center, - horizontalAlignment = Alignment.CenterHorizontally + verticalAlignment = Alignment.CenterVertically, + horizontalArrangement = Arrangement.Center ) { + Icon( + painterResource(MR.images.ic_check), + contentDescription = null, + tint = MaterialTheme.colors.primary, + ) + TextIconSpaced(false) Text(stringResource(MR.strings.accept_contact_button), color = MaterialTheme.colors.primary) } } @@ -81,46 +99,32 @@ fun showRejectRequestAlert(rhId: Long?, contactRequestId: Long) { } fun showAcceptRequestAlert(rhId: Long?, contactRequestId: Long) { - // Show 2 buttons in a row - if (chatModel.addressShortLinkDataSet) { - AlertManager.shared.showAlertDialog( - title = generalGetString(MR.strings.accept_contact_request), - confirmText = generalGetString(MR.strings.accept_contact_button), - onConfirm = { - AlertManager.shared.hideAlert() - acceptContactRequest(rhId, incognito = false, contactRequestId, isCurrentUser = true, chatModel) - }, - hostDevice = hostDevice(rhId), - ) - // Show 3 buttons in a column - } else { - AlertManager.shared.showAlertDialogButtonsColumn( - title = generalGetString(MR.strings.accept_contact_request), - buttons = { - Column { - // Accept - SectionItemView({ - AlertManager.shared.hideAlert() - acceptContactRequest(rhId, incognito = false, contactRequestId, isCurrentUser = true, chatModel) - }) { - Text(generalGetString(MR.strings.accept_contact_button), Modifier.fillMaxWidth(), textAlign = TextAlign.Center, color = MaterialTheme.colors.primary) - } - // Accept incognito - SectionItemView({ - AlertManager.shared.hideAlert() - acceptContactRequest(rhId, incognito = true, contactRequestId, isCurrentUser = true, chatModel) - }) { - Text(generalGetString(MR.strings.accept_contact_incognito_button), Modifier.fillMaxWidth(), textAlign = TextAlign.Center, color = MaterialTheme.colors.primary) - } - // Cancel - SectionItemView({ - AlertManager.shared.hideAlert() - }) { - Text(stringResource(MR.strings.cancel_verb), Modifier.fillMaxWidth(), textAlign = TextAlign.Center, color = MaterialTheme.colors.primary) - } + AlertManager.shared.showAlertDialogButtonsColumn( + title = generalGetString(MR.strings.accept_contact_request), + buttons = { + Column { + // Accept + SectionItemView({ + AlertManager.shared.hideAlert() + acceptContactRequest(rhId, incognito = false, contactRequestId, isCurrentUser = true, chatModel) + }) { + Text(generalGetString(MR.strings.accept_contact_button), Modifier.fillMaxWidth(), textAlign = TextAlign.Center, color = MaterialTheme.colors.primary) } - }, - hostDevice = hostDevice(rhId), - ) - } + // Accept incognito + SectionItemView({ + AlertManager.shared.hideAlert() + acceptContactRequest(rhId, incognito = true, contactRequestId, isCurrentUser = true, chatModel) + }) { + Text(generalGetString(MR.strings.accept_contact_incognito_button), Modifier.fillMaxWidth(), textAlign = TextAlign.Center, color = MaterialTheme.colors.primary) + } + // Cancel + SectionItemView({ + AlertManager.shared.hideAlert() + }) { + Text(stringResource(MR.strings.cancel_verb), Modifier.fillMaxWidth(), textAlign = TextAlign.Center, color = MaterialTheme.colors.primary) + } + } + }, + hostDevice = hostDevice(rhId), + ) } diff --git a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chat/ComposeView.kt b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chat/ComposeView.kt index 674354c13e..d75069b922 100644 --- a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chat/ComposeView.kt +++ b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chat/ComposeView.kt @@ -549,8 +549,7 @@ fun ComposeView( } } - // TODO [short links] different messages for business - fun showSendConnectPreparedContactAlert(sendConnect: () -> Unit) { + fun showSendConnectPreparedContactAlert() { val empty = composeState.value.whitespaceOnly AlertManager.shared.showAlertDialogStacked( title = generalGetString(MR.strings.compose_view_send_contact_request_alert_question), @@ -561,7 +560,7 @@ fun ComposeView( else generalGetString(MR.strings.compose_view_send_request) ), - onConfirm = { sendConnect() }, + onConfirm = { withApi { sendConnectPreparedContact() } }, dismissText = ( if (empty) generalGetString(MR.strings.compose_view_add_message) @@ -1405,7 +1404,7 @@ fun ComposeView( SendContactRequestView( disableSendButton = disableSendButton, icon = MR.images.ic_work_filled, - sendRequest = { showSendConnectPreparedContactAlert(sendConnect = { withApi { connectPreparedGroup() } }) } + sendRequest = { withApi { connectPreparedGroup() } } ) } } else if (nextSendGrpInv.value) { @@ -1436,7 +1435,7 @@ fun ComposeView( SendContactRequestView( disableSendButton = disableSendButton, icon = MR.images.ic_person_add_filled, - sendRequest = { showSendConnectPreparedContactAlert(sendConnect = { withApi { sendConnectPreparedContact() } }) } + sendRequest = { showSendConnectPreparedContactAlert() } ) } } else if ( 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 e100210d38..c33e8e09a2 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 @@ -396,16 +396,19 @@ private fun ModalData.UserAddressSettings( SectionView { ShareWithContactsButton(shareViaProfile, setProfileAddress) AutoAcceptToggle(addressSettingsState) { saveAddressSettings(addressSettingsState.value, savedAddressSettingsState) } - if (!chatModel.addressShortLinkDataSet && !addressSettingsState.value.businessAddress) { - AcceptIncognitoToggle(addressSettingsState) - } } SectionDividerSpaced() - SectionView(stringResource(MR.strings.address_welcome_message).uppercase()) { - AutoReplyEditor(addressSettingsState) + // TODO v6.4.1 move auto-reply editor here + // SectionView(stringResource(MR.strings.address_welcome_message).uppercase()) { + // AutoReplyEditor(addressSettingsState) + // } + // SectionDividerSpaced(maxTopPadding = true, maxBottomPadding = false) + + if (addressSettingsState.value.autoAccept) { + AutoAcceptSection(addressSettingsState = addressSettingsState) + SectionDividerSpaced(maxTopPadding = true, maxBottomPadding = false) } - SectionDividerSpaced(maxTopPadding = true, maxBottomPadding = false) saveAddressSettingsButton(addressSettingsState.value == savedAddressSettingsState.value) { saveAddressSettings(addressSettingsState.value, savedAddressSettingsState) @@ -492,15 +495,15 @@ private fun AutoAcceptToggle(addressSettingsState: MutableState, - savedAddressSettingsStatee: MutableState, - saveAddressSettings: (AddressSettingsState, MutableState) -> Unit -) { +private fun AutoAcceptSection(addressSettingsState: MutableState) { SectionView(stringResource(MR.strings.auto_accept_contact).uppercase()) { if (!chatModel.addressShortLinkDataSet && !addressSettingsState.value.businessAddress) { AcceptIncognitoToggle(addressSettingsState) } + // TODO v6.4.1 show this message editor even with auto-accept disabled AutoReplyEditor(addressSettingsState) - saveAddressSettingsButton(addressSettingsState.value == savedAddressSettingsStatee.value) { - saveAddressSettings(addressSettingsState.value, savedAddressSettingsStatee) - } + SectionTextFooter(stringResource(MR.strings.sent_to_your_contact_after_connection)) } } diff --git a/apps/multiplatform/common/src/commonMain/resources/MR/base/strings.xml b/apps/multiplatform/common/src/commonMain/resources/MR/base/strings.xml index ab0bbc8a43..b60c55c3b9 100644 --- a/apps/multiplatform/common/src/commonMain/resources/MR/base/strings.xml +++ b/apps/multiplatform/common/src/commonMain/resources/MR/base/strings.xml @@ -1071,6 +1071,7 @@ Stop sharing address? Stop sharing Auto-accept + Sent to your contact after connection. Welcome message Enter welcome message… (optional) Save settings?