This commit is contained in:
Isaac 2026-02-16 21:54:04 +04:00
parent 4f6ba2c2d0
commit 7171441b96
7 changed files with 199 additions and 213 deletions

View file

@ -999,7 +999,35 @@ private func extractAccountManagerState(records: AccountRecordsView<TelegramAcco
telegramUIDeclareEncodables()
initializeAccountManagement()
if isUITest,
let deleteIdx = CommandLine.arguments.firstIndex(of: "--delete-test-account"),
deleteIdx + 1 < CommandLine.arguments.count
{
let phone = CommandLine.arguments[deleteIdx + 1]
let digits = phone.hasPrefix("+") ? String(phone.dropFirst()) : phone
guard digits.count == 10, digits.hasPrefix("99966") else {
preconditionFailure("--delete-test-account phone must match 99966XYYYY")
}
let dcDigit = digits[digits.index(digits.startIndex, offsetBy: 5)]
let phoneCode = String(repeating: dcDigit, count: 5)
let _ = test_loginAndDeleteAccount(
rootPath: rootPath,
accountManager: accountManager,
networkArguments: networkArguments,
encryptionParameters: encryptionParameters,
phoneNumber: "+\(digits)",
phoneCode: phoneCode
).start(error: { _ in
preconditionFailure("test_loginAndDeleteAccount failed")
}, completed: { [weak self] in
self?.window?.accessibilityIdentifier = "DeleteAccount.Success"
})
return true
}
let pushRegistry = PKPushRegistry(queue: .main)
if #available(iOS 9.0, *) {
pushRegistry.desiredPushTypes = Set([.voIP])