summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--ios/MullvadVPN/Account.swift11
1 files changed, 11 insertions, 0 deletions
diff --git a/ios/MullvadVPN/Account.swift b/ios/MullvadVPN/Account.swift
index bd82097477..7ee61f5a76 100644
--- a/ios/MullvadVPN/Account.swift
+++ b/ios/MullvadVPN/Account.swift
@@ -69,6 +69,7 @@ extension AccountError: LocalizedError {
/// A enum holding the `UserDefaults` string keys
private enum UserDefaultsKeys: String {
+ case isAgreedToTermsOfService = "isAgreedToTermsOfService"
case accountToken = "accountToken"
case accountExpiry = "accountExpiry"
}
@@ -79,6 +80,11 @@ class Account {
static let shared = Account()
private let apiClient = MullvadAPI()
+ /// Returns true if user agreed to terms of service, otherwise false
+ var isAgreedToTermsOfService: Bool {
+ return UserDefaults.standard.bool(forKey: UserDefaultsKeys.isAgreedToTermsOfService.rawValue)
+ }
+
/// Returns the currently used account token
var token: String? {
return UserDefaults.standard.string(forKey: UserDefaultsKeys.accountToken.rawValue)
@@ -93,6 +99,11 @@ class Account {
return token != nil
}
+ /// Save the boolean flag in preferences indicating that the user agreed to terms of service.
+ func agreeToTermsOfService() {
+ UserDefaults.standard.set(true, forKey: UserDefaultsKeys.isAgreedToTermsOfService.rawValue)
+ }
+
/// Perform the login and save the account token along with expiry (if available) to the
/// application preferences.
func login(with accountToken: String) -> AnyPublisher<(), AccountError> {