mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-07-23 03:31:09 +00:00
Merge commit 'ba81d1e4129709801d68531c6132c5698719b0da'
This commit is contained in:
commit
c7e8448685
@ -325,74 +325,6 @@ class ShareRootController: UIViewController {
|
||||
strongSelf.currentPasscodeController = controller
|
||||
strongSelf.mainWindow?.present(controller, on: .root)
|
||||
})
|
||||
|
||||
/*var attemptData: TGPasscodeEntryAttemptData?
|
||||
if let attempts = accessChallengeData.attempts {
|
||||
attemptData = TGPasscodeEntryAttemptData(numberOfInvalidAttempts: Int(attempts.count), dateOfLastInvalidAttempt: Double(attempts.timestamp))
|
||||
}
|
||||
let mode: TGPasscodeEntryControllerMode
|
||||
switch accessChallengeData {
|
||||
case .none:
|
||||
displayShare()
|
||||
return
|
||||
case .numericalPassword:
|
||||
mode = TGPasscodeEntryControllerModeVerifySimple
|
||||
case .plaintextPassword:
|
||||
mode = TGPasscodeEntryControllerModeVerifyComplex
|
||||
}
|
||||
let presentationData = account.telegramApplicationContext.currentPresentationData.with { $0 }
|
||||
|
||||
let legacyController = LegacyController(presentation: LegacyControllerPresentation.modal(animateIn: true), theme: presentationData.theme)
|
||||
let controller = TGPasscodeEntryController(context: legacyController.context, style: TGPasscodeEntryControllerStyleDefault, mode: mode, cancelEnabled: true, allowTouchId: false, attemptData: attemptData, completion: { value in
|
||||
if value != nil {
|
||||
displayShare()
|
||||
} else {
|
||||
self?.extensionContext?.completeRequest(returningItems: nil, completionHandler: nil)
|
||||
}
|
||||
})!
|
||||
controller.checkCurrentPasscode = { value in
|
||||
if let value = value {
|
||||
switch accessChallengeData {
|
||||
case .none:
|
||||
return true
|
||||
case let .numericalPassword(code, _, _):
|
||||
return value == code
|
||||
case let .plaintextPassword(code, _, _):
|
||||
return value == code
|
||||
}
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
}
|
||||
controller.updateAttemptData = { attemptData in
|
||||
let _ = account.postbox.transaction({ transaction -> Void in
|
||||
var attempts: AccessChallengeAttempts?
|
||||
if let attemptData = attemptData {
|
||||
attempts = AccessChallengeAttempts(count: Int32(attemptData.numberOfInvalidAttempts), timestamp: Int32(attemptData.dateOfLastInvalidAttempt))
|
||||
}
|
||||
var data = transaction.getAccessChallengeData()
|
||||
switch data {
|
||||
case .none:
|
||||
break
|
||||
case let .numericalPassword(value, timeout, _):
|
||||
data = .numericalPassword(value: value, timeout: timeout, attempts: attempts)
|
||||
case let .plaintextPassword(value, timeout, _):
|
||||
data = .plaintextPassword(value: value, timeout: timeout, attempts: attempts)
|
||||
}
|
||||
transaction.setAccessChallengeData(data)
|
||||
}).start()
|
||||
}
|
||||
/*controller.touchIdCompletion = {
|
||||
let _ = (account.postbox.transaction { transaction -> Void in
|
||||
let data = transaction.getAccessChallengeData().withUpdatedAutolockDeadline(nil)
|
||||
transaction.setAccessChallengeData(data)
|
||||
}).start()
|
||||
}*/
|
||||
|
||||
legacyController.bind(controller: controller)
|
||||
legacyController.supportedOrientations = ViewControllerSupportedOrientations(regularSize: .portrait, compactSize: .portrait)
|
||||
legacyController.statusBar.statusBarStyle = .White
|
||||
*/
|
||||
}
|
||||
|
||||
self.disposable.set(applicationInterface.start(next: { _, _, _ in }, error: { [weak self] error in
|
||||
|
Loading…
x
Reference in New Issue
Block a user