Skip to content

Commit 90b9177

Browse files
committed
Remove hasAccount test, replace with check for deviceState.isLoggedIn
1 parent b24cf37 commit 90b9177

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

ios/MullvadVPN/TunnelManager/TunnelManager.swift

+2-5
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,6 @@ final class TunnelManager: StorePaymentObserver {
6060
private let observerList = ObserverList<TunnelObserver>()
6161
private var networkMonitor: NWPathMonitor?
6262

63-
private var hasAccount = false
64-
6563
private var privateKeyRotationTimer: DispatchSourceTimer?
6664
public private(set) var isRunningPeriodicPrivateKeyRotation = false
6765
public private(set) var nextKeyRotationDate: Date? = nil
@@ -114,7 +112,7 @@ final class TunnelManager: StorePaymentObserver {
114112
nslock.lock()
115113
defer { nslock.unlock() }
116114

117-
guard !isRunningPeriodicPrivateKeyRotation, hasAccount else { return }
115+
guard !isRunningPeriodicPrivateKeyRotation, deviceState.isLoggedIn else { return }
118116

119117
logger.debug("Start periodic private key rotation.")
120118

@@ -135,7 +133,7 @@ final class TunnelManager: StorePaymentObserver {
135133
}
136134

137135
func startOrStopPeriodicPrivateKeyRotation() {
138-
if hasAccount {
136+
if deviceState.isLoggedIn {
139137
startPeriodicPrivateKeyRotation()
140138
} else {
141139
stopPeriodicPrivateKeyRotation()
@@ -348,7 +346,6 @@ final class TunnelManager: StorePaymentObserver {
348346
operation.completionQueue = .main
349347
operation.completionHandler = { [weak self] result in
350348
guard let self else { return }
351-
hasAccount = action.isConstructive
352349
startOrStopPeriodicPrivateKeyRotation()
353350

354351
completionHandler(result)

0 commit comments

Comments
 (0)