From 8aaf0df8e70d26cea74f002208a54fb9718e42d1 Mon Sep 17 00:00:00 2001 From: Mark Aleksander Hil <32651095+markaleksanderh@users.noreply.github.com> Date: Thu, 29 Apr 2021 10:27:07 +0100 Subject: [PATCH 1/2] Updated ChatHelpInfo (#112) --- Main.hs | 61 ++++++++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 45 insertions(+), 16 deletions(-) diff --git a/Main.hs b/Main.hs index cdc1152bc8..d7100d2e5b 100644 --- a/Main.hs +++ b/Main.hs @@ -119,29 +119,58 @@ serializeChatResponse = \case msgPlain :: ByteString -> [StyledString] msgPlain = map styleMarkdownText . T.lines . safeDecodeUtf8 + chatHelpInfo :: [StyledString] chatHelpInfo = map styleMarkdown - [ "Using chat:", - highlight "/add " <> " - create invitation to send out-of-band to your contact ", - " ( is the alias you choose to message your contact)", - highlight "/connect " <> " - connect using ", - " (a string returned by /add that starts from \"smp::\")", - " if /connect is used by your contact,", - " is the alias your contact chooses to message you", - highlight "@ " <> " - send (any string) to contact ", - " @ will be auto-typed to send to the previous contact -", - " just start typing the message!", - highlight "/delete" <> " - delete contact and all messages you had with them", - highlight "/markdown" <> " - markdown cheat-sheet", - "", - "Commands can be abbreviated to 1 letter: ", - listCommands ["/h", "/a", "/c", "/d", "/m"] - ] + [ + "", + Markdown (Colored Green) "Using Simplex chat prototype:", + indent <> "A connection is established in three steps.", + indent <> "The following example shows how to set up a connection and message a contact.", + "", + Markdown (Colored Green) "Step 1:", + indent <> "Alice enters the add command to add her contact, Bob.", + "", + indent <> Markdown (Colored Yellow) "/add bob", + "", + indent <> "The add command creates an invitation.", + indent <> "Alice adds a name for her contact, Bob.", + indent <> "The command outputs an invitation to the terminal.", + indent <> "Alice copies the key and sends it to her contact,", + indent <> "Bob, out of band using a trusted method.", + "", + Markdown (Colored Green) "Step 2:", + indent <> "When Bob receives the invitation from Alice,", + indent <> "he uses the connect command to establish a connection.", + "", + indent <> Markdown (Colored Yellow) "/connect alice ", + "", + + indent <> "Bob enters the command, followed by a name for his contact,", + indent <> "- in this case Alice - followed by the invitation he received out of band from Alice.", + "", + Markdown (Colored Green) "Step 3:", + indent <> "Bob and Alice are notified once the connection is established.", + indent <> "Both may now use the message command to send a message.", + "", + indent <> Markdown (Colored Yellow) "@bob Hello, Alice!", + "", + "", + Markdown (Colored Green) "Other commands:", + indent <> Markdown (Colored Yellow) "/delete" <> " - deletes contact and all communications with them.", + indent <> Markdown (Colored Yellow) "/markdown" <> " - displays cheatsheet of markdown syntax.", + "", + "The above commands may be abbreviated to a single letter: ", + listCommands ["/a", "/c", "/m", "/d"] + + ] + where listCommands = mconcat . intersperse ", " . map highlight highlight = Markdown (Colored Cyan) + indent = " " markdownInfo :: [StyledString] markdownInfo = From 28b7d01117df6d3476299568d023161998cc09e5 Mon Sep 17 00:00:00 2001 From: Evgeny Poberezkin <2769109+epoberezkin@users.noreply.github.com> Date: Fri, 30 Apr 2021 09:06:59 +0100 Subject: [PATCH 2/2] reduce help size (#113) --- Main.hs | 68 +++++++++++++++++++-------------------------------------- 1 file changed, 23 insertions(+), 45 deletions(-) diff --git a/Main.hs b/Main.hs index d7100d2e5b..7204971cda 100644 --- a/Main.hs +++ b/Main.hs @@ -119,58 +119,36 @@ serializeChatResponse = \case msgPlain :: ByteString -> [StyledString] msgPlain = map styleMarkdownText . T.lines . safeDecodeUtf8 - chatHelpInfo :: [StyledString] chatHelpInfo = map styleMarkdown - [ - "", - Markdown (Colored Green) "Using Simplex chat prototype:", - indent <> "A connection is established in three steps.", - indent <> "The following example shows how to set up a connection and message a contact.", - "", - Markdown (Colored Green) "Step 1:", - indent <> "Alice enters the add command to add her contact, Bob.", - "", - indent <> Markdown (Colored Yellow) "/add bob", - "", - indent <> "The add command creates an invitation.", - indent <> "Alice adds a name for her contact, Bob.", - indent <> "The command outputs an invitation to the terminal.", - indent <> "Alice copies the key and sends it to her contact,", - indent <> "Bob, out of band using a trusted method.", - "", - Markdown (Colored Green) "Step 2:", - indent <> "When Bob receives the invitation from Alice,", - indent <> "he uses the connect command to establish a connection.", - "", - indent <> Markdown (Colored Yellow) "/connect alice ", - "", - - indent <> "Bob enters the command, followed by a name for his contact,", - indent <> "- in this case Alice - followed by the invitation he received out of band from Alice.", - "", - Markdown (Colored Green) "Step 3:", - indent <> "Bob and Alice are notified once the connection is established.", - indent <> "Both may now use the message command to send a message.", - "", - indent <> Markdown (Colored Yellow) "@bob Hello, Alice!", - "", - "", - Markdown (Colored Green) "Other commands:", - indent <> Markdown (Colored Yellow) "/delete" <> " - deletes contact and all communications with them.", - indent <> Markdown (Colored Yellow) "/markdown" <> " - displays cheatsheet of markdown syntax.", - "", - "The above commands may be abbreviated to a single letter: ", - listCommands ["/a", "/c", "/m", "/d"] - - ] - + [ Markdown (Colored Cyan) "Using Simplex chat prototype.", + "Follow these steps to set up a connection:", + "", + Markdown (Colored Green) "Step 1: " <> Markdown (Colored Cyan) "/add bob" <> " -- Alice adds her contact, Bob (she can use any name).", + indent <> "Alice should send the invitation printed by the /add command", + indent <> "to her contact, Bob, out-of-band, via any trusted channel.", + "", + Markdown (Colored Green) "Step 2: " <> Markdown (Colored Cyan) "/connect alice " <> " -- Bob accepts the invitation.", + indent <> "Bob also can use any name for his contact, Alice,", + indent <> "followed by the invitation he received out-of-band.", + "", + Markdown (Colored Green) "Step 3: " <> "Bob and Alice are notified that the connection is set up,", + indent <> "both can now send messages:", + indent <> Markdown (Colored Cyan) "@bob Hello, Bob!" <> " -- Alice messages Bob.", + indent <> Markdown (Colored Cyan) "@alice Hey, Alice!" <> " -- Bob replies to Alice.", + "", + Markdown (Colored Green) "Other commands:", + indent <> Markdown (Colored Cyan) "/delete" <> " -- deletes contact and all messages with them.", + indent <> Markdown (Colored Cyan) "/markdown" <> " -- prints the supported markdown syntax.", + "", + "The commands may be abbreviated to a single letter: " <> listCommands ["/a", "/c", "/d", "/m"] + ] where listCommands = mconcat . intersperse ", " . map highlight highlight = Markdown (Colored Cyan) - indent = " " + indent = " " markdownInfo :: [StyledString] markdownInfo =