diff --git a/cabal.project b/cabal.project index d9d9a1d26b..3b8c5538a1 100644 --- a/cabal.project +++ b/cabal.project @@ -5,7 +5,7 @@ constraints: zip +disable-bzip2 +disable-zstd source-repository-package type: git location: https://github.com/simplex-chat/simplexmq.git - tag: a8260290e7896a1e75ae595c255171175237cb06 + tag: 51d0b48ce15433d8473770522b1eb814688d2aea source-repository-package type: git diff --git a/scripts/nix/sha256map.nix b/scripts/nix/sha256map.nix index 61e6a6aaa8..fcc28b64f2 100644 --- a/scripts/nix/sha256map.nix +++ b/scripts/nix/sha256map.nix @@ -1,5 +1,5 @@ { - "https://github.com/simplex-chat/simplexmq.git"."a8260290e7896a1e75ae595c255171175237cb06" = "0nmndbxzskyg7cmc7m8nviwalrq8144bzz6y7ywpaai36fdjmj5l"; + "https://github.com/simplex-chat/simplexmq.git"."51d0b48ce15433d8473770522b1eb814688d2aea" = "1v1n96lq9k6cvayqhlc7ywr1zwj2qnnsirv4dilqwl507gb6gqyj"; "https://github.com/simplex-chat/aeson.git"."3eb66f9a68f103b5f1489382aad89f5712a64db7" = "0kilkx59fl6c3qy3kjczqvm8c3f4n3p0bdk9biyflf51ljnzp4yp"; "https://github.com/simplex-chat/haskell-terminal.git"."f708b00009b54890172068f168bf98508ffcd495" = "0zmq7lmfsk8m340g47g5963yba7i88n4afa6z93sg9px5jv1mijj"; "https://github.com/zw3rk/android-support.git"."3c3a5ab0b8b137a072c98d3d0937cbdc96918ddb" = "1r6jyxbim3dsvrmakqfyxbd6ms6miaghpbwyl0sr6dzwpgaprz97"; diff --git a/src/Simplex/Chat.hs b/src/Simplex/Chat.hs index 5ff8aeaaeb..6db48345cd 100644 --- a/src/Simplex/Chat.hs +++ b/src/Simplex/Chat.hs @@ -60,7 +60,6 @@ import qualified Simplex.Messaging.Crypto as C import Simplex.Messaging.Encoding import Simplex.Messaging.Encoding.String import Simplex.Messaging.Notifications.Client (NtfServer) -import Simplex.Messaging.Notifications.Protocol (DeviceToken (..), PushProvider (..)) import Simplex.Messaging.Parsers (base64P, parseAll) import Simplex.Messaging.Protocol (ErrorType (..), MsgBody, MsgFlags (..)) import qualified Simplex.Messaging.Protocol as SMP @@ -205,7 +204,8 @@ processChatCommand = \case APIStopChat -> do ask >>= stopChatController pure CRChatStopped - APISetAppPhase phase -> withAgent (`setAgentPhase` phase) $> CRCmdOk + APIActivateChat -> withAgent activateAgent $> CRCmdOk + APISuspendChat t -> withAgent (`suspendAgent` t) $> CRCmdOk ResubscribeAllConnections -> withUser (subscribeUserConnections resubscribeConnection) $> CRCmdOk SetFilesFolder filesFolder' -> do createDirectoryIfMissing True filesFolder' @@ -1096,7 +1096,7 @@ processAgentMessage Nothing _ _ = throwChatError CENoActiveUser processAgentMessage (Just User {userId}) "" agentMessage = case agentMessage of DOWN srv conns -> serverEvent srv conns CRContactsDisconnected "disconnected" UP srv conns -> serverEvent srv conns CRContactsSubscribed "connected" - PHASE phase -> toView $ CRAppPhase phase + SUSPENDED -> toView CRChatSuspended _ -> pure () where serverEvent srv@SMP.ProtocolServer {host, port} conns event str = do @@ -2250,7 +2250,8 @@ chatCommandP = <|> "/_start subscribe=" *> (StartChat <$> ("on" $> True <|> "off" $> False)) <|> "/_start" $> StartChat True <|> "/_stop" $> APIStopChat - <|> "/_app phase " *> (APISetAppPhase <$> strP) + <|> "/_app activate" $> APIActivateChat + <|> "/_app suspend " *> (APISuspendChat <$> A.decimal) <|> "/_resubscribe all" $> ResubscribeAllConnections <|> "/_files_folder " *> (SetFilesFolder <$> filePath) <|> "/_db export " *> (APIExportArchive <$> jsonP) diff --git a/src/Simplex/Chat/Controller.hs b/src/Simplex/Chat/Controller.hs index c895fd7cc9..67ab50029d 100644 --- a/src/Simplex/Chat/Controller.hs +++ b/src/Simplex/Chat/Controller.hs @@ -101,7 +101,8 @@ data ChatCommand | CreateActiveUser Profile | StartChat {subscribeConnections :: Bool} | APIStopChat - | APISetAppPhase AgentPhase + | APIActivateChat + | APISuspendChat {suspendTimeout :: Int} | ResubscribeAllConnections | SetFilesFolder FilePath | APIExportArchive ArchiveConfig @@ -185,7 +186,7 @@ data ChatResponse | CRChatStarted | CRChatRunning | CRChatStopped - | CRAppPhase {appPhase :: AgentPhase} + | CRChatSuspended | CRApiChats {chats :: [AChat]} | CRApiChat {chat :: AChat} | CRLastMessages {chatItems :: [AChatItem]} diff --git a/src/Simplex/Chat/View.hs b/src/Simplex/Chat/View.hs index 7808f1ffec..448e9c6582 100644 --- a/src/Simplex/Chat/View.hs +++ b/src/Simplex/Chat/View.hs @@ -55,7 +55,7 @@ responseToView testView = \case CRChatStarted -> ["chat started"] CRChatRunning -> ["chat is running"] CRChatStopped -> ["chat stopped"] - CRAppPhase p -> ["app phase " <> sShow p] + CRChatSuspended -> ["chat suspended"] CRApiChats chats -> if testView then testViewChats chats else [plain . bshow $ J.encode chats] CRApiChat chat -> if testView then testViewChat chat else [plain . bshow $ J.encode chat] CRApiParsedMarkdown ft -> [plain . bshow $ J.encode ft] diff --git a/stack.yaml b/stack.yaml index d991665da1..63b756b335 100644 --- a/stack.yaml +++ b/stack.yaml @@ -49,7 +49,7 @@ extra-deps: # - simplexmq-1.0.0@sha256:34b2004728ae396e3ae449cd090ba7410781e2b3cefc59259915f4ca5daa9ea8,8561 # - ../simplexmq - github: simplex-chat/simplexmq - commit: a8260290e7896a1e75ae595c255171175237cb06 + commit: 51d0b48ce15433d8473770522b1eb814688d2aea # - terminal-0.2.0.0@sha256:de6770ecaae3197c66ac1f0db5a80cf5a5b1d3b64a66a05b50f442de5ad39570,2977 - github: simplex-chat/aeson commit: 3eb66f9a68f103b5f1489382aad89f5712a64db7