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

@ -0,0 +1,32 @@
//
// NetworkServices.swift
// suixinkan
//
import Foundation
@MainActor
/// APIClient AuthAPI
final class NetworkServices {
static let shared = NetworkServices()
let apiClient: APIClient
let authAPI: AuthAPI
///
private init() {
let client = APIClient(environment: .current)
apiClient = client
authAPI = AuthAPI(client: client)
client.bindAuthTokenProvider {
let token = AppStore.shared.token.trimmingCharacters(in: .whitespacesAndNewlines)
return token.isEmpty ? nil : token
}
}
/// mock `APIClient`
init(apiClient: APIClient) {
self.apiClient = apiClient
authAPI = AuthAPI(client: apiClient)
}
}