Add networking layer and wire up v9 login flow with unit tests.

Introduce APIClient/AuthAPI, complete login with multi-account selection, and polish the login card UI with shadow and keyboard dismiss.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-07-06 15:33:34 +08:00
parent b7d74905b7
commit 699f1ba7c4
21 changed files with 2387 additions and 18 deletions

View File

@ -13,6 +13,8 @@ final class AppStore {
private enum Key {
static let token = "key_in_token"
static let lastLoginUsername = "key_last_login_username"
static let privacyAgreementAccepted = "key_privacy_agreement_accepted"
}
private let defaults: UserDefaults
@ -27,6 +29,24 @@ final class AppStore {
set { defaults.set(newValue, forKey: Key.token) }
}
///
var lastLoginUsername: String? {
get { defaults.string(forKey: Key.lastLoginUsername) }
set {
if let newValue {
defaults.set(newValue, forKey: Key.lastLoginUsername)
} else {
defaults.removeObject(forKey: Key.lastLoginUsername)
}
}
}
///
var privacyAgreementAccepted: Bool {
get { defaults.bool(forKey: Key.privacyAgreementAccepted) }
set { defaults.set(newValue, forKey: Key.privacyAgreementAccepted) }
}
/// Token
var isLoggedIn: Bool {
!token.isEmpty