Various improvements

This commit is contained in:
Ilya Laktyushin
2022-12-17 15:35:00 +04:00
parent aeafae62df
commit 77df1cf45a
182 changed files with 6119 additions and 5449 deletions

View File

@@ -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
}
}