Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading