{-# LANGUAGE NamedFieldPuns #-} {-# LANGUAGE OverloadedStrings #-} module Simplex.Chat.Help ( chatWelcome, chatHelpInfo, filesHelpInfo, groupsHelpInfo, contactsHelpInfo, myAddressHelpInfo, incognitoHelpInfo, messagesHelpInfo, remoteHelpInfo, markdownInfo, settingsInfo, databaseHelpInfo, ) where import Data.List (intersperse) import Data.Text (Text) import qualified Data.Text as T import Simplex.Chat.Markdown import Simplex.Chat.Styled import Simplex.Chat.Types (LocalProfile (..), User (..)) import System.Console.ANSI.Types highlight :: Text -> Markdown highlight = markdown (colored Cyan) green :: Text -> Markdown green = markdown (colored Green) indent :: Markdown indent = " " listHighlight :: [Text] -> Markdown listHighlight = mconcat . intersperse ", " . map highlight chatWelcome :: User -> [StyledString] chatWelcome user = map styleMarkdown [ " __ __", " ___ ___ __ __ ___ _ ___" <> "\\ \\ / /" <> " ___ _ _ _ _____", " / __|_ _| \\/ | _ \\ | | __ " <> "\\ V /" <> " / __| || | /_\\_ _|", " \\__ \\| || |\\/| | _/ |__| _|" <> " / . \\" <> "| (__| __ |/ _ \\| |", " |___/___|_| |_|_| |____|___" <> "/_/ \\_\\" <> "\\___|_||_/_/ \\_\\_|", "", "Welcome " <> green userName <> "!", "Thank you for installing SimpleX Chat!", "", "Connect to SimpleX Chat developers for any questions - just type " <> highlight "/simplex", "", "Follow our updates:", "> Reddit: https://www.reddit.com/r/SimpleXChat/", "> Twitter: https://twitter.com/SimpleXChat", "", "Type " <> highlight "/help" <> " for usage info, " <> highlight "/welcome" <> " to show this message" ] where User {profile = LocalProfile {displayName, fullName}} = user userName = if T.null fullName then displayName else fullName chatHelpInfo :: [StyledString] chatHelpInfo = map styleMarkdown [ highlight "Using SimpleX Chat", "Follow these steps to set up a connection:", "", green "Step 1: " <> highlight "/connect" <> " - Alice adds a contact.", indent <> "Alice should send the one-time invitation printed by the /connect command", indent <> "to her contact, Bob, out-of-band, via any trusted channel.", "", green "Step 2: " <> highlight "/connect " <> " - Bob accepts the invitation.", indent <> "Bob should use the invitation he received out-of-band.", "", green "Step 3: " <> "Bob and Alice are notified that the connection is set up,", indent <> "both can now send messages:", indent <> highlight "@bob Hello, Bob!" <> " - Alice messages Bob (assuming Bob has display name 'bob').", indent <> highlight "@alice Hey, Alice!" <> " - Bob replies to Alice.", "", green "Send file: " <> highlight "/file bob ./photo.jpg", "", green "Create group: " <> highlight "/group team", "", green "Create your address: " <> highlight "/address", "", green "Other commands:", indent <> highlight "/help " <> " - help on: " <> listHighlight ["groups", "contacts", "messages", "files", "address", "incognito", "remote", "settings", "db"], indent <> highlight "/profile " <> " - show / update user profile", indent <> highlight "/delete " <> " - delete contact and all messages with them", indent <> highlight "/chats " <> " - most recent chats", indent <> highlight "/markdown " <> " - supported markdown syntax", indent <> highlight "/version " <> " - SimpleX Chat version", indent <> highlight "/quit " <> " - quit chat", "", "The commands may be abbreviated: " <> listHighlight ["/c", "/f", "/g", "/p", "/ad"] <> ", etc." ] filesHelpInfo :: [StyledString] filesHelpInfo = map styleMarkdown [ green "File transfer commands:", indent <> highlight "/file @ " <> " - send file to contact", indent <> highlight "/file # " <> " - send file to group", indent <> highlight "/image [] " <> " - send file as image to @contact or #group", indent <> highlight "/freceive [] " <> " - accept to receive file", indent <> highlight "/fforward [] " <> " - forward received file to @contact or #group", indent <> highlight "/fcancel " <> " - cancel sending / receiving file", indent <> highlight "/fstatus " <> " - show file transfer status", indent <> highlight "/imgf @ " <> " - forward received image to contact", indent <> highlight "/imgf # " <> " - forward received image to group", "", "The commands may be abbreviated: " <> listHighlight ["/f", "/img", "/fr", "/ff", "/fc", "/fs"] ] groupsHelpInfo :: [StyledString] groupsHelpInfo = map styleMarkdown [ green "Group commands:", indent <> highlight "/group [] " <> " - create group", indent <> highlight "/add [] " <> " - add contact to group, roles: " <> highlight "owner" <> ", " <> highlight "admin" <> " (default), " <> highlight "member", indent <> highlight "/join " <> " - accept group invitation", indent <> highlight "/members " <> " - list group members", indent <> highlight "/remove " <> " - remove member from group", indent <> highlight "/leave " <> " - leave group", indent <> highlight "/clear # " <> " - clear all messages in the group locally", indent <> highlight "/delete # " <> " - delete group and all messages", indent <> highlight "/gp " <> " - view group profile", indent <> highlight "/gp [] " <> " - update group profile names", indent <> highlight "/group_descr [] " <> " - update/remove group description", indent <> highlight "/groups " <> " - list groups", indent <> highlight "# " <> " - send message to group", "", green "Public group links:", indent <> highlight "/create link # [role] " <> " - create public group link (with optional role, default: member)", indent <> highlight "/set link role # role " <> " - change role assigned to the users joining via the link (member/observer)", indent <> highlight "/show link # " <> " - show public group link and initial member role", indent <> highlight "/delete link # " <> " - delete link to join the group (does NOT delete any members)", "", green "Mute group messages:", indent <> highlight "/mute # " <> " - do not show contact's messages", indent <> highlight "/unmute # " <> " - show contact's messages", "", green "Group member connection and security:", indent <> highlight "/code # " <> " - show member's security code", indent <> highlight "/verify # " <> " - verify member's security code", indent <> highlight "/verify # " <> " - clear security code verification", indent <> highlight "/info # " <> " - info about member connection", indent <> highlight "/switch # " <> " - switch receiving messages to another SMP relay", "", green "Group chat preferences:", indent <> highlight "/set voice # on/off " <> " - enable/disable voice messages", indent <> highlight "/set files # on/off " <> " - enable/disable files and media (other than voice)", indent <> highlight "/set history # on/off " <> " - enable/disable sending recent history to new members", indent <> highlight "/set delete # on/off " <> " - enable/disable full message deletion", indent <> highlight "/set direct # on/off " <> " - enable/disable direct messages to other members", indent <> highlight "/set disappear # on