update kotlin layout

This commit is contained in:
Evgeny @ SimpleX Chat
2026-05-31 22:13:17 +00:00
parent 6136282f8b
commit 17ccc9da20
3 changed files with 46 additions and 21 deletions
@@ -34,7 +34,7 @@ fun ChannelWebPageView(
chatModel: ChatModel,
close: () -> Unit
) {
val isChannel = groupInfo.useRelays
val isChannel = groupInfo.isChannel
val access = groupInfo.groupProfile.publicGroup?.publicGroupAccess
val webPage = rememberSaveable { mutableStateOf(access?.groupWebPage ?: "") }
val allowEmbedding = rememberSaveable { mutableStateOf(access?.allowEmbedding ?: false) }
@@ -113,19 +113,13 @@ private fun ChannelWebPageLayout(
ColumnWithScrollBar {
AppBarTitle(stringResource(if (isChannel) MR.strings.channel_webpage else MR.strings.group_webpage))
SectionView(stringResource(MR.strings.web_page).uppercase()) {
SectionItemView {
ProfileNameField(webPage, stringResource(MR.strings.web_page_url_placeholder))
}
PreferenceToggle(stringResource(MR.strings.allow_embedding), checked = allowEmbedding.value) {
allowEmbedding.value = it
}
}
SectionTextFooter(stringResource(MR.strings.web_page_footer))
val embedCode = embedCode(groupRelays, groupInfo)
if (embedCode != null) {
SectionView(stringResource(MR.strings.embed_code).uppercase()) {
SectionItemView {
Text(stringResource(MR.strings.webpage_info), color = MaterialTheme.colors.secondary)
}
SectionView(stringResource(MR.strings.webpage_code).uppercase()) {
SectionItemView {
Text(
embedCode,
@@ -140,11 +134,30 @@ private fun ChannelWebPageLayout(
}) {
Icon(painterResource(MR.images.ic_content_copy), null, tint = MaterialTheme.colors.primary)
Spacer(Modifier.width(8.dp))
Text(stringResource(MR.strings.copy_embed_code), color = MaterialTheme.colors.primary)
Text(stringResource(MR.strings.copy_code), color = MaterialTheme.colors.primary)
}
}
SectionTextFooter(stringResource(MR.strings.webpage_code_footer))
} else {
SectionItemView {
Text(stringResource(MR.strings.relays_no_web_support), color = MaterialTheme.colors.secondary)
}
}
SectionView(stringResource(MR.strings.enter_webpage_url).uppercase()) {
SectionItemView {
ProfileNameField(webPage, stringResource(MR.strings.web_page_url_placeholder))
}
}
SectionTextFooter(stringResource(MR.strings.webpage_url_footer))
SectionView {
PreferenceToggle(stringResource(MR.strings.allow_anyone_to_embed), checked = allowEmbedding.value) {
allowEmbedding.value = it
}
}
SectionTextFooter(stringResource(if (allowEmbedding.value) MR.strings.embed_any_webpage_can_show else MR.strings.embed_only_your_page))
SectionView {
SectionItemView(save, disabled = dataUnchanged) {
Text(
@@ -614,7 +614,6 @@ fun ModalData.GroupChatInfoLayout(
if (groupInfo.isOwner && groupLink != null) {
anyTopSectionRowShow = true
ChannelLinkButton(manageGroupLink)
ChannelWebPageButton(groupInfo, manageWebPage)
} else if (channelLink != null) {
anyTopSectionRowShow = true
ChannelLinkQRCodeSection(channelLink)
@@ -799,6 +798,13 @@ fun ModalData.GroupChatInfoLayout(
}
}
if (groupInfo.useRelays && groupInfo.isOwner) {
SectionDividerSpaced()
SectionView(title = stringResource(MR.strings.advanced_options)) {
ChannelWebPageButton(groupInfo, manageWebPage)
}
}
if (developerTools) {
SectionDividerSpaced()
SectionView(title = stringResource(MR.strings.section_title_for_console)) {
@@ -1214,7 +1220,7 @@ private fun ChannelLinkButton(onClick: () -> Unit) {
private fun ChannelWebPageButton(groupInfo: GroupInfo, onClick: () -> Unit) {
SettingsActionItem(
painterResource(MR.images.ic_travel_explore),
stringResource(if (groupInfo.useRelays) MR.strings.channel_webpage else MR.strings.group_webpage),
stringResource(if (groupInfo.isChannel) MR.strings.channel_webpage else MR.strings.group_webpage),
onClick,
iconColor = MaterialTheme.colors.secondary
)
@@ -1920,12 +1920,18 @@
<string name="channel_link">Channel link</string>
<string name="channel_webpage">Channel webpage</string>
<string name="group_webpage">Group webpage</string>
<string name="web_page">Web page</string>
<string name="web_page_url_placeholder">Web page URL</string>
<string name="allow_embedding">Allow embedding</string>
<string name="web_page_footer">Set a web page URL where your channel preview is hosted. Allow embedding to let any website embed the preview.</string>
<string name="embed_code">Embed code</string>
<string name="copy_embed_code">Copy embed code</string>
<string name="advanced_options">Advanced options</string>
<string name="web_page_url_placeholder">https://</string>
<string name="allow_anyone_to_embed">Allow anyone to embed</string>
<string name="enter_webpage_url">Enter webpage URL</string>
<string name="webpage_url_footer">It will be shown to subscribers and used to allow loading the preview.</string>
<string name="webpage_code">Webpage code</string>
<string name="webpage_code_footer">Add this code to your webpage. It will display the preview of your channel / group.</string>
<string name="copy_code">Copy code</string>
<string name="webpage_info">Create a webpage to show your channel preview to visitors before they subscribe. Host it yourself or use any static hosting.</string>
<string name="relays_no_web_support">Used chat relays do not support webpages.</string>
<string name="embed_any_webpage_can_show">Any webpage can show the preview.</string>
<string name="embed_only_your_page">Only your page above can show the preview.</string>
<string name="create_group_link">Create group link</string>
<string name="button_create_group_link">Create link</string>
<string name="delete_link_question">Delete link?</string>