Various improvements

This commit is contained in:
Ilya Laktyushin 2025-10-20 22:57:29 +04:00
parent 35c9a5d279
commit 2cb5122bb3
17 changed files with 221 additions and 108 deletions

View File

@ -15157,3 +15157,9 @@ Error: %8$@";
"Chat.NewThreadInfo.Text" = "Type any message to\ncreate a new thread."; "Chat.NewThreadInfo.Text" = "Type any message to\ncreate a new thread.";
"Chat.InlineTopicMenu.NewForumThreadTab" = "New Chat"; "Chat.InlineTopicMenu.NewForumThreadTab" = "New Chat";
"Chat.GenericForuThreadStatus" = "thread"; "Chat.GenericForuThreadStatus" = "thread";
"Privacy.SavedMusic" = "Saved Music";
"Privacy.SavedMusic.WhoCanSeeMyMusic" = "WHO CAN SEE MY SAVED MUSIC";
"Privacy.SavedMusic.CustomHelp" = "You can restrict who can see your saved music with granular precision.";
"Privacy.SavedMusic.AlwaysShareWith.Title" = "Always Share With";
"Privacy.SavedMusic.NeverShareWith.Title" = "Never Share With";

View File

@ -169,5 +169,6 @@ public enum SelectivePrivacySettingsKind {
case voiceMessages case voiceMessages
case bio case bio
case birthday case birthday
case savedMusic
case giftsAutoSave case giftsAutoSave
} }

View File

