Skip to content

Commit

Permalink
Fix app going into blocked state on first-time installs
Browse files Browse the repository at this point in the history
  • Loading branch information
rablador authored and buggmagnet committed Oct 18, 2024
1 parent 5d881c8 commit 4761681
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
3 changes: 3 additions & 0 deletions ios/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ Line wrap the file at 100 chars. Th
- Replace the draft key encapsulation mechanism Kyber (round 3) with the standardized
ML-KEM (FIPS 203) dito in the handshake for Quantum-resistant tunnels.

### Fixed
- Fix app going into blocked state on first-time installs.

## [2024.8 - 2024-10-14]
### Added
- Add a new access method that uses the encrypted DNS proxy to reach our API.
Expand Down
11 changes: 9 additions & 2 deletions ios/MullvadVPN/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -519,15 +519,22 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
}
}

/// Returns an operation that acts on two conditions:
/// Returns an operation that acts on the following conditions:
/// 1. If the app has never been launched, preload with default settings.
/// - or -
/// 1. Has the app been launched at least once after install? (`FirstTimeLaunch.hasFinished`)
/// 2. Has the app - at some point in time - been updated from a version compatible with wiping settings?
/// (`SettingsManager.getShouldWipeSettings()`)
/// If (1) is `false` and (2) is `true`, we know that the app has been freshly installed/reinstalled and is
/// compatible, thus triggering a settings wipe.
private func getWipeSettingsOperation() -> AsyncBlockOperation {
AsyncBlockOperation {
if !FirstTimeLaunch.hasFinished, SettingsManager.getShouldWipeSettings() {
let appHasNeverBeenLaunched = !FirstTimeLaunch.hasFinished && !SettingsManager.getShouldWipeSettings()
let appWasLaunchedAfterReinstall = !FirstTimeLaunch.hasFinished && SettingsManager.getShouldWipeSettings()

if appHasNeverBeenLaunched {
try? SettingsManager.writeSettings(LatestTunnelSettings())
} else if appWasLaunchedAfterReinstall {
if let deviceState = try? SettingsManager.readDeviceState(),
let accountData = deviceState.accountData,
let deviceData = deviceState.deviceData {
Expand Down

0 comments on commit 4761681

Please sign in to comment.