From 67e0ca28a927e147ae8aebdb147288957af49196 Mon Sep 17 00:00:00 2001 From: Evgeny Poberezkin <2769109+epoberezkin@users.noreply.github.com> Date: Wed, 12 Jan 2022 06:55:04 +0000 Subject: [PATCH] additional notifications (#199) --- src/Simplex/Chat.hs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/Simplex/Chat.hs b/src/Simplex/Chat.hs index 5c56c788c5..081a219735 100644 --- a/src/Simplex/Chat.hs +++ b/src/Simplex/Chat.hs @@ -778,6 +778,7 @@ processAgentMessage user@User {userId, profile} agentConnId agentMessage = do profileContactRequest invId p = do cName <- withStore $ \st -> createContactRequest st userId userContactLinkId invId p showReceivedContactRequest cName p + showToast (cName <> "> ") "wants to connect to you" withAckMessage :: ConnId -> MsgMeta -> m () -> m () withAckMessage cId MsgMeta {recipient = (msgId, _)} action = @@ -842,6 +843,7 @@ processAgentMessage user@User {userId, profile} agentConnId agentMessage = do chSize <- asks $ fileChunkSize . config ft <- withStore $ \st -> createRcvFileTransfer st userId contact fInv chSize showReceivedMessage c (snd $ broker meta) (receivedFileInvitation ft) (integrity (meta :: MsgMeta)) + showToast (c <> "> ") "wants to send a file" setActive $ ActiveC c processGroupFileInvitation :: GroupName -> GroupMember -> MsgMeta -> FileInvitation -> m () @@ -849,14 +851,16 @@ processAgentMessage user@User {userId, profile} agentConnId agentMessage = do chSize <- asks $ fileChunkSize . config ft <- withStore $ \st -> createRcvGroupFileTransfer st userId m fInv chSize showReceivedGroupMessage gName c (snd $ broker meta) (receivedFileInvitation ft) (integrity (meta :: MsgMeta)) + showToast ("#" <> gName <> " " <> c <> "> ") "wants to send a file" setActive $ ActiveG gName processGroupInvitation :: Contact -> GroupInvitation -> m () - processGroupInvitation ct@Contact {localDisplayName} inv@(GroupInvitation (MemberIdRole fromMemId fromRole) (MemberIdRole memId memRole) _ _) = do - when (fromRole < GRAdmin || fromRole < memRole) $ chatError (CEGroupContactRole localDisplayName) + processGroupInvitation ct@Contact {localDisplayName = c} inv@(GroupInvitation (MemberIdRole fromMemId fromRole) (MemberIdRole memId memRole) _ _) = do + when (fromRole < GRAdmin || fromRole < memRole) $ chatError (CEGroupContactRole c) when (fromMemId == memId) $ chatError CEGroupDuplicateMemberId - group <- withStore $ \st -> createGroupInvitation st user ct inv - showReceivedGroupInvitation group localDisplayName memRole + group@Group {localDisplayName = gName} <- withStore $ \st -> createGroupInvitation st user ct inv + showReceivedGroupInvitation group c memRole + showToast ("#" <> gName <> " " <> c <> "> ") $ "invited you to join the group" xInfo :: Contact -> Profile -> m () xInfo c@Contact {profile = p} p' = unless (p == p') $ do