Various fixes

This commit is contained in:
Ilya Laktyushin
2024-03-24 17:58:23 +04:00
parent ac19cc508b
commit b8382386c2
11 changed files with 159 additions and 99 deletions

View File

@@ -16,6 +16,30 @@ public func makePrivacyAndSecurityController(context: AccountContext) -> ViewCon
return privacyAndSecurityController(context: context, focusOnItemTag: PrivacyAndSecurityEntryTag.autoArchive)
}
public func makeBioPrivacyController(context: AccountContext, settings: Promise<AccountPrivacySettings?>, present: @escaping (ViewController) -> Void) {
let signal = settings.get()
|> take(1)
|> deliverOnMainQueue
let _ = signal.startStandalone(next: { info in
if let info = info {
present(selectivePrivacySettingsController(context: context, kind: .bio, current: info.bio, updated: { updated, _, _, _ in
let applySetting: Signal<Void, NoError> = settings.get()
|> filter { $0 != nil }
|> take(1)
|> deliverOnMainQueue
|> mapToSignal { value -> Signal<Void, NoError> in
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, globalSettings: value.globalSettings, accountRemovalTimeout: value.accountRemovalTimeout, messageAutoremoveTimeout: value.messageAutoremoveTimeout)))
}
return .complete()
}
let _ = applySetting.startStandalone()
}))
}
})
}
public func makeBirthdayPrivacyController(context: AccountContext, settings: Promise<AccountPrivacySettings?>, openedFromBirthdayScreen: Bool, present: @escaping (ViewController) -> Void) {
let signal = settings.get()
|> take(1)