mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-08-08 08:31:13 +00:00
Add hide read time setting
This commit is contained in:
parent
90876a9ac4
commit
2bb75e1356
@ -1016,6 +1016,7 @@ public enum PremiumIntroSource {
|
|||||||
case nameColor
|
case nameColor
|
||||||
case similarChannels
|
case similarChannels
|
||||||
case wallpapers
|
case wallpapers
|
||||||
|
case presence
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum PremiumGiftSource: Equatable {
|
public enum PremiumGiftSource: Equatable {
|
||||||
|
@ -253,6 +253,12 @@ public enum PremiumSource: Equatable {
|
|||||||
} else {
|
} else {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
case .presence:
|
||||||
|
if case .presence = rhs {
|
||||||
|
return true
|
||||||
|
} else {
|
||||||
|
return false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -293,6 +299,7 @@ public enum PremiumSource: Equatable {
|
|||||||
case nameColor
|
case nameColor
|
||||||
case similarChannels
|
case similarChannels
|
||||||
case wallpapers
|
case wallpapers
|
||||||
|
case presence
|
||||||
|
|
||||||
var identifier: String? {
|
var identifier: String? {
|
||||||
switch self {
|
switch self {
|
||||||
@ -372,6 +379,8 @@ public enum PremiumSource: Equatable {
|
|||||||
return "similar_channels"
|
return "similar_channels"
|
||||||
case .wallpapers:
|
case .wallpapers:
|
||||||
return "wallpapers"
|
return "wallpapers"
|
||||||
|
case .presence:
|
||||||
|
return "presence"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -767,7 +767,7 @@ public func privacyAndSecurityController(
|
|||||||
|> deliverOnMainQueue
|
|> deliverOnMainQueue
|
||||||
currentInfoDisposable.set(signal.start(next: { [weak currentInfoDisposable] info in
|
currentInfoDisposable.set(signal.start(next: { [weak currentInfoDisposable] info in
|
||||||
if let info = info {
|
if let info = info {
|
||||||
pushControllerImpl?(selectivePrivacySettingsController(context: context, kind: .presence, current: info.presence, updated: { updated, _, _ in
|
pushControllerImpl?(selectivePrivacySettingsController(context: context, kind: .presence, current: info.presence, globalSettings: info.globalSettings, updated: { updated, _, _, updatedGlobalSettings in
|
||||||
if let currentInfoDisposable = currentInfoDisposable {
|
if let currentInfoDisposable = currentInfoDisposable {
|
||||||
let applySetting: Signal<Void, NoError> = privacySettingsPromise.get()
|
let applySetting: Signal<Void, NoError> = privacySettingsPromise.get()
|
||||||
|> filter { $0 != nil }
|
|> filter { $0 != nil }
|
||||||
@ -790,7 +790,7 @@ public func privacyAndSecurityController(
|
|||||||
|> deliverOnMainQueue
|
|> deliverOnMainQueue
|
||||||
currentInfoDisposable.set(signal.start(next: { [weak currentInfoDisposable] info in
|
currentInfoDisposable.set(signal.start(next: { [weak currentInfoDisposable] info in
|
||||||
if let info = info {
|
if let info = info {
|
||||||
pushControllerImpl?(selectivePrivacySettingsController(context: context, kind: .groupInvitations, current: info.groupInvitations, updated: { updated, _, _ in
|
pushControllerImpl?(selectivePrivacySettingsController(context: context, kind: .groupInvitations, current: info.groupInvitations, updated: { updated, _, _, _ in
|
||||||
if let currentInfoDisposable = currentInfoDisposable {
|
if let currentInfoDisposable = currentInfoDisposable {
|
||||||
let applySetting: Signal<Void, NoError> = privacySettingsPromise.get()
|
let applySetting: Signal<Void, NoError> = privacySettingsPromise.get()
|
||||||
|> filter { $0 != nil }
|
|> filter { $0 != nil }
|
||||||
@ -823,7 +823,7 @@ public func privacyAndSecurityController(
|
|||||||
currentInfoDisposable.set((combineLatest(privacySignal, callsSignal)
|
currentInfoDisposable.set((combineLatest(privacySignal, callsSignal)
|
||||||
|> deliverOnMainQueue).start(next: { [weak currentInfoDisposable] info, callSettings in
|
|> deliverOnMainQueue).start(next: { [weak currentInfoDisposable] info, callSettings in
|
||||||
if let info = info {
|
if let info = info {
|
||||||
pushControllerImpl?(selectivePrivacySettingsController(context: context, kind: .voiceCalls, current: info.voiceCalls, callSettings: (info.voiceCallsP2P, callSettings.0), voipConfiguration: callSettings.1, callIntegrationAvailable: CallKitIntegration.isAvailable, updated: { updated, updatedCallSettings, _ in
|
pushControllerImpl?(selectivePrivacySettingsController(context: context, kind: .voiceCalls, current: info.voiceCalls, callSettings: (info.voiceCallsP2P, callSettings.0), voipConfiguration: callSettings.1, callIntegrationAvailable: CallKitIntegration.isAvailable, updated: { updated, updatedCallSettings, _, _ in
|
||||||
if let currentInfoDisposable = currentInfoDisposable, let (updatedCallsPrivacy, updatedCallSettings) = updatedCallSettings {
|
if let currentInfoDisposable = currentInfoDisposable, let (updatedCallsPrivacy, updatedCallSettings) = updatedCallSettings {
|
||||||
let _ = updateVoiceCallSettingsSettingsInteractively(accountManager: context.sharedContext.accountManager, { _ in
|
let _ = updateVoiceCallSettingsSettingsInteractively(accountManager: context.sharedContext.accountManager, { _ in
|
||||||
return updatedCallSettings
|
return updatedCallSettings
|
||||||
@ -854,7 +854,7 @@ public func privacyAndSecurityController(
|
|||||||
requestPublicPhotoSetup?(completion)
|
requestPublicPhotoSetup?(completion)
|
||||||
}, requestPublicPhotoRemove: { completion in
|
}, requestPublicPhotoRemove: { completion in
|
||||||
requestPublicPhotoRemove?(completion)
|
requestPublicPhotoRemove?(completion)
|
||||||
}, updated: { updated, _, _ in
|
}, updated: { updated, _, _, _ in
|
||||||
if let currentInfoDisposable = currentInfoDisposable {
|
if let currentInfoDisposable = currentInfoDisposable {
|
||||||
let applySetting: Signal<Void, NoError> = privacySettingsPromise.get()
|
let applySetting: Signal<Void, NoError> = privacySettingsPromise.get()
|
||||||
|> filter { $0 != nil }
|
|> filter { $0 != nil }
|
||||||
@ -877,7 +877,7 @@ public func privacyAndSecurityController(
|
|||||||
|> deliverOnMainQueue
|
|> deliverOnMainQueue
|
||||||
currentInfoDisposable.set(signal.start(next: { [weak currentInfoDisposable] info in
|
currentInfoDisposable.set(signal.start(next: { [weak currentInfoDisposable] info in
|
||||||
if let info = info {
|
if let info = info {
|
||||||
pushControllerImpl?(selectivePrivacySettingsController(context: context, kind: .forwards, current: info.forwards, updated: { updated, _, _ in
|
pushControllerImpl?(selectivePrivacySettingsController(context: context, kind: .forwards, current: info.forwards, updated: { updated, _, _, _ in
|
||||||
if let currentInfoDisposable = currentInfoDisposable {
|
if let currentInfoDisposable = currentInfoDisposable {
|
||||||
let applySetting: Signal<Void, NoError> = privacySettingsPromise.get()
|
let applySetting: Signal<Void, NoError> = privacySettingsPromise.get()
|
||||||
|> filter { $0 != nil }
|
|> filter { $0 != nil }
|
||||||
@ -900,7 +900,7 @@ public func privacyAndSecurityController(
|
|||||||
|> deliverOnMainQueue
|
|> deliverOnMainQueue
|
||||||
currentInfoDisposable.set(signal.start(next: { [weak currentInfoDisposable] info in
|
currentInfoDisposable.set(signal.start(next: { [weak currentInfoDisposable] info in
|
||||||
if let info = info {
|
if let info = info {
|
||||||
pushControllerImpl?(selectivePrivacySettingsController(context: context, kind: .phoneNumber, current: info.phoneNumber, phoneDiscoveryEnabled: info.phoneDiscoveryEnabled, updated: { updated, _, updatedDiscoveryEnabled in
|
pushControllerImpl?(selectivePrivacySettingsController(context: context, kind: .phoneNumber, current: info.phoneNumber, phoneDiscoveryEnabled: info.phoneDiscoveryEnabled, updated: { updated, _, updatedDiscoveryEnabled, _ in
|
||||||
if let currentInfoDisposable = currentInfoDisposable {
|
if let currentInfoDisposable = currentInfoDisposable {
|
||||||
let applySetting: Signal<Void, NoError> = privacySettingsPromise.get()
|
let applySetting: Signal<Void, NoError> = privacySettingsPromise.get()
|
||||||
|> filter { $0 != nil }
|
|> filter { $0 != nil }
|
||||||
@ -930,7 +930,7 @@ public func privacyAndSecurityController(
|
|||||||
|
|
||||||
if isPremium {
|
if isPremium {
|
||||||
if let info = info {
|
if let info = info {
|
||||||
pushControllerImpl?(selectivePrivacySettingsController(context: context, kind: .voiceMessages, current: info.voiceMessages, updated: { updated, _, _ in
|
pushControllerImpl?(selectivePrivacySettingsController(context: context, kind: .voiceMessages, current: info.voiceMessages, updated: { updated, _, _, _ in
|
||||||
if let currentInfoDisposable = currentInfoDisposable {
|
if let currentInfoDisposable = currentInfoDisposable {
|
||||||
let applySetting: Signal<Void, NoError> = privacySettingsPromise.get()
|
let applySetting: Signal<Void, NoError> = privacySettingsPromise.get()
|
||||||
|> filter { $0 != nil }
|
|> filter { $0 != nil }
|
||||||
@ -970,7 +970,7 @@ public func privacyAndSecurityController(
|
|||||||
|> deliverOnMainQueue
|
|> deliverOnMainQueue
|
||||||
currentInfoDisposable.set(signal.start(next: { [weak currentInfoDisposable] info in
|
currentInfoDisposable.set(signal.start(next: { [weak currentInfoDisposable] info in
|
||||||
if let info = info {
|
if let info = info {
|
||||||
pushControllerImpl?(selectivePrivacySettingsController(context: context, kind: .bio, current: info.bio, updated: { updated, _, updatedDiscoveryEnabled in
|
pushControllerImpl?(selectivePrivacySettingsController(context: context, kind: .bio, current: info.bio, updated: { updated, _, updatedDiscoveryEnabled, _ in
|
||||||
if let currentInfoDisposable = currentInfoDisposable {
|
if let currentInfoDisposable = currentInfoDisposable {
|
||||||
let applySetting: Signal<Void, NoError> = privacySettingsPromise.get()
|
let applySetting: Signal<Void, NoError> = privacySettingsPromise.get()
|
||||||
|> filter { $0 != nil }
|
|> filter { $0 != nil }
|
||||||
|
@ -55,22 +55,35 @@ private final class SelectivePrivacySettingsControllerArguments {
|
|||||||
let updateCallIntegrationEnabled: ((Bool) -> Void)?
|
let updateCallIntegrationEnabled: ((Bool) -> Void)?
|
||||||
let updatePhoneDiscovery: ((Bool) -> Void)?
|
let updatePhoneDiscovery: ((Bool) -> Void)?
|
||||||
let copyPhoneLink: ((String) -> Void)?
|
let copyPhoneLink: ((String) -> Void)?
|
||||||
|
|
||||||
let setPublicPhoto: (() -> Void)?
|
let setPublicPhoto: (() -> Void)?
|
||||||
let removePublicPhoto: (() -> Void)?
|
let removePublicPhoto: (() -> Void)?
|
||||||
|
let updateHideReadTime: ((Bool) -> Void)?
|
||||||
|
let openPremiumIntro: () -> Void
|
||||||
|
|
||||||
init(context: AccountContext, updateType: @escaping (SelectivePrivacySettingType) -> Void, openSelective: @escaping (SelectivePrivacySettingsPeerTarget, Bool) -> Void, updateCallP2PMode: ((SelectivePrivacySettingType) -> Void)?, updateCallIntegrationEnabled: ((Bool) -> Void)?, updatePhoneDiscovery: ((Bool) -> Void)?, copyPhoneLink: ((String) -> Void)?, setPublicPhoto: (() -> Void)?, removePublicPhoto: (() -> Void)?) {
|
init(
|
||||||
|
context: AccountContext,
|
||||||
|
updateType: @escaping (SelectivePrivacySettingType) -> Void,
|
||||||
|
openSelective: @escaping (SelectivePrivacySettingsPeerTarget, Bool) -> Void,
|
||||||
|
updateCallP2PMode: ((SelectivePrivacySettingType) -> Void)?,
|
||||||
|
updateCallIntegrationEnabled: ((Bool) -> Void)?,
|
||||||
|
updatePhoneDiscovery: ((Bool) -> Void)?,
|
||||||
|
copyPhoneLink: ((String) -> Void)?,
|
||||||
|
setPublicPhoto: (() -> Void)?,
|
||||||
|
removePublicPhoto: (() -> Void)?,
|
||||||
|
updateHideReadTime: ((Bool) -> Void)?,
|
||||||
|
openPremiumIntro: @escaping () -> Void
|
||||||
|
) {
|
||||||
self.context = context
|
self.context = context
|
||||||
self.updateType = updateType
|
self.updateType = updateType
|
||||||
self.openSelective = openSelective
|
self.openSelective = openSelective
|
||||||
|
|
||||||
self.updateCallP2PMode = updateCallP2PMode
|
self.updateCallP2PMode = updateCallP2PMode
|
||||||
self.updateCallIntegrationEnabled = updateCallIntegrationEnabled
|
self.updateCallIntegrationEnabled = updateCallIntegrationEnabled
|
||||||
self.updatePhoneDiscovery = updatePhoneDiscovery
|
self.updatePhoneDiscovery = updatePhoneDiscovery
|
||||||
self.copyPhoneLink = copyPhoneLink
|
self.copyPhoneLink = copyPhoneLink
|
||||||
|
|
||||||
self.setPublicPhoto = setPublicPhoto
|
self.setPublicPhoto = setPublicPhoto
|
||||||
self.removePublicPhoto = removePublicPhoto
|
self.removePublicPhoto = removePublicPhoto
|
||||||
|
self.updateHideReadTime = updateHideReadTime
|
||||||
|
self.openPremiumIntro = openPremiumIntro
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -83,6 +96,8 @@ private enum SelectivePrivacySettingsSection: Int32 {
|
|||||||
case callsIntegrationEnabled
|
case callsIntegrationEnabled
|
||||||
case phoneDiscovery
|
case phoneDiscovery
|
||||||
case photo
|
case photo
|
||||||
|
case hideReadTime
|
||||||
|
case premium
|
||||||
}
|
}
|
||||||
|
|
||||||
private func stringForUserCount(_ peers: [EnginePeer.Id: SelectivePrivacyPeer], strings: PresentationStrings) -> String {
|
private func stringForUserCount(_ peers: [EnginePeer.Id: SelectivePrivacyPeer], strings: PresentationStrings) -> String {
|
||||||
@ -123,6 +138,10 @@ private enum SelectivePrivacySettingsEntry: ItemListNodeEntry {
|
|||||||
case phoneDiscoveryEverybody(PresentationTheme, String, Bool)
|
case phoneDiscoveryEverybody(PresentationTheme, String, Bool)
|
||||||
case phoneDiscoveryMyContacts(PresentationTheme, String, Bool)
|
case phoneDiscoveryMyContacts(PresentationTheme, String, Bool)
|
||||||
case phoneDiscoveryInfo(PresentationTheme, String, String)
|
case phoneDiscoveryInfo(PresentationTheme, String, String)
|
||||||
|
case hideReadTime(PresentationTheme, String, Bool)
|
||||||
|
case hideReadTimeInfo(PresentationTheme, String)
|
||||||
|
case subscribeToPremium(PresentationTheme, String)
|
||||||
|
case subscribeToPremiumInfo(PresentationTheme, String)
|
||||||
case setPublicPhoto(PresentationTheme, String)
|
case setPublicPhoto(PresentationTheme, String)
|
||||||
case removePublicPhoto(PresentationTheme, String, EnginePeer, TelegramMediaImage?, UIImage?)
|
case removePublicPhoto(PresentationTheme, String, EnginePeer, TelegramMediaImage?, UIImage?)
|
||||||
case publicPhotoInfo(PresentationTheme, String)
|
case publicPhotoInfo(PresentationTheme, String)
|
||||||
@ -145,6 +164,10 @@ private enum SelectivePrivacySettingsEntry: ItemListNodeEntry {
|
|||||||
return SelectivePrivacySettingsSection.phoneDiscovery.rawValue
|
return SelectivePrivacySettingsSection.phoneDiscovery.rawValue
|
||||||
case .setPublicPhoto, .removePublicPhoto, .publicPhotoInfo:
|
case .setPublicPhoto, .removePublicPhoto, .publicPhotoInfo:
|
||||||
return SelectivePrivacySettingsSection.photo.rawValue
|
return SelectivePrivacySettingsSection.photo.rawValue
|
||||||
|
case .hideReadTime, .hideReadTimeInfo:
|
||||||
|
return SelectivePrivacySettingsSection.hideReadTime.rawValue
|
||||||
|
case .subscribeToPremium, .subscribeToPremiumInfo:
|
||||||
|
return SelectivePrivacySettingsSection.premium.rawValue
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -206,6 +229,14 @@ private enum SelectivePrivacySettingsEntry: ItemListNodeEntry {
|
|||||||
return 25
|
return 25
|
||||||
case .publicPhotoInfo:
|
case .publicPhotoInfo:
|
||||||
return 26
|
return 26
|
||||||
|
case .hideReadTime:
|
||||||
|
return 27
|
||||||
|
case .hideReadTimeInfo:
|
||||||
|
return 28
|
||||||
|
case .subscribeToPremium:
|
||||||
|
return 29
|
||||||
|
case .subscribeToPremiumInfo:
|
||||||
|
return 30
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -379,6 +410,30 @@ private enum SelectivePrivacySettingsEntry: ItemListNodeEntry {
|
|||||||
} else {
|
} else {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
case let .hideReadTime(lhsTheme, lhsText, lhsValue):
|
||||||
|
if case let .hideReadTime(rhsTheme, rhsText, rhsValue) = rhs, lhsTheme === rhsTheme, lhsText == rhsText, lhsValue == rhsValue {
|
||||||
|
return true
|
||||||
|
} else {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
case let .hideReadTimeInfo(lhsTheme, lhsText):
|
||||||
|
if case let .hideReadTimeInfo(rhsTheme, rhsText) = rhs, lhsTheme === rhsTheme, lhsText == rhsText {
|
||||||
|
return true
|
||||||
|
} else {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
case let .subscribeToPremium(lhsTheme, lhsText):
|
||||||
|
if case let .subscribeToPremium(rhsTheme, rhsText) = rhs, lhsTheme === rhsTheme, lhsText == rhsText {
|
||||||
|
return true
|
||||||
|
} else {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
case let .subscribeToPremiumInfo(lhsTheme, lhsText):
|
||||||
|
if case let .subscribeToPremiumInfo(rhsTheme, rhsText) = rhs, lhsTheme === rhsTheme, lhsText == rhsText {
|
||||||
|
return true
|
||||||
|
} else {
|
||||||
|
return false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -480,6 +535,18 @@ private enum SelectivePrivacySettingsEntry: ItemListNodeEntry {
|
|||||||
case let .publicPhotoInfo(_, text):
|
case let .publicPhotoInfo(_, text):
|
||||||
return ItemListTextItem(presentationData: presentationData, text: .markdown(text), sectionId: self.section, linkAction: { _ in
|
return ItemListTextItem(presentationData: presentationData, text: .markdown(text), sectionId: self.section, linkAction: { _ in
|
||||||
})
|
})
|
||||||
|
case let .hideReadTime(_, text, value):
|
||||||
|
return ItemListSwitchItem(presentationData: presentationData, title: text, value: value, sectionId: self.section, style: .blocks, updated: { value in
|
||||||
|
arguments.updateHideReadTime?(value)
|
||||||
|
})
|
||||||
|
case let .hideReadTimeInfo(_, text):
|
||||||
|
return ItemListTextItem(presentationData: presentationData, text: .plain(text), sectionId: self.section)
|
||||||
|
case let .subscribeToPremium(_, text):
|
||||||
|
return ItemListPeerActionItem(presentationData: presentationData, icon: nil, title: text, sectionId: self.section, height: .generic, color: .accent, editing: false, action: {
|
||||||
|
arguments.openPremiumIntro()
|
||||||
|
})
|
||||||
|
case let .subscribeToPremiumInfo(_, text):
|
||||||
|
return ItemListTextItem(presentationData: presentationData, text: .plain(text), sectionId: self.section)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -500,10 +567,11 @@ private struct SelectivePrivacySettingsControllerState: Equatable {
|
|||||||
let callIntegrationAvailable: Bool?
|
let callIntegrationAvailable: Bool?
|
||||||
let callIntegrationEnabled: Bool?
|
let callIntegrationEnabled: Bool?
|
||||||
let phoneDiscoveryEnabled: Bool?
|
let phoneDiscoveryEnabled: Bool?
|
||||||
|
let hideReadTimeEnabled: Bool?
|
||||||
|
|
||||||
let uploadedPhoto: UIImage?
|
let uploadedPhoto: UIImage?
|
||||||
|
|
||||||
init(setting: SelectivePrivacySettingType, enableFor: [EnginePeer.Id: SelectivePrivacyPeer], disableFor: [EnginePeer.Id: SelectivePrivacyPeer], enableForCloseFriends: Bool, saving: Bool, callDataSaving: VoiceCallDataSaving?, callP2PMode: SelectivePrivacySettingType?, callP2PEnableFor: [EnginePeer.Id: SelectivePrivacyPeer]?, callP2PDisableFor: [EnginePeer.Id: SelectivePrivacyPeer]?, callP2PEnableForCloseFriends: Bool?, callIntegrationAvailable: Bool?, callIntegrationEnabled: Bool?, phoneDiscoveryEnabled: Bool?, uploadedPhoto: UIImage?) {
|
init(setting: SelectivePrivacySettingType, enableFor: [EnginePeer.Id: SelectivePrivacyPeer], disableFor: [EnginePeer.Id: SelectivePrivacyPeer], enableForCloseFriends: Bool, saving: Bool, callDataSaving: VoiceCallDataSaving?, callP2PMode: SelectivePrivacySettingType?, callP2PEnableFor: [EnginePeer.Id: SelectivePrivacyPeer]?, callP2PDisableFor: [EnginePeer.Id: SelectivePrivacyPeer]?, callP2PEnableForCloseFriends: Bool?, callIntegrationAvailable: Bool?, callIntegrationEnabled: Bool?, phoneDiscoveryEnabled: Bool?, hideReadTimeEnabled: Bool?, uploadedPhoto: UIImage?) {
|
||||||
self.setting = setting
|
self.setting = setting
|
||||||
self.enableFor = enableFor
|
self.enableFor = enableFor
|
||||||
self.disableFor = disableFor
|
self.disableFor = disableFor
|
||||||
@ -517,6 +585,7 @@ private struct SelectivePrivacySettingsControllerState: Equatable {
|
|||||||
self.callIntegrationAvailable = callIntegrationAvailable
|
self.callIntegrationAvailable = callIntegrationAvailable
|
||||||
self.callIntegrationEnabled = callIntegrationEnabled
|
self.callIntegrationEnabled = callIntegrationEnabled
|
||||||
self.phoneDiscoveryEnabled = phoneDiscoveryEnabled
|
self.phoneDiscoveryEnabled = phoneDiscoveryEnabled
|
||||||
|
self.hideReadTimeEnabled = hideReadTimeEnabled
|
||||||
self.uploadedPhoto = uploadedPhoto
|
self.uploadedPhoto = uploadedPhoto
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -560,6 +629,9 @@ private struct SelectivePrivacySettingsControllerState: Equatable {
|
|||||||
if lhs.phoneDiscoveryEnabled != rhs.phoneDiscoveryEnabled {
|
if lhs.phoneDiscoveryEnabled != rhs.phoneDiscoveryEnabled {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
if lhs.hideReadTimeEnabled != rhs.hideReadTimeEnabled {
|
||||||
|
return false
|
||||||
|
}
|
||||||
if lhs.uploadedPhoto !== rhs.uploadedPhoto {
|
if lhs.uploadedPhoto !== rhs.uploadedPhoto {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
@ -568,52 +640,57 @@ private struct SelectivePrivacySettingsControllerState: Equatable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func withUpdatedSetting(_ setting: SelectivePrivacySettingType) -> SelectivePrivacySettingsControllerState {
|
func withUpdatedSetting(_ setting: SelectivePrivacySettingType) -> SelectivePrivacySettingsControllerState {
|
||||||
return SelectivePrivacySettingsControllerState(setting: setting, enableFor: self.enableFor, disableFor: self.disableFor, enableForCloseFriends: self.enableForCloseFriends, saving: self.saving, callDataSaving: self.callDataSaving, callP2PMode: self.callP2PMode, callP2PEnableFor: self.callP2PEnableFor, callP2PDisableFor: self.callP2PDisableFor, callP2PEnableForCloseFriends: self.callP2PEnableForCloseFriends, callIntegrationAvailable: self.callIntegrationAvailable, callIntegrationEnabled: self.callIntegrationEnabled, phoneDiscoveryEnabled: self.phoneDiscoveryEnabled, uploadedPhoto: self.uploadedPhoto)
|
return SelectivePrivacySettingsControllerState(setting: setting, enableFor: self.enableFor, disableFor: self.disableFor, enableForCloseFriends: self.enableForCloseFriends, saving: self.saving, callDataSaving: self.callDataSaving, callP2PMode: self.callP2PMode, callP2PEnableFor: self.callP2PEnableFor, callP2PDisableFor: self.callP2PDisableFor, callP2PEnableForCloseFriends: self.callP2PEnableForCloseFriends, callIntegrationAvailable: self.callIntegrationAvailable, callIntegrationEnabled: self.callIntegrationEnabled, phoneDiscoveryEnabled: self.phoneDiscoveryEnabled, hideReadTimeEnabled: self.hideReadTimeEnabled, uploadedPhoto: self.uploadedPhoto)
|
||||||
}
|
}
|
||||||
|
|
||||||
func withUpdatedEnableFor(_ enableFor: [EnginePeer.Id: SelectivePrivacyPeer]) -> SelectivePrivacySettingsControllerState {
|
func withUpdatedEnableFor(_ enableFor: [EnginePeer.Id: SelectivePrivacyPeer]) -> SelectivePrivacySettingsControllerState {
|
||||||
return SelectivePrivacySettingsControllerState(setting: self.setting, enableFor: enableFor, disableFor: self.disableFor, enableForCloseFriends: self.enableForCloseFriends, saving: self.saving, callDataSaving: self.callDataSaving, callP2PMode: self.callP2PMode, callP2PEnableFor: self.callP2PEnableFor, callP2PDisableFor: self.callP2PDisableFor, callP2PEnableForCloseFriends: self.callP2PEnableForCloseFriends, callIntegrationAvailable: self.callIntegrationAvailable, callIntegrationEnabled: self.callIntegrationEnabled, phoneDiscoveryEnabled: self.phoneDiscoveryEnabled, uploadedPhoto: self.uploadedPhoto)
|
return SelectivePrivacySettingsControllerState(setting: self.setting, enableFor: enableFor, disableFor: self.disableFor, enableForCloseFriends: self.enableForCloseFriends, saving: self.saving, callDataSaving: self.callDataSaving, callP2PMode: self.callP2PMode, callP2PEnableFor: self.callP2PEnableFor, callP2PDisableFor: self.callP2PDisableFor, callP2PEnableForCloseFriends: self.callP2PEnableForCloseFriends, callIntegrationAvailable: self.callIntegrationAvailable, callIntegrationEnabled: self.callIntegrationEnabled, phoneDiscoveryEnabled: self.phoneDiscoveryEnabled, hideReadTimeEnabled: self.hideReadTimeEnabled, uploadedPhoto: self.uploadedPhoto)
|
||||||
}
|
}
|
||||||
|
|
||||||
func withUpdatedDisableFor(_ disableFor: [EnginePeer.Id: SelectivePrivacyPeer]) -> SelectivePrivacySettingsControllerState {
|
func withUpdatedDisableFor(_ disableFor: [EnginePeer.Id: SelectivePrivacyPeer]) -> SelectivePrivacySettingsControllerState {
|
||||||
return SelectivePrivacySettingsControllerState(setting: self.setting, enableFor: self.enableFor, disableFor: disableFor, enableForCloseFriends: self.enableForCloseFriends, saving: self.saving, callDataSaving: self.callDataSaving, callP2PMode: self.callP2PMode, callP2PEnableFor: self.callP2PEnableFor, callP2PDisableFor: self.callP2PDisableFor, callP2PEnableForCloseFriends: self.callP2PEnableForCloseFriends, callIntegrationAvailable: self.callIntegrationAvailable, callIntegrationEnabled: self.callIntegrationEnabled, phoneDiscoveryEnabled: self.phoneDiscoveryEnabled, uploadedPhoto: self.uploadedPhoto)
|
return SelectivePrivacySettingsControllerState(setting: self.setting, enableFor: self.enableFor, disableFor: disableFor, enableForCloseFriends: self.enableForCloseFriends, saving: self.saving, callDataSaving: self.callDataSaving, callP2PMode: self.callP2PMode, callP2PEnableFor: self.callP2PEnableFor, callP2PDisableFor: self.callP2PDisableFor, callP2PEnableForCloseFriends: self.callP2PEnableForCloseFriends, callIntegrationAvailable: self.callIntegrationAvailable, callIntegrationEnabled: self.callIntegrationEnabled, phoneDiscoveryEnabled: self.phoneDiscoveryEnabled, hideReadTimeEnabled: self.hideReadTimeEnabled, uploadedPhoto: self.uploadedPhoto)
|
||||||
}
|
}
|
||||||
|
|
||||||
func withUpdatedEnableForCloseFriends(_ enableForCloseFriends: Bool) -> SelectivePrivacySettingsControllerState {
|
func withUpdatedEnableForCloseFriends(_ enableForCloseFriends: Bool) -> SelectivePrivacySettingsControllerState {
|
||||||
return SelectivePrivacySettingsControllerState(setting: self.setting, enableFor: self.enableFor, disableFor: self.disableFor, enableForCloseFriends: enableForCloseFriends, saving: self.saving, callDataSaving: self.callDataSaving, callP2PMode: self.callP2PMode, callP2PEnableFor: self.callP2PEnableFor, callP2PDisableFor: self.callP2PDisableFor, callP2PEnableForCloseFriends: self.callP2PEnableForCloseFriends, callIntegrationAvailable: self.callIntegrationAvailable, callIntegrationEnabled: self.callIntegrationEnabled, phoneDiscoveryEnabled: self.phoneDiscoveryEnabled, uploadedPhoto: self.uploadedPhoto)
|
return SelectivePrivacySettingsControllerState(setting: self.setting, enableFor: self.enableFor, disableFor: self.disableFor, enableForCloseFriends: enableForCloseFriends, saving: self.saving, callDataSaving: self.callDataSaving, callP2PMode: self.callP2PMode, callP2PEnableFor: self.callP2PEnableFor, callP2PDisableFor: self.callP2PDisableFor, callP2PEnableForCloseFriends: self.callP2PEnableForCloseFriends, callIntegrationAvailable: self.callIntegrationAvailable, callIntegrationEnabled: self.callIntegrationEnabled, phoneDiscoveryEnabled: self.phoneDiscoveryEnabled, hideReadTimeEnabled: self.hideReadTimeEnabled, uploadedPhoto: self.uploadedPhoto)
|
||||||
}
|
}
|
||||||
|
|
||||||
func withUpdatedSaving(_ saving: Bool) -> SelectivePrivacySettingsControllerState {
|
func withUpdatedSaving(_ saving: Bool) -> SelectivePrivacySettingsControllerState {
|
||||||
return SelectivePrivacySettingsControllerState(setting: self.setting, enableFor: self.enableFor, disableFor: self.disableFor, enableForCloseFriends: self.enableForCloseFriends, saving: saving, callDataSaving: self.callDataSaving, callP2PMode: self.callP2PMode, callP2PEnableFor: self.callP2PEnableFor, callP2PDisableFor: self.callP2PDisableFor, callP2PEnableForCloseFriends: self.callP2PEnableForCloseFriends, callIntegrationAvailable: self.callIntegrationAvailable, callIntegrationEnabled: self.callIntegrationEnabled, phoneDiscoveryEnabled: self.phoneDiscoveryEnabled, uploadedPhoto: self.uploadedPhoto)
|
return SelectivePrivacySettingsControllerState(setting: self.setting, enableFor: self.enableFor, disableFor: self.disableFor, enableForCloseFriends: self.enableForCloseFriends, saving: saving, callDataSaving: self.callDataSaving, callP2PMode: self.callP2PMode, callP2PEnableFor: self.callP2PEnableFor, callP2PDisableFor: self.callP2PDisableFor, callP2PEnableForCloseFriends: self.callP2PEnableForCloseFriends, callIntegrationAvailable: self.callIntegrationAvailable, callIntegrationEnabled: self.callIntegrationEnabled, phoneDiscoveryEnabled: self.phoneDiscoveryEnabled, hideReadTimeEnabled: self.hideReadTimeEnabled, uploadedPhoto: self.uploadedPhoto)
|
||||||
}
|
}
|
||||||
|
|
||||||
func withUpdatedCallP2PMode(_ mode: SelectivePrivacySettingType) -> SelectivePrivacySettingsControllerState {
|
func withUpdatedCallP2PMode(_ mode: SelectivePrivacySettingType) -> SelectivePrivacySettingsControllerState {
|
||||||
return SelectivePrivacySettingsControllerState(setting: self.setting, enableFor: self.enableFor, disableFor: self.disableFor, enableForCloseFriends: self.enableForCloseFriends, saving: self.saving, callDataSaving: self.callDataSaving, callP2PMode: mode, callP2PEnableFor: self.callP2PEnableFor, callP2PDisableFor: self.callP2PDisableFor, callP2PEnableForCloseFriends: self.callP2PEnableForCloseFriends, callIntegrationAvailable: self.callIntegrationAvailable, callIntegrationEnabled: self.callIntegrationEnabled, phoneDiscoveryEnabled: self.phoneDiscoveryEnabled, uploadedPhoto: self.uploadedPhoto)
|
return SelectivePrivacySettingsControllerState(setting: self.setting, enableFor: self.enableFor, disableFor: self.disableFor, enableForCloseFriends: self.enableForCloseFriends, saving: self.saving, callDataSaving: self.callDataSaving, callP2PMode: mode, callP2PEnableFor: self.callP2PEnableFor, callP2PDisableFor: self.callP2PDisableFor, callP2PEnableForCloseFriends: self.callP2PEnableForCloseFriends, callIntegrationAvailable: self.callIntegrationAvailable, callIntegrationEnabled: self.callIntegrationEnabled, phoneDiscoveryEnabled: self.phoneDiscoveryEnabled, hideReadTimeEnabled: self.hideReadTimeEnabled, uploadedPhoto: self.uploadedPhoto)
|
||||||
}
|
}
|
||||||
|
|
||||||
func withUpdatedCallP2PEnableFor(_ enableFor: [EnginePeer.Id: SelectivePrivacyPeer]) -> SelectivePrivacySettingsControllerState {
|
func withUpdatedCallP2PEnableFor(_ enableFor: [EnginePeer.Id: SelectivePrivacyPeer]) -> SelectivePrivacySettingsControllerState {
|
||||||
return SelectivePrivacySettingsControllerState(setting: self.setting, enableFor: self.enableFor, disableFor: self.disableFor, enableForCloseFriends: self.enableForCloseFriends, saving: self.saving, callDataSaving: self.callDataSaving, callP2PMode: self.callP2PMode, callP2PEnableFor: enableFor, callP2PDisableFor: self.callP2PDisableFor, callP2PEnableForCloseFriends: self.callP2PEnableForCloseFriends, callIntegrationAvailable: self.callIntegrationAvailable, callIntegrationEnabled: self.callIntegrationEnabled, phoneDiscoveryEnabled: self.phoneDiscoveryEnabled, uploadedPhoto: self.uploadedPhoto)
|
return SelectivePrivacySettingsControllerState(setting: self.setting, enableFor: self.enableFor, disableFor: self.disableFor, enableForCloseFriends: self.enableForCloseFriends, saving: self.saving, callDataSaving: self.callDataSaving, callP2PMode: self.callP2PMode, callP2PEnableFor: enableFor, callP2PDisableFor: self.callP2PDisableFor, callP2PEnableForCloseFriends: self.callP2PEnableForCloseFriends, callIntegrationAvailable: self.callIntegrationAvailable, callIntegrationEnabled: self.callIntegrationEnabled, phoneDiscoveryEnabled: self.phoneDiscoveryEnabled, hideReadTimeEnabled: self.hideReadTimeEnabled, uploadedPhoto: self.uploadedPhoto)
|
||||||
}
|
}
|
||||||
|
|
||||||
func withUpdatedCallP2PDisableFor(_ disableFor: [EnginePeer.Id: SelectivePrivacyPeer]) -> SelectivePrivacySettingsControllerState {
|
func withUpdatedCallP2PDisableFor(_ disableFor: [EnginePeer.Id: SelectivePrivacyPeer]) -> SelectivePrivacySettingsControllerState {
|
||||||
return SelectivePrivacySettingsControllerState(setting: self.setting, enableFor: self.enableFor, disableFor: self.disableFor, enableForCloseFriends: self.enableForCloseFriends, saving: self.saving, callDataSaving: self.callDataSaving, callP2PMode: self.callP2PMode, callP2PEnableFor: self.callP2PEnableFor, callP2PDisableFor: disableFor, callP2PEnableForCloseFriends: self.callP2PEnableForCloseFriends, callIntegrationAvailable: self.callIntegrationAvailable, callIntegrationEnabled: self.callIntegrationEnabled, phoneDiscoveryEnabled: self.phoneDiscoveryEnabled, uploadedPhoto: self.uploadedPhoto)
|
return SelectivePrivacySettingsControllerState(setting: self.setting, enableFor: self.enableFor, disableFor: self.disableFor, enableForCloseFriends: self.enableForCloseFriends, saving: self.saving, callDataSaving: self.callDataSaving, callP2PMode: self.callP2PMode, callP2PEnableFor: self.callP2PEnableFor, callP2PDisableFor: disableFor, callP2PEnableForCloseFriends: self.callP2PEnableForCloseFriends, callIntegrationAvailable: self.callIntegrationAvailable, callIntegrationEnabled: self.callIntegrationEnabled, phoneDiscoveryEnabled: self.phoneDiscoveryEnabled, hideReadTimeEnabled: self.hideReadTimeEnabled, uploadedPhoto: self.uploadedPhoto)
|
||||||
}
|
}
|
||||||
|
|
||||||
func withUpdatedCallP2PEnableForCloseFriends(_ callP2PEnableForCloseFriends: Bool) -> SelectivePrivacySettingsControllerState {
|
func withUpdatedCallP2PEnableForCloseFriends(_ callP2PEnableForCloseFriends: Bool) -> SelectivePrivacySettingsControllerState {
|
||||||
return SelectivePrivacySettingsControllerState(setting: self.setting, enableFor: self.enableFor, disableFor: self.disableFor, enableForCloseFriends: self.enableForCloseFriends, saving: self.saving, callDataSaving: self.callDataSaving, callP2PMode: self.callP2PMode, callP2PEnableFor: self.callP2PEnableFor, callP2PDisableFor: self.callP2PDisableFor, callP2PEnableForCloseFriends: callP2PEnableForCloseFriends, callIntegrationAvailable: self.callIntegrationAvailable, callIntegrationEnabled: self.callIntegrationEnabled, phoneDiscoveryEnabled: self.phoneDiscoveryEnabled, uploadedPhoto: self.uploadedPhoto)
|
return SelectivePrivacySettingsControllerState(setting: self.setting, enableFor: self.enableFor, disableFor: self.disableFor, enableForCloseFriends: self.enableForCloseFriends, saving: self.saving, callDataSaving: self.callDataSaving, callP2PMode: self.callP2PMode, callP2PEnableFor: self.callP2PEnableFor, callP2PDisableFor: self.callP2PDisableFor, callP2PEnableForCloseFriends: callP2PEnableForCloseFriends, callIntegrationAvailable: self.callIntegrationAvailable, callIntegrationEnabled: self.callIntegrationEnabled, phoneDiscoveryEnabled: self.phoneDiscoveryEnabled, hideReadTimeEnabled: self.hideReadTimeEnabled, uploadedPhoto: self.uploadedPhoto)
|
||||||
}
|
}
|
||||||
|
|
||||||
func withUpdatedCallsIntegrationEnabled(_ enabled: Bool) -> SelectivePrivacySettingsControllerState {
|
func withUpdatedCallsIntegrationEnabled(_ enabled: Bool) -> SelectivePrivacySettingsControllerState {
|
||||||
return SelectivePrivacySettingsControllerState(setting: self.setting, enableFor: self.enableFor, disableFor: self.disableFor, enableForCloseFriends: self.enableForCloseFriends, saving: self.saving, callDataSaving: self.callDataSaving, callP2PMode: self.callP2PMode, callP2PEnableFor: self.callP2PEnableFor, callP2PDisableFor: self.callP2PDisableFor, callP2PEnableForCloseFriends: self.callP2PEnableForCloseFriends, callIntegrationAvailable: self.callIntegrationAvailable, callIntegrationEnabled: enabled, phoneDiscoveryEnabled: self.phoneDiscoveryEnabled, uploadedPhoto: self.uploadedPhoto)
|
return SelectivePrivacySettingsControllerState(setting: self.setting, enableFor: self.enableFor, disableFor: self.disableFor, enableForCloseFriends: self.enableForCloseFriends, saving: self.saving, callDataSaving: self.callDataSaving, callP2PMode: self.callP2PMode, callP2PEnableFor: self.callP2PEnableFor, callP2PDisableFor: self.callP2PDisableFor, callP2PEnableForCloseFriends: self.callP2PEnableForCloseFriends, callIntegrationAvailable: self.callIntegrationAvailable, callIntegrationEnabled: enabled, phoneDiscoveryEnabled: self.phoneDiscoveryEnabled, hideReadTimeEnabled: self.hideReadTimeEnabled, uploadedPhoto: self.uploadedPhoto)
|
||||||
}
|
}
|
||||||
|
|
||||||
func withUpdatedPhoneDiscoveryEnabled(_ phoneDiscoveryEnabled: Bool) -> SelectivePrivacySettingsControllerState {
|
func withUpdatedPhoneDiscoveryEnabled(_ phoneDiscoveryEnabled: Bool) -> SelectivePrivacySettingsControllerState {
|
||||||
return SelectivePrivacySettingsControllerState(setting: self.setting, enableFor: self.enableFor, disableFor: self.disableFor, enableForCloseFriends: self.enableForCloseFriends, saving: self.saving, callDataSaving: self.callDataSaving, callP2PMode: self.callP2PMode, callP2PEnableFor: self.callP2PEnableFor, callP2PDisableFor: self.callP2PDisableFor, callP2PEnableForCloseFriends: self.callP2PEnableForCloseFriends, callIntegrationAvailable: self.callIntegrationAvailable, callIntegrationEnabled: self.callIntegrationEnabled, phoneDiscoveryEnabled: phoneDiscoveryEnabled, uploadedPhoto: self.uploadedPhoto)
|
return SelectivePrivacySettingsControllerState(setting: self.setting, enableFor: self.enableFor, disableFor: self.disableFor, enableForCloseFriends: self.enableForCloseFriends, saving: self.saving, callDataSaving: self.callDataSaving, callP2PMode: self.callP2PMode, callP2PEnableFor: self.callP2PEnableFor, callP2PDisableFor: self.callP2PDisableFor, callP2PEnableForCloseFriends: self.callP2PEnableForCloseFriends, callIntegrationAvailable: self.callIntegrationAvailable, callIntegrationEnabled: self.callIntegrationEnabled, phoneDiscoveryEnabled: phoneDiscoveryEnabled, hideReadTimeEnabled: self.hideReadTimeEnabled, uploadedPhoto: self.uploadedPhoto)
|
||||||
}
|
}
|
||||||
|
|
||||||
func withUpdatedUploadedPhoto(_ uploadedPhoto: UIImage?) -> SelectivePrivacySettingsControllerState {
|
func withUpdatedUploadedPhoto(_ uploadedPhoto: UIImage?) -> SelectivePrivacySettingsControllerState {
|
||||||
return SelectivePrivacySettingsControllerState(setting: self.setting, enableFor: self.enableFor, disableFor: self.disableFor, enableForCloseFriends: self.enableForCloseFriends, saving: self.saving, callDataSaving: self.callDataSaving, callP2PMode: self.callP2PMode, callP2PEnableFor: self.callP2PEnableFor, callP2PDisableFor: self.callP2PDisableFor, callP2PEnableForCloseFriends: self.callP2PEnableForCloseFriends, callIntegrationAvailable: self.callIntegrationAvailable, callIntegrationEnabled: self.callIntegrationEnabled, phoneDiscoveryEnabled: self.phoneDiscoveryEnabled, uploadedPhoto: uploadedPhoto)
|
return SelectivePrivacySettingsControllerState(setting: self.setting, enableFor: self.enableFor, disableFor: self.disableFor, enableForCloseFriends: self.enableForCloseFriends, saving: self.saving, callDataSaving: self.callDataSaving, callP2PMode: self.callP2PMode, callP2PEnableFor: self.callP2PEnableFor, callP2PDisableFor: self.callP2PDisableFor, callP2PEnableForCloseFriends: self.callP2PEnableForCloseFriends, callIntegrationAvailable: self.callIntegrationAvailable, callIntegrationEnabled: self.callIntegrationEnabled, phoneDiscoveryEnabled: self.phoneDiscoveryEnabled, hideReadTimeEnabled: self.hideReadTimeEnabled, uploadedPhoto: uploadedPhoto)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func withUpdatedHideReadTimeEnabled(_ hideReadTimeEnabled: Bool) -> SelectivePrivacySettingsControllerState {
|
||||||
|
return SelectivePrivacySettingsControllerState(setting: self.setting, enableFor: self.enableFor, disableFor: self.disableFor, enableForCloseFriends: self.enableForCloseFriends, saving: self.saving, callDataSaving: self.callDataSaving, callP2PMode: self.callP2PMode, callP2PEnableFor: self.callP2PEnableFor, callP2PDisableFor: self.callP2PDisableFor, callP2PEnableForCloseFriends: self.callP2PEnableForCloseFriends, callIntegrationAvailable: self.callIntegrationAvailable, callIntegrationEnabled: self.callIntegrationEnabled, phoneDiscoveryEnabled: self.phoneDiscoveryEnabled, hideReadTimeEnabled: hideReadTimeEnabled, uploadedPhoto: self.uploadedPhoto)
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private func selectivePrivacySettingsControllerEntries(presentationData: PresentationData, kind: SelectivePrivacySettingsKind, state: SelectivePrivacySettingsControllerState, peerName: String, phoneNumber: String, peer: EnginePeer?, publicPhoto: TelegramMediaImage?) -> [SelectivePrivacySettingsEntry] {
|
private func selectivePrivacySettingsControllerEntries(presentationData: PresentationData, kind: SelectivePrivacySettingsKind, state: SelectivePrivacySettingsControllerState, peerName: String, phoneNumber: String, peer: EnginePeer?, publicPhoto: TelegramMediaImage?) -> [SelectivePrivacySettingsEntry] {
|
||||||
@ -769,6 +846,17 @@ private func selectivePrivacySettingsControllerEntries(presentationData: Present
|
|||||||
entries.append(.publicPhotoInfo(presentationData.theme, presentationData.strings.Privacy_ProfilePhoto_PublicPhotoInfo))
|
entries.append(.publicPhotoInfo(presentationData.theme, presentationData.strings.Privacy_ProfilePhoto_PublicPhotoInfo))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if case .presence = kind, let peer {
|
||||||
|
//TODO:localize
|
||||||
|
entries.append(.hideReadTime(presentationData.theme, "Hide Read Time", state.hideReadTimeEnabled == true))
|
||||||
|
entries.append(.hideReadTimeInfo(presentationData.theme, "Do not show the time when you read a message to people you hid your last seen from."))
|
||||||
|
|
||||||
|
if !peer.isPremium {
|
||||||
|
entries.append(.subscribeToPremium(presentationData.theme, "Subscribe to Telegram Premium"))
|
||||||
|
entries.append(.subscribeToPremiumInfo(presentationData.theme, "If you subscribe to Telegram Premium, you will still see other users' last seen and read time even if you hid yours from them (unless they specifically restricted it)."))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return entries
|
return entries
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -780,9 +868,10 @@ func selectivePrivacySettingsController(
|
|||||||
phoneDiscoveryEnabled: Bool? = nil,
|
phoneDiscoveryEnabled: Bool? = nil,
|
||||||
voipConfiguration: VoipConfiguration? = nil,
|
voipConfiguration: VoipConfiguration? = nil,
|
||||||
callIntegrationAvailable: Bool? = nil,
|
callIntegrationAvailable: Bool? = nil,
|
||||||
|
globalSettings: GlobalPrivacySettings? = nil,
|
||||||
requestPublicPhotoSetup: ((@escaping (UIImage?) -> Void) -> Void)? = nil,
|
requestPublicPhotoSetup: ((@escaping (UIImage?) -> Void) -> Void)? = nil,
|
||||||
requestPublicPhotoRemove: ((@escaping () -> Void) -> Void)? = nil,
|
requestPublicPhotoRemove: ((@escaping () -> Void) -> Void)? = nil,
|
||||||
updated: @escaping (SelectivePrivacySettings, (SelectivePrivacySettings, VoiceCallSettings)?, Bool?) -> Void
|
updated: @escaping (SelectivePrivacySettings, (SelectivePrivacySettings, VoiceCallSettings)?, Bool?, GlobalPrivacySettings?) -> Void
|
||||||
) -> ViewController {
|
) -> ViewController {
|
||||||
let strings = context.sharedContext.currentPresentationData.with { $0 }.strings
|
let strings = context.sharedContext.currentPresentationData.with { $0 }.strings
|
||||||
|
|
||||||
@ -817,7 +906,8 @@ func selectivePrivacySettingsController(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let initialState = SelectivePrivacySettingsControllerState(setting: SelectivePrivacySettingType(current), enableFor: initialEnableFor, disableFor: initialDisableFor, enableForCloseFriends: initialEnableForCloseFriends, saving: false, callDataSaving: callSettings?.1.dataSaving, callP2PMode: callSettings != nil ? SelectivePrivacySettingType(callSettings!.0) : nil, callP2PEnableFor: initialCallP2PEnableFor, callP2PDisableFor: initialCallP2PDisableFor, callP2PEnableForCloseFriends: initialCallEnableForCloseFriends, callIntegrationAvailable: callIntegrationAvailable, callIntegrationEnabled: callSettings?.1.enableSystemIntegration, phoneDiscoveryEnabled: phoneDiscoveryEnabled, uploadedPhoto: nil)
|
//TODO:replace hideReadTimeEnabled with actual value
|
||||||
|
let initialState = SelectivePrivacySettingsControllerState(setting: SelectivePrivacySettingType(current), enableFor: initialEnableFor, disableFor: initialDisableFor, enableForCloseFriends: initialEnableForCloseFriends, saving: false, callDataSaving: callSettings?.1.dataSaving, callP2PMode: callSettings != nil ? SelectivePrivacySettingType(callSettings!.0) : nil, callP2PEnableFor: initialCallP2PEnableFor, callP2PDisableFor: initialCallP2PDisableFor, callP2PEnableForCloseFriends: initialCallEnableForCloseFriends, callIntegrationAvailable: callIntegrationAvailable, callIntegrationEnabled: callSettings?.1.enableSystemIntegration, phoneDiscoveryEnabled: phoneDiscoveryEnabled, hideReadTimeEnabled: globalSettings?.keepArchivedFolders, uploadedPhoto: nil)
|
||||||
|
|
||||||
let statePromise = ValuePromise(initialState, ignoreRepeated: true)
|
let statePromise = ValuePromise(initialState, ignoreRepeated: true)
|
||||||
let stateValue = Atomic(value: initialState)
|
let stateValue = Atomic(value: initialState)
|
||||||
@ -1071,6 +1161,13 @@ func selectivePrivacySettingsController(
|
|||||||
return state.withUpdatedUploadedPhoto(nil)
|
return state.withUpdatedUploadedPhoto(nil)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
}, updateHideReadTime: { value in
|
||||||
|
updateState { state in
|
||||||
|
return state.withUpdatedHideReadTimeEnabled(value)
|
||||||
|
}
|
||||||
|
}, openPremiumIntro: {
|
||||||
|
let controller = context.sharedContext.makePremiumIntroController(context: context, source: .presence, forceDark: false, dismissed: nil)
|
||||||
|
pushControllerImpl?(controller, true)
|
||||||
})
|
})
|
||||||
|
|
||||||
let peer = context.engine.data.subscribe(TelegramEngine.EngineData.Item.Peer.Peer(id: context.account.peerId))
|
let peer = context.engine.data.subscribe(TelegramEngine.EngineData.Item.Peer.Peer(id: context.account.peerId))
|
||||||
@ -1129,6 +1226,7 @@ func selectivePrivacySettingsController(
|
|||||||
let callDataSaving: VoiceCallDataSaving?
|
let callDataSaving: VoiceCallDataSaving?
|
||||||
let callIntegrationEnabled: Bool?
|
let callIntegrationEnabled: Bool?
|
||||||
let phoneDiscoveryEnabled: Bool?
|
let phoneDiscoveryEnabled: Bool?
|
||||||
|
let hideReadTimeEnabled: Bool?
|
||||||
}
|
}
|
||||||
|
|
||||||
var appliedSettings: AppliedSettings?
|
var appliedSettings: AppliedSettings?
|
||||||
@ -1140,6 +1238,8 @@ func selectivePrivacySettingsController(
|
|||||||
var phoneDiscoveryEnabled: Bool?
|
var phoneDiscoveryEnabled: Bool?
|
||||||
var callDataSaving: VoiceCallDataSaving?
|
var callDataSaving: VoiceCallDataSaving?
|
||||||
var callIntegrationEnabled: Bool?
|
var callIntegrationEnabled: Bool?
|
||||||
|
var hideReadTimeEnabled: Bool?
|
||||||
|
|
||||||
updateState { state in
|
updateState { state in
|
||||||
wasSaving = state.saving
|
wasSaving = state.saving
|
||||||
callDataSaving = state.callDataSaving
|
callDataSaving = state.callDataSaving
|
||||||
@ -1157,6 +1257,10 @@ func selectivePrivacySettingsController(
|
|||||||
phoneDiscoveryEnabled = value
|
phoneDiscoveryEnabled = value
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if case .presence = kind, let value = state.hideReadTimeEnabled {
|
||||||
|
hideReadTimeEnabled = value
|
||||||
|
}
|
||||||
|
|
||||||
if case .voiceCalls = kind, let callP2PMode = state.callP2PMode, let disableFor = state.callP2PDisableFor, let enableFor = state.callP2PEnableFor, let enableForCloseFriends = state.callP2PEnableForCloseFriends {
|
if case .voiceCalls = kind, let callP2PMode = state.callP2PMode, let disableFor = state.callP2PDisableFor, let enableFor = state.callP2PEnableFor, let enableForCloseFriends = state.callP2PEnableForCloseFriends {
|
||||||
switch callP2PMode {
|
switch callP2PMode {
|
||||||
case .everybody:
|
case .everybody:
|
||||||
@ -1172,7 +1276,7 @@ func selectivePrivacySettingsController(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if let settings = settings, !wasSaving {
|
if let settings = settings, !wasSaving {
|
||||||
let settingsToApply = AppliedSettings(settings: settings, callP2PSettings: callP2PSettings, callDataSaving: callDataSaving, callIntegrationEnabled: callIntegrationEnabled, phoneDiscoveryEnabled: phoneDiscoveryEnabled)
|
let settingsToApply = AppliedSettings(settings: settings, callP2PSettings: callP2PSettings, callDataSaving: callDataSaving, callIntegrationEnabled: callIntegrationEnabled, phoneDiscoveryEnabled: phoneDiscoveryEnabled, hideReadTimeEnabled: hideReadTimeEnabled)
|
||||||
if appliedSettings == settingsToApply {
|
if appliedSettings == settingsToApply {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -1208,14 +1312,27 @@ func selectivePrivacySettingsController(
|
|||||||
updatePhoneDiscoverySignal = context.engine.privacy.updatePhoneNumberDiscovery(value: phoneDiscoveryEnabled)
|
updatePhoneDiscoverySignal = context.engine.privacy.updatePhoneNumberDiscovery(value: phoneDiscoveryEnabled)
|
||||||
}
|
}
|
||||||
|
|
||||||
let _ = (combineLatest(updateSettingsSignal, updateCallP2PSettingsSignal, updatePhoneDiscoverySignal)
|
var updateGlobalSettingsSignal: Signal<Never, NoError> = Signal.complete()
|
||||||
|
var updatedGlobalSettings: GlobalPrivacySettings?
|
||||||
|
if let updateHideReadTime = arguments.updateHideReadTime, let globalSettings {
|
||||||
|
//TODO:update global settings
|
||||||
|
let _ = updateHideReadTime
|
||||||
|
updatedGlobalSettings = GlobalPrivacySettings(automaticallyArchiveAndMuteNonContacts: globalSettings.automaticallyArchiveAndMuteNonContacts, keepArchivedUnmuted: globalSettings.keepArchivedUnmuted, keepArchivedFolders: globalSettings.keepArchivedFolders)
|
||||||
|
if let updatedGlobalSettings {
|
||||||
|
updateGlobalSettingsSignal = context.engine.privacy.updateGlobalPrivacySettings(settings: updatedGlobalSettings)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let _ = (combineLatest(updateSettingsSignal, updateCallP2PSettingsSignal, updatePhoneDiscoverySignal, updateGlobalSettingsSignal)
|
||||||
|> deliverOnMainQueue).start(completed: {
|
|> deliverOnMainQueue).start(completed: {
|
||||||
})
|
})
|
||||||
|
|
||||||
if case .voiceCalls = kind, let dataSaving = callDataSaving, let callP2PSettings = callP2PSettings, let systemIntegrationEnabled = callIntegrationEnabled {
|
if case .presence = kind {
|
||||||
updated(settings, (callP2PSettings, VoiceCallSettings(dataSaving: dataSaving, enableSystemIntegration: systemIntegrationEnabled)), phoneDiscoveryEnabled)
|
updated(settings, nil, phoneDiscoveryEnabled, updateGlobalSettingsSignal)
|
||||||
|
} else if case .voiceCalls = kind, let dataSaving = callDataSaving, let callP2PSettings = callP2PSettings, let systemIntegrationEnabled = callIntegrationEnabled {
|
||||||
|
updated(settings, (callP2PSettings, VoiceCallSettings(dataSaving: dataSaving, enableSystemIntegration: systemIntegrationEnabled)), phoneDiscoveryEnabled, nil)
|
||||||
} else {
|
} else {
|
||||||
updated(settings, nil, phoneDiscoveryEnabled)
|
updated(settings, nil, phoneDiscoveryEnabled, nil)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -597,7 +597,7 @@ private func privacySearchableItems(context: AccountContext, privacySettings: Ac
|
|||||||
current = info.bio
|
current = info.bio
|
||||||
}
|
}
|
||||||
|
|
||||||
present(.push, selectivePrivacySettingsController(context: context, kind: kind, current: current, callSettings: callSettings != nil ? (info.voiceCallsP2P, callSettings!.0) : nil, voipConfiguration: callSettings?.1, callIntegrationAvailable: CallKitIntegration.isAvailable, updated: { updated, updatedCallSettings, _ in
|
present(.push, selectivePrivacySettingsController(context: context, kind: kind, current: current, callSettings: callSettings != nil ? (info.voiceCallsP2P, callSettings!.0) : nil, voipConfiguration: callSettings?.1, callIntegrationAvailable: CallKitIntegration.isAvailable, updated: { updated, updatedCallSettings, _, _ in
|
||||||
if let (_, updatedCallSettings) = updatedCallSettings {
|
if let (_, updatedCallSettings) = updatedCallSettings {
|
||||||
let _ = updateVoiceCallSettingsSettingsInteractively(accountManager: context.sharedContext.accountManager, { _ in
|
let _ = updateVoiceCallSettingsSettingsInteractively(accountManager: context.sharedContext.accountManager, { _ in
|
||||||
return updatedCallSettings
|
return updatedCallSettings
|
||||||
|
@ -1945,6 +1945,8 @@ public final class SharedAccountContextImpl: SharedAccountContext {
|
|||||||
mappedSource = .similarChannels
|
mappedSource = .similarChannels
|
||||||
case .wallpapers:
|
case .wallpapers:
|
||||||
mappedSource = .wallpapers
|
mappedSource = .wallpapers
|
||||||
|
case .presence:
|
||||||
|
mappedSource = .presence
|
||||||
}
|
}
|
||||||
let controller = PremiumIntroScreen(context: context, modal: modal, source: mappedSource, forceDark: forceDark)
|
let controller = PremiumIntroScreen(context: context, modal: modal, source: mappedSource, forceDark: forceDark)
|
||||||
controller.wasDismissed = dismissed
|
controller.wasDismissed = dismissed
|
||||||
|
Loading…
x
Reference in New Issue
Block a user