core: forward compatible format encoding (for remote desktop) (#6147)

* core: forward compatible format encoding (for remote desktop)

* fix ios
This commit is contained in:
Evgeny
2025-08-02 16:10:15 +01:00
committed by GitHub
parent 317cbd3785
commit bdb18b2941
6 changed files with 12 additions and 2 deletions
+6 -1
View File
@@ -53,6 +53,7 @@ data Format
| Mention {memberName :: Text}
| Email
| Phone
| Unknown {json :: J.Value}
deriving (Eq, Show)
mentionedNames :: MarkdownList -> [Text]
@@ -305,6 +306,7 @@ markdownText (FormattedText f_ t) = case f_ of
Mention _ -> t
Email -> t
Phone -> t
Unknown _ -> t
where
around c = c `T.cons` t `T.snoc` c
color c = case colorStr c of
@@ -340,7 +342,10 @@ viewName s = if T.any isSpace s || maybe False (isPunctuation . snd) (T.unsnoc s
$(JQ.deriveJSON (enumJSON $ dropPrefix "XL") ''SimplexLinkType)
$(JQ.deriveJSON (sumTypeJSON fstToLower) ''Format)
$(JQ.deriveToJSON (sumTypeJSON fstToLower) ''Format)
instance FromJSON Format where
parseJSON v = $(JQ.mkParseJSON (sumTypeJSON fstToLower) ''Format) v <|> pure (Unknown v)
$(JQ.deriveJSON defaultJSON ''FormattedText)