Update last seen privacy

This commit is contained in:
Isaac
2024-01-15 23:04:55 +04:00
parent e3692128cf
commit 2d23d6c497
2 changed files with 14 additions and 17 deletions

View File

@@ -10917,7 +10917,7 @@ Sorry for the inconvenience.";
"Settings.Privacy.Messages.ValueContactsAndPremium" = "Contacts and Premium";
"Settings.Privacy.ReadTime" = "Hide Read Time";
"Settings.Privacy.ReadTimeFooter" = "Do not show the time when you read a message to people you hid your last seen from. If you turn this on, their read time will also be hidden from you.\nThis does not affect group chats.";
"Settings.Privacy.ReadTimeFooter" = "Hide the time when you read messages from people who can't see your last seen. If you turn this on, their read time will also be hidden from you.\nThis setting does not affect group chats.";
"Settings.Privacy.LastSeenRevealedToast" = "Your last seen time is now visible.";
"Settings.Privacy.MessageReadTimeRevealedToast" = "Your read times are now visible.";

View File

@@ -58,7 +58,6 @@ private final class SelectivePrivacySettingsControllerArguments {
let setPublicPhoto: (() -> Void)?
let removePublicPhoto: (() -> Void)?
let updateHideReadTime: ((Bool) -> Void)?
let updateHideReadTimeDisabled: (() -> Void)?
let openPremiumIntro: () -> Void
init(
@@ -72,7 +71,6 @@ private final class SelectivePrivacySettingsControllerArguments {
setPublicPhoto: (() -> Void)?,
removePublicPhoto: (() -> Void)?,
updateHideReadTime: ((Bool) -> Void)?,
updateHideReadTimeDisabled: (() -> Void)?,
openPremiumIntro: @escaping () -> Void
) {
self.context = context
@@ -85,7 +83,6 @@ private final class SelectivePrivacySettingsControllerArguments {
self.setPublicPhoto = setPublicPhoto
self.removePublicPhoto = removePublicPhoto
self.updateHideReadTime = updateHideReadTime
self.updateHideReadTimeDisabled = updateHideReadTimeDisabled
self.openPremiumIntro = openPremiumIntro
}
}
@@ -541,8 +538,6 @@ private enum SelectivePrivacySettingsEntry: ItemListNodeEntry {
case let .hideReadTime(_, text, enabled, value):
return ItemListSwitchItem(presentationData: presentationData, title: text, value: value, enabled: enabled, sectionId: self.section, style: .blocks, updated: { value in
arguments.updateHideReadTime?(value)
}, activatedWhileDisabled: {
arguments.updateHideReadTimeDisabled?()
})
case let .hideReadTimeInfo(_, text):
return ItemListTextItem(presentationData: presentationData, text: .plain(text), sectionId: self.section)
@@ -855,10 +850,15 @@ private func selectivePrivacySettingsControllerEntries(presentationData: Present
let isEnabled: Bool
switch state.setting {
case .everybody:
if !state.disableFor.isEmpty {
isEnabled = true
} else {
isEnabled = false
}
default:
isEnabled = true
}
if isEnabled {
entries.append(.hideReadTime(presentationData.theme, presentationData.strings.Settings_Privacy_ReadTime, isEnabled, isEnabled && state.hideReadTimeEnabled == true))
entries.append(.hideReadTimeInfo(presentationData.theme, presentationData.strings.Settings_Privacy_ReadTimeFooter))
@@ -867,6 +867,7 @@ private func selectivePrivacySettingsControllerEntries(presentationData: Present
entries.append(.subscribeToPremiumInfo(presentationData.theme, presentationData.strings.Settings_Privacy_ReadTimePremiumFooter))
}
}
}
return entries
}
@@ -1176,10 +1177,6 @@ func selectivePrivacySettingsController(
updateState { state in
return state.withUpdatedHideReadTimeEnabled(value)
}
}, updateHideReadTimeDisabled: {
HapticFeedback().error()
let presentationData = context.sharedContext.currentPresentationData.with { $0 }
presentControllerImpl?(UndoOverlayController(presentationData: presentationData, content: .info(title: nil, text: presentationData.strings.PrivacyInfo_ShowReadTime_AlwaysToast_Text, timeout: nil, customUndoText: nil), elevatedLayout: false, animateInAsReplacement: false, action: { _ in return false }), nil)
}, openPremiumIntro: {
let controller = context.sharedContext.makePremiumIntroController(context: context, source: .presence, forceDark: false, dismissed: nil)
pushControllerImpl?(controller, true)