core: update simplexmq (time diff calculation); core, ios: add deleteAt to chat item info (#2440)

This commit is contained in:
spaced4ndy
2023-05-15 21:07:03 +04:00
committed by GitHub
parent 25156bb56c
commit a059739210
8 changed files with 47 additions and 28 deletions
+4
View File
@@ -204,6 +204,9 @@ chatItemTs' ChatItem {meta = CIMeta {itemTs}} = itemTs
chatItemTimed :: ChatItem c d -> Maybe CITimed
chatItemTimed ChatItem {meta = CIMeta {itemTimed}} = itemTimed
timedDeleteAt' :: CITimed -> Maybe UTCTime
timedDeleteAt' CITimed {deleteAt} = deleteAt
chatItemMember :: GroupInfo -> ChatItem 'CTGroup d -> GroupMember
chatItemMember GroupInfo {membership} ChatItem {chatDir} = case chatDir of
CIGroupSnd -> membership
@@ -1502,6 +1505,7 @@ data ChatItemInfo = ChatItemInfo
itemTs :: UTCTime,
createdAt :: UTCTime,
updatedAt :: UTCTime,
deleteAt :: Maybe UTCTime,
itemVersions :: [ChatItemVersion]
}
deriving (Eq, Show, Generic)
+11 -8
View File
@@ -426,16 +426,19 @@ viewChatItem chat ci@ChatItem {chatDir, meta = meta, content, quotedItem, file}
prohibited = styled (colored Red) ("[unexpected chat item created, please report to developers]" :: String)
viewChatItemInfo :: AChatItem -> ChatItemInfo -> TimeZone -> [StyledString]
viewChatItemInfo (AChatItem _ msgDir _ _) ChatItemInfo {itemTs, createdAt, itemVersions} tz = case msgDir of
SMDRcv ->
[ "sent at: " <> ts itemTs,
"received at: " <> ts createdAt
]
<> versions
SMDSnd ->
["sent at: " <> ts itemTs] <> versions
viewChatItemInfo (AChatItem _ msgDir _ _) ChatItemInfo {itemTs, createdAt, deleteAt, itemVersions} tz =
["sent at: " <> ts itemTs]
<> receivedAt
<> toBeDeletedAt
<> versions
where
ts = styleTime . localTs tz
receivedAt = case msgDir of
SMDRcv -> ["received at: " <> ts createdAt]
SMDSnd -> []
toBeDeletedAt = case deleteAt of
Just d -> ["to be deleted at: " <> ts d]
Nothing -> []
versions =
if null itemVersions
then []