diff --git a/apps/ios/SimpleXChat/APITypes.swift b/apps/ios/SimpleXChat/APITypes.swift index 601497ed39..aa0055fa70 100644 --- a/apps/ios/SimpleXChat/APITypes.swift +++ b/apps/ios/SimpleXChat/APITypes.swift @@ -758,6 +758,8 @@ public enum StoreError: Decodable, Hashable { case userContactLinkNotFound case contactRequestNotFound(contactRequestId: Int64) case contactRequestNotFoundByName(contactName: ContactName) + case invalidContactRequestEntity(contactRequestId: Int64) + case invalidBusinessChatContactRequest case groupNotFound(groupId: Int64) case groupNotFoundByName(groupName: GroupName) case groupMemberNameNotFound(groupId: Int64, groupMemberName: ContactName) diff --git a/apps/ios/SimpleXChat/ChatTypes.swift b/apps/ios/SimpleXChat/ChatTypes.swift index 71c72f4dc2..13da4d38fe 100644 --- a/apps/ios/SimpleXChat/ChatTypes.swift +++ b/apps/ios/SimpleXChat/ChatTypes.swift @@ -2142,7 +2142,7 @@ public struct GroupInfo: Identifiable, Decodable, NamedChat, Hashable { } public struct PreparedGroup: Decodable, Hashable { - public var connLinkToConnect: CreatedConnLink? + public var connLinkToConnect: CreatedConnLink public var connLinkStartedConnection: Bool } 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 b1ffa20b2e..ffacf597f4 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 @@ -438,14 +438,16 @@ object ChatModel { chatState.itemsRemoved(listOf(removed), chatItems.value) } - suspend fun addChatItem(rhId: Long?, cInfo: ChatInfo, cItem: ChatItem) { + suspend fun addChatItem(rhId: Long?, chatInfo: ChatInfo, cItem: ChatItem) { // updates membersRequireAttention - updateChatInfo(rhId, cInfo) - // mark chat non deleted - if (cInfo is ChatInfo.Direct && cInfo.chatDeleted) { - val updatedContact = cInfo.contact.copy(chatDeleted = false) - updateContact(rhId, updatedContact) + val cInfo = if (chatInfo is ChatInfo.Direct && chatInfo.chatDeleted) { + // mark chat non deleted + val updatedContact = chatInfo.contact.copy(chatDeleted = false) + ChatInfo.Direct(updatedContact) + } else { + chatInfo } + updateChatInfo(rhId, cInfo) // update chat list val i = getChatIndex(rhId, cInfo.id) val chat: Chat @@ -1502,7 +1504,13 @@ sealed class ChatInfo: SomeChat, NamedChat { if (contact.sendMsgToConnect) return null if (contact.nextAcceptContactRequest) { return generalGetString(MR.strings.cant_send_message_generic) to null } if (!contact.active) return generalGetString(MR.strings.cant_send_message_contact_deleted) to null - if (!contact.sndReady) return generalGetString(MR.strings.cant_send_message_contact_not_ready) to null + if (!contact.sndReady) { + return if (contact.preparedContact?.uiConnLinkType == ConnectionMode.Con) { + generalGetString(MR.strings.cant_send_message_request_is_sent) to null + } else { + generalGetString(MR.strings.cant_send_message_contact_not_ready) to null + } + } if (contact.activeConn?.connectionStats?.ratchetSyncSendProhibited == true) return generalGetString(MR.strings.cant_send_message_contact_not_synchronized) to null if (contact.activeConn?.connDisabled == true) return generalGetString(MR.strings.cant_send_message_contact_disabled) to null return null @@ -1532,6 +1540,8 @@ sealed class ChatInfo: SomeChat, NamedChat { return null } } + } else if (groupInfo.nextConnectPrepared) { + return null } else { return when (groupInfo.membership.memberStatus) { GroupMemberStatus.MemRejected -> generalGetString(MR.strings.cant_send_message_rejected) to null @@ -1699,6 +1709,9 @@ data class Contact( true } + val isContactCard: Boolean = + activeConn == null && profile.contactLink != null && active + val contactConnIncognito = activeConn?.customUserProfileId != null @@ -1906,8 +1919,7 @@ data class GroupInfo ( override val createdAt: Instant, override val updatedAt: Instant, val chatTs: Instant?, - val connLinkToConnect: CreatedConnLink?, - val connLinkStartedConnection: Boolean, + val preparedGroup: PreparedGroup?, val uiThemes: ThemeModeOverrides? = null, val membersRequireAttention: Int, val chatTags: List, @@ -1919,7 +1931,7 @@ data class GroupInfo ( override val apiId get() = groupId override val ready get() = membership.memberActive override val nextConnect get() = nextConnectPrepared - val nextConnectPrepared = connLinkToConnect != null && !connLinkStartedConnection + val nextConnectPrepared = if (preparedGroup != null) !preparedGroup.connLinkStartedConnection else false override val chatDeleted get() = false override val incognito get() = membership.memberIncognito override fun featureEnabled(feature: ChatFeature) = when (feature) { @@ -1946,6 +1958,13 @@ data class GroupInfo ( val canModerate: Boolean get() = membership.memberRole >= GroupMemberRole.Moderator && membership.memberActive + val chatIconName: ImageResource + get() = when (businessChat?.chatType) { + null -> MR.images.ic_supervised_user_circle_filled + BusinessChatType.Business -> MR.images.ic_work_filled_padded + BusinessChatType.Customer -> MR.images.ic_account_circle_filled + } + fun groupFeatureEnabled(feature: GroupFeature): Boolean { val p = fullGroupPreferences return when (feature) { @@ -1972,8 +1991,7 @@ data class GroupInfo ( createdAt = Clock.System.now(), updatedAt = Clock.System.now(), chatTs = Clock.System.now(), - connLinkToConnect = null, - connLinkStartedConnection = false, + preparedGroup = null, uiThemes = null, membersRequireAttention = 0, chatTags = emptyList(), @@ -1983,6 +2001,12 @@ data class GroupInfo ( } } +@Serializable +data class PreparedGroup ( + val connLinkToConnect: CreatedConnLink, + val connLinkStartedConnection: Boolean +) + @Serializable data class GroupRef(val groupId: Long, val localDisplayName: String) @@ -2886,6 +2910,7 @@ data class ChatItem ( deletable = false, editable = false, userMention = false, + showGroupAsSender = false, ), content = CIContent.RcvDeleted(deleteMode = CIDeleteMode.cidmBroadcast), quotedItem = null, @@ -2911,6 +2936,7 @@ data class ChatItem ( deletable = false, editable = false, userMention = false, + showGroupAsSender = false ), content = CIContent.SndMsgContent(MsgContent.MCText("")), quotedItem = null, @@ -3056,7 +3082,8 @@ data class CIMeta ( val itemLive: Boolean?, val userMention: Boolean, val deletable: Boolean, - val editable: Boolean + val editable: Boolean, + val showGroupAsSender: Boolean ) { val timestampText: String get() = getTimestampText(itemTs, true) @@ -3095,6 +3122,7 @@ data class CIMeta ( deletable = deletable, editable = editable, userMention = false, + showGroupAsSender = false ) fun invalidJSON(): CIMeta = @@ -3114,7 +3142,8 @@ data class CIMeta ( itemLive = false, deletable = false, editable = false, - userMention = false + userMention = false, + showGroupAsSender = false ) } } @@ -3469,6 +3498,13 @@ sealed class CIContent: ItemContent { is InvalidJSON -> "invalid data" } + val hasMsgContent: Boolean get() = + if (msgContent != null) { + (msgContent as MsgContent).text.trim().isNotEmpty() + } else { + false + } + val showMemberName: Boolean get() = when (this) { is RcvMsgContent -> true diff --git a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/model/SimpleXAPI.kt b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/model/SimpleXAPI.kt index e511f30ff7..3eabe63f15 100644 --- a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/model/SimpleXAPI.kt +++ b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/model/SimpleXAPI.kt @@ -793,7 +793,7 @@ object ChatController { } suspend fun apiStartChat(ctrl: ChatCtrl? = null): Boolean { - val r = sendCmd(null, CC.StartChat(mainApp = true, largeLinkData = false), ctrl) + val r = sendCmd(null, CC.StartChat(mainApp = true, largeLinkData = true), ctrl) when (r.result) { is CR.ChatStarted -> return true is CR.ChatRunning -> return false @@ -1391,19 +1391,19 @@ object ChatController { } } - suspend fun apiPrepareContact(rh: Long?, connLink: CreatedConnLink, contactShortLinkData: ContactShortLinkData): Contact? { + suspend fun apiPrepareContact(rh: Long?, connLink: CreatedConnLink, contactShortLinkData: ContactShortLinkData): Chat? { val userId = try { currentUserId("apiPrepareContact") } catch (e: Exception) { return null } val r = sendCmd(rh, CC.APIPrepareContact(userId, connLink, contactShortLinkData)) - if (r is API.Result && r.res is CR.NewPreparedContact) return r.res.contact + if (r is API.Result && r.res is CR.NewPreparedChat) return r.res.chat Log.e(TAG, "apiPrepareContact bad response: ${r.responseType} ${r.details}") AlertManager.shared.showAlertMsg(generalGetString(MR.strings.error_preparing_contact), "${r.responseType}: ${r.details}") return null } - suspend fun apiPrepareGroup(rh: Long?, connLink: CreatedConnLink, groupShortLinkData: GroupShortLinkData): GroupInfo? { + suspend fun apiPrepareGroup(rh: Long?, connLink: CreatedConnLink, groupShortLinkData: GroupShortLinkData): Chat? { val userId = try { currentUserId("apiPrepareGroup") } catch (e: Exception) { return null } val r = sendCmd(rh, CC.APIPrepareGroup(userId, connLink, groupShortLinkData)) - if (r is API.Result && r.res is CR.NewPreparedGroup) return r.res.groupInfo + if (r is API.Result && r.res is CR.NewPreparedChat) return r.res.chat Log.e(TAG, "apiPrepareGroup bad response: ${r.responseType} ${r.details}") AlertManager.shared.showAlertMsg(generalGetString(MR.strings.error_preparing_group), "${r.responseType}: ${r.details}") return null @@ -1425,7 +1425,7 @@ object ChatController { return null } - suspend fun apiConnectPreparedContact(rh: Long?, contactId: Long, incognito: Boolean, msg: MsgContent): Contact? { + suspend fun apiConnectPreparedContact(rh: Long?, contactId: Long, incognito: Boolean, msg: MsgContent?): Contact? { val r = sendCmd(rh, CC.APIConnectPreparedContact(contactId, incognito, msg)) if (r is API.Result && r.res is CR.StartedConnectionToContact) return r.res.contact Log.e(TAG, "apiConnectPreparedContact bad response: ${r.responseType} ${r.details}") @@ -1435,8 +1435,8 @@ object ChatController { return null } - suspend fun apiConnectPreparedGroup(rh: Long?, groupId: Long, incognito: Boolean): GroupInfo? { - val r = sendCmd(rh, CC.APIConnectPreparedGroup(groupId, incognito)) + suspend fun apiConnectPreparedGroup(rh: Long?, groupId: Long, incognito: Boolean, msg: MsgContent?): GroupInfo? { + val r = sendCmd(rh, CC.APIConnectPreparedGroup(groupId, incognito, msg)) if (r is API.Result && r.res is CR.StartedConnectionToGroup) return r.res.groupInfo Log.e(TAG, "apiConnectPreparedGroup bad response: ${r.responseType} ${r.details}") if (!(networkErrorAlert(r))) { @@ -1631,9 +1631,9 @@ object ChatController { return null } - suspend fun userAddressAutoAccept(rh: Long?, autoAccept: AutoAccept?): UserContactLinkRec? { - val userId = kotlin.runCatching { currentUserId("userAddressAutoAccept") }.getOrElse { return null } - val r = sendCmd(rh, CC.ApiAddressAutoAccept(userId, autoAccept)) + suspend fun apiSetUserAddressSettings(rh: Long?, settings: AddressSettings): UserContactLinkRec? { + val userId = kotlin.runCatching { currentUserId("apiSetUserAddressSettings") }.getOrElse { return null } + val r = sendCmd(rh, CC.ApiSetAddressSettings(userId, settings)) if (r is API.Result && r.res is CR.UserContactLinkUpdated) return r.res.contactLink if (r is API.Error && r.err is ChatError.ChatErrorStore && r.err.storeError is StoreError.UserContactLinkNotFound @@ -3493,8 +3493,8 @@ sealed class CC { class APIPrepareGroup(val userId: Long, val connLink: CreatedConnLink, val groupShortLinkData: GroupShortLinkData): CC() class APIChangePreparedContactUser(val contactId: Long, val newUserId: Long): CC() class APIChangePreparedGroupUser(val groupId: Long, val newUserId: Long): CC() - class APIConnectPreparedContact(val contactId: Long, val incognito: Boolean, val msg: MsgContent): CC() - class APIConnectPreparedGroup(val groupId: Long, val incognito: Boolean): CC() + class APIConnectPreparedContact(val contactId: Long, val incognito: Boolean, val msg: MsgContent?): CC() + class APIConnectPreparedGroup(val groupId: Long, val incognito: Boolean, val msg: MsgContent?): CC() class APIConnect(val userId: Long, val incognito: Boolean, val connLink: CreatedConnLink): CC() class ApiConnectContactViaAddress(val userId: Long, val incognito: Boolean, val contactId: Long): CC() class ApiDeleteChat(val type: ChatType, val id: Long, val chatDeleteMode: ChatDeleteMode): CC() @@ -3512,7 +3512,7 @@ sealed class CC { class ApiShowMyAddress(val userId: Long): CC() class ApiAddMyAddressShortLink(val userId: Long): CC() class ApiSetProfileAddress(val userId: Long, val on: Boolean): CC() - class ApiAddressAutoAccept(val userId: Long, val autoAccept: AutoAccept?): CC() + class ApiSetAddressSettings(val userId: Long, val addressSettings: AddressSettings): CC() class ApiGetCallInvitations: CC() class ApiSendCallInvitation(val contact: Contact, val callType: CallType): CC() class ApiRejectCall(val contact: Contact): CC() @@ -3688,8 +3688,8 @@ sealed class CC { is APIPrepareGroup -> "/_prepare group $userId ${connLink.connFullLink} ${connLink.connShortLink ?: ""} ${json.encodeToString(groupShortLinkData)}" is APIChangePreparedContactUser -> "/_set contact user @$contactId $newUserId" is APIChangePreparedGroupUser -> "/_set group user #$groupId $newUserId" - is APIConnectPreparedContact -> "/_connect contact @$contactId incognito=${onOff(incognito)} ${msg.cmdString}" - is APIConnectPreparedGroup -> "/_connect group #$groupId incognito=${onOff(incognito)}" + is APIConnectPreparedContact -> "/_connect contact @$contactId incognito=${onOff(incognito)} ${maybeContent(msg)}" + is APIConnectPreparedGroup -> "/_connect group #$groupId incognito=${onOff(incognito)} ${maybeContent(msg)}" is APIConnect -> "/_connect $userId incognito=${onOff(incognito)} ${connLink.connFullLink} ${connLink.connShortLink ?: ""}" is ApiConnectContactViaAddress -> "/_connect contact $userId incognito=${onOff(incognito)} $contactId" is ApiDeleteChat -> "/_delete ${chatRef(type, id, scope = null)} ${chatDeleteMode.cmdString}" @@ -3707,7 +3707,7 @@ sealed class CC { is ApiShowMyAddress -> "/_show_address $userId" is ApiAddMyAddressShortLink -> "/_short_link_address $userId" is ApiSetProfileAddress -> "/_profile_address $userId ${onOff(on)}" - is ApiAddressAutoAccept -> "/_auto_accept $userId ${AutoAccept.cmdString(autoAccept)}" + is ApiSetAddressSettings -> "/_address_settings $userId ${json.encodeToString(addressSettings)}" is ApiAcceptContact -> "/_accept incognito=${onOff(incognito)} $contactReqId" is ApiRejectContact -> "/_reject $contactReqId" is ApiGetCallInvitations -> "/_call get" @@ -3880,7 +3880,7 @@ sealed class CC { is ApiShowMyAddress -> "apiShowMyAddress" is ApiAddMyAddressShortLink -> "apiAddMyAddressShortLink" is ApiSetProfileAddress -> "apiSetProfileAddress" - is ApiAddressAutoAccept -> "apiAddressAutoAccept" + is ApiSetAddressSettings -> "apiSetAddressSettings" is ApiAcceptContact -> "apiAcceptContact" is ApiRejectContact -> "apiRejectContact" is ApiGetCallInvitations -> "apiGetCallInvitations" @@ -3950,6 +3950,14 @@ sealed class CC { private fun maybePwd(pwd: String?): String = if (pwd == "" || pwd == null) "" else " " + json.encodeToString(pwd) + private fun maybeContent(mc: MsgContent?): String { + return when { + mc is MsgContent.MCText && mc.text.isEmpty() -> "" + mc != null -> " " + mc.cmdString + else -> "" + } + } + companion object { fun chatRef(chatType: ChatType, id: Long, scope: GroupChatScope?) = when (scope) { null -> "${chatType.type}${id}" @@ -5913,8 +5921,7 @@ sealed class CR { @Serializable @SerialName("connectionIncognitoUpdated") class ConnectionIncognitoUpdated(val user: UserRef, val toConnection: PendingContactConnection): CR() @Serializable @SerialName("connectionUserChanged") class ConnectionUserChanged(val user: UserRef, val fromConnection: PendingContactConnection, val toConnection: PendingContactConnection, val newUser: UserRef): CR() @Serializable @SerialName("connectionPlan") class CRConnectionPlan(val user: UserRef, val connLink: CreatedConnLink, val connectionPlan: ConnectionPlan): CR() - @Serializable @SerialName("newPreparedContact") class NewPreparedContact(val user: UserRef, val contact: Contact): CR() - @Serializable @SerialName("newPreparedGroup") class NewPreparedGroup(val user: UserRef, val groupInfo: GroupInfo): CR() + @Serializable @SerialName("newPreparedChat") class NewPreparedChat(val user: UserRef, val chat: Chat): CR() @Serializable @SerialName("contactUserChanged") class ContactUserChanged(val user: UserRef, val fromContact: Contact, val newUser: UserRef, val toContact: Contact): CR() @Serializable @SerialName("groupUserChanged") class GroupUserChanged(val user: UserRef, val fromGroup: GroupInfo, val newUser: UserRef, val toGroup: GroupInfo): CR() @Serializable @SerialName("sentConfirmation") class SentConfirmation(val user: UserRef, val connection: PendingContactConnection): CR() @@ -6101,8 +6108,7 @@ sealed class CR { is ConnectionIncognitoUpdated -> "connectionIncognitoUpdated" is ConnectionUserChanged -> "ConnectionUserChanged" is CRConnectionPlan -> "connectionPlan" - is NewPreparedContact -> "newPreparedContact" - is NewPreparedGroup -> "newPreparedGroup" + is NewPreparedChat -> "newPreparedChat" is ContactUserChanged -> "contactUserChanged" is GroupUserChanged -> "groupUserChanged" is SentConfirmation -> "sentConfirmation" @@ -6279,8 +6285,7 @@ sealed class CR { is ConnectionIncognitoUpdated -> withUser(user, json.encodeToString(toConnection)) is ConnectionUserChanged -> withUser(user, "fromConnection: ${json.encodeToString(fromConnection)}\ntoConnection: ${json.encodeToString(toConnection)}\nnewUser: ${json.encodeToString(newUser)}" ) is CRConnectionPlan -> withUser(user, "connLink: ${json.encodeToString(connLink)}\nconnectionPlan: ${json.encodeToString(connectionPlan)}") - is NewPreparedContact -> withUser(user, json.encodeToString(contact)) - is NewPreparedGroup -> withUser(user, json.encodeToString(groupInfo)) + is NewPreparedChat -> withUser(user, json.encodeToString(chat)) is ContactUserChanged -> withUser(user, "fromContact: ${json.encodeToString(fromContact)}\nnewUserId: ${json.encodeToString(newUser.userId)}\ntoContact: ${json.encodeToString(toContact)}") is GroupUserChanged -> withUser(user, "fromGroup: ${json.encodeToString(fromGroup)}\nnewUserId: ${json.encodeToString(newUser.userId)}\ntoGroup: ${json.encodeToString(toGroup)}") is SentConfirmation -> withUser(user, json.encodeToString(connection)) @@ -6621,25 +6626,18 @@ enum class RatchetSyncState { data class UserContactLinkRec( val connLinkContact: CreatedConnLink, val shortLinkDataSet: Boolean, - val autoAccept: AutoAccept? = null + val addressSettings: AddressSettings ) @Serializable -class AutoAccept(val businessAddress: Boolean, val acceptIncognito: Boolean, val autoReply: MsgContent?) { - companion object { - fun cmdString(autoAccept: AutoAccept?): String { - if (autoAccept == null) return "off" - var s = "on" - if (autoAccept.acceptIncognito) { - s += " incognito=on" - } else if (autoAccept.businessAddress) { - s += " business" - } - val msg = autoAccept.autoReply ?: return s - return s + " " + msg.cmdString - } - } -} +data class AddressSettings( + val businessAddress: Boolean, + val autoAccept: AutoAccept?, + val autoReply: MsgContent? +) + +@Serializable +data class AutoAccept(val acceptIncognito: Boolean) @Serializable data class GroupLink( @@ -6892,6 +6890,8 @@ sealed class StoreError { is UserContactLinkNotFound -> "userContactLinkNotFound" is ContactRequestNotFound -> "contactRequestNotFound $contactRequestId" is ContactRequestNotFoundByName -> "contactRequestNotFoundByName $contactName" + is InvalidContactRequestEntity -> "invalidContactRequestEntity $contactRequestId" + is InvalidBusinessChatContactRequest -> "invalidBusinessChatContactRequest" is GroupNotFound -> "groupNotFound $groupId" is GroupNotFoundByName -> "groupNotFoundByName $groupName" is GroupMemberNameNotFound -> "groupMemberNameNotFound $groupId $groupMemberName" @@ -6968,6 +6968,8 @@ sealed class StoreError { @Serializable @SerialName("userContactLinkNotFound") object UserContactLinkNotFound: StoreError() @Serializable @SerialName("contactRequestNotFound") class ContactRequestNotFound(val contactRequestId: Long): StoreError() @Serializable @SerialName("contactRequestNotFoundByName") class ContactRequestNotFoundByName(val contactName: String): StoreError() + @Serializable @SerialName("invalidContactRequestEntity") class InvalidContactRequestEntity(val contactRequestId: Long): StoreError() + @Serializable @SerialName("invalidBusinessChatContactRequest") object InvalidBusinessChatContactRequest: StoreError() @Serializable @SerialName("groupNotFound") class GroupNotFound(val groupId: Long): StoreError() @Serializable @SerialName("groupNotFoundByName") class GroupNotFoundByName(val groupName: String): StoreError() @Serializable @SerialName("groupMemberNameNotFound") class GroupMemberNameNotFound(val groupId: Long, val groupMemberName: String): StoreError() 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 57373c95a3..36bf956038 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 @@ -527,9 +527,10 @@ fun ComposeView( } } - suspend fun connectPreparedGroup() { + suspend fun sendConnectPreparedGroup() { + val mc = checkLinkPreview() // TODO [short links] use incognito default (incognito choice will be available via context profile picker) - val groupInfo = chatModel.controller.apiConnectPreparedGroup(chat.remoteHostId, chat.chatInfo.apiId, incognito = false) + val groupInfo = chatModel.controller.apiConnectPreparedGroup(chat.remoteHostId, chat.chatInfo.apiId, incognito = false, msg = mc) if (groupInfo != null) { withContext(Dispatchers.Main) { chatsCtx.updateGroup(chat.remoteHostId, groupInfo) @@ -548,7 +549,7 @@ fun ComposeView( } else if (chat.chatInfo is ChatInfo.Direct && chat.chatInfo.contact.nextConnectPrepared) { sendConnectPreparedContact() } else if (chat.chatInfo is ChatInfo.Group && chat.chatInfo.groupInfo.nextConnectPrepared) { - connectPreparedGroup() + sendConnectPreparedGroup() } } }) { diff --git a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chat/group/GroupChatInfoView.kt b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chat/group/GroupChatInfoView.kt index 1a7192b22d..74069f25f1 100644 --- a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chat/group/GroupChatInfoView.kt +++ b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chat/group/GroupChatInfoView.kt @@ -592,7 +592,9 @@ fun ModalData.GroupChatInfoLayout( } } item { - SectionDividerSpaced(maxTopPadding = true, maxBottomPadding = false) + if (!groupInfo.nextConnectPrepared) { + SectionDividerSpaced(maxTopPadding = true, maxBottomPadding = false) + } SectionView { ClearChatButton(clearChat) if (groupInfo.canDelete) { diff --git a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/helpers/ChatInfoImage.kt b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/helpers/ChatInfoImage.kt index c3e97dd27b..72fab4990b 100644 --- a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/helpers/ChatInfoImage.kt +++ b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/helpers/ChatInfoImage.kt @@ -31,12 +31,7 @@ import kotlin.math.max fun ChatInfoImage(chatInfo: ChatInfo, size: Dp, iconColor: Color = MaterialTheme.colors.secondaryVariant, shadow: Boolean = false) { val icon = when (chatInfo) { - is ChatInfo.Group -> - when (chatInfo.groupInfo.businessChat?.chatType) { - BusinessChatType.Business -> MR.images.ic_work_filled_padded - BusinessChatType.Customer -> MR.images.ic_account_circle_filled - null -> MR.images.ic_supervised_user_circle_filled - } + is ChatInfo.Group -> chatInfo.groupInfo.chatIconName is ChatInfo.Local -> MR.images.ic_folder_filled else -> MR.images.ic_account_circle_filled } diff --git a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/newchat/ConnectPlan.kt b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/newchat/ConnectPlan.kt index e722d0223c..b9245d0c92 100644 --- a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/newchat/ConnectPlan.kt +++ b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/newchat/ConnectPlan.kt @@ -382,6 +382,13 @@ fun askCurrentOrIncognitoProfileAlert( ) } +fun openChat_(chatModel: ChatModel, rhId: Long?, close: (() -> Unit)?, chat: Chat) { + withBGApi { + close?.invoke() + openChat(secondaryChatsCtx = null, rhId, chat.chatInfo) + } +} + fun openKnownContact(chatModel: ChatModel, rhId: Long?, close: (() -> Unit)?, contact: Contact) { withBGApi { val c = chatModel.getContactChat(contact.contactId) @@ -470,12 +477,11 @@ fun showPrepareContactAlert( onConfirm = { AlertManager.privacySensitive.hideAlert() withBGApi { - val contact = chatModel.controller.apiPrepareContact(rhId, connectionLink, contactShortLinkData) - if (contact != null) { + val chat = chatModel.controller.apiPrepareContact(rhId, connectionLink, contactShortLinkData) + if (chat != null) { withContext(Dispatchers.Main) { - val chatInfo = ChatInfo.Direct(contact) - ChatController.chatModel.chatsContext.addChat(Chat(rhId, chatInfo, chatItems = listOf())) - openKnownContact(chatModel, rhId, close, contact) + ChatController.chatModel.chatsContext.addChat(chat) + openChat_(chatModel, rhId, close, chat) } } cleanup?.invoke() @@ -500,12 +506,11 @@ fun showPrepareGroupAlert( onConfirm = { AlertManager.privacySensitive.hideAlert() withBGApi { - val groupInfo = chatModel.controller.apiPrepareGroup(rhId, connectionLink, groupShortLinkData) - if (groupInfo != null) { + val chat = chatModel.controller.apiPrepareGroup(rhId, connectionLink, groupShortLinkData) + if (chat != null) { withContext(Dispatchers.Main) { - val chatInfo = ChatInfo.Group(groupInfo, groupChatScope = null) - ChatController.chatModel.chatsContext.addChat(Chat(rhId, chatInfo, chatItems = listOf())) - openKnownGroup(chatModel, rhId, close, groupInfo) + ChatController.chatModel.chatsContext.addChat(chat) + openChat_(chatModel, rhId, close, chat) } } cleanup?.invoke() 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 2ec9ebabb7..1b60c42f01 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 @@ -48,7 +48,7 @@ fun UserAddressView( progressIndicator = true withBGApi { try { - val u = chatModel.controller.apiSetProfileAddress(user?.value?.remoteHostId, on) + val u = chatModel.controller.apiSetProfileAddress(user.value?.remoteHostId, on) if (u != null) { chatModel.updateUser(u) } @@ -65,7 +65,11 @@ fun UserAddressView( progressIndicator = true val connReqContact = chatModel.controller.apiCreateUserAddress(user.value?.remoteHostId) if (connReqContact != null) { - chatModel.userAddress.value = UserContactLinkRec(connReqContact, shortLinkDataSet = connReqContact.connShortLink != null) + chatModel.userAddress.value = UserContactLinkRec( + connReqContact, + shortLinkDataSet = connReqContact.connShortLink != null, + addressSettings = AddressSettings(businessAddress = false, autoAccept = null, autoReply = null) + ) AlertManager.shared.showAlertDialog( title = generalGetString(MR.strings.share_address_with_contacts_question), @@ -139,7 +143,7 @@ fun UserAddressView( onConfirm = { progressIndicator = true withBGApi { - val u = chatModel.controller.apiDeleteUserAddress(user?.value?.remoteHostId) + val u = chatModel.controller.apiDeleteUserAddress(user.value?.remoteHostId) if (u != null) { chatModel.userAddress.value = null chatModel.updateUser(u) @@ -151,12 +155,12 @@ fun UserAddressView( destructive = true, ) }, - saveAas = { aas: AutoAcceptState, savedAAS: MutableState -> + saveAddressSettings = { settings: AddressSettingsState, savedSettings: MutableState -> withBGApi { - val address = chatModel.controller.userAddressAutoAccept(user?.value?.remoteHostId, aas.autoAccept) + val address = chatModel.controller.apiSetUserAddressSettings(user.value?.remoteHostId, settings.addressSettings) if (address != null) { chatModel.userAddress.value = address - savedAAS.value = aas + savedSettings.value = settings } } }, @@ -198,7 +202,7 @@ private fun UserAddressLayout( sendEmail: (UserContactLinkRec) -> Unit, setProfileAddress: (Boolean) -> Unit, deleteAddress: () -> Unit, - saveAas: (AutoAcceptState, MutableState) -> Unit, + saveAddressSettings: (AddressSettingsState, MutableState) -> Unit, ) { ColumnWithScrollBar { AppBarTitle(stringResource(MR.strings.simplex_address), hostDevice(user?.remoteHostId)) @@ -222,8 +226,8 @@ private fun UserAddressLayout( LearnMoreButton(learnMore) } } else { - val autoAcceptState = remember { mutableStateOf(AutoAcceptState(userAddress)) } - val autoAcceptStateSaved = remember { mutableStateOf(autoAcceptState.value) } + val addressSettingsState = remember { mutableStateOf(AddressSettingsState(settings = userAddress.addressSettings)) } + val savedAddressSettingsState = remember { mutableStateOf(addressSettingsState.value) } val showShortLink = remember { mutableStateOf(true) } SectionViewWithButton( @@ -233,20 +237,20 @@ private fun UserAddressLayout( SimpleXCreatedLinkQRCode(userAddress.connLinkContact, short = showShortLink.value) ShareAddressButton { share(userAddress.connLinkContact.simplexChatUri(short = showShortLink.value)) } // ShareViaEmailButton { sendEmail(userAddress) } - BusinessAddressToggle(autoAcceptState) { saveAas(autoAcceptState.value, autoAcceptStateSaved) } - AddressSettingsButton(user, userAddress, shareViaProfile, setProfileAddress, saveAas) + BusinessAddressToggle(addressSettingsState) { saveAddressSettings(addressSettingsState.value, savedAddressSettingsState) } + AddressSettingsButton(user, userAddress, shareViaProfile, setProfileAddress, saveAddressSettings) if (userAddress.connLinkContact.connShortLink == null) { AddShortLinkButton(text = stringResource(MR.strings.add_short_link), showAddShortLinkAlert) } else if (!userAddress.shortLinkDataSet) { AddShortLinkButton(text = stringResource(MR.strings.share_profile_via_link), showAddShortLinkAlert) } - if (autoAcceptState.value.business) { + if (addressSettingsState.value.businessAddress) { SectionTextFooter(stringResource(MR.strings.add_your_team_members_to_conversations)) } } - SectionDividerSpaced(maxTopPadding = autoAcceptState.value.business) + SectionDividerSpaced(maxTopPadding = addressSettingsState.value.businessAddress) SectionView(generalGetString(MR.strings.or_to_share_privately).uppercase()) { CreateOneTimeLinkButton() } @@ -330,14 +334,14 @@ private fun AddressSettingsButton( userAddress: UserContactLinkRec, shareViaProfile: MutableState, setProfileAddress: (Boolean) -> Unit, - saveAas: (AutoAcceptState, MutableState) -> Unit, + saveAddressSettings: (AddressSettingsState, MutableState) -> Unit, ) { SettingsActionItem( painterResource(MR.images.ic_settings), stringResource(MR.strings.address_settings), click = { ModalManager.start.showCustomModal { close -> - UserAddressSettings(user, userAddress, shareViaProfile, setProfileAddress, saveAas, close = close) + UserAddressSettings(user, userAddress, shareViaProfile, setProfileAddress, saveAddressSettings, close = close) } } ) @@ -349,20 +353,20 @@ private fun ModalData.UserAddressSettings( userAddress: UserContactLinkRec, shareViaProfile: MutableState, setProfileAddress: (Boolean) -> Unit, - saveAas: (AutoAcceptState, MutableState) -> Unit, + saveAddressSettings: (AddressSettingsState, MutableState) -> Unit, close: () -> Unit ) { - val autoAcceptState = remember { stateGetOrPut("autoAcceptState") { (AutoAcceptState(userAddress)) } } - val autoAcceptStateSaved = remember { stateGetOrPut("autoAcceptStateSaved") { (autoAcceptState.value) } } + val addressSettingsState = remember { stateGetOrPut("autoAcceptState") { (AddressSettingsState(userAddress.addressSettings)) } } + val savedAddressSettingsState = remember { stateGetOrPut("autoAcceptStateSaved") { (addressSettingsState.value) } } - fun onClose(close: () -> Unit): Boolean = if (autoAcceptState.value == autoAcceptStateSaved.value) { + fun onClose(close: () -> Unit): Boolean = if (addressSettingsState.value == savedAddressSettingsState.value) { chatModel.centerPanelBackgroundClickHandler = null close() false } else { showUnsavedChangesAlert( save = { - saveAas(autoAcceptState.value, autoAcceptStateSaved) + saveAddressSettings(addressSettingsState.value, savedAddressSettingsState) chatModel.centerPanelBackgroundClickHandler = null close() }, @@ -391,12 +395,20 @@ private fun ModalData.UserAddressSettings( ) { SectionView { ShareWithContactsButton(shareViaProfile, setProfileAddress) - AutoAcceptToggle(autoAcceptState) { saveAas(autoAcceptState.value, autoAcceptStateSaved) } + AutoAcceptToggle(addressSettingsState) { saveAddressSettings(addressSettingsState.value, savedAddressSettingsState) } + if (!chatModel.addressShortLinkDataSet && !addressSettingsState.value.businessAddress) { + AcceptIncognitoToggle(addressSettingsState) + } } + SectionDividerSpaced() - if (autoAcceptState.value.enable) { - SectionDividerSpaced() - AutoAcceptSection(autoAcceptState, autoAcceptStateSaved, saveAas) + SectionView(stringResource(MR.strings.address_welcome_message).uppercase()) { + AutoReplyEditor(addressSettingsState) + } + SectionDividerSpaced(maxTopPadding = true, maxBottomPadding = false) + + saveAddressSettingsButton(addressSettingsState.value == savedAddressSettingsState.value) { + saveAddressSettings(addressSettingsState.value, savedAddressSettingsState) } } } @@ -444,33 +456,53 @@ fun ShareWithContactsButton(shareViaProfile: MutableState, setProfileAd } @Composable -private fun BusinessAddressToggle(autoAcceptState: MutableState, saveAas: (AutoAcceptState) -> Unit) { +private fun BusinessAddressToggle(addressSettingsState: MutableState, saveAddressSettings: (AddressSettingsState) -> Unit) { PreferenceToggleWithIcon( stringResource(MR.strings.business_address), painterResource(MR.images.ic_work), - checked = autoAcceptState.value.business, - ) { ba -> - autoAcceptState.value = if (ba) - AutoAcceptState(enable = true, incognito = false, business = true, autoAcceptState.value.welcomeText) + checked = addressSettingsState.value.businessAddress, + ) { businessToggle -> + addressSettingsState.value = if (businessToggle) + AddressSettingsState( + businessAddress = true, + autoAccept = true, + autoAcceptIncognito = false, + autoReply = addressSettingsState.value.autoReply + ) else - AutoAcceptState(autoAcceptState.value.enable, autoAcceptState.value.incognito, business = false, autoAcceptState.value.welcomeText) - saveAas(autoAcceptState.value) + AddressSettingsState( + businessAddress = false, + autoAccept = addressSettingsState.value.autoAccept, + autoAcceptIncognito = addressSettingsState.value.autoAcceptIncognito, + autoReply = addressSettingsState.value.autoReply + ) + saveAddressSettings(addressSettingsState.value) } } @Composable -private fun AutoAcceptToggle(autoAcceptState: MutableState, saveAas: (AutoAcceptState) -> Unit) { +private fun AutoAcceptToggle(addressSettingsState: MutableState, saveAddressSettings: (AddressSettingsState) -> Unit) { PreferenceToggleWithIcon( stringResource(MR.strings.auto_accept_contact), painterResource(MR.images.ic_check), - disabled = autoAcceptState.value.business, - checked = autoAcceptState.value.enable - ) { - autoAcceptState.value = if (!it) - AutoAcceptState() + disabled = addressSettingsState.value.businessAddress, + checked = addressSettingsState.value.autoAccept + ) { autoAcceptToggle -> + addressSettingsState.value = if (autoAcceptToggle) + AddressSettingsState( + businessAddress = addressSettingsState.value.businessAddress, + autoAccept = true, + autoAcceptIncognito = addressSettingsState.value.autoAcceptIncognito, + autoReply = addressSettingsState.value.autoReply + ) else - AutoAcceptState(it, autoAcceptState.value.incognito, autoAcceptState.value.business, autoAcceptState.value.welcomeText) - saveAas(autoAcceptState.value) + AddressSettingsState( + businessAddress = false, + autoAccept = false, + autoAcceptIncognito = addressSettingsState.value.autoAcceptIncognito, + autoReply = addressSettingsState.value.autoReply + ) + saveAddressSettings(addressSettingsState.value) } } @@ -485,103 +517,110 @@ private fun DeleteAddressButton(onClick: () -> Unit) { ) } -private class AutoAcceptState { - var enable: Boolean = false +private class AddressSettingsState { + var businessAddress: Boolean = false private set - var incognito: Boolean = false + var autoAccept: Boolean = false private set - var business: Boolean = false + var autoAcceptIncognito: Boolean = false private set - var welcomeText: String = "" + var autoReply: String = "" private set - constructor(enable: Boolean = false, incognito: Boolean = false, business: Boolean = false, welcomeText: String = "") { - this.enable = enable - this.incognito = incognito - this.business = business - this.welcomeText = welcomeText + constructor(businessAddress: Boolean = false, autoAccept: Boolean = false, autoAcceptIncognito: Boolean = false, autoReply: String = "") { + this.businessAddress = businessAddress + this.autoAccept = autoAccept + this.autoAcceptIncognito = autoAcceptIncognito + this.autoReply = autoReply } - constructor(contactLink: UserContactLinkRec) { - contactLink.autoAccept?.let { aa -> - enable = true - incognito = aa.acceptIncognito - business = aa.businessAddress - aa.autoReply?.let { msg -> - welcomeText = msg.text - } ?: run { - welcomeText = "" - } - } + constructor(settings: AddressSettings) { + this.businessAddress = settings.businessAddress + this.autoAccept = settings.autoAccept != null + this.autoAcceptIncognito = settings.autoAccept?.acceptIncognito == true + this.autoReply = settings.autoReply?.text ?: "" } - val autoAccept: AutoAccept? + val addressSettings: AddressSettings get() { - if (enable) { - var autoReply: MsgContent? = null - val s = welcomeText.trim() - if (s != "") { - autoReply = MsgContent.MCText(s) - } - return AutoAccept(business, incognito, autoReply) - } - return null + return AddressSettings( + businessAddress = this.businessAddress, + autoAccept = if (this.autoAccept) AutoAccept(acceptIncognito = this.autoAcceptIncognito) else null, + autoReply = if (this.autoReply.isEmpty()) null else MsgContent.MCText(this.autoReply) + ) } override fun equals(other: Any?): Boolean { - if (other !is AutoAcceptState) return false - return this.enable == other.enable && this.incognito == other.incognito && this.business == other.business && this.welcomeText == other.welcomeText + if (other !is AddressSettingsState) return false + return ( + this.businessAddress == other.businessAddress + && this.autoAccept == other.autoAccept + && this.autoAcceptIncognito == other.autoAcceptIncognito + && this.autoReply == other.autoReply + ) } override fun hashCode(): Int { - var result = enable.hashCode() - result = 31 * result + incognito.hashCode() - result = 31 * result + business.hashCode() - result = 31 * result + welcomeText.hashCode() + var result = businessAddress.hashCode() + result = 31 * result + autoAccept.hashCode() + result = 31 * result + autoAcceptIncognito.hashCode() + result = 31 * result + autoReply.hashCode() return result } } @Composable private fun AutoAcceptSection( - autoAcceptState: MutableState, - savedAutoAcceptState: MutableState, - saveAas: (AutoAcceptState, MutableState) -> Unit + addressSettingsState: MutableState, + savedAddressSettingsStatee: MutableState, + saveAddressSettings: (AddressSettingsState, MutableState) -> Unit ) { SectionView(stringResource(MR.strings.auto_accept_contact).uppercase()) { - if (!chatModel.addressShortLinkDataSet && !autoAcceptState.value.business) { - AcceptIncognitoToggle(autoAcceptState) + if (!chatModel.addressShortLinkDataSet && !addressSettingsState.value.businessAddress) { + AcceptIncognitoToggle(addressSettingsState) + } + AutoReplyEditor(addressSettingsState) + saveAddressSettingsButton(addressSettingsState.value == savedAddressSettingsStatee.value) { + saveAddressSettings(addressSettingsState.value, savedAddressSettingsStatee) } - WelcomeMessageEditor(autoAcceptState) - SaveAASButton(autoAcceptState.value == savedAutoAcceptState.value) { saveAas(autoAcceptState.value, savedAutoAcceptState) } } } @Composable -private fun AcceptIncognitoToggle(autoAcceptState: MutableState) { +private fun AcceptIncognitoToggle(addressSettingsState: MutableState) { PreferenceToggleWithIcon( stringResource(MR.strings.accept_contact_incognito_button), - if (autoAcceptState.value.incognito) painterResource(MR.images.ic_theater_comedy_filled) else painterResource(MR.images.ic_theater_comedy), - if (autoAcceptState.value.incognito) Indigo else MaterialTheme.colors.secondary, - checked = autoAcceptState.value.incognito, - ) { - autoAcceptState.value = AutoAcceptState(autoAcceptState.value.enable, it, autoAcceptState.value.business, autoAcceptState.value.welcomeText) + if (addressSettingsState.value.autoAcceptIncognito) painterResource(MR.images.ic_theater_comedy_filled) else painterResource(MR.images.ic_theater_comedy), + if (addressSettingsState.value.autoAcceptIncognito) Indigo else MaterialTheme.colors.secondary, + checked = addressSettingsState.value.autoAcceptIncognito, + ) { incognitoToggle -> + addressSettingsState.value = AddressSettingsState( + businessAddress = addressSettingsState.value.businessAddress, + autoAccept = addressSettingsState.value.autoAccept, + autoAcceptIncognito = incognitoToggle, + autoReply = addressSettingsState.value.autoReply + ) } } @Composable -private fun WelcomeMessageEditor(autoAcceptState: MutableState) { - val welcomeText = rememberSaveable { mutableStateOf(autoAcceptState.value.welcomeText) } - TextEditor(welcomeText, Modifier.height(100.dp), placeholder = stringResource(MR.strings.enter_welcome_message_optional)) - LaunchedEffect(welcomeText.value) { - if (welcomeText.value != autoAcceptState.value.welcomeText) { - autoAcceptState.value = AutoAcceptState(autoAcceptState.value.enable, autoAcceptState.value.incognito, autoAcceptState.value.business, welcomeText.value) +private fun AutoReplyEditor(addressSettingsState: MutableState) { + val autoReply = rememberSaveable { mutableStateOf(addressSettingsState.value.autoReply) } + TextEditor(autoReply, Modifier.height(100.dp), placeholder = stringResource(MR.strings.enter_welcome_message_optional)) + LaunchedEffect(autoReply.value) { + if (autoReply.value != addressSettingsState.value.autoReply) { + addressSettingsState.value = AddressSettingsState( + businessAddress = addressSettingsState.value.businessAddress, + autoAccept = addressSettingsState.value.autoAccept, + autoAcceptIncognito = addressSettingsState.value.autoAcceptIncognito, + autoReply = autoReply.value + ) } } } @Composable -private fun SaveAASButton(disabled: Boolean, onClick: () -> Unit) { +private fun saveAddressSettingsButton(disabled: Boolean, onClick: () -> Unit) { SectionItemView(onClick, disabled = disabled) { Text(stringResource(MR.strings.save_verb), color = if (disabled) MaterialTheme.colors.secondary else MaterialTheme.colors.primary) } @@ -602,7 +641,7 @@ fun PreviewUserAddressLayoutNoAddress() { showAddShortLinkAlert = {}, share = { _ -> }, deleteAddress = {}, - saveAas = { _, _ -> }, + saveAddressSettings = { _, _ -> }, setProfileAddress = { _ -> }, learnMore = {}, shareViaProfile = remember { mutableStateOf(false) }, @@ -631,12 +670,16 @@ fun PreviewUserAddressLayoutAddressCreated() { SimpleXTheme { UserAddressLayout( user = User.sampleData, - userAddress = UserContactLinkRec(CreatedConnLink("https://simplex.chat/contact#/?v=1&smp=smp%3A%2F%2FPQUV2eL0t7OStZOoAsPEV2QYWt4-xilbakvGUGOItUo%3D%40smp6.simplex.im%2FK1rslx-m5bpXVIdMZg9NLUZ_8JBm8xTt%23MCowBQYDK2VuAyEALDeVe-sG8mRY22LsXlPgiwTNs9dbiLrNuA7f3ZMAJ2w%3D", null), shortLinkDataSet = false), + userAddress = UserContactLinkRec( + CreatedConnLink("https://simplex.chat/contact#/?v=1&smp=smp%3A%2F%2FPQUV2eL0t7OStZOoAsPEV2QYWt4-xilbakvGUGOItUo%3D%40smp6.simplex.im%2FK1rslx-m5bpXVIdMZg9NLUZ_8JBm8xTt%23MCowBQYDK2VuAyEALDeVe-sG8mRY22LsXlPgiwTNs9dbiLrNuA7f3ZMAJ2w%3D", null), + shortLinkDataSet = false, + addressSettings = AddressSettings(businessAddress = false, autoAccept = null, autoReply = null) + ), createAddress = {}, showAddShortLinkAlert = {}, share = { _ -> }, deleteAddress = {}, - saveAas = { _, _ -> }, + saveAddressSettings = { _, _ -> }, setProfileAddress = { _ -> }, learnMore = {}, shareViaProfile = remember { mutableStateOf(false) }, 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 05bae2f200..3ed8a0ba5a 100644 --- a/apps/multiplatform/common/src/commonMain/resources/MR/base/strings.xml +++ b/apps/multiplatform/common/src/commonMain/resources/MR/base/strings.xml @@ -429,8 +429,8 @@ connecting… send to connect open to join - you are invited to group - join as %s + You are invited to group + Join as %s rejected connecting… Tap to start a new chat @@ -523,6 +523,7 @@ You can\'t send messages! contact not ready + request is sent contact deleted not synchronized contact disabled @@ -1055,9 +1056,10 @@ Stop sharing address? Stop sharing Auto-accept + Welcome message Enter welcome message… (optional) Save settings? - Save auto-accept settings + Save SimpleX address settings Delete address Invite friends Let\'s talk in SimpleX Chat