mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-08-29 01:09:15 +00:00
core: change default for Disappearing Messages to "allow", mobile: support disabling without prohibiting (#2192)
* core: change default for Disappearing Messages to "allow", mobile: support disabling without prohibiting * fix tests * disable tests back in CI * fixed tests 2 * remove enable Co-authored-by: spaced4ndy <8711996+spaced4ndy@users.noreply.github.com> --------- Co-authored-by: spaced4ndy <8711996+spaced4ndy@users.noreply.github.com>
This commit is contained in:
co-authored by
spaced4ndy
parent
9edbe2e589
commit
5f41cf3c52
@@ -661,7 +661,7 @@ toChatPrefs FullPreferences {fullDelete, voice, timedMessages, calls} =
|
||||
defaultChatPrefs :: FullPreferences
|
||||
defaultChatPrefs =
|
||||
FullPreferences
|
||||
{ timedMessages = TimedMessagesPreference {allow = FANo, ttl = Nothing},
|
||||
{ timedMessages = TimedMessagesPreference {allow = FAYes, ttl = Nothing},
|
||||
fullDelete = FullDeletePreference {allow = FANo},
|
||||
-- receipts = SimplePreference {allow = FANo},
|
||||
voice = VoicePreference {allow = FAYes},
|
||||
@@ -988,7 +988,7 @@ prefStateText feature allowed param = case allowed of
|
||||
|
||||
featureStateText :: ChatFeature -> PrefEnabled -> Maybe Int -> Text
|
||||
featureStateText feature enabled param =
|
||||
chatFeatureNameText feature <> ": " <> prefEnabledToText enabled <> case enabled of
|
||||
chatFeatureNameText feature <> ": " <> prefEnabledToText feature enabled param <> case enabled of
|
||||
PrefEnabled {forUser = True} -> paramText_ feature param
|
||||
_ -> ""
|
||||
|
||||
@@ -997,12 +997,16 @@ paramText_ feature param = case feature of
|
||||
CFTimedMessages -> maybe "" (\p -> " (" <> timedTTLText p <> ")") param
|
||||
_ -> ""
|
||||
|
||||
prefEnabledToText :: PrefEnabled -> Text
|
||||
prefEnabledToText = \case
|
||||
PrefEnabled True True -> "enabled"
|
||||
prefEnabledToText :: ChatFeature -> PrefEnabled -> Maybe Int -> Text
|
||||
prefEnabledToText f enabled param = case enabled of
|
||||
PrefEnabled True True -> enabledStr
|
||||
PrefEnabled False False -> "off"
|
||||
PrefEnabled {forUser = True, forContact = False} -> "enabled for you"
|
||||
PrefEnabled {forUser = False, forContact = True} -> "enabled for contact"
|
||||
PrefEnabled {forUser = True, forContact = False} -> enabledStr <> " for you"
|
||||
PrefEnabled {forUser = False, forContact = True} -> enabledStr <> " for contact"
|
||||
where
|
||||
enabledStr = case f of
|
||||
CFTimedMessages -> if isJust param then "enabled" else "allowed"
|
||||
_ -> "enabled"
|
||||
|
||||
preferenceText :: forall f. FeatureI f => FeaturePreference f -> Text
|
||||
preferenceText p =
|
||||
|
||||
@@ -900,7 +900,7 @@ viewContactPreferences user ct ct' cups =
|
||||
viewContactPref :: FullPreferences -> FullPreferences -> Maybe Preferences -> ContactUserPreferences -> AChatFeature -> Maybe StyledString
|
||||
viewContactPref userPrefs userPrefs' ctPrefs cups (ACF f)
|
||||
| userPref == userPref' && ctPref == contactPreference = Nothing
|
||||
| otherwise = Just . plain $ chatFeatureNameText' f <> ": " <> prefEnabledToText enabled <> " (you allow: " <> countactUserPrefText userPreference <> ", contact allows: " <> preferenceText contactPreference <> ")"
|
||||
| otherwise = Just . plain $ chatFeatureNameText' f <> ": " <> prefEnabledToText (chatFeature f) enabled (prefParam userPref') <> " (you allow: " <> countactUserPrefText userPreference <> ", contact allows: " <> preferenceText contactPreference <> ")"
|
||||
where
|
||||
userPref = getPreference f userPrefs
|
||||
userPref' = getPreference f userPrefs'
|
||||
|
||||
Reference in New Issue
Block a user