more cards

This commit is contained in:
Evgeny @ SimpleX Chat
2026-05-21 14:08:45 +00:00
parent 37e58500cd
commit d8e88579bd
7 changed files with 73 additions and 63 deletions
@@ -3193,7 +3193,7 @@ fun addGroupMembers(groupInfo: GroupInfo, rhId: Long?, view: Any? = null, close:
withBGApi {
setGroupMembers(rhId, groupInfo, chatModel)
close?.invoke()
ModalManager.end.showModalCloseable(true) { close ->
ModalManager.end.showModalCloseable(showClose = true) { close ->
AddGroupMembersView(rhId, groupInfo, false, chatModel, close)
}
}
@@ -3204,7 +3204,7 @@ fun openGroupLink(groupInfo: GroupInfo, rhId: Long?, view: Any? = null, close: (
withBGApi {
val link = chatModel.controller.apiGetGroupLink(rhId, groupInfo.groupId)
close?.invoke()
ModalManager.end.showModalCloseable(true) {
ModalManager.end.showModalCloseable(showClose = true, cardScreen = true) {
GroupLinkView(chatModel, rhId, groupInfo, link, onGroupLinkUpdated = null, isChannel = groupInfo.useRelays, shareGroupInfo = groupInfo)
}
}
@@ -117,7 +117,7 @@ private fun ChannelRelaysLayout(
// Backend gate (APIAddGroupRelays) rejects any chatRelayId already in group_relays
// regardless of relayStatus, so all current rows must be excluded from the add list.
val existingRelayIds = groupRelays.mapNotNull { it.userChatRelay.chatRelayId }.toSet()
ModalManager.end.showModalCloseable(true) { close ->
ModalManager.end.showModalCloseable(showClose = true, cardScreen = true) { close ->
AddGroupRelayView(
groupInfo = groupInfo,
existingRelayIds = existingRelayIds,
@@ -115,7 +115,7 @@ fun ModalData.GroupChatInfoView(
setGroupMembers(rhId, groupInfo, chatModel)
if (!isActive) return@launch
ModalManager.end.showModalCloseable(true) { close ->
ModalManager.end.showModalCloseable(showClose = true) { close ->
AddGroupMembersView(rhId, groupInfo, false, chatModel, close)
}
}
@@ -171,7 +171,7 @@ fun ModalData.GroupChatInfoView(
clearChat = { clearChatDialog(chat, close) },
leaveGroup = { leaveGroupDialog(rhId, groupInfo, chatModel, close) },
manageGroupLink = {
ModalManager.end.showModal { GroupLinkView(chatModel, rhId, groupInfo, groupLink, onGroupLinkUpdated, isChannel = groupInfo.useRelays, shareGroupInfo = groupInfo) }
ModalManager.end.showModal(cardScreen = true) { GroupLinkView(chatModel, rhId, groupInfo, groupLink, onGroupLinkUpdated, isChannel = groupInfo.useRelays, shareGroupInfo = groupInfo) }
},
onSearchClicked = onSearchClicked,
deletingItems = deletingItems
@@ -1194,7 +1194,9 @@ private fun ChannelLinkButton(onClick: () -> Unit) {
@Composable
private fun ChannelLinkQRCodeSection(groupLink: String) {
val clipboard = LocalClipboardManager.current
SimpleXLinkQRCode(connReq = groupLink)
Box(Modifier.padding(vertical = DEFAULT_PADDING_HALF)) {
SimpleXLinkQRCode(connReq = groupLink)
}
SectionItemView({
clipboard.shareText(simplexChatLink(groupLink))
}) {
@@ -1,7 +1,9 @@
package chat.simplex.common.views.chat.group
import SectionBottomSpacer
import SectionDividerSpaced
import SectionItemView
import SectionView
import SectionViewWithButton
import androidx.compose.foundation.layout.*
import androidx.compose.material.*
@@ -215,7 +217,10 @@ fun GroupLinkLayout(
}
} else {
if (!isChannel) {
RoleSelectionRow(groupInfo, groupLinkMemberRole)
SectionView {
RoleSelectionRow(groupInfo, groupLinkMemberRole)
}
SectionDividerSpaced()
}
var initialLaunch by remember { mutableStateOf(true) }
LaunchedEffect(groupLinkMemberRole.value) {
@@ -225,69 +230,70 @@ fun GroupLinkLayout(
initialLaunch = false
}
val showShortLink = remember { mutableStateOf(true) }
Spacer(Modifier.height(DEFAULT_PADDING_HALF))
SectionViewWithButton(
titleButton =
if (!isChannel && groupLink.connLinkContact.connShortLink != null) {
{ ToggleShortLinkButton(showShortLink) }
} else null) {
SimpleXCreatedLinkQRCode(groupLink.connLinkContact, short = showShortLink.value)
}
if (!isChannel && groupLink.shouldBeUpgraded) {
Box(Modifier.padding(vertical = DEFAULT_PADDING_HALF)) {
SimpleXCreatedLinkQRCode(groupLink.connLinkContact, short = showShortLink.value)
}
if (!isChannel && groupLink.shouldBeUpgraded) {
SettingsActionItem(
painterResource(MR.images.ic_add),
stringResource(MR.strings.upgrade_group_link),
click = { showAddShortLinkAlert(null) },
iconColor = MaterialTheme.colors.primary,
textColor = MaterialTheme.colors.primary,
)
}
val clipboard = LocalClipboardManager.current
SettingsActionItem(
painterResource(MR.images.ic_add),
stringResource(MR.strings.upgrade_group_link),
click = { showAddShortLinkAlert(null) },
iconColor = MaterialTheme.colors.primary,
textColor = MaterialTheme.colors.primary,
)
}
val clipboard = LocalClipboardManager.current
SettingsActionItem(
painterResource(MR.images.ic_share),
stringResource(MR.strings.share_link),
click = {
if (!isChannel && groupLink.shouldBeUpgraded) {
showAddShortLinkAlert {
painterResource(MR.images.ic_share),
stringResource(MR.strings.share_link),
click = {
if (!isChannel && groupLink.shouldBeUpgraded) {
showAddShortLinkAlert {
clipboard.shareText(groupLink.connLinkContact.simplexChatUri(short = showShortLink.value))
}
} else {
clipboard.shareText(groupLink.connLinkContact.simplexChatUri(short = showShortLink.value))
}
} else {
clipboard.shareText(groupLink.connLinkContact.simplexChatUri(short = showShortLink.value))
}
},
iconColor = MaterialTheme.colors.primary,
textColor = MaterialTheme.colors.primary,
)
if (shareGroupInfo != null && isChannel) {
SettingsActionItem(
painterResource(MR.images.ic_forward),
stringResource(MR.strings.share_via_chat),
click = {
chatModel.sharedContent.value = SharedContent.ChatLink(shareGroupInfo)
chatModel.chatId.value = null
ModalManager.closeAllModalsEverywhere()
},
iconColor = MaterialTheme.colors.primary,
textColor = MaterialTheme.colors.primary,
)
}
if (!creatingGroup && !isChannel) {
SettingsActionItem(
painterResource(MR.images.ic_delete),
stringResource(MR.strings.delete_link),
click = deleteLink,
iconColor = Color.Red,
textColor = Color.Red,
)
}
if (creatingGroup && close != null) {
SettingsActionItem(
painterResource(MR.images.ic_check),
stringResource(MR.strings.continue_to_next_step),
click = close,
iconColor = MaterialTheme.colors.primary,
textColor = MaterialTheme.colors.primary,
)
if (shareGroupInfo != null && isChannel) {
SettingsActionItem(
painterResource(MR.images.ic_forward),
stringResource(MR.strings.share_via_chat),
click = {
chatModel.sharedContent.value = SharedContent.ChatLink(shareGroupInfo)
chatModel.chatId.value = null
ModalManager.closeAllModalsEverywhere()
},
iconColor = MaterialTheme.colors.primary,
textColor = MaterialTheme.colors.primary,
)
}
if (!creatingGroup && !isChannel) {
SettingsActionItem(
painterResource(MR.images.ic_delete),
stringResource(MR.strings.delete_link),
click = deleteLink,
iconColor = Color.Red,
textColor = Color.Red,
)
}
if (creatingGroup && close != null) {
SettingsActionItem(
painterResource(MR.images.ic_check),
stringResource(MR.strings.continue_to_next_step),
click = close,
iconColor = MaterialTheme.colors.primary,
textColor = MaterialTheme.colors.primary,
)
}
}
}
}
@@ -185,7 +185,9 @@ private fun GroupPreferencesLayout(
AppBarTitle(stringResource(titleId))
if (!groupInfo.useRelays) {
if (groupInfo.businessChat == null) {
MemberAdmissionButton(openMemberAdmission)
SectionView {
MemberAdmissionButton(openMemberAdmission)
}
SectionDividerSpaced()
}
TimedMessagesPreference()
@@ -66,7 +66,7 @@ fun AddChannelView(chatModel: ChatModel, close: () -> Unit, closeAll: () -> Unit
closeAll()
withBGApi {
openGroupChat(null, gInfo.groupId)
ModalManager.end.showModalCloseable(true) { close ->
ModalManager.end.showModalCloseable(showClose = true, cardScreen = true) { close ->
GroupLinkView(chatModel, rhId = null, groupInfo = gInfo, groupLink = groupLink.value, onGroupLinkUpdated = null, creatingGroup = true, isChannel = true, shareGroupInfo = gInfo, close = close)
}
}
@@ -567,7 +567,7 @@ private fun LinkStepView(
}
}
}
ModalView(close = close, showClose = false) {
ModalView(close = close, showClose = false, cardScreen = true) {
GroupLinkView(
chatModel = chatModel,
rhId = null,
@@ -53,11 +53,11 @@ fun AddGroupView(chatModel: ChatModel, rh: RemoteHostInfo?, close: () -> Unit, c
closeAll.invoke()
if (!groupInfo.incognito) {
ModalManager.end.showModalCloseable(true) { close ->
ModalManager.end.showModalCloseable(showClose = true) { close ->
AddGroupMembersView(rhId, groupInfo, creatingGroup = true, chatModel, close)
}
} else {
ModalManager.end.showModalCloseable(true) { close ->
ModalManager.end.showModalCloseable(showClose = true, cardScreen = true) { close ->
GroupLinkView(chatModel, rhId, groupInfo, groupLink = null, onGroupLinkUpdated = null, creatingGroup = true, close = close)
}
}