修复合作获客扫码绑定崩溃与 Toast 层级,并接入分成比例修改。

将扫码页提升到列表层弹出并补齐 AppDelegate.window,避免扫码时 UIKit 取主窗口崩溃;Toast 改用独立 UIWindow 显示在 sheet 之上;合作获客员支持短信验证修改分成比例,同时优化冷启动根视图创建时机并补充相关测试。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-07-03 20:37:24 +08:00
parent 00c3cd0a93
commit 49e997ddba
20 changed files with 905 additions and 70 deletions

View File

@ -7,6 +7,30 @@
import SwiftUI
///
enum RootContentDisplayState: Equatable {
case bootstrapPlaceholder
case login
case restoringPlaceholder
case mainTabs
/// bootstrap
static func resolve(isColdStartBootstrapPending: Bool, appPhase: AuthPhase) -> RootContentDisplayState {
if isColdStartBootstrapPending {
return .bootstrapPlaceholder
}
switch appPhase {
case .loggedOut:
return .login
case .restoring:
return .restoringPlaceholder
case .loggedIn:
return .mainTabs
}
}
}
/// App
struct RootView: View {
@Environment(\.scenePhase) private var scenePhase
@ -236,13 +260,13 @@ struct RootView: View {
@ViewBuilder
private var rootContent: some View {
switch appSession.phase {
case .loggedOut:
LoginView()
case .restoring:
switch rootContentDisplayState {
case .bootstrapPlaceholder, .restoringPlaceholder:
Color.clear
.frame(maxWidth: .infinity, maxHeight: .infinity)
case .loggedIn:
case .login:
LoginView()
case .mainTabs:
MainTabsView()
.task {
#if DEBUG
@ -252,6 +276,14 @@ struct RootView: View {
}
}
///
private var rootContentDisplayState: RootContentDisplayState {
RootContentDisplayState.resolve(
isColdStartBootstrapPending: isColdStartBootstrapPending,
appPhase: appSession.phase
)
}
///
private var scenicSpotTaskID: String {
let phaseText: String