@ -149,7 +149,9 @@ final class AttachmentContainer: ASDisplayNode, ASGestureRecognizerDelegate {
self.panGestureRecognizer = panRecognizer self.panGestureRecognizer = panRecognizer
self.wrappingNode.view.addGestureRecognizer(panRecognizer) self.wrappingNode.view.addGestureRecognizer(panRecognizer)
self.clipNode.view.addSubview(self.pillView) if self.glass {
self.clipNode.view.addSubview(self.pillView)
}
} }
func cancelPanGesture() { func cancelPanGesture() {

View File

@ -4,8 +4,8 @@ import UIKit
import AsyncDisplayKit import AsyncDisplayKit
import TelegramPresentationData import TelegramPresentationData
private let textFont = Font.regular(13.0) private let textFont = Font.regular(14.0)
private let selectedTextFont = Font.bold(13.0) private let selectedTextFont = Font.semibold(14.0)
public enum SegmentedControlLayout { public enum SegmentedControlLayout {
case stretchToFill(width: CGFloat) case stretchToFill(width: CGFloat)

View File

@ -32,6 +32,7 @@ private final class PrivacyAndSecurityControllerArguments {
let openVoiceMessagePrivacy: () -> Void let openVoiceMessagePrivacy: () -> Void
let openBioPrivacy: () -> Void let openBioPrivacy: () -> Void
let openBirthdayPrivacy: () -> Void let openBirthdayPrivacy: () -> Void
let openSavedMusicPrivacy: () -> Void
let openPasscode: () -> Void let openPasscode: () -> Void
let openTwoStepVerification: (TwoStepVerificationAccessConfiguration?) -> Void let openTwoStepVerification: (TwoStepVerificationAccessConfiguration?) -> Void
let openActiveSessions: () -> Void let openActiveSessions: () -> Void
@ -43,7 +44,7 @@ private final class PrivacyAndSecurityControllerArguments {
let openMessagePrivacy: () -> Void let openMessagePrivacy: () -> Void
let openGiftsPrivacy: () -> Void let openGiftsPrivacy: () -> Void
init(account: Account, openBlockedUsers: @escaping () -> Void, openLastSeenPrivacy: @escaping () -> Void, openGroupsPrivacy: @escaping () -> Void, openVoiceCallPrivacy: @escaping () -> Void, openProfilePhotoPrivacy: @escaping () -> Void, openForwardPrivacy: @escaping () -> Void, openPhoneNumberPrivacy: @escaping () -> Void, openVoiceMessagePrivacy: @escaping () -> Void, openBioPrivacy: @escaping () -> Void, openBirthdayPrivacy: @escaping () -> Void, openPasscode: @escaping () -> Void, openTwoStepVerification: @escaping (TwoStepVerificationAccessConfiguration?) -> Void, openActiveSessions: @escaping () -> Void, toggleArchiveAndMuteNonContacts: @escaping (Bool) -> Void, setupAccountAutoremove: @escaping () -> Void, setupMessageAutoremove: @escaping () -> Void, openDataSettings: @escaping () -> Void, openEmailSettings: @escaping (String?) -> Void, openMessagePrivacy: @escaping () -> Void, openGiftsPrivacy: @escaping () -> Void) { init(account: Account, openBlockedUsers: @escaping () -> Void, openLastSeenPrivacy: @escaping () -> Void, openGroupsPrivacy: @escaping () -> Void, openVoiceCallPrivacy: @escaping () -> Void, openProfilePhotoPrivacy: @escaping () -> Void, openForwardPrivacy: @escaping () -> Void, openPhoneNumberPrivacy: @escaping () -> Void, openVoiceMessagePrivacy: @escaping () -> Void, openBioPrivacy: @escaping () -> Void, openBirthdayPrivacy: @escaping () -> Void, openSavedMusicPrivacy: @escaping () -> Void, openPasscode: @escaping () -> Void, openTwoStepVerification: @escaping (TwoStepVerificationAccessConfiguration?) -> Void, openActiveSessions: @escaping () -> Void, toggleArchiveAndMuteNonContacts: @escaping (Bool) -> Void, setupAccountAutoremove: @escaping () -> Void, setupMessageAutoremove: @escaping () -> Void, openDataSettings: @escaping () -> Void, openEmailSettings: @escaping (String?) -> Void, openMessagePrivacy: @escaping () -> Void, openGiftsPrivacy: @escaping () -> Void) {
self.account = account self.account = account
self.openBlockedUsers = openBlockedUsers self.openBlockedUsers = openBlockedUsers
self.openLastSeenPrivacy = openLastSeenPrivacy self.openLastSeenPrivacy = openLastSeenPrivacy
@ -55,6 +56,7 @@ private final class PrivacyAndSecurityControllerArguments {
self.openVoiceMessagePrivacy = openVoiceMessagePrivacy self.openVoiceMessagePrivacy = openVoiceMessagePrivacy
self.openBioPrivacy = openBioPrivacy self.openBioPrivacy = openBioPrivacy
self.openBirthdayPrivacy = openBirthdayPrivacy self.openBirthdayPrivacy = openBirthdayPrivacy
self.openSavedMusicPrivacy = openSavedMusicPrivacy
self.openPasscode = openPasscode self.openPasscode = openPasscode
self.openTwoStepVerification = openTwoStepVerification self.openTwoStepVerification = openTwoStepVerification
self.openActiveSessions = openActiveSessions self.openActiveSessions = openActiveSessions
@ -106,6 +108,7 @@ private enum PrivacyAndSecurityEntry: ItemListNodeEntry {
case messagePrivacy(PresentationTheme, GlobalPrivacySettings.NonContactChatsPrivacy, Bool) case messagePrivacy(PresentationTheme, GlobalPrivacySettings.NonContactChatsPrivacy, Bool)
case bioPrivacy(PresentationTheme, String, String) case bioPrivacy(PresentationTheme, String, String)
case birthdayPrivacy(PresentationTheme, String, String) case birthdayPrivacy(PresentationTheme, String, String)
case savedMusicPrivacy(PresentationTheme, String, String)
case giftsAutoSavePrivacy(PresentationTheme, String, String) case giftsAutoSavePrivacy(PresentationTheme, String, String)
case selectivePrivacyInfo(PresentationTheme, String) case selectivePrivacyInfo(PresentationTheme, String)
case passcode(PresentationTheme, String, Bool, String) case passcode(PresentationTheme, String, Bool, String)
@ -130,7 +133,7 @@ private enum PrivacyAndSecurityEntry: ItemListNodeEntry {
return PrivacyAndSecuritySection.general.rawValue return PrivacyAndSecuritySection.general.rawValue
case .loginEmail, .loginEmailInfo: case .loginEmail, .loginEmailInfo:
return PrivacyAndSecuritySection.loginEmail.rawValue return PrivacyAndSecuritySection.loginEmail.rawValue
case .privacyHeader, .phoneNumberPrivacy, .lastSeenPrivacy, .profilePhotoPrivacy, .forwardPrivacy, .groupPrivacy, .groupPrivacyFooter, .voiceCallPrivacy, .voiceMessagePrivacy, .messagePrivacy, .bioPrivacy, .birthdayPrivacy, .giftsAutoSavePrivacy, .selectivePrivacyInfo: case .privacyHeader, .phoneNumberPrivacy, .lastSeenPrivacy, .profilePhotoPrivacy, .forwardPrivacy, .groupPrivacy, .groupPrivacyFooter, .voiceCallPrivacy, .voiceMessagePrivacy, .messagePrivacy, .bioPrivacy, .birthdayPrivacy, .savedMusicPrivacy, .giftsAutoSavePrivacy, .selectivePrivacyInfo:
return PrivacyAndSecuritySection.privacy.rawValue return PrivacyAndSecuritySection.privacy.rawValue
case .autoArchiveHeader, .autoArchive, .autoArchiveInfo: case .autoArchiveHeader, .autoArchive, .autoArchiveInfo:
return PrivacyAndSecuritySection.autoArchive.rawValue return PrivacyAndSecuritySection.autoArchive.rawValue
@ -173,36 +176,38 @@ private enum PrivacyAndSecurityEntry: ItemListNodeEntry {
return 14 return 14
case .birthdayPrivacy: case .birthdayPrivacy:
return 15 return 15
case .forwardPrivacy: case .savedMusicPrivacy:
return 16 return 16
case .voiceCallPrivacy: case .forwardPrivacy:
return 17 return 17
case .voiceMessagePrivacy: case .voiceCallPrivacy:
return 18 return 18
case .messagePrivacy: case .voiceMessagePrivacy:
return 19 return 19
case .groupPrivacy: case .messagePrivacy:
return 20 return 20
case .groupPrivacyFooter: case .groupPrivacy:
return 21 return 21
case .selectivePrivacyInfo: case .groupPrivacyFooter:
return 22 return 22
case .autoArchiveHeader: case .selectivePrivacyInfo:
return 23 return 23
case .autoArchive: case .autoArchiveHeader:
return 24 return 24
case .autoArchiveInfo: case .autoArchive:
return 25 return 25
case .accountHeader: case .autoArchiveInfo:
return 26 return 26
case .accountTimeout: case .accountHeader:
return 27 return 27
case .accountInfo: case .accountTimeout:
return 28 return 28
case .dataSettings: case .accountInfo:
return 29 return 29
case .dataSettingsInfo: case .dataSettings:
return 30 return 30
case .dataSettingsInfo:
return 31
} }
} }
@ -286,6 +291,12 @@ private enum PrivacyAndSecurityEntry: ItemListNodeEntry {
} else { } else {
return false return false
} }
case let .savedMusicPrivacy(lhsTheme, lhsText, lhsValue):
if case let .savedMusicPrivacy(rhsTheme, rhsText, rhsValue) = rhs, lhsTheme === rhsTheme, lhsText == rhsText, lhsValue == rhsValue {
return true
} else {
return false
}
case let .giftsAutoSavePrivacy(lhsTheme, lhsText, lhsValue): case let .giftsAutoSavePrivacy(lhsTheme, lhsText, lhsValue):
if case let .giftsAutoSavePrivacy(rhsTheme, rhsText, rhsValue) = rhs, lhsTheme === rhsTheme, lhsText == rhsText, lhsValue == rhsValue { if case let .giftsAutoSavePrivacy(rhsTheme, rhsText, rhsValue) = rhs, lhsTheme === rhsTheme, lhsText == rhsText, lhsValue == rhsValue {
return true return true
@ -455,6 +466,10 @@ private enum PrivacyAndSecurityEntry: ItemListNodeEntry {
return ItemListDisclosureItem(presentationData: presentationData, systemStyle: .glass, title: text, label: value, sectionId: self.section, style: .blocks, action: { return ItemListDisclosureItem(presentationData: presentationData, systemStyle: .glass, title: text, label: value, sectionId: self.section, style: .blocks, action: {
arguments.openBirthdayPrivacy() arguments.openBirthdayPrivacy()
}) })
case let .savedMusicPrivacy(_, text, value):
return ItemListDisclosureItem(presentationData: presentationData, systemStyle: .glass, title: text, label: value, sectionId: self.section, style: .blocks, action: {
arguments.openSavedMusicPrivacy()
})
case let .giftsAutoSavePrivacy(_, text, value): case let .giftsAutoSavePrivacy(_, text, value):
return ItemListDisclosureItem(presentationData: presentationData, systemStyle: .glass, title: text, label: value, sectionId: self.section, style: .blocks, action: { return ItemListDisclosureItem(presentationData: presentationData, systemStyle: .glass, title: text, label: value, sectionId: self.section, style: .blocks, action: {
arguments.openGiftsPrivacy() arguments.openGiftsPrivacy()
@ -670,6 +685,7 @@ private func privacyAndSecurityControllerEntries(
entries.append(.bioPrivacy(presentationData.theme, presentationData.strings.Privacy_Bio, stringForSelectiveSettings(strings: presentationData.strings, settings: privacySettings.bio))) entries.append(.bioPrivacy(presentationData.theme, presentationData.strings.Privacy_Bio, stringForSelectiveSettings(strings: presentationData.strings, settings: privacySettings.bio)))
entries.append(.giftsAutoSavePrivacy(presentationData.theme, presentationData.strings.Privacy_Gifts, stringForSelectiveSettings(strings: presentationData.strings, settings: privacySettings.giftsAutoSave))) entries.append(.giftsAutoSavePrivacy(presentationData.theme, presentationData.strings.Privacy_Gifts, stringForSelectiveSettings(strings: presentationData.strings, settings: privacySettings.giftsAutoSave)))
entries.append(.birthdayPrivacy(presentationData.theme, presentationData.strings.Privacy_Birthday, stringForSelectiveSettings(strings: presentationData.strings, settings: privacySettings.birthday))) entries.append(.birthdayPrivacy(presentationData.theme, presentationData.strings.Privacy_Birthday, stringForSelectiveSettings(strings: presentationData.strings, settings: privacySettings.birthday)))
entries.append(.savedMusicPrivacy(presentationData.theme, presentationData.strings.Privacy_SavedMusic, stringForSelectiveSettings(strings: presentationData.strings, settings: privacySettings.savedMusic)))
entries.append(.forwardPrivacy(presentationData.theme, presentationData.strings.Privacy_Forwards, stringForSelectiveSettings(strings: presentationData.strings, settings: privacySettings.forwards))) entries.append(.forwardPrivacy(presentationData.theme, presentationData.strings.Privacy_Forwards, stringForSelectiveSettings(strings: presentationData.strings, settings: privacySettings.forwards)))
entries.append(.voiceCallPrivacy(presentationData.theme, presentationData.strings.Privacy_Calls, stringForSelectiveSettings(strings: presentationData.strings, settings: privacySettings.voiceCalls))) entries.append(.voiceCallPrivacy(presentationData.theme, presentationData.strings.Privacy_Calls, stringForSelectiveSettings(strings: presentationData.strings, settings: privacySettings.voiceCalls)))
if !isPremiumDisabled || isPremium { if !isPremiumDisabled || isPremium {
@ -685,6 +701,7 @@ private func privacyAndSecurityControllerEntries(
entries.append(.bioPrivacy(presentationData.theme, presentationData.strings.Privacy_GroupsAndChannels, presentationData.strings.Channel_NotificationLoading)) entries.append(.bioPrivacy(presentationData.theme, presentationData.strings.Privacy_GroupsAndChannels, presentationData.strings.Channel_NotificationLoading))
entries.append(.giftsAutoSavePrivacy(presentationData.theme, presentationData.strings.Privacy_Gifts, presentationData.strings.Channel_NotificationLoading)) entries.append(.giftsAutoSavePrivacy(presentationData.theme, presentationData.strings.Privacy_Gifts, presentationData.strings.Channel_NotificationLoading))
entries.append(.birthdayPrivacy(presentationData.theme, presentationData.strings.Privacy_Birthday, presentationData.strings.Channel_NotificationLoading)) entries.append(.birthdayPrivacy(presentationData.theme, presentationData.strings.Privacy_Birthday, presentationData.strings.Channel_NotificationLoading))
entries.append(.savedMusicPrivacy(presentationData.theme, presentationData.strings.Privacy_SavedMusic, presentationData.strings.Channel_NotificationLoading))
entries.append(.forwardPrivacy(presentationData.theme, presentationData.strings.Privacy_Forwards, presentationData.strings.Channel_NotificationLoading)) entries.append(.forwardPrivacy(presentationData.theme, presentationData.strings.Privacy_Forwards, presentationData.strings.Channel_NotificationLoading))
entries.append(.voiceCallPrivacy(presentationData.theme, presentationData.strings.Privacy_Calls, presentationData.strings.Channel_NotificationLoading)) entries.append(.voiceCallPrivacy(presentationData.theme, presentationData.strings.Privacy_Calls, presentationData.strings.Channel_NotificationLoading))
if !isPremiumDisabled || isPremium { if !isPremiumDisabled || isPremium {
@ -886,7 +903,7 @@ public func privacyAndSecurityController(
|> deliverOnMainQueue |> deliverOnMainQueue
|> mapToSignal { value -> Signal<Void, NoError> in |> mapToSignal { value -> Signal<Void, NoError> in
if let value = value { if let value = value {
privacySettingsPromise.set(.single(AccountPrivacySettings(presence: updated, groupInvitations: value.groupInvitations, voiceCalls: value.voiceCalls, voiceCallsP2P: value.voiceCallsP2P, profilePhoto: value.profilePhoto, forwards: value.forwards, phoneNumber: value.phoneNumber, phoneDiscoveryEnabled: value.phoneDiscoveryEnabled, voiceMessages: value.voiceMessages, bio: value.bio, birthday: value.birthday, giftsAutoSave: value.giftsAutoSave, noPaidMessages: value.noPaidMessages, globalSettings: updatedGlobalSettings ?? value.globalSettings, accountRemovalTimeout: value.accountRemovalTimeout, messageAutoremoveTimeout: value.messageAutoremoveTimeout))) privacySettingsPromise.set(.single(AccountPrivacySettings(presence: updated, groupInvitations: value.groupInvitations, voiceCalls: value.voiceCalls, voiceCallsP2P: value.voiceCallsP2P, profilePhoto: value.profilePhoto, forwards: value.forwards, phoneNumber: value.phoneNumber, phoneDiscoveryEnabled: value.phoneDiscoveryEnabled, voiceMessages: value.voiceMessages, bio: value.bio, birthday: value.birthday, giftsAutoSave: value.giftsAutoSave, noPaidMessages: value.noPaidMessages, savedMusic: value.savedMusic, globalSettings: updatedGlobalSettings ?? value.globalSettings, accountRemovalTimeout: value.accountRemovalTimeout, messageAutoremoveTimeout: value.messageAutoremoveTimeout)))
} }
return .complete() return .complete()
} }
@ -909,7 +926,7 @@ public func privacyAndSecurityController(
|> deliverOnMainQueue |> deliverOnMainQueue
|> mapToSignal { value -> Signal<Void, NoError> in |> mapToSignal { value -> Signal<Void, NoError> in
if let value = value { if let value = value {
privacySettingsPromise.set(.single(AccountPrivacySettings(presence: value.presence, groupInvitations: updated, voiceCalls: value.voiceCalls, voiceCallsP2P: value.voiceCallsP2P, profilePhoto: value.profilePhoto, forwards: value.forwards, phoneNumber: value.phoneNumber, phoneDiscoveryEnabled: value.phoneDiscoveryEnabled, voiceMessages: value.voiceMessages, bio: value.bio, birthday: value.birthday, giftsAutoSave: value.giftsAutoSave, noPaidMessages: value.noPaidMessages, globalSettings: value.globalSettings, accountRemovalTimeout: value.accountRemovalTimeout, messageAutoremoveTimeout: value.messageAutoremoveTimeout))) privacySettingsPromise.set(.single(AccountPrivacySettings(presence: value.presence, groupInvitations: updated, voiceCalls: value.voiceCalls, voiceCallsP2P: value.voiceCallsP2P, profilePhoto: value.profilePhoto, forwards: value.forwards, phoneNumber: value.phoneNumber, phoneDiscoveryEnabled: value.phoneDiscoveryEnabled, voiceMessages: value.voiceMessages, bio: value.bio, birthday: value.birthday, giftsAutoSave: value.giftsAutoSave, noPaidMessages: value.noPaidMessages, savedMusic: value.savedMusic, globalSettings: value.globalSettings, accountRemovalTimeout: value.accountRemovalTimeout, messageAutoremoveTimeout: value.messageAutoremoveTimeout)))
} }
return .complete() return .complete()
} }
@ -950,7 +967,7 @@ public func privacyAndSecurityController(
|> deliverOnMainQueue |> deliverOnMainQueue
|> mapToSignal { value -> Signal<Void, NoError> in |> mapToSignal { value -> Signal<Void, NoError> in
if let value = value { if let value = value {
privacySettingsPromise.set(.single(AccountPrivacySettings(presence: value.presence, groupInvitations: value.groupInvitations, voiceCalls: updated, voiceCallsP2P: updatedCallsPrivacy, profilePhoto: value.profilePhoto, forwards: value.forwards, phoneNumber: value.phoneNumber, phoneDiscoveryEnabled: value.phoneDiscoveryEnabled, voiceMessages: value.voiceMessages, bio: value.bio, birthday: value.birthday, giftsAutoSave: value.giftsAutoSave, noPaidMessages: value.noPaidMessages, globalSettings: value.globalSettings, accountRemovalTimeout: value.accountRemovalTimeout, messageAutoremoveTimeout: value.messageAutoremoveTimeout))) privacySettingsPromise.set(.single(AccountPrivacySettings(presence: value.presence, groupInvitations: value.groupInvitations, voiceCalls: updated, voiceCallsP2P: updatedCallsPrivacy, profilePhoto: value.profilePhoto, forwards: value.forwards, phoneNumber: value.phoneNumber, phoneDiscoveryEnabled: value.phoneDiscoveryEnabled, voiceMessages: value.voiceMessages, bio: value.bio, birthday: value.birthday, giftsAutoSave: value.giftsAutoSave, noPaidMessages: value.noPaidMessages, savedMusic: value.savedMusic, globalSettings: value.globalSettings, accountRemovalTimeout: value.accountRemovalTimeout, messageAutoremoveTimeout: value.messageAutoremoveTimeout)))
} }
return .complete() return .complete()
} }
@ -981,7 +998,7 @@ public func privacyAndSecurityController(
|> deliverOnMainQueue |> deliverOnMainQueue
|> mapToSignal { value -> Signal<Void, NoError> in |> mapToSignal { value -> Signal<Void, NoError> in
if let value = value { if let value = value {
privacySettingsPromise.set(.single(AccountPrivacySettings(presence: value.presence, groupInvitations: value.groupInvitations, voiceCalls: value.voiceCalls, voiceCallsP2P: value.voiceCallsP2P, profilePhoto: updated, forwards: value.forwards, phoneNumber: value.phoneNumber, phoneDiscoveryEnabled: value.phoneDiscoveryEnabled, voiceMessages: value.voiceMessages, bio: value.bio, birthday: value.birthday, giftsAutoSave: value.giftsAutoSave, noPaidMessages: value.noPaidMessages, globalSettings: value.globalSettings, accountRemovalTimeout: value.accountRemovalTimeout, messageAutoremoveTimeout: value.messageAutoremoveTimeout))) privacySettingsPromise.set(.single(AccountPrivacySettings(presence: value.presence, groupInvitations: value.groupInvitations, voiceCalls: value.voiceCalls, voiceCallsP2P: value.voiceCallsP2P, profilePhoto: updated, forwards: value.forwards, phoneNumber: value.phoneNumber, phoneDiscoveryEnabled: value.phoneDiscoveryEnabled, voiceMessages: value.voiceMessages, bio: value.bio, birthday: value.birthday, giftsAutoSave: value.giftsAutoSave, noPaidMessages: value.noPaidMessages, savedMusic: value.savedMusic, globalSettings: value.globalSettings, accountRemovalTimeout: value.accountRemovalTimeout, messageAutoremoveTimeout: value.messageAutoremoveTimeout)))
} }
return .complete() return .complete()
} }
@ -1004,7 +1021,7 @@ public func privacyAndSecurityController(
|> deliverOnMainQueue |> deliverOnMainQueue
|> mapToSignal { value -> Signal<Void, NoError> in |> mapToSignal { value -> Signal<Void, NoError> in
if let value = value { if let value = value {
privacySettingsPromise.set(.single(AccountPrivacySettings(presence: value.presence, groupInvitations: value.groupInvitations, voiceCalls: value.voiceCalls, voiceCallsP2P: value.voiceCallsP2P, profilePhoto: value.profilePhoto, forwards: updated, phoneNumber: value.phoneNumber, phoneDiscoveryEnabled: value.phoneDiscoveryEnabled, voiceMessages: value.voiceMessages, bio: value.bio, birthday: value.birthday, giftsAutoSave: value.giftsAutoSave, noPaidMessages: value.noPaidMessages, globalSettings: value.globalSettings, accountRemovalTimeout: value.accountRemovalTimeout, messageAutoremoveTimeout: value.messageAutoremoveTimeout))) privacySettingsPromise.set(.single(AccountPrivacySettings(presence: value.presence, groupInvitations: value.groupInvitations, voiceCalls: value.voiceCalls, voiceCallsP2P: value.voiceCallsP2P, profilePhoto: value.profilePhoto, forwards: updated, phoneNumber: value.phoneNumber, phoneDiscoveryEnabled: value.phoneDiscoveryEnabled, voiceMessages: value.voiceMessages, bio: value.bio, birthday: value.birthday, giftsAutoSave: value.giftsAutoSave, noPaidMessages: value.noPaidMessages, savedMusic: value.savedMusic, globalSettings: value.globalSettings, accountRemovalTimeout: value.accountRemovalTimeout, messageAutoremoveTimeout: value.messageAutoremoveTimeout)))
} }
return .complete() return .complete()
} }
@ -1027,7 +1044,7 @@ public func privacyAndSecurityController(
|> deliverOnMainQueue |> deliverOnMainQueue
|> mapToSignal { value -> Signal<Void, NoError> in |> mapToSignal { value -> Signal<Void, NoError> in
if let value = value { if let value = value {
privacySettingsPromise.set(.single(AccountPrivacySettings(presence: value.presence, groupInvitations: value.groupInvitations, voiceCalls: value.voiceCalls, voiceCallsP2P: value.voiceCallsP2P, profilePhoto: value.profilePhoto, forwards: value.forwards, phoneNumber: updated, phoneDiscoveryEnabled: updatedDiscoveryEnabled ?? value.phoneDiscoveryEnabled, voiceMessages: value.voiceMessages, bio: value.bio, birthday: value.birthday, giftsAutoSave: value.giftsAutoSave, noPaidMessages: value.noPaidMessages, globalSettings: value.globalSettings, accountRemovalTimeout: value.accountRemovalTimeout, messageAutoremoveTimeout: value.messageAutoremoveTimeout))) privacySettingsPromise.set(.single(AccountPrivacySettings(presence: value.presence, groupInvitations: value.groupInvitations, voiceCalls: value.voiceCalls, voiceCallsP2P: value.voiceCallsP2P, profilePhoto: value.profilePhoto, forwards: value.forwards, phoneNumber: updated, phoneDiscoveryEnabled: updatedDiscoveryEnabled ?? value.phoneDiscoveryEnabled, voiceMessages: value.voiceMessages, bio: value.bio, birthday: value.birthday, giftsAutoSave: value.giftsAutoSave, noPaidMessages: value.noPaidMessages, savedMusic: value.savedMusic, globalSettings: value.globalSettings, accountRemovalTimeout: value.accountRemovalTimeout, messageAutoremoveTimeout: value.messageAutoremoveTimeout)))
} }
return .complete() return .complete()
} }
@ -1053,7 +1070,7 @@ public func privacyAndSecurityController(
|> deliverOnMainQueue |> deliverOnMainQueue
|> mapToSignal { value -> Signal<Void, NoError> in |> mapToSignal { value -> Signal<Void, NoError> in
if let value = value { if let value = value {
privacySettingsPromise.set(.single(AccountPrivacySettings(presence: value.presence, groupInvitations: value.groupInvitations, voiceCalls: value.voiceCalls, voiceCallsP2P: value.voiceCallsP2P, profilePhoto: value.profilePhoto, forwards: value.forwards, phoneNumber: value.phoneNumber, phoneDiscoveryEnabled: value.phoneDiscoveryEnabled, voiceMessages: updated, bio: value.bio, birthday: value.birthday, giftsAutoSave: value.giftsAutoSave, noPaidMessages: value.noPaidMessages, globalSettings: value.globalSettings, accountRemovalTimeout: value.accountRemovalTimeout, messageAutoremoveTimeout: value.messageAutoremoveTimeout))) privacySettingsPromise.set(.single(AccountPrivacySettings(presence: value.presence, groupInvitations: value.groupInvitations, voiceCalls: value.voiceCalls, voiceCallsP2P: value.voiceCallsP2P, profilePhoto: value.profilePhoto, forwards: value.forwards, phoneNumber: value.phoneNumber, phoneDiscoveryEnabled: value.phoneDiscoveryEnabled, voiceMessages: updated, bio: value.bio, birthday: value.birthday, giftsAutoSave: value.giftsAutoSave, noPaidMessages: value.noPaidMessages, savedMusic: value.savedMusic, globalSettings: value.globalSettings, accountRemovalTimeout: value.accountRemovalTimeout, messageAutoremoveTimeout: value.messageAutoremoveTimeout)))
} }
return .complete() return .complete()
} }
@ -1076,7 +1093,7 @@ public func privacyAndSecurityController(
|> deliverOnMainQueue |> deliverOnMainQueue
|> mapToSignal { value -> Signal<Void, NoError> in |> mapToSignal { value -> Signal<Void, NoError> in
if let value = value { if let value = value {
privacySettingsPromise.set(.single(AccountPrivacySettings(presence: value.presence, groupInvitations: value.groupInvitations, voiceCalls: value.voiceCalls, voiceCallsP2P: value.voiceCallsP2P, profilePhoto: value.profilePhoto, forwards: value.forwards, phoneNumber: value.phoneNumber, phoneDiscoveryEnabled: value.phoneDiscoveryEnabled, voiceMessages: value.voiceMessages, bio: updated, birthday: value.birthday, giftsAutoSave: value.giftsAutoSave, noPaidMessages: value.noPaidMessages, globalSettings: value.globalSettings, accountRemovalTimeout: value.accountRemovalTimeout, messageAutoremoveTimeout: value.messageAutoremoveTimeout))) privacySettingsPromise.set(.single(AccountPrivacySettings(presence: value.presence, groupInvitations: value.groupInvitations, voiceCalls: value.voiceCalls, voiceCallsP2P: value.voiceCallsP2P, profilePhoto: value.profilePhoto, forwards: value.forwards, phoneNumber: value.phoneNumber, phoneDiscoveryEnabled: value.phoneDiscoveryEnabled, voiceMessages: value.voiceMessages, bio: updated, birthday: value.birthday, giftsAutoSave: value.giftsAutoSave, noPaidMessages: value.noPaidMessages, savedMusic: value.savedMusic, globalSettings: value.globalSettings, accountRemovalTimeout: value.accountRemovalTimeout, messageAutoremoveTimeout: value.messageAutoremoveTimeout)))
} }
return .complete() return .complete()
} }
@ -1099,7 +1116,30 @@ public func privacyAndSecurityController(
|> deliverOnMainQueue |> deliverOnMainQueue
|> mapToSignal { value -> Signal<Void, NoError> in |> mapToSignal { value -> Signal<Void, NoError> in
if let value = value { if let value = value {
privacySettingsPromise.set(.single(AccountPrivacySettings(presence: value.presence, groupInvitations: value.groupInvitations, voiceCalls: value.voiceCalls, voiceCallsP2P: value.voiceCallsP2P, profilePhoto: value.profilePhoto, forwards: value.forwards, phoneNumber: value.phoneNumber, phoneDiscoveryEnabled: value.phoneDiscoveryEnabled, voiceMessages: value.voiceMessages, bio: value.bio, birthday: updated, giftsAutoSave: value.giftsAutoSave, noPaidMessages: value.noPaidMessages, globalSettings: value.globalSettings, accountRemovalTimeout: value.accountRemovalTimeout, messageAutoremoveTimeout: value.messageAutoremoveTimeout))) privacySettingsPromise.set(.single(AccountPrivacySettings(presence: value.presence, groupInvitations: value.groupInvitations, voiceCalls: value.voiceCalls, voiceCallsP2P: value.voiceCallsP2P, profilePhoto: value.profilePhoto, forwards: value.forwards, phoneNumber: value.phoneNumber, phoneDiscoveryEnabled: value.phoneDiscoveryEnabled, voiceMessages: value.voiceMessages, bio: value.bio, birthday: updated, giftsAutoSave: value.giftsAutoSave, noPaidMessages: value.noPaidMessages, savedMusic: value.savedMusic, globalSettings: value.globalSettings, accountRemovalTimeout: value.accountRemovalTimeout, messageAutoremoveTimeout: value.messageAutoremoveTimeout)))
}
return .complete()
}
currentInfoDisposable.set(applySetting.start())
}
}), true)
}
}))
}, openSavedMusicPrivacy: {
let signal = privacySettingsPromise.get()
|> take(1)
|> deliverOnMainQueue
currentInfoDisposable.set(signal.start(next: { [weak currentInfoDisposable] info in
if let info = info {
pushControllerImpl?(selectivePrivacySettingsController(context: context, kind: .savedMusic, current: info.savedMusic, updated: { updated, _, _, _ in
if let currentInfoDisposable = currentInfoDisposable {
let applySetting: Signal<Void, NoError> = privacySettingsPromise.get()
|> filter { $0 != nil }
|> take(1)
|> deliverOnMainQueue
|> mapToSignal { value -> Signal<Void, NoError> in
if let value = value {
privacySettingsPromise.set(.single(AccountPrivacySettings(presence: value.presence, groupInvitations: value.groupInvitations, voiceCalls: value.voiceCalls, voiceCallsP2P: value.voiceCallsP2P, profilePhoto: value.profilePhoto, forwards: value.forwards, phoneNumber: value.phoneNumber, phoneDiscoveryEnabled: value.phoneDiscoveryEnabled, voiceMessages: value.voiceMessages, bio: value.bio, birthday: value.birthday, giftsAutoSave: value.giftsAutoSave, noPaidMessages: value.noPaidMessages, savedMusic: updated, globalSettings: value.globalSettings, accountRemovalTimeout: value.accountRemovalTimeout, messageAutoremoveTimeout: value.messageAutoremoveTimeout)))
} }
return .complete() return .complete()
} }
@ -1167,7 +1207,7 @@ public func privacyAndSecurityController(
var globalSettings = value.globalSettings var globalSettings = value.globalSettings
globalSettings.automaticallyArchiveAndMuteNonContacts = archiveValue globalSettings.automaticallyArchiveAndMuteNonContacts = archiveValue
privacySettingsPromise.set(.single(AccountPrivacySettings(presence: value.presence, groupInvitations: value.groupInvitations, voiceCalls: value.voiceCalls, voiceCallsP2P: value.voiceCallsP2P, profilePhoto: value.profilePhoto, forwards: value.forwards, phoneNumber: value.phoneNumber, phoneDiscoveryEnabled: value.phoneDiscoveryEnabled, voiceMessages: value.voiceMessages, bio: value.bio, birthday: value.birthday, giftsAutoSave: value.giftsAutoSave, noPaidMessages: value.noPaidMessages, globalSettings: globalSettings, accountRemovalTimeout: value.accountRemovalTimeout, messageAutoremoveTimeout: value.messageAutoremoveTimeout))) privacySettingsPromise.set(.single(AccountPrivacySettings(presence: value.presence, groupInvitations: value.groupInvitations, voiceCalls: value.voiceCalls, voiceCallsP2P: value.voiceCallsP2P, profilePhoto: value.profilePhoto, forwards: value.forwards, phoneNumber: value.phoneNumber, phoneDiscoveryEnabled: value.phoneDiscoveryEnabled, voiceMessages: value.voiceMessages, bio: value.bio, birthday: value.birthday, giftsAutoSave: value.giftsAutoSave, noPaidMessages: value.noPaidMessages, savedMusic: value.savedMusic, globalSettings: globalSettings, accountRemovalTimeout: value.accountRemovalTimeout, messageAutoremoveTimeout: value.messageAutoremoveTimeout)))
} }
return .complete() return .complete()
} }
@ -1206,7 +1246,7 @@ public func privacyAndSecurityController(
|> deliverOnMainQueue |> deliverOnMainQueue
|> mapToSignal { value -> Signal<Void, NoError> in |> mapToSignal { value -> Signal<Void, NoError> in
if let value = value { if let value = value {
privacySettingsPromise.set(.single(AccountPrivacySettings(presence: value.presence, groupInvitations: value.groupInvitations, voiceCalls: value.voiceCalls, voiceCallsP2P: value.voiceCallsP2P, profilePhoto: value.profilePhoto, forwards: value.forwards, phoneNumber: value.phoneNumber, phoneDiscoveryEnabled: value.phoneDiscoveryEnabled, voiceMessages: value.voiceMessages, bio: value.bio, birthday: value.birthday, giftsAutoSave: value.giftsAutoSave, noPaidMessages: value.noPaidMessages, globalSettings: value.globalSettings, accountRemovalTimeout: timeout, messageAutoremoveTimeout: value.messageAutoremoveTimeout))) privacySettingsPromise.set(.single(AccountPrivacySettings(presence: value.presence, groupInvitations: value.groupInvitations, voiceCalls: value.voiceCalls, voiceCallsP2P: value.voiceCallsP2P, profilePhoto: value.profilePhoto, forwards: value.forwards, phoneNumber: value.phoneNumber, phoneDiscoveryEnabled: value.phoneDiscoveryEnabled, voiceMessages: value.voiceMessages, bio: value.bio, birthday: value.birthday, giftsAutoSave: value.giftsAutoSave, noPaidMessages: value.noPaidMessages, savedMusic: value.savedMusic, globalSettings: value.globalSettings, accountRemovalTimeout: timeout, messageAutoremoveTimeout: value.messageAutoremoveTimeout)))
} }
return .complete() return .complete()
} }
@ -1269,7 +1309,7 @@ public func privacyAndSecurityController(
|> deliverOnMainQueue |> deliverOnMainQueue
|> mapToSignal { value -> Signal<Void, NoError> in |> mapToSignal { value -> Signal<Void, NoError> in
if let value = value { if let value = value {
privacySettingsPromise.set(.single(AccountPrivacySettings(presence: value.presence, groupInvitations: value.groupInvitations, voiceCalls: value.voiceCalls, voiceCallsP2P: value.voiceCallsP2P, profilePhoto: value.profilePhoto, forwards: value.forwards, phoneNumber: value.phoneNumber, phoneDiscoveryEnabled: value.phoneDiscoveryEnabled, voiceMessages: value.voiceMessages, bio: value.bio, birthday: value.birthday, giftsAutoSave: value.giftsAutoSave, noPaidMessages: value.noPaidMessages, globalSettings: value.globalSettings, accountRemovalTimeout: value.accountRemovalTimeout, messageAutoremoveTimeout: updatedValue == 0 ? nil : updatedValue))) privacySettingsPromise.set(.single(AccountPrivacySettings(presence: value.presence, groupInvitations: value.groupInvitations, voiceCalls: value.voiceCalls, voiceCallsP2P: value.voiceCallsP2P, profilePhoto: value.profilePhoto, forwards: value.forwards, phoneNumber: value.phoneNumber, phoneDiscoveryEnabled: value.phoneDiscoveryEnabled, voiceMessages: value.voiceMessages, bio: value.bio, birthday: value.birthday, giftsAutoSave: value.giftsAutoSave, noPaidMessages: value.noPaidMessages, savedMusic: value.savedMusic, globalSettings: value.globalSettings, accountRemovalTimeout: value.accountRemovalTimeout, messageAutoremoveTimeout: updatedValue == 0 ? nil : updatedValue)))
} }
return .complete() return .complete()
} }
@ -1319,7 +1359,7 @@ public func privacyAndSecurityController(
var globalSettings = value.globalSettings var globalSettings = value.globalSettings
globalSettings.nonContactChatsPrivacy = settingValue globalSettings.nonContactChatsPrivacy = settingValue
privacySettingsPromise.set(.single(AccountPrivacySettings(presence: value.presence, groupInvitations: value.groupInvitations, voiceCalls: value.voiceCalls, voiceCallsP2P: value.voiceCallsP2P, profilePhoto: value.profilePhoto, forwards: value.forwards, phoneNumber: value.phoneNumber, phoneDiscoveryEnabled: value.phoneDiscoveryEnabled, voiceMessages: value.voiceMessages, bio: value.bio, birthday: value.birthday, giftsAutoSave: value.giftsAutoSave, noPaidMessages: value.noPaidMessages, globalSettings: globalSettings, accountRemovalTimeout: value.accountRemovalTimeout, messageAutoremoveTimeout: value.messageAutoremoveTimeout))) privacySettingsPromise.set(.single(AccountPrivacySettings(presence: value.presence, groupInvitations: value.groupInvitations, voiceCalls: value.voiceCalls, voiceCallsP2P: value.voiceCallsP2P, profilePhoto: value.profilePhoto, forwards: value.forwards, phoneNumber: value.phoneNumber, phoneDiscoveryEnabled: value.phoneDiscoveryEnabled, voiceMessages: value.voiceMessages, bio: value.bio, birthday: value.birthday, giftsAutoSave: value.giftsAutoSave, noPaidMessages: value.noPaidMessages, savedMusic: value.savedMusic, globalSettings: globalSettings, accountRemovalTimeout: value.accountRemovalTimeout, messageAutoremoveTimeout: value.messageAutoremoveTimeout)))
} }
return .complete() return .complete()
} }
@ -1366,7 +1406,7 @@ public func privacyAndSecurityController(
|> deliverOnMainQueue |> deliverOnMainQueue
|> mapToSignal { value -> Signal<Void, NoError> in |> mapToSignal { value -> Signal<Void, NoError> in
if let value = value { if let value = value {
privacySettingsPromise.set(.single(AccountPrivacySettings(presence: value.presence, groupInvitations: value.groupInvitations, voiceCalls: value.voiceCalls, voiceCallsP2P: value.voiceCallsP2P, profilePhoto: value.profilePhoto, forwards: value.forwards, phoneNumber: value.phoneNumber, phoneDiscoveryEnabled: value.phoneDiscoveryEnabled, voiceMessages: value.voiceMessages, bio: value.bio, birthday: value.birthday, giftsAutoSave: updated, noPaidMessages: value.noPaidMessages, globalSettings: updatedGlobalSettings ?? value.globalSettings, accountRemovalTimeout: value.accountRemovalTimeout, messageAutoremoveTimeout: value.messageAutoremoveTimeout))) privacySettingsPromise.set(.single(AccountPrivacySettings(presence: value.presence, groupInvitations: value.groupInvitations, voiceCalls: value.voiceCalls, voiceCallsP2P: value.voiceCallsP2P, profilePhoto: value.profilePhoto, forwards: value.forwards, phoneNumber: value.phoneNumber, phoneDiscoveryEnabled: value.phoneDiscoveryEnabled, voiceMessages: value.voiceMessages, bio: value.bio, birthday: value.birthday, giftsAutoSave: updated, noPaidMessages: value.noPaidMessages, savedMusic: value.savedMusic, globalSettings: updatedGlobalSettings ?? value.globalSettings, accountRemovalTimeout: value.accountRemovalTimeout, messageAutoremoveTimeout: value.messageAutoremoveTimeout)))
} }
return .complete() return .complete()
} }

View File

@ -1012,6 +1012,11 @@ private func selectivePrivacySettingsControllerEntries(presentationData: Present
settingInfoText = presentationData.strings.Privacy_Birthday_CustomHelp settingInfoText = presentationData.strings.Privacy_Birthday_CustomHelp
disableForText = presentationData.strings.PrivacyLastSeenSettings_NeverShareWith disableForText = presentationData.strings.PrivacyLastSeenSettings_NeverShareWith
enableForText = presentationData.strings.PrivacyLastSeenSettings_AlwaysShareWith enableForText = presentationData.strings.PrivacyLastSeenSettings_AlwaysShareWith
case .savedMusic:
settingTitle = presentationData.strings.Privacy_SavedMusic_WhoCanSeeMyMusic
settingInfoText = presentationData.strings.Privacy_SavedMusic_CustomHelp
disableForText = presentationData.strings.PrivacyLastSeenSettings_NeverShareWith
enableForText = presentationData.strings.PrivacyLastSeenSettings_AlwaysShareWith
case .giftsAutoSave: case .giftsAutoSave:
settingTitle = presentationData.strings.Privacy_Gifts_WhoCanSeeMyBio settingTitle = presentationData.strings.Privacy_Gifts_WhoCanSeeMyBio
settingInfoText = presentationData.strings.Privacy_Gifts_CustomHelp settingInfoText = presentationData.strings.Privacy_Gifts_CustomHelp
@ -1295,6 +1300,8 @@ public func selectivePrivacySettingsController(
title = strings.Privacy_Bio_AlwaysShareWith_Title title = strings.Privacy_Bio_AlwaysShareWith_Title
case .birthday: case .birthday:
title = strings.Privacy_Birthday_AlwaysShareWith_Title title = strings.Privacy_Birthday_AlwaysShareWith_Title
case .savedMusic:
title = strings.Privacy_SavedMusic_AlwaysShareWith_Title
case .giftsAutoSave: case .giftsAutoSave:
title = strings.Privacy_Gifts_AlwaysAllow_Title title = strings.Privacy_Gifts_AlwaysAllow_Title
} }
@ -1318,6 +1325,8 @@ public func selectivePrivacySettingsController(
title = strings.Privacy_Bio_NeverShareWith_Title title = strings.Privacy_Bio_NeverShareWith_Title
case .birthday: case .birthday:
title = strings.Privacy_Birthday_NeverShareWith_Title title = strings.Privacy_Birthday_NeverShareWith_Title
case .savedMusic:
title = strings.Privacy_SavedMusic_NeverShareWith_Title
case .giftsAutoSave: case .giftsAutoSave:
title = strings.Privacy_Gifts_NeverAllow_Title title = strings.Privacy_Gifts_NeverAllow_Title
} }
@ -1686,26 +1695,28 @@ public func selectivePrivacySettingsController(
let title: String let title: String
switch kind { switch kind {
case .presence: case .presence:
title = presentationData.strings.PrivacySettings_LastSeenTitle title = presentationData.strings.PrivacySettings_LastSeenTitle
case .groupInvitations: case .groupInvitations:
title = presentationData.strings.Privacy_GroupsAndChannels title = presentationData.strings.Privacy_GroupsAndChannels
case .voiceCalls: case .voiceCalls:
title = presentationData.strings.Settings_CallSettings title = presentationData.strings.Settings_CallSettings
case .profilePhoto: case .profilePhoto:
title = presentationData.strings.Privacy_ProfilePhoto title = presentationData.strings.Privacy_ProfilePhoto
case .forwards: case .forwards:
title = presentationData.strings.Privacy_Forwards title = presentationData.strings.Privacy_Forwards
case .phoneNumber: case .phoneNumber:
title = presentationData.strings.Privacy_PhoneNumber title = presentationData.strings.Privacy_PhoneNumber
case .voiceMessages: case .voiceMessages:
title = presentationData.strings.Privacy_VoiceMessages title = presentationData.strings.Privacy_VoiceMessages
case .bio: case .bio:
title = presentationData.strings.Privacy_Bio title = presentationData.strings.Privacy_Bio
case .birthday: case .birthday:
title = presentationData.strings.Privacy_Birthday title = presentationData.strings.Privacy_Birthday
case .giftsAutoSave: case .savedMusic:
title = presentationData.strings.Privacy_Gifts title = presentationData.strings.Privacy_SavedMusic
case .giftsAutoSave:
title = presentationData.strings.Privacy_Gifts
} }
let controllerState = ItemListControllerState(presentationData: ItemListPresentationData(presentationData), title: .text(title), leftNavigationButton: nil, rightNavigationButton: nil, backNavigationButton: ItemListBackButton(title: presentationData.strings.Common_Back), animateChanges: false) let controllerState = ItemListControllerState(presentationData: ItemListPresentationData(presentationData), title: .text(title), leftNavigationButton: nil, rightNavigationButton: nil, backNavigationButton: ItemListBackButton(title: presentationData.strings.Common_Back), animateChanges: false)
let listState = ItemListNodeState(presentationData: ItemListPresentationData(presentationData), entries: selectivePrivacySettingsControllerEntries(presentationData: presentationData, kind: kind, state: state, peerName: peerName ?? "", phoneNumber: phoneNumber, peer: peer, birthday: birthday, publicPhoto: publicPhoto.knownValue), style: .blocks, animateChanges: true) let listState = ItemListNodeState(presentationData: ItemListPresentationData(presentationData), entries: selectivePrivacySettingsControllerEntries(presentationData: presentationData, kind: kind, state: state, peerName: peerName ?? "", phoneNumber: phoneNumber, peer: peer, birthday: birthday, publicPhoto: publicPhoto.knownValue), style: .blocks, animateChanges: true)
@ -1796,26 +1807,28 @@ public func selectivePrivacySettingsController(
let type: UpdateSelectiveAccountPrivacySettingsType let type: UpdateSelectiveAccountPrivacySettingsType
switch kind { switch kind {
case .presence: case .presence:
type = .presence type = .presence
case .groupInvitations: case .groupInvitations:
type = .groupInvitations type = .groupInvitations
case .voiceCalls: case .voiceCalls:
type = .voiceCalls type = .voiceCalls
case .profilePhoto: case .profilePhoto:
type = .profilePhoto type = .profilePhoto
case .forwards: case .forwards:
type = .forwards type = .forwards
case .phoneNumber: case .phoneNumber:
type = .phoneNumber type = .phoneNumber
case .voiceMessages: case .voiceMessages:
type = .voiceMessages type = .voiceMessages
case .bio: case .bio:
type = .bio type = .bio
case .birthday: case .birthday:
type = .birthday type = .birthday
case .giftsAutoSave: case .savedMusic:
type = .giftsAutoSave type = .savedMusic
case .giftsAutoSave:
type = .giftsAutoSave
} }
let updateSettingsSignal = context.engine.privacy.updateSelectiveAccountPrivacySettings(type: type, settings: settings) let updateSettingsSignal = context.engine.privacy.updateSelectiveAccountPrivacySettings(type: type, settings: settings)

View File

@ -579,26 +579,28 @@ private func privacySearchableItems(context: AccountContext, privacySettings: Ac
|> deliverOnMainQueue).start(next: { info, callSettings in |> deliverOnMainQueue).start(next: { info, callSettings in
let current: SelectivePrivacySettings let current: SelectivePrivacySettings
switch kind { switch kind {
case .presence: case .presence:
current = info.presence current = info.presence
case .groupInvitations: case .groupInvitations:
current = info.groupInvitations current = info.groupInvitations
case .voiceCalls: case .voiceCalls:
current = info.voiceCalls current = info.voiceCalls
case .profilePhoto: case .profilePhoto:
current = info.profilePhoto current = info.profilePhoto
case .forwards: case .forwards:
current = info.forwards current = info.forwards
case .phoneNumber: case .phoneNumber:
current = info.phoneNumber current = info.phoneNumber
case .voiceMessages: case .voiceMessages:
current = info.voiceMessages current = info.voiceMessages
case .bio: case .bio:
current = info.bio current = info.bio
case .birthday: case .birthday:
current = info.birthday current = info.birthday
case .giftsAutoSave: case .savedMusic:
current = info.giftsAutoSave current = info.savedMusic
case .giftsAutoSave:
current = info.giftsAutoSave
} }
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

View File

@ -30,7 +30,7 @@ public func makeBioPrivacyController(context: AccountContext, settings: Promise<
|> deliverOnMainQueue |> deliverOnMainQueue
|> mapToSignal { value -> Signal<Void, NoError> in |> mapToSignal { value -> Signal<Void, NoError> in
if let value = value { if let value = value {
settings.set(.single(AccountPrivacySettings(presence: value.presence, groupInvitations: value.groupInvitations, voiceCalls: value.voiceCalls, voiceCallsP2P: value.voiceCallsP2P, profilePhoto: value.profilePhoto, forwards: value.forwards, phoneNumber: value.phoneNumber, phoneDiscoveryEnabled: value.phoneDiscoveryEnabled, voiceMessages: value.voiceMessages, bio: updated, birthday: value.birthday, giftsAutoSave: value.giftsAutoSave, noPaidMessages: value.noPaidMessages, globalSettings: value.globalSettings, accountRemovalTimeout: value.accountRemovalTimeout, messageAutoremoveTimeout: value.messageAutoremoveTimeout))) settings.set(.single(AccountPrivacySettings(presence: value.presence, groupInvitations: value.groupInvitations, voiceCalls: value.voiceCalls, voiceCallsP2P: value.voiceCallsP2P, profilePhoto: value.profilePhoto, forwards: value.forwards, phoneNumber: value.phoneNumber, phoneDiscoveryEnabled: value.phoneDiscoveryEnabled, voiceMessages: value.voiceMessages, bio: updated, birthday: value.birthday, giftsAutoSave: value.giftsAutoSave, noPaidMessages: value.noPaidMessages, savedMusic: value.savedMusic, globalSettings: value.globalSettings, accountRemovalTimeout: value.accountRemovalTimeout, messageAutoremoveTimeout: value.messageAutoremoveTimeout)))
} }
return .complete() return .complete()
} }
@ -54,7 +54,7 @@ public func makeBirthdayPrivacyController(context: AccountContext, settings: Pro
|> deliverOnMainQueue |> deliverOnMainQueue
|> mapToSignal { value -> Signal<Void, NoError> in |> mapToSignal { value -> Signal<Void, NoError> in
if let value = value { if let value = value {
settings.set(.single(AccountPrivacySettings(presence: value.presence, groupInvitations: value.groupInvitations, voiceCalls: value.voiceCalls, voiceCallsP2P: value.voiceCallsP2P, profilePhoto: value.profilePhoto, forwards: value.forwards, phoneNumber: value.phoneNumber, phoneDiscoveryEnabled: value.phoneDiscoveryEnabled, voiceMessages: value.voiceMessages, bio: value.bio, birthday: updated, giftsAutoSave: value.giftsAutoSave, noPaidMessages: value.noPaidMessages, globalSettings: value.globalSettings, accountRemovalTimeout: value.accountRemovalTimeout, messageAutoremoveTimeout: value.messageAutoremoveTimeout))) settings.set(.single(AccountPrivacySettings(presence: value.presence, groupInvitations: value.groupInvitations, voiceCalls: value.voiceCalls, voiceCallsP2P: value.voiceCallsP2P, profilePhoto: value.profilePhoto, forwards: value.forwards, phoneNumber: value.phoneNumber, phoneDiscoveryEnabled: value.phoneDiscoveryEnabled, voiceMessages: value.voiceMessages, bio: value.bio, birthday: updated, giftsAutoSave: value.giftsAutoSave, noPaidMessages: value.noPaidMessages, savedMusic: value.savedMusic, globalSettings: value.globalSettings, accountRemovalTimeout: value.accountRemovalTimeout, messageAutoremoveTimeout: value.messageAutoremoveTimeout)))
} }
return .complete() return .complete()
} }

View File

@ -454,6 +454,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
dict[55761658] = { return Api.InputPrivacyKey.parse_inputPrivacyKeyPhoneNumber($0) } dict[55761658] = { return Api.InputPrivacyKey.parse_inputPrivacyKeyPhoneNumber($0) }
dict[-610373422] = { return Api.InputPrivacyKey.parse_inputPrivacyKeyPhoneP2P($0) } dict[-610373422] = { return Api.InputPrivacyKey.parse_inputPrivacyKeyPhoneP2P($0) }
dict[1461304012] = { return Api.InputPrivacyKey.parse_inputPrivacyKeyProfilePhoto($0) } dict[1461304012] = { return Api.InputPrivacyKey.parse_inputPrivacyKeyProfilePhoto($0) }
dict[1304334886] = { return Api.InputPrivacyKey.parse_inputPrivacyKeySavedMusic($0) }
dict[-512548031] = { return Api.InputPrivacyKey.parse_inputPrivacyKeyStarGiftsAutoSave($0) } dict[-512548031] = { return Api.InputPrivacyKey.parse_inputPrivacyKeyStarGiftsAutoSave($0) }
dict[1335282456] = { return Api.InputPrivacyKey.parse_inputPrivacyKeyStatusTimestamp($0) } dict[1335282456] = { return Api.InputPrivacyKey.parse_inputPrivacyKeyStatusTimestamp($0) }
dict[-1360618136] = { return Api.InputPrivacyKey.parse_inputPrivacyKeyVoiceMessages($0) } dict[-1360618136] = { return Api.InputPrivacyKey.parse_inputPrivacyKeyVoiceMessages($0) }
@ -813,6 +814,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
dict[-778378131] = { return Api.PrivacyKey.parse_privacyKeyPhoneNumber($0) } dict[-778378131] = { return Api.PrivacyKey.parse_privacyKeyPhoneNumber($0) }
dict[961092808] = { return Api.PrivacyKey.parse_privacyKeyPhoneP2P($0) } dict[961092808] = { return Api.PrivacyKey.parse_privacyKeyPhoneP2P($0) }
dict[-1777000467] = { return Api.PrivacyKey.parse_privacyKeyProfilePhoto($0) } dict[-1777000467] = { return Api.PrivacyKey.parse_privacyKeyProfilePhoto($0) }
dict[-8759525] = { return Api.PrivacyKey.parse_privacyKeySavedMusic($0) }
dict[749010424] = { return Api.PrivacyKey.parse_privacyKeyStarGiftsAutoSave($0) } dict[749010424] = { return Api.PrivacyKey.parse_privacyKeyStarGiftsAutoSave($0) }
dict[-1137792208] = { return Api.PrivacyKey.parse_privacyKeyStatusTimestamp($0) } dict[-1137792208] = { return Api.PrivacyKey.parse_privacyKeyStatusTimestamp($0) }
dict[110621716] = { return Api.PrivacyKey.parse_privacyKeyVoiceMessages($0) } dict[110621716] = { return Api.PrivacyKey.parse_privacyKeyVoiceMessages($0) }
@ -1033,7 +1035,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
dict[-1609668650] = { return Api.Theme.parse_theme($0) } dict[-1609668650] = { return Api.Theme.parse_theme($0) }
dict[-94849324] = { return Api.ThemeSettings.parse_themeSettings($0) } dict[-94849324] = { return Api.ThemeSettings.parse_themeSettings($0) }
dict[-7173643] = { return Api.Timezone.parse_timezone($0) } dict[-7173643] = { return Api.Timezone.parse_timezone($0) }
dict[1287725239] = { return Api.TodoCompletion.parse_todoCompletion($0) } dict[572241380] = { return Api.TodoCompletion.parse_todoCompletion($0) }
dict[-878074577] = { return Api.TodoItem.parse_todoItem($0) } dict[-878074577] = { return Api.TodoItem.parse_todoItem($0) }
dict[1236871718] = { return Api.TodoList.parse_todoList($0) } dict[1236871718] = { return Api.TodoList.parse_todoList($0) }
dict[-305282981] = { return Api.TopPeer.parse_topPeer($0) } dict[-305282981] = { return Api.TopPeer.parse_topPeer($0) }

View File

@ -350,6 +350,7 @@ public extension Api {
case inputPrivacyKeyPhoneNumber case inputPrivacyKeyPhoneNumber
case inputPrivacyKeyPhoneP2P case inputPrivacyKeyPhoneP2P
case inputPrivacyKeyProfilePhoto case inputPrivacyKeyProfilePhoto
case inputPrivacyKeySavedMusic
case inputPrivacyKeyStarGiftsAutoSave case inputPrivacyKeyStarGiftsAutoSave
case inputPrivacyKeyStatusTimestamp case inputPrivacyKeyStatusTimestamp
case inputPrivacyKeyVoiceMessages case inputPrivacyKeyVoiceMessages
@ -415,6 +416,12 @@ public extension Api {
buffer.appendInt32(1461304012) buffer.appendInt32(1461304012)
} }
break
case .inputPrivacyKeySavedMusic:
if boxed {
buffer.appendInt32(1304334886)
}
break break
case .inputPrivacyKeyStarGiftsAutoSave: case .inputPrivacyKeyStarGiftsAutoSave:
if boxed { if boxed {
@ -459,6 +466,8 @@ public extension Api {
return ("inputPrivacyKeyPhoneP2P", []) return ("inputPrivacyKeyPhoneP2P", [])
case .inputPrivacyKeyProfilePhoto: case .inputPrivacyKeyProfilePhoto:
return ("inputPrivacyKeyProfilePhoto", []) return ("inputPrivacyKeyProfilePhoto", [])
case .inputPrivacyKeySavedMusic:
return ("inputPrivacyKeySavedMusic", [])
case .inputPrivacyKeyStarGiftsAutoSave: case .inputPrivacyKeyStarGiftsAutoSave:
return ("inputPrivacyKeyStarGiftsAutoSave", []) return ("inputPrivacyKeyStarGiftsAutoSave", [])
case .inputPrivacyKeyStatusTimestamp: case .inputPrivacyKeyStatusTimestamp:
@ -498,6 +507,9 @@ public extension Api {
public static func parse_inputPrivacyKeyProfilePhoto(_ reader: BufferReader) -> InputPrivacyKey? { public static func parse_inputPrivacyKeyProfilePhoto(_ reader: BufferReader) -> InputPrivacyKey? {
return Api.InputPrivacyKey.inputPrivacyKeyProfilePhoto return Api.InputPrivacyKey.inputPrivacyKeyProfilePhoto
} }
public static func parse_inputPrivacyKeySavedMusic(_ reader: BufferReader) -> InputPrivacyKey? {
return Api.InputPrivacyKey.inputPrivacyKeySavedMusic
}
public static func parse_inputPrivacyKeyStarGiftsAutoSave(_ reader: BufferReader) -> InputPrivacyKey? { public static func parse_inputPrivacyKeyStarGiftsAutoSave(_ reader: BufferReader) -> InputPrivacyKey? {
return Api.InputPrivacyKey.inputPrivacyKeyStarGiftsAutoSave return Api.InputPrivacyKey.inputPrivacyKeyStarGiftsAutoSave
} }

View File

@ -1134,6 +1134,7 @@ public extension Api {
case privacyKeyPhoneNumber case privacyKeyPhoneNumber
case privacyKeyPhoneP2P case privacyKeyPhoneP2P
case privacyKeyProfilePhoto case privacyKeyProfilePhoto
case privacyKeySavedMusic
case privacyKeyStarGiftsAutoSave case privacyKeyStarGiftsAutoSave
case privacyKeyStatusTimestamp case privacyKeyStatusTimestamp
case privacyKeyVoiceMessages case privacyKeyVoiceMessages
@ -1199,6 +1200,12 @@ public extension Api {
buffer.appendInt32(-1777000467) buffer.appendInt32(-1777000467)
} }
break
case .privacyKeySavedMusic:
if boxed {
buffer.appendInt32(-8759525)
}
break break
case .privacyKeyStarGiftsAutoSave: case .privacyKeyStarGiftsAutoSave:
if boxed { if boxed {
@ -1243,6 +1250,8 @@ public extension Api {
return ("privacyKeyPhoneP2P", []) return ("privacyKeyPhoneP2P", [])
case .privacyKeyProfilePhoto: case .privacyKeyProfilePhoto:
return ("privacyKeyProfilePhoto", []) return ("privacyKeyProfilePhoto", [])
case .privacyKeySavedMusic:
return ("privacyKeySavedMusic", [])
case .privacyKeyStarGiftsAutoSave: case .privacyKeyStarGiftsAutoSave:
return ("privacyKeyStarGiftsAutoSave", []) return ("privacyKeyStarGiftsAutoSave", [])
case .privacyKeyStatusTimestamp: case .privacyKeyStatusTimestamp:
@ -1282,6 +1291,9 @@ public extension Api {
public static func parse_privacyKeyProfilePhoto(_ reader: BufferReader) -> PrivacyKey? { public static func parse_privacyKeyProfilePhoto(_ reader: BufferReader) -> PrivacyKey? {
return Api.PrivacyKey.privacyKeyProfilePhoto return Api.PrivacyKey.privacyKeyProfilePhoto
} }
public static func parse_privacyKeySavedMusic(_ reader: BufferReader) -> PrivacyKey? {
return Api.PrivacyKey.privacyKeySavedMusic
}
public static func parse_privacyKeyStarGiftsAutoSave(_ reader: BufferReader) -> PrivacyKey? { public static func parse_privacyKeyStarGiftsAutoSave(_ reader: BufferReader) -> PrivacyKey? {
return Api.PrivacyKey.privacyKeyStarGiftsAutoSave return Api.PrivacyKey.privacyKeyStarGiftsAutoSave
} }

View File

@ -186,16 +186,16 @@ public extension Api {
} }
public extension Api { public extension Api {
enum TodoCompletion: TypeConstructorDescription { enum TodoCompletion: TypeConstructorDescription {
case todoCompletion(id: Int32, completedBy: Int64, date: Int32) case todoCompletion(id: Int32, completedBy: Api.Peer, date: Int32)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self { switch self {
case .todoCompletion(let id, let completedBy, let date): case .todoCompletion(let id, let completedBy, let date):
if boxed { if boxed {
buffer.appendInt32(1287725239) buffer.appendInt32(572241380)
} }
serializeInt32(id, buffer: buffer, boxed: false) serializeInt32(id, buffer: buffer, boxed: false)
serializeInt64(completedBy, buffer: buffer, boxed: false) completedBy.serialize(buffer, true)
serializeInt32(date, buffer: buffer, boxed: false) serializeInt32(date, buffer: buffer, boxed: false)
break break
} }
@ -211,8 +211,10 @@ public extension Api {
public static func parse_todoCompletion(_ reader: BufferReader) -> TodoCompletion? { public static func parse_todoCompletion(_ reader: BufferReader) -> TodoCompletion? {
var _1: Int32? var _1: Int32?
_1 = reader.readInt32() _1 = reader.readInt32()
var _2: Int64? var _2: Api.Peer?
_2 = reader.readInt64() if let signature = reader.readInt32() {
_2 = Api.parse(reader, signature: signature) as? Api.Peer
}
var _3: Int32? var _3: Int32?
_3 = reader.readInt32() _3 = reader.readInt32()
let _c1 = _1 != nil let _c1 = _1 != nil

View File

@ -27,7 +27,7 @@ extension TelegramMediaTodo.Completion {
init(apiCompletion: Api.TodoCompletion) { init(apiCompletion: Api.TodoCompletion) {
switch apiCompletion { switch apiCompletion {
case let .todoCompletion(id, completedBy, date): case let .todoCompletion(id, completedBy, date):
self.init(id: id, date: date, completedBy: EnginePeer.Id(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(completedBy))) self.init(id: id, date: date, completedBy: completedBy.peerId)
} }
} }
} }

View File

@ -131,12 +131,13 @@ public struct AccountPrivacySettings: Equatable {
public var birthday: SelectivePrivacySettings public var birthday: SelectivePrivacySettings
public var giftsAutoSave: SelectivePrivacySettings public var giftsAutoSave: SelectivePrivacySettings
public var noPaidMessages: SelectivePrivacySettings public var noPaidMessages: SelectivePrivacySettings
public var savedMusic: SelectivePrivacySettings
public var globalSettings: GlobalPrivacySettings public var globalSettings: GlobalPrivacySettings
public var accountRemovalTimeout: Int32 public var accountRemovalTimeout: Int32
public var messageAutoremoveTimeout: Int32? public var messageAutoremoveTimeout: Int32?
public init(presence: SelectivePrivacySettings, groupInvitations: SelectivePrivacySettings, voiceCalls: SelectivePrivacySettings, voiceCallsP2P: SelectivePrivacySettings, profilePhoto: SelectivePrivacySettings, forwards: SelectivePrivacySettings, phoneNumber: SelectivePrivacySettings, phoneDiscoveryEnabled: Bool, voiceMessages: SelectivePrivacySettings, bio: SelectivePrivacySettings, birthday: SelectivePrivacySettings, giftsAutoSave: SelectivePrivacySettings, noPaidMessages: SelectivePrivacySettings, globalSettings: GlobalPrivacySettings, accountRemovalTimeout: Int32, messageAutoremoveTimeout: Int32?) { public init(presence: SelectivePrivacySettings, groupInvitations: SelectivePrivacySettings, voiceCalls: SelectivePrivacySettings, voiceCallsP2P: SelectivePrivacySettings, profilePhoto: SelectivePrivacySettings, forwards: SelectivePrivacySettings, phoneNumber: SelectivePrivacySettings, phoneDiscoveryEnabled: Bool, voiceMessages: SelectivePrivacySettings, bio: SelectivePrivacySettings, birthday: SelectivePrivacySettings, giftsAutoSave: SelectivePrivacySettings, noPaidMessages: SelectivePrivacySettings, savedMusic: SelectivePrivacySettings, globalSettings: GlobalPrivacySettings, accountRemovalTimeout: Int32, messageAutoremoveTimeout: Int32?) {
self.presence = presence self.presence = presence
self.groupInvitations = groupInvitations self.groupInvitations = groupInvitations
self.voiceCalls = voiceCalls self.voiceCalls = voiceCalls
@ -150,6 +151,7 @@ public struct AccountPrivacySettings: Equatable {
self.birthday = birthday self.birthday = birthday
self.giftsAutoSave = giftsAutoSave self.giftsAutoSave = giftsAutoSave
self.noPaidMessages = noPaidMessages self.noPaidMessages = noPaidMessages
self.savedMusic = savedMusic
self.globalSettings = globalSettings self.globalSettings = globalSettings
self.accountRemovalTimeout = accountRemovalTimeout self.accountRemovalTimeout = accountRemovalTimeout
self.messageAutoremoveTimeout = messageAutoremoveTimeout self.messageAutoremoveTimeout = messageAutoremoveTimeout
@ -195,6 +197,9 @@ public struct AccountPrivacySettings: Equatable {
if lhs.noPaidMessages != rhs.noPaidMessages { if lhs.noPaidMessages != rhs.noPaidMessages {
return false return false
} }
if lhs.savedMusic != rhs.savedMusic {
return false
}
if lhs.globalSettings != rhs.globalSettings { if lhs.globalSettings != rhs.globalSettings {
return false return false
} }

View File

@ -14,6 +14,10 @@ func _internal_requestUpdateTodoMessageItems(account: Account, messageId: Messag
guard let peer = transaction.getPeer(messageId.peerId), let inputPeer = apiInputPeer(peer) else { guard let peer = transaction.getPeer(messageId.peerId), let inputPeer = apiInputPeer(peer) else {
return .complete() return .complete()
} }
var completedBy = account.peerId
if messageId.peerId.namespace == Namespaces.Peer.CloudChannel, let cachedChannelData = transaction.getPeerCachedData(peerId: messageId.peerId) as? CachedChannelData, let sendAsPeerId = cachedChannelData.sendAsPeerId {
completedBy = sendAsPeerId
}
transaction.updateMessage(messageId, update: { currentMessage in transaction.updateMessage(messageId, update: { currentMessage in
let storeForwardInfo = currentMessage.forwardInfo.flatMap(StoreMessageForwardInfo.init) let storeForwardInfo = currentMessage.forwardInfo.flatMap(StoreMessageForwardInfo.init)
var media: [Media] = [] var media: [Media] = []
@ -21,7 +25,7 @@ func _internal_requestUpdateTodoMessageItems(account: Account, messageId: Messag
let timestamp = Int32(CFAbsoluteTimeGetCurrent() + NSTimeIntervalSince1970) let timestamp = Int32(CFAbsoluteTimeGetCurrent() + NSTimeIntervalSince1970)
var updatedCompletions = todo.completions var updatedCompletions = todo.completions
for id in completedIds { for id in completedIds {
updatedCompletions.append(TelegramMediaTodo.Completion(id: id, date: timestamp, completedBy: account.peerId)) updatedCompletions.append(TelegramMediaTodo.Completion(id: id, date: timestamp, completedBy: completedBy))
} }
updatedCompletions.removeAll(where: { incompletedIds.contains($0.id) }) updatedCompletions.removeAll(where: { incompletedIds.contains($0.id) })
media = [todo.withUpdated(completions: updatedCompletions)] media = [todo.withUpdated(completions: updatedCompletions)]

View File

@ -67,16 +67,17 @@ func _internal_requestAccountPrivacySettings(account: Account) -> Signal<Account
let birthdayPrivacy = account.network.request(Api.functions.account.getPrivacy(key: .inputPrivacyKeyBirthday)) let birthdayPrivacy = account.network.request(Api.functions.account.getPrivacy(key: .inputPrivacyKeyBirthday))
let giftsAutoSavePrivacy = account.network.request(Api.functions.account.getPrivacy(key: .inputPrivacyKeyStarGiftsAutoSave)) let giftsAutoSavePrivacy = account.network.request(Api.functions.account.getPrivacy(key: .inputPrivacyKeyStarGiftsAutoSave))
let noPaidMessagesPrivacy = account.network.request(Api.functions.account.getPrivacy(key: .inputPrivacyKeyNoPaidMessages)) let noPaidMessagesPrivacy = account.network.request(Api.functions.account.getPrivacy(key: .inputPrivacyKeyNoPaidMessages))
let savedMusicPrivacy = account.network.request(Api.functions.account.getPrivacy(key: .inputPrivacyKeySavedMusic))
let autoremoveTimeout = account.network.request(Api.functions.account.getAccountTTL()) let autoremoveTimeout = account.network.request(Api.functions.account.getAccountTTL())
let globalPrivacySettings = account.network.request(Api.functions.account.getGlobalPrivacySettings()) let globalPrivacySettings = account.network.request(Api.functions.account.getGlobalPrivacySettings())
let messageAutoremoveTimeout = account.network.request(Api.functions.messages.getDefaultHistoryTTL()) let messageAutoremoveTimeout = account.network.request(Api.functions.messages.getDefaultHistoryTTL())
return combineLatest(lastSeenPrivacy, groupPrivacy, voiceCallPrivacy, voiceCallP2P, profilePhotoPrivacy, forwardPrivacy, phoneNumberPrivacy, phoneDiscoveryPrivacy, voiceMessagesPrivacy, bioPrivacy, birthdayPrivacy, giftsAutoSavePrivacy, noPaidMessagesPrivacy, autoremoveTimeout, globalPrivacySettings, messageAutoremoveTimeout) return combineLatest(lastSeenPrivacy, groupPrivacy, voiceCallPrivacy, voiceCallP2P, profilePhotoPrivacy, forwardPrivacy, phoneNumberPrivacy, phoneDiscoveryPrivacy, voiceMessagesPrivacy, bioPrivacy, birthdayPrivacy, giftsAutoSavePrivacy, noPaidMessagesPrivacy, savedMusicPrivacy, autoremoveTimeout, globalPrivacySettings, messageAutoremoveTimeout)
|> `catch` { _ in |> `catch` { _ in
return .complete() return .complete()
} }
|> mapToSignal { lastSeenPrivacy, groupPrivacy, voiceCallPrivacy, voiceCallP2P, profilePhotoPrivacy, forwardPrivacy, phoneNumberPrivacy, phoneDiscoveryPrivacy, voiceMessagesPrivacy, bioPrivacy, birthdayPrivacy, giftsAutoSavePrivacy, noPaidMessagesPrivacy, autoremoveTimeout, globalPrivacySettings, messageAutoremoveTimeout -> Signal<AccountPrivacySettings, NoError> in |> mapToSignal { lastSeenPrivacy, groupPrivacy, voiceCallPrivacy, voiceCallP2P, profilePhotoPrivacy, forwardPrivacy, phoneNumberPrivacy, phoneDiscoveryPrivacy, voiceMessagesPrivacy, bioPrivacy, birthdayPrivacy, giftsAutoSavePrivacy, noPaidMessagesPrivacy, savedMusicPrivacy, autoremoveTimeout, globalPrivacySettings, messageAutoremoveTimeout -> Signal<AccountPrivacySettings, NoError> in
let accountTimeoutSeconds: Int32 let accountTimeoutSeconds: Int32
switch autoremoveTimeout { switch autoremoveTimeout {
case let .accountDaysTTL(days): case let .accountDaysTTL(days):
@ -105,6 +106,7 @@ func _internal_requestAccountPrivacySettings(account: Account) -> Signal<Account
let birthdayRules: [Api.PrivacyRule] let birthdayRules: [Api.PrivacyRule]
let giftsAutoSaveRules: [Api.PrivacyRule] let giftsAutoSaveRules: [Api.PrivacyRule]
let noPaidMessagesRules: [Api.PrivacyRule] let noPaidMessagesRules: [Api.PrivacyRule]
let savedMusicRules: [Api.PrivacyRule]
var apiUsers: [Api.User] = [] var apiUsers: [Api.User] = []
var apiChats: [Api.Chat] = [] var apiChats: [Api.Chat] = []
@ -203,6 +205,12 @@ func _internal_requestAccountPrivacySettings(account: Account) -> Signal<Account
apiChats.append(contentsOf: chats) apiChats.append(contentsOf: chats)
noPaidMessagesRules = rules noPaidMessagesRules = rules
} }
switch savedMusicPrivacy {
case let .privacyRules(rules, chats, users):
apiUsers.append(contentsOf: users)
apiChats.append(contentsOf: chats)
savedMusicRules = rules
}
var peers: [SelectivePrivacyPeer] = [] var peers: [SelectivePrivacyPeer] = []
for user in apiUsers { for user in apiUsers {
@ -286,6 +294,7 @@ func _internal_requestAccountPrivacySettings(account: Account) -> Signal<Account
birthday: SelectivePrivacySettings(apiRules: birthdayRules, peers: peerMap), birthday: SelectivePrivacySettings(apiRules: birthdayRules, peers: peerMap),
giftsAutoSave: SelectivePrivacySettings(apiRules: giftsAutoSaveRules, peers: peerMap), giftsAutoSave: SelectivePrivacySettings(apiRules: giftsAutoSaveRules, peers: peerMap),
noPaidMessages: SelectivePrivacySettings(apiRules: noPaidMessagesRules, peers: peerMap), noPaidMessages: SelectivePrivacySettings(apiRules: noPaidMessagesRules, peers: peerMap),
savedMusic: SelectivePrivacySettings(apiRules: savedMusicRules, peers: peerMap),
globalSettings: globalSettings, globalSettings: globalSettings,
accountRemovalTimeout: accountTimeoutSeconds, accountRemovalTimeout: accountTimeoutSeconds,
messageAutoremoveTimeout: messageAutoremoveSeconds messageAutoremoveTimeout: messageAutoremoveSeconds
@ -455,6 +464,7 @@ public enum UpdateSelectiveAccountPrivacySettingsType {
case birthday case birthday
case giftsAutoSave case giftsAutoSave
case noPaidMessages case noPaidMessages
case savedMusic
var apiKey: Api.InputPrivacyKey { var apiKey: Api.InputPrivacyKey {
switch self { switch self {
@ -482,6 +492,8 @@ public enum UpdateSelectiveAccountPrivacySettingsType {
return .inputPrivacyKeyStarGiftsAutoSave return .inputPrivacyKeyStarGiftsAutoSave
case .noPaidMessages: case .noPaidMessages:
return .inputPrivacyKeyNoPaidMessages return .inputPrivacyKeyNoPaidMessages
case .savedMusic:
return .inputPrivacyKeySavedMusic
} }
} }
} }

View File

@ -132,7 +132,7 @@ final class SegmentControlComponent: Component {
if themeUpdated { if themeUpdated {
let backgroundColor = component.theme.overallDarkAppearance ? component.theme.list.itemBlocksBackgroundColor : component.theme.rootController.navigationBar.segmentedBackgroundColor let backgroundColor = component.theme.overallDarkAppearance ? component.theme.list.itemBlocksBackgroundColor : component.theme.rootController.navigationBar.segmentedBackgroundColor
segmentedView.setTitleTextAttributes([ segmentedView.setTitleTextAttributes([
.font: UIFont.boldSystemFont(ofSize: 15.0), .font: Font.semibold(14.0),
.foregroundColor: component.theme.rootController.navigationBar.segmentedTextColor .foregroundColor: component.theme.rootController.navigationBar.segmentedTextColor
], for: .normal) ], for: .normal)
segmentedView.foregroundColor = component.theme.rootController.navigationBar.segmentedForegroundColor segmentedView.foregroundColor = component.theme.rootController.navigationBar.segmentedForegroundColor