committed by
GitHub
parent
69767126aa
commit
5116bfa79c
@@ -105,5 +105,6 @@ mkChatOpts BroadcastBotOpts {coreOptions} =
|
||||
chatServerPort = Nothing,
|
||||
optFilesFolder = Nothing,
|
||||
allowInstantFiles = True,
|
||||
muteNotifications = True,
|
||||
maintenance = False
|
||||
}
|
||||
|
||||
@@ -129,6 +129,7 @@ mobileChatOpts dbFilePrefix dbKey =
|
||||
chatServerPort = Nothing,
|
||||
optFilesFolder = Nothing,
|
||||
allowInstantFiles = True,
|
||||
muteNotifications = True,
|
||||
maintenance = True
|
||||
}
|
||||
|
||||
|
||||
@@ -36,6 +36,7 @@ data ChatOpts = ChatOpts
|
||||
chatServerPort :: Maybe String,
|
||||
optFilesFolder :: Maybe FilePath,
|
||||
allowInstantFiles :: Bool,
|
||||
muteNotifications :: Bool,
|
||||
maintenance :: Bool
|
||||
}
|
||||
|
||||
@@ -221,6 +222,11 @@ chatOptsP appDir defaultDbFileName = do
|
||||
<> short 'f'
|
||||
<> help "Send and receive instant files without acceptance"
|
||||
)
|
||||
muteNotifications <-
|
||||
switch
|
||||
( long "mute"
|
||||
<> help "Mute notifications"
|
||||
)
|
||||
maintenance <-
|
||||
switch
|
||||
( long "maintenance"
|
||||
@@ -235,6 +241,7 @@ chatOptsP appDir defaultDbFileName = do
|
||||
chatServerPort,
|
||||
optFilesFolder,
|
||||
allowInstantFiles,
|
||||
muteNotifications,
|
||||
maintenance
|
||||
}
|
||||
|
||||
|
||||
@@ -41,8 +41,8 @@ terminalChatConfig =
|
||||
|
||||
simplexChatTerminal :: WithTerminal t => ChatConfig -> ChatOpts -> t -> IO ()
|
||||
simplexChatTerminal cfg opts t = do
|
||||
sendToast <- initializeNotifications
|
||||
handle checkDBKeyError . simplexChatCore cfg opts (Just sendToast) $ \u cc -> do
|
||||
sendToast <- if muteNotifications opts then pure Nothing else Just <$> initializeNotifications
|
||||
handle checkDBKeyError . simplexChatCore cfg opts sendToast $ \u cc -> do
|
||||
ct <- newChatTerminal t
|
||||
when (firstTime cc) . printToTerminal ct $ chatWelcome u
|
||||
runChatTerminal ct cc
|
||||
|
||||
@@ -73,6 +73,7 @@ testOpts =
|
||||
chatServerPort = Nothing,
|
||||
optFilesFolder = Nothing,
|
||||
allowInstantFiles = True,
|
||||
muteNotifications = True,
|
||||
maintenance = False
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user