Files
suixinkan_uikit/suixinkan/App/NetworkServices.swift
汉秋 3c4ca7eefb Add submit-task flow aligned with Android and extract profile edit page.
Implement task creation with cloud/local media, order linking, and OSS upload; wire home entry and move profile nickname/avatar editing to ProfileEditViewController.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-07 10:12:20 +08:00

56 lines
1.8 KiB
Swift
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

//
// NetworkServices.swift
// suixinkan
//
import Foundation
@MainActor
/// APIClient API
final class NetworkServices {
static let shared = NetworkServices()
let apiClient: APIClient
let authAPI: AuthAPI
let profileAPI: ProfileAPI
let statisticsAPI: StatisticsAPI
let orderAPI: OrderAPI
let homeAPI: HomeAPI
let paymentAPI: PaymentAPI
let taskAPI: TaskAPI
let uploadAPI: UploadAPI
let ossUploadService: OSSUploadService
private init() {
let client = APIClient(environment: .current)
apiClient = client
authAPI = AuthAPI(client: client)
profileAPI = ProfileAPI(client: client)
statisticsAPI = StatisticsAPI(client: client)
orderAPI = OrderAPI(client: client)
homeAPI = HomeAPI(client: client)
paymentAPI = PaymentAPI(client: client)
taskAPI = TaskAPI(client: client)
uploadAPI = UploadAPI(client: client)
ossUploadService = OSSUploadService(configService: uploadAPI)
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)
profileAPI = ProfileAPI(client: apiClient)
statisticsAPI = StatisticsAPI(client: apiClient)
orderAPI = OrderAPI(client: apiClient)
homeAPI = HomeAPI(client: apiClient)
paymentAPI = PaymentAPI(client: apiClient)
taskAPI = TaskAPI(client: apiClient)
uploadAPI = UploadAPI(client: apiClient)
ossUploadService = OSSUploadService(configService: uploadAPI)
}
}