Use peer name localization

This commit is contained in:
Peter
2019-10-11 16:05:35 +04:00
parent 120135b8fe
commit 284db5aba8
100 changed files with 391 additions and 275 deletions

View File

@@ -929,12 +929,14 @@ func selectivePrivacySettingsController(context: AccountContext, kind: Selective
}
})
let peerName = context.account.postbox.transaction { transaction -> String in
return (transaction.getPeer(context.account.peerId) as? TelegramUser)?.displayTitle ?? ""
let peer = context.account.postbox.transaction { transaction -> Peer? in
return transaction.getPeer(context.account.peerId) as? TelegramUser
}
let signal = combineLatest(context.sharedContext.presentationData, statePromise.get(), peerName) |> deliverOnMainQueue
|> map { presentationData, state, peerName -> (ItemListControllerState, (ItemListNodeState, Any)) in
let signal = combineLatest(context.sharedContext.presentationData, statePromise.get(), peer) |> deliverOnMainQueue
|> map { presentationData, state, peer -> (ItemListControllerState, (ItemListNodeState, Any)) in
let peerName = peer?.displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder)
let title: String
switch kind {
@@ -952,7 +954,7 @@ func selectivePrivacySettingsController(context: AccountContext, kind: Selective
title = presentationData.strings.Privacy_PhoneNumber
}
let controllerState = ItemListControllerState(theme: presentationData.theme, title: .text(title), leftNavigationButton: nil, rightNavigationButton: nil, backNavigationButton: ItemListBackButton(title: presentationData.strings.Common_Back), animateChanges: false)
let listState = ItemListNodeState(entries: selectivePrivacySettingsControllerEntries(presentationData: presentationData, kind: kind, state: state, peerName: peerName), style: .blocks, animateChanges: false)
let listState = ItemListNodeState(entries: selectivePrivacySettingsControllerEntries(presentationData: presentationData, kind: kind, state: state, peerName: peerName ?? ""), style: .blocks, animateChanges: false)
return (controllerState, (listState, arguments))
} |> afterDisposed {