Skip to content

Commit 620a6cf

Browse files
committed
Merge branch 'fix-app-going-into-blocked-state-on-first-time-installs-ios-886'
2 parents 5d881c8 + 4761681 commit 620a6cf

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

ios/CHANGELOG.md

+3
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ Line wrap the file at 100 chars. Th
2626
- Replace the draft key encapsulation mechanism Kyber (round 3) with the standardized
2727
ML-KEM (FIPS 203) dito in the handshake for Quantum-resistant tunnels.
2828

29+
### Fixed
30+
- Fix app going into blocked state on first-time installs.
31+
2932
## [2024.8 - 2024-10-14]
3033
### Added
3134
- Add a new access method that uses the encrypted DNS proxy to reach our API.

ios/MullvadVPN/AppDelegate.swift

+9-2
Original file line numberDiff line numberDiff line change
@@ -519,15 +519,22 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
519519
}
520520
}
521521

522-
/// Returns an operation that acts on two conditions:
522+
/// Returns an operation that acts on the following conditions:
523+
/// 1. If the app has never been launched, preload with default settings.
524+
/// - or -
523525
/// 1. Has the app been launched at least once after install? (`FirstTimeLaunch.hasFinished`)
524526
/// 2. Has the app - at some point in time - been updated from a version compatible with wiping settings?
525527
/// (`SettingsManager.getShouldWipeSettings()`)
526528
/// If (1) is `false` and (2) is `true`, we know that the app has been freshly installed/reinstalled and is
527529
/// compatible, thus triggering a settings wipe.
528530
private func getWipeSettingsOperation() -> AsyncBlockOperation {
529531
AsyncBlockOperation {
530-
if !FirstTimeLaunch.hasFinished, SettingsManager.getShouldWipeSettings() {
532+
let appHasNeverBeenLaunched = !FirstTimeLaunch.hasFinished && !SettingsManager.getShouldWipeSettings()
533+
let appWasLaunchedAfterReinstall = !FirstTimeLaunch.hasFinished && SettingsManager.getShouldWipeSettings()
534+
535+
if appHasNeverBeenLaunched {
536+
try? SettingsManager.writeSettings(LatestTunnelSettings())
537+
} else if appWasLaunchedAfterReinstall {
531538
if let deviceState = try? SettingsManager.readDeviceState(),
532539
let accountData = deviceState.accountData,
533540
let deviceData = deviceState.deviceData {

0 commit comments

Comments
 (0)