core: add peer type "agent" (#7738)

* add agent peer type

* bot types

* agent app icons

* refactor

* smaller image

---------

Co-authored-by: Evgeny @ SimpleX Chat <259188159+evgeny-simplex@users.noreply.github.com>
This commit is contained in:
EvgenyandEvgeny @ SimpleX Chat authored and GitHub committed 2026-10-17 19:23:53 +01:00
1 parent 9a90d8e230
commit 77f9f4a464
29 files changed
+101 -45

No files matched your search

@@ -1954,7 +1954,7 @@ data class Contact(
activeConn?.customUserProfileId != null
val chatIconName: ImageResource get() =
if (isBot) MR.images.ic_cube else MR.images.ic_account_circle_filled
peerTypeIcon(profile.peerType)
fun allowsFeature(feature: ChatFeature): Boolean = when (feature) {
ChatFeature.TimedMessages -> mergedPreferences.timedMessages.contactPreference.allow != FeatureAllowed.NO
@@ -2165,6 +2165,7 @@ sealed class ChatPeerType {
@Serializable @SerialName("human") object Human: ChatPeerType()
@Serializable @SerialName("bot") object Bot: ChatPeerType()
@Serializable @SerialName("business") object Business: ChatPeerType()
@Serializable @SerialName("agent") object Agent: ChatPeerType()
@Serializable @SerialName("unknown") data class Unknown(val type: String): ChatPeerType()
val text: String
@@ -2172,6 +2173,7 @@ sealed class ChatPeerType {
is Human -> "human"
is Bot -> "bot"
is Business -> "business"
is Agent -> "agent"
is Unknown -> type
}
}
@@ -2183,11 +2185,19 @@ object ChatPeerTypeSerializer : KSerializer<ChatPeerType> {
"human" -> ChatPeerType.Human
"bot" -> ChatPeerType.Bot
"business" -> ChatPeerType.Business
"agent" -> ChatPeerType.Agent
else -> ChatPeerType.Unknown(v)
}
override fun serialize(encoder: Encoder, value: ChatPeerType) = encoder.encodeString(value.text)
}
fun peerTypeIcon(peerType: ChatPeerType?): ImageResource =
when (peerType) {
ChatPeerType.Bot -> MR.images.ic_cube
ChatPeerType.Agent -> MR.images.ic_agent
else -> MR.images.ic_account_circle_filled
}
// Supporter badge. The credential/proof bytes stay core-side; the UI only sees the disclosed type + status.
// Unknown types keep their string so a verified badge's real name can be shown, while the icon falls back to supporter.
@Serializable(with = BadgeTypeSerializer::class)
@@ -8139,7 +8139,7 @@ sealed class StoreError {
is UserChatRelayNotFound -> "userChatRelayNotFound $chatRelayId"
is GroupRelayNotFound -> "groupRelayNotFound $groupRelayId"
is GroupRelayNotFoundByMemberId -> "groupRelayNotFoundByMemberId $groupMemberId"
is DuplicateGroupMessage -> "duplicateGroupMessage $groupId $sharedMsgId $authorGroupMemberId $authorGroupMemberId"
is DuplicateGroupMessage -> "duplicateGroupMessage $groupId $sharedMsgId $authorGroupMemberId $forwardedByGroupMemberId"
is RemoteHostNotFound -> "remoteHostNotFound $remoteHostId"
is RemoteHostUnknown -> "remoteHostUnknown"
is RemoteHostDuplicateCA -> "remoteHostDuplicateCA"
@@ -717,8 +717,7 @@ fun showPrepareContactAlert(
image = contactShortLinkData.profile.image,
icon =
if (contactShortLinkData.business) MR.images.ic_work_filled_padded
else if (contactShortLinkData.profile.peerType == ChatPeerType.Bot) MR.images.ic_cube
else MR.images.ic_account_circle_filled
else peerTypeIcon(contactShortLinkData.profile.peerType)
)
},
profileBadge = if (contactShortLinkData.localBadge?.status == BadgeStatus.ExpiredOld) null else contactShortLinkData.localBadge,
@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" height="22px" viewBox="0 -960 960 960" width="22px" fill="#000000"><path d="M564.12,-698.86 C564.12,-652.47 526.51,-614.86 480.12,-614.86 C433.73,-614.86 396.12,-652.47 396.12,-698.86 C396.12,-745.25 433.73,-782.86 480.12,-782.86 C526.51,-782.86 564.12,-745.25 564.12,-698.86 Z M373.01,-371.05 C373.01,-324.66 335.4,-287.05 289.01,-287.05 C242.62,-287.05 205.01,-324.66 205.01,-371.05 C205.01,-417.44 242.62,-455.05 289.01,-455.05 C335.4,-455.05 373.01,-417.44 373.01,-371.05 Z M755.03,-371.07 C755.03,-324.68 717.42,-287.07 671.03,-287.07 C624.63,-287.07 587.03,-324.68 587.03,-371.07 C587.03,-417.46 624.63,-455.07 671.03,-455.07 C717.42,-455.07 755.03,-417.46 755.03,-371.07 Z"/></svg>

After

Width:  |  Height:  |  Size: 728 B