Skip to content

Commit

Permalink
Update last seen privacy
Browse files Browse the repository at this point in the history
  • Loading branch information
Isaac committed Jan 15, 2024
1 parent e369212 commit 2d23d6c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 17 deletions.
2 changes: 1 addition & 1 deletion Telegram/Telegram-iOS/en.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -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.";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -72,7 +71,6 @@ private final class SelectivePrivacySettingsControllerArguments {
setPublicPhoto: (() -> Void)?,
removePublicPhoto: (() -> Void)?,
updateHideReadTime: ((Bool) -> Void)?,
updateHideReadTimeDisabled: (() -> Void)?,
openPremiumIntro: @escaping () -> Void
) {
self.context = context
Expand All @@ -85,7 +83,6 @@ private final class SelectivePrivacySettingsControllerArguments {
self.setPublicPhoto = setPublicPhoto
self.removePublicPhoto = removePublicPhoto
self.updateHideReadTime = updateHideReadTime
self.updateHideReadTimeDisabled = updateHideReadTimeDisabled
self.openPremiumIntro = openPremiumIntro
}
}
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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))
}
}
}

Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 2d23d6c

Please sign in to comment.