update for asynchronous message delivery (#92)

This commit is contained in:
Evgeny Poberezkin
2021-08-14 21:04:51 +01:00
committed by GitHub
parent f3c64f3fc7
commit e5b9cdef9d
6 changed files with 35 additions and 13 deletions
+4
View File
@@ -324,6 +324,8 @@ data ConnStatus
ConnSndReady
| -- | connection is ready for both parties to send and receive messages
ConnReady
| -- | connection deleted
ConnDeleted
deriving (Eq, Show)
instance FromField ConnStatus where fromField = fromTextField_ connStatusT
@@ -338,6 +340,7 @@ connStatusT = \case
"accepted" -> Just ConnAccepted
"snd-ready" -> Just ConnSndReady
"ready" -> Just ConnReady
"deleted" -> Just ConnDeleted
_ -> Nothing
serializeConnStatus :: ConnStatus -> Text
@@ -348,6 +351,7 @@ serializeConnStatus = \case
ConnAccepted -> "accepted"
ConnSndReady -> "snd-ready"
ConnReady -> "ready"
ConnDeleted -> "deleted"
data ConnType = ConnContact | ConnMember
deriving (Eq, Show)
+8 -1
View File
@@ -13,6 +13,7 @@ module Simplex.Chat.View
showContactGroups,
showContactConnected,
showContactDisconnected,
showContactAnotherClient,
showContactSubscribed,
showContactSubError,
showGroupSubscribed,
@@ -81,6 +82,9 @@ showContactConnected = printToView . contactConnected
showContactDisconnected :: ChatReader m => ContactName -> m ()
showContactDisconnected = printToView . contactDisconnected
showContactAnotherClient :: ChatReader m => ContactName -> m ()
showContactAnotherClient = printToView . contactAnotherClient
showContactSubscribed :: ChatReader m => ContactName -> m ()
showContactSubscribed = printToView . contactSubscribed
@@ -186,7 +190,10 @@ contactConnected :: Contact -> [StyledString]
contactConnected ct = [ttyFullContact ct <> ": contact is connected"]
contactDisconnected :: ContactName -> [StyledString]
contactDisconnected c = [ttyContact c <> ": contact is disconnected - restart chat"]
contactDisconnected c = [ttyContact c <> ": contact is disconnected (messages will be queued)"]
contactAnotherClient :: ContactName -> [StyledString]
contactAnotherClient c = [ttyContact c <> ": contact is connected to another client"]
contactSubscribed :: ContactName -> [StyledString]
contactSubscribed c = [ttyContact c <> ": contact is active"]