core, ui: public group profile wip (#6734)

This commit is contained in:
spaced4ndy
2026-04-01 14:17:27 +00:00
committed by GitHub
parent dfd8e224f6
commit 42fe94752c
26 changed files with 323 additions and 147 deletions
@@ -2163,6 +2163,39 @@ data class PreparedGroup (
@Serializable
data class GroupRef(val groupId: Long, val localDisplayName: String)
@Serializable(with = GroupTypeSerializer::class)
sealed class GroupType {
@Serializable @SerialName("channel") object Channel: GroupType()
@Serializable @SerialName("unknown") data class Unknown(val type: String): GroupType()
}
object GroupTypeSerializer : KSerializer<GroupType> {
override val descriptor: SerialDescriptor =
PrimitiveSerialDescriptor("GroupType", PrimitiveKind.STRING)
override fun deserialize(decoder: Decoder): GroupType {
return when (val value = decoder.decodeString()) {
"channel" -> GroupType.Channel
else -> GroupType.Unknown(value)
}
}
override fun serialize(encoder: Encoder, value: GroupType) {
val stringValue = when (value) {
is GroupType.Channel -> "channel"
is GroupType.Unknown -> value.type
}
encoder.encodeString(stringValue)
}
}
@Serializable
data class PublicGroupProfile(
val groupType: GroupType,
val groupLink: String,
val publicGroupId: String
)
@Serializable
data class GroupProfile (
override val displayName: String,
@@ -2170,7 +2203,7 @@ data class GroupProfile (
override val shortDescr: String?,
val description: String? = null,
override val image: String? = null,
val groupLink: String? = null,
val publicGroup: PublicGroupProfile? = null,
override val localAlias: String = "",
val groupPreferences: GroupPreferences? = null,
val memberAdmission: GroupMemberAdmission? = null
@@ -4548,7 +4548,7 @@ data class RelayConnectionResult(
data class GroupShortLinkInfo(
val direct: Boolean,
val groupRelays: List<String>,
val sharedGroupId: String? = null
val publicGroupId: String? = null
)
@Serializable
@@ -545,21 +545,22 @@ fun ModalData.GroupChatInfoLayout(
}
var anyTopSectionRowShow = false
val channelLink = groupInfo.groupProfile.publicGroup?.groupLink
if (groupInfo.useRelays) {
SectionView {
if (groupInfo.isOwner && groupLink != null) {
anyTopSectionRowShow = true
ChannelLinkButton(manageGroupLink)
} else if (groupInfo.groupProfile.groupLink != null) {
} else if (channelLink != null) {
anyTopSectionRowShow = true
ChannelLinkQRCodeSection(groupInfo.groupProfile.groupLink!!)
ChannelLinkQRCodeSection(channelLink)
}
if (groupInfo.isOwner || activeSortedMembers.any { it.memberRole >= GroupMemberRole.Owner }) {
anyTopSectionRowShow = true
ChannelMembersButton(chat.remoteHostId, groupInfo, showMemberInfo)
}
}
if (!groupInfo.isOwner && groupInfo.groupProfile.groupLink != null) {
if (!groupInfo.isOwner && channelLink != null) {
SectionTextFooter(stringResource(MR.strings.you_can_share_channel_link_anybody_will_be_able_to_connect))
}
} else {