diff --git a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chat/group/ChannelWebPageView.kt b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chat/group/ChannelWebPageView.kt
index ebf64ed64d..99e5a4dc7e 100644
--- a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chat/group/ChannelWebPageView.kt
+++ b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chat/group/ChannelWebPageView.kt
@@ -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(
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 4591669acf..0f8a34a811 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
@@ -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
)
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 d7c22f95b0..7bab71312c 100644
--- a/apps/multiplatform/common/src/commonMain/resources/MR/base/strings.xml
+++ b/apps/multiplatform/common/src/commonMain/resources/MR/base/strings.xml
@@ -1920,12 +1920,18 @@
Channel link
Channel webpage
Group webpage
- Web page
- Web page URL
- Allow embedding
- Set a web page URL where your channel preview is hosted. Allow embedding to let any website embed the preview.
- Embed code
- Copy embed code
+ Advanced options
+ https://
+ Allow anyone to embed
+ Enter webpage URL
+ It will be shown to subscribers and used to allow loading the preview.
+ Webpage code
+ Add this code to your webpage. It will display the preview of your channel / group.
+ Copy code
+ Create a webpage to show your channel preview to visitors before they subscribe. Host it yourself or use any static hosting.
+ Used chat relays do not support webpages.
+ Any webpage can show the preview.
+ Only your page above can show the preview.
Create group link
Create link
Delete link?