Skip to content

Commit

Permalink
Alex/disable onboarding existing users (#2105)
Browse files Browse the repository at this point in the history
Task/Issue URL: https://app.asana.com/0/1177771139624306/1206416810557971/f

Description:
Disables onboarding for users having Data directory
  • Loading branch information
mallexxx authored Jan 23, 2024
1 parent a800396 commit 4aff4a7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 8 additions & 0 deletions DuckDuckGo/Application/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,14 @@ final class AppDelegate: NSObject, NSApplicationDelegate, FileDownloadManagerDel
fileStore = EncryptedFileStore()
}

// keep this on top!
// disable onboarding for existing users
let isOnboardingFinished = UserDefaultsWrapper<Bool>(key: .onboardingFinished, defaultValue: false)
if !isOnboardingFinished.wrappedValue,
FileManager.default.fileExists(atPath: URL.sandboxApplicationSupportURL.path) {
isOnboardingFinished.wrappedValue = true
}

let internalUserDeciderStore = InternalUserDeciderStore(fileStore: fileStore)
internalUserDecider = DefaultInternalUserDecider(store: internalUserDeciderStore)

Expand Down
2 changes: 1 addition & 1 deletion DuckDuckGo/Common/Utilities/UserDefaultsWrapper.swift
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ public struct UserDefaultsWrapper<T> {

return value
}
set {
nonmutating set {
setValue(newValue)
}
}
Expand Down

0 comments on commit 4aff4a7

Please sign in to comment.