Skip to content

Commit

Permalink
Remove old legacyOauthToken code (from 2016)
Browse files Browse the repository at this point in the history
  • Loading branch information
amy-at-kickstarter committed Feb 14, 2024
1 parent 7b522b7 commit 735ce1d
Showing 1 changed file with 0 additions and 13 deletions.
13 changes: 0 additions & 13 deletions Library/AppEnvironment.swift
Original file line number Diff line number Diff line change
Expand Up @@ -298,11 +298,6 @@ public struct AppEnvironment: AppEnvironmentType {
if let oauthToken = data["apiService.oauthToken.token"] as? String {
// If there is an oauth token stored in the defaults, then we can authenticate our api service
service = service.login(OauthToken(token: oauthToken))
removeLegacyOauthToken(fromUserDefaults: userDefaults)
} else if let oauthToken = legacyOauthToken(forUserDefaults: userDefaults) {
// Otherwise if there is a token in the legacy user defaults entry we can use that
service = service.login(OauthToken(token: oauthToken))
removeLegacyOauthToken(fromUserDefaults: userDefaults)
}

// Try restoring the client id for the api service
Expand Down Expand Up @@ -413,11 +408,3 @@ public struct AppEnvironment: AppEnvironmentType {
userDefaults.set(data, forKey: self.environmentStorageKey)
}
}

private func legacyOauthToken(forUserDefaults userDefaults: KeyValueStoreType) -> String? {
return userDefaults.object(forKey: "com.kickstarter.access_token") as? String
}

private func removeLegacyOauthToken(fromUserDefaults userDefaults: KeyValueStoreType) {
userDefaults.removeObject(forKey: "com.kickstarter.access_token")
}

0 comments on commit 735ce1d

Please sign in to comment.