mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-23 14:45:21 +00:00
Refactoring
This commit is contained in:
@@ -17,8 +17,7 @@ final class AuthorizationSequenceSplashController: ViewController {
|
||||
}
|
||||
|
||||
private let accountManager: AccountManager
|
||||
private let postbox: Postbox
|
||||
private let network: Network
|
||||
private let account: UnauthorizedAccount
|
||||
private let theme: PresentationTheme
|
||||
|
||||
private let controller: RMIntroViewController
|
||||
@@ -30,14 +29,13 @@ final class AuthorizationSequenceSplashController: ViewController {
|
||||
private let suggestedLocalization = Promise<SuggestedLocalizationInfo?>()
|
||||
private let activateLocalizationDisposable = MetaDisposable()
|
||||
|
||||
init(accountManager: AccountManager, postbox: Postbox, network: Network, theme: PresentationTheme) {
|
||||
init(accountManager: AccountManager, account: UnauthorizedAccount, theme: PresentationTheme) {
|
||||
self.accountManager = accountManager
|
||||
self.postbox = postbox
|
||||
self.network = network
|
||||
self.account = account
|
||||
self.theme = theme
|
||||
|
||||
self.suggestedLocalization.set(.single(nil)
|
||||
|> then(currentlySuggestedLocalization(network: network, extractKeys: ["Login.ContinueWithLocalization"])))
|
||||
|> then(TelegramEngineUnauthorized(account: self.account).localization.currentlySuggestedLocalization(extractKeys: ["Login.ContinueWithLocalization"])))
|
||||
let suggestedLocalization = self.suggestedLocalization
|
||||
|
||||
let localizationSignal = SSignal(generator: { subscriber in
|
||||
@@ -176,7 +174,7 @@ final class AuthorizationSequenceSplashController: ViewController {
|
||||
}
|
||||
|
||||
if let suggestedCode = suggestedCode {
|
||||
_ = markSuggestedLocalizationAsSeenInteractively(postbox: strongSelf.postbox, languageCode: suggestedCode).start()
|
||||
_ = TelegramEngineUnauthorized(account: strongSelf.account).localization.markSuggestedLocalizationAsSeenInteractively(languageCode: suggestedCode).start()
|
||||
}
|
||||
|
||||
if currentCode == code {
|
||||
@@ -186,9 +184,8 @@ final class AuthorizationSequenceSplashController: ViewController {
|
||||
|
||||
strongSelf.controller.isEnabled = false
|
||||
let accountManager = strongSelf.accountManager
|
||||
let postbox = strongSelf.postbox
|
||||
|
||||
strongSelf.activateLocalizationDisposable.set(downloadAndApplyLocalization(accountManager: accountManager, postbox: postbox, network: strongSelf.network, languageCode: code).start(completed: {
|
||||
strongSelf.activateLocalizationDisposable.set(TelegramEngineUnauthorized(account: strongSelf.account).localization.downloadAndApplyLocalization(accountManager: accountManager, languageCode: code).start(completed: {
|
||||
let _ = (accountManager.transaction { transaction -> PresentationStrings? in
|
||||
let localizationSettings: LocalizationSettings?
|
||||
if let current = transaction.getSharedData(SharedDataKeys.localizationSettings) as? LocalizationSettings {
|
||||
|
||||
Reference in New Issue
Block a user