From 2d23d6c497370c8ab3b11f32c12996a509ae58bf Mon Sep 17 00:00:00 2001 From: Isaac <> Date: Mon, 15 Jan 2024 23:04:55 +0400 Subject: [PATCH] Update last seen privacy --- .../Telegram-iOS/en.lproj/Localizable.strings | 2 +- .../SelectivePrivacySettingsController.swift | 29 +++++++++---------- 2 files changed, 14 insertions(+), 17 deletions(-) diff --git a/Telegram/Telegram-iOS/en.lproj/Localizable.strings b/Telegram/Telegram-iOS/en.lproj/Localizable.strings index 858e3c09db7..0b75fe6d0fc 100644 --- a/Telegram/Telegram-iOS/en.lproj/Localizable.strings +++ b/Telegram/Telegram-iOS/en.lproj/Localizable.strings @@ -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."; diff --git a/submodules/SettingsUI/Sources/Privacy and Security/SelectivePrivacySettingsController.swift b/submodules/SettingsUI/Sources/Privacy and Security/SelectivePrivacySettingsController.swift index 2d15ce97a32..91a6c4309d8 100644 --- a/submodules/SettingsUI/Sources/Privacy and Security/SelectivePrivacySettingsController.swift +++ b/submodules/SettingsUI/Sources/Privacy and Security/SelectivePrivacySettingsController.swift @@ -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,16 +850,22 @@ private func selectivePrivacySettingsControllerEntries(presentationData: Present let isEnabled: Bool switch state.setting { case .everybody: - isEnabled = false + if !state.disableFor.isEmpty { + isEnabled = true + } else { + isEnabled = false + } default: isEnabled = true } - 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)) - - if !peer.isPremium { - entries.append(.subscribeToPremium(presentationData.theme, presentationData.strings.Settings_Privacy_ReadTimePremium)) - entries.append(.subscribeToPremiumInfo(presentationData.theme, presentationData.strings.Settings_Privacy_ReadTimePremiumFooter)) + 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)) + + if !peer.isPremium { + entries.append(.subscribeToPremium(presentationData.theme, presentationData.strings.Settings_Privacy_ReadTimePremium)) + entries.append(.subscribeToPremiumInfo(presentationData.theme, presentationData.strings.Settings_Privacy_ReadTimePremiumFooter)) + } } } @@ -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)