mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-05-24 15:15:35 +00:00
core: forward compatible format encoding (for remote desktop) (#6147)
* core: forward compatible format encoding (for remote desktop) * fix ios
This commit is contained in:
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user