Skip to content

Commit 646e306

Browse files
committed
Fixed session management issue,
In the process of cleanup pice of code is missed (retaining expire time and time of generating the token)
1 parent e09ad46 commit 646e306

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

GoInfoGame/GoInfoGame/Login/SessionManager.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
//
77

88
import Foundation
9+
import UIKit
910

1011
//@MainActor
1112
final class SessionManager: ObservableObject {
@@ -38,6 +39,11 @@ final class SessionManager: ObservableObject {
3839
self?.username = username
3940
_ = KeychainManager.save(key: "accessToken", data: response.accessToken)
4041
self?.lastLoginPassword = password
42+
UserDefaults.standard.setValue(response.expiresIn, forKey: "accessToken_expire_in")
43+
UserDefaults.standard.setValue(Date().timeIntervalSince1970, forKey: "accessToken_Generate")
44+
if let appDelegate = UIApplication.shared.delegate as? AppDelegate {
45+
appDelegate.validateAccessToken()
46+
}
4147

4248
self?.isLoginSuccessful = true
4349
self?.hasLoginFailed = false

0 commit comments

Comments
 (0)