Skip to content

core, ui: tolerate unknown MsgContentTag in chatContentTypes#6805

Merged
epoberezkin merged 1 commit into
masterfrom
nd/fix-group-open-error
Apr 16, 2026
Merged

core, ui: tolerate unknown MsgContentTag in chatContentTypes#6805
epoberezkin merged 1 commit into
masterfrom
nd/fix-group-open-error

Conversation

@Narasimha-sc
Copy link
Copy Markdown
Collaborator

@Narasimha-sc Narasimha-sc commented Apr 14, 2026

Summary

  • Fixes the error opening a group containing items with unknown or legacy msg_content_tag values (e.g. "liveText"). Strict enum decoding of List<MsgContentTag> in apiGetChatContentTypes was failing on the whole response; backend already round-trips unknowns via MCUnknown_, so the clients now do the same.
  • Follows the open-union pattern used by GroupType / ReportReason: preserve the original type string in the Unknown variant so it round-trips instead of collapsing to a sentinel.
  • Multiplatform (Kotlin): MsgContentTag becomes a sealed class with object cases for known tags and data class Unknown(val type: String); custom MsgContentTagSerializer maps "liveText"Text and wraps everything else in Unknown(s). apiGetChatContentTypes filters out Unknown.
  • iOS (Swift): MsgContentTag becomes a Codable, Hashable enum with case unknown(type: String); rawValue retained as a computed property so existing call sites compile unchanged. "liveText".text; .chat case added for parity with backend/multiplatform. apiGetChatContentTypes filters out .unknown.

Test plan

  • Open a group that contains a message with an unknown/legacy msg_content_tag on Android — group opens without the "Error loading details: chatContentTypes" error.
  • Repeat on iOS.
  • Regression: open a normal group — content types load unchanged, no unknowns shown.

Opening a group containing items with unknown/legacy msg_content_tag
(e.g. "liveText") raised "Error loading details: chatContentTypes: ..."
because strict enum decoding failed on the whole response.

Follows the open-union pattern (GroupType/ReportReason): preserve the
original type string in the Unknown variant so it round-trips.
@Narasimha-sc Narasimha-sc force-pushed the nd/fix-group-open-error branch from 9ff69e4 to 0cd1d93 Compare April 14, 2026 12:20
Comment thread apps/ios/Shared/Model/SimpleXAPI.swift
@epoberezkin epoberezkin merged commit e2a5529 into master Apr 16, 2026
10 of 21 checks passed
@epoberezkin epoberezkin deleted the nd/fix-group-open-error branch April 16, 2026 09:10
@github-actions github-actions Bot locked and limited conversation to collaborators Apr 16, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants