mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-09-16 10:33:10 +00:00
core: update simplexmq (time diff calculation); core, ios: add deleteAt to chat item info (#2440)
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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 []
|
||||
|
||||
Reference in New Issue
Block a user