mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-22 22:25:57 +00:00
Various improvements
This commit is contained in:
@@ -316,8 +316,8 @@ public final class AppLockContextImpl: AppLockContext {
|
||||
public var invalidAttempts: Signal<AccessChallengeAttempts?, NoError> {
|
||||
return self.currentState.get()
|
||||
|> map { state in
|
||||
return state.unlockAttemts.flatMap { unlockAttemts in
|
||||
return AccessChallengeAttempts(count: unlockAttemts.count, bootTimestamp: unlockAttemts.timestamp.bootTimestamp, uptime: unlockAttemts.timestamp.uptime)
|
||||
return state.unlockAttempts.flatMap { unlockAttempts in
|
||||
return AccessChallengeAttempts(count: unlockAttempts.count, bootTimestamp: unlockAttempts.timestamp.bootTimestamp, uptime: unlockAttempts.timestamp.uptime)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -346,7 +346,7 @@ public final class AppLockContextImpl: AppLockContext {
|
||||
self.updateLockState { state in
|
||||
var state = state
|
||||
|
||||
state.unlockAttemts = nil
|
||||
state.unlockAttempts = nil
|
||||
|
||||
state.isManuallyLocked = false
|
||||
|
||||
@@ -362,16 +362,16 @@ public final class AppLockContextImpl: AppLockContext {
|
||||
public func failedUnlockAttempt() {
|
||||
self.updateLockState { state in
|
||||
var state = state
|
||||
var unlockAttemts = state.unlockAttemts ?? UnlockAttempts(count: 0, timestamp: MonotonicTimestamp(bootTimestamp: 0, uptime: 0))
|
||||
var unlockAttempts = state.unlockAttempts ?? UnlockAttempts(count: 0, timestamp: MonotonicTimestamp(bootTimestamp: 0, uptime: 0))
|
||||
|
||||
unlockAttemts.count += 1
|
||||
unlockAttempts.count += 1
|
||||
|
||||
var bootTimestamp: Int32 = 0
|
||||
let uptime = getDeviceUptimeSeconds(&bootTimestamp)
|
||||
let timestamp = MonotonicTimestamp(bootTimestamp: bootTimestamp, uptime: uptime)
|
||||
|
||||
unlockAttemts.timestamp = timestamp
|
||||
state.unlockAttemts = unlockAttemts
|
||||
unlockAttempts.timestamp = timestamp
|
||||
state.unlockAttempts = unlockAttempts
|
||||
return state
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user