mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2026-03-30 02:35:05 +00:00
Fix max number of accounts
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import SGStrings
|
||||
import SGSettingsUI
|
||||
import Foundation
|
||||
import UIKit
|
||||
@@ -231,15 +232,15 @@ extension PeerInfoScreenNode {
|
||||
guard let strongSelf = self else {
|
||||
return
|
||||
}
|
||||
var maximumAvailableAccounts: Int = 3
|
||||
var maximumAvailableAccounts: Int = maximumSwiftgramNumberOfAccounts
|
||||
if accountAndPeer?.1.isPremium == true && !strongSelf.context.account.testingEnvironment {
|
||||
maximumAvailableAccounts = 4
|
||||
maximumAvailableAccounts = maximumSwiftgramNumberOfAccounts
|
||||
}
|
||||
var count: Int = 1
|
||||
for (accountContext, peer, _) in accountsAndPeers {
|
||||
if !accountContext.account.testingEnvironment {
|
||||
if peer.isPremium {
|
||||
maximumAvailableAccounts = 4
|
||||
maximumAvailableAccounts = maximumSwiftgramNumberOfAccounts
|
||||
}
|
||||
count += 1
|
||||
}
|
||||
@@ -259,7 +260,23 @@ extension PeerInfoScreenNode {
|
||||
navigationController.pushViewController(controller)
|
||||
}
|
||||
} else {
|
||||
strongSelf.context.sharedContext.beginNewAuth(testingEnvironment: strongSelf.context.account.testingEnvironment)
|
||||
// MARK: Swiftgram
|
||||
if count + 1 > maximumSafeNumberOfAccounts {
|
||||
let presentationData = strongSelf.context.sharedContext.currentPresentationData.with { $0 }
|
||||
let alertController = textAlertController(context: strongSelf.context, updatedPresentationData: strongSelf.controller?.updatedPresentationData, title: presentationData.strings.ChatList_DeleteSavedMessagesConfirmationTitle, text: i18n("Auth.AccountBackupReminder", presentationData.strings.baseLanguageCode), actions: [
|
||||
TextAlertAction(type: .defaultAction, title: presentationData.strings.Common_OK, action: {
|
||||
strongSelf.context.sharedContext.beginNewAuth(testingEnvironment: strongSelf.context.account.testingEnvironment)
|
||||
})
|
||||
])
|
||||
if let controller = strongSelf.controller {
|
||||
controller.present(alertController, in: .window(.root))
|
||||
} else {
|
||||
strongSelf.context.sharedContext.beginNewAuth(testingEnvironment: strongSelf.context.account.testingEnvironment)
|
||||
}
|
||||
} else {
|
||||
strongSelf.context.sharedContext.beginNewAuth(testingEnvironment: strongSelf.context.account.testingEnvironment)
|
||||
}
|
||||
//
|
||||
}
|
||||
})
|
||||
case .logout:
|
||||
|
||||
Reference in New Issue
Block a user