mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-07-19 05:07:28 +00:00
core: Chat preferences (#1261)
* core: Preferences * Changes * fix types * Follow up * Review * Review * update logic * update * update 2 * Tests * Fixed a bug and tests * Voice -> voice messages * refactor * fix Co-authored-by: Evgeny Poberezkin <2769109+epoberezkin@users.noreply.github.com>
This commit is contained in:
co-authored by
Evgeny Poberezkin
parent
14038ce370
commit
4e5a5c11dc
@@ -123,6 +123,7 @@ responseToView testView = \case
|
||||
CRSndGroupFileCancelled _ ftm fts -> viewSndGroupFileCancelled ftm fts
|
||||
CRRcvFileCancelled ft -> receivingFile_ "cancelled" ft
|
||||
CRUserProfileUpdated p p' -> viewUserProfileUpdated p p'
|
||||
CRContactPrefsUpdated ct -> viewContactPrefsUpdated ct
|
||||
CRContactAliasUpdated c -> viewContactAliasUpdated c
|
||||
CRConnectionAliasUpdated c -> viewConnectionAliasUpdated c
|
||||
CRContactUpdated c c' -> viewContactUpdated c c'
|
||||
@@ -701,6 +702,18 @@ viewUserProfileUpdated Profile {displayName = n, fullName, image} Profile {displ
|
||||
where
|
||||
notified = " (your contacts are notified)"
|
||||
|
||||
viewContactPrefsUpdated :: Contact -> [StyledString]
|
||||
viewContactPrefsUpdated Contact {profile = LocalProfile {preferences}, userPreferences = ChatPreferences {voice = userVoice}} =
|
||||
let contactVoice = preferences >>= voice
|
||||
in ["preferences were updated: " <> "contact's voice messages are " <> viewPreference contactVoice <> ", user's voice messages are " <> viewPreference userVoice]
|
||||
|
||||
viewPreference :: Maybe Preference -> StyledString
|
||||
viewPreference = \case
|
||||
Just Preference {enable} -> case enable of
|
||||
PSOn -> "on"
|
||||
PSOff -> "off"
|
||||
_ -> "unset"
|
||||
|
||||
viewGroupUpdated :: GroupInfo -> GroupInfo -> Maybe GroupMember -> [StyledString]
|
||||
viewGroupUpdated
|
||||
GroupInfo {localDisplayName = n, groupProfile = GroupProfile {fullName, image}}
|
||||
|
||||
Reference in New Issue
Block a user