移除 Splash 固定 1.5 秒等待,并补充启动流程分析文档。

未登录冷启动可立即进入登录页;已登录仍等待 bootstrap 接口完成,但不再叠加人为延迟。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-06-29 15:27:18 +08:00
parent 3dcfb99254
commit d9f897038d
5 changed files with 362 additions and 11 deletions

View File

@ -26,11 +26,13 @@ App 模块负责应用入口、根视图切换、全局状态注入、主导航
## 启动流程
> 完整启动接口清单、数据依赖与 Splash 优化方案见 [启动流程分析与优化方案](../../docs/startup-analysis.md)。
1. `suixinkanApp` 创建 `RootView`
2. `RootView` 初始化共享依赖,并把它们注入 Environment。
3. iOS 系统 Launch Screen 展示白底 + `SplashLogo`
4. `SplashView` 覆盖根视图,展示与 Android 对齐的品牌启动页。
5. `SplashCoordinator.start` 并行执行最短 1.5 秒展示和 `SessionBootstrapper.restore`UI Test 模式跳过 1.5 秒延迟
5. `SplashCoordinator.start` 并行执行 `SessionBootstrapper.restore`Splash 以 bootstrap 完成为准,无固定最短展示时长
6. `APIClient` 绑定 `AppSession.token` 作为默认 token provider。
7. `SessionBootstrapper.restore` 尝试从 UserDefaults 读取正式 token。
8. 无 token 时保持 `loggedOut`Splash 结束后展示 `LoginView`

View File

@ -9,23 +9,23 @@ import Combine
import Foundation
@MainActor
/// bootstrap
/// bootstrapSplash bootstrap
final class SplashCoordinator: ObservableObject {
@Published private(set) var isFinished = false
private let minimumDisplayDuration: TimeInterval
private let skipsMinimumDuration: Bool
/// UI Test
/// delay
init(
minimumDisplayDuration: TimeInterval = 1.5,
minimumDisplayDuration: TimeInterval = 0,
skipsMinimumDuration: Bool = AppUITestLaunchState.isRunningUITests
) {
self.minimumDisplayDuration = minimumDisplayDuration
self.skipsMinimumDuration = skipsMinimumDuration
}
/// bootstrap Splash
/// bootstrap Splash
func start(bootstrap: @escaping () async -> Void) async {
guard !isFinished else { return }

View File

@ -9,7 +9,7 @@ Splash 模块负责冷启动时的品牌启动页展示,对齐 Android `Splash
## 核心对象
- `SplashView`展示白底、180pt Logo、「随心瞰 / 商家版」文案。
- `SplashCoordinator`:并行执行最短 1.5 秒展示与 `SessionBootstrapper.restore`两者都完成后结束 Splash。
- `SplashCoordinator`:并行执行 `SessionBootstrapper.restore`bootstrap 完成后结束 Splash(无固定最短展示时长)
- `SplashLogo` / `LaunchBackground`:启动页图片与背景色资源,同时用于系统 `UILaunchScreen`
## 展示规则
@ -23,10 +23,8 @@ Splash 模块负责冷启动时的品牌启动页展示,对齐 Android `Splash
1. iOS 系统 Launch Screen 展示白底 + Logo。
2. `RootView` 挂载后立即显示 `SplashView`
3. `SplashCoordinator.start` 并行执行
- 最短展示 1.5 秒UI Test 模式跳过)
- `SessionBootstrapper.restore` 静默恢复登录态
4. 两者都完成后淡出 Splash进入 `LoginView``MainTabsView`
3. `SplashCoordinator.start` 并行执行 `SessionBootstrapper.restore` 静默恢复登录态。
4. bootstrap 完成后淡出 Splash进入 `LoginView``MainTabsView`
5. 冷启动期间不显示 Lottie 全局 Loading。
## 与 Android 的差异