
- 将SplashV2替换为SplashPage,优化应用启动流程。 - 在LoginModels中将用户ID参数更改为加密后的ID,增强安全性。 - 更新AppConfig中的API基础URL,确保与生产环境一致。 - 在CommonComponents中添加底部Tab栏图标映射逻辑,提升用户体验。 - 新增NineGridImagePicker组件,支持多图选择功能,优化CreateFeedPage的图片选择逻辑。 - 移除冗余的BottomTabView组件,简化视图结构,提升代码整洁性。 - 在MainPage中整合创建动态页面的逻辑,优化导航体验。 - 新增MePage视图,提供用户信息管理功能,增强应用的可用性。
64 lines
2.4 KiB
Swift
64 lines
2.4 KiB
Swift
import SwiftUI
|
|
|
|
struct SplashPage: View {
|
|
@State private var showLogin = false
|
|
@State private var showMain = false
|
|
@State private var hasCheckedAuth = false
|
|
private let splashTransitionAnimation: Animation = .easeInOut(duration: 0.25)
|
|
|
|
var body: some View {
|
|
Group {
|
|
if showMain {
|
|
MainPage(onLogout: {
|
|
showMain = false
|
|
showLogin = true
|
|
})
|
|
} else if showLogin {
|
|
NavigationStack {
|
|
LoginPage(onLoginSuccess: {
|
|
showMain = true
|
|
})
|
|
}
|
|
} else {
|
|
ZStack {
|
|
LoginBackgroundView()
|
|
VStack(spacing: 32) {
|
|
Spacer().frame(height: 200)
|
|
Image("logo")
|
|
.resizable()
|
|
.aspectRatio(contentMode: .fit)
|
|
.frame(width: 100, height: 100)
|
|
Text(LocalizedString("splash.title", comment: "E-Parti"))
|
|
.font(.system(size: 40, weight: .regular))
|
|
.foregroundColor(.white)
|
|
Spacer()
|
|
}
|
|
}
|
|
.onAppear {
|
|
guard !hasCheckedAuth else { return }
|
|
hasCheckedAuth = true
|
|
Task { @MainActor in
|
|
debugInfoSync("🚀 SplashV2 启动,开始检查登录缓存")
|
|
let status = await UserInfoManager.checkAuthenticationStatus()
|
|
if status.canAutoLogin {
|
|
debugInfoSync("✅ 检测到可自动登录,尝试预取用户信息")
|
|
_ = await UserInfoManager.autoFetchUserInfoOnAppLaunch(apiService: LiveAPIService())
|
|
withAnimation(splashTransitionAnimation) {
|
|
showMain = true
|
|
}
|
|
} else {
|
|
debugInfoSync("🔑 未登录或缓存无效,进入登录页")
|
|
withAnimation(splashTransitionAnimation) {
|
|
showLogin = true
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
.ignoresSafeArea()
|
|
}
|
|
}
|
|
|
|
|