Live Activities, nudging, unit tests
This commit is contained in:
@@ -10,10 +10,12 @@ import UIKit
|
||||
|
||||
struct RootView: View {
|
||||
@Environment(MAService.self) private var service
|
||||
@Environment(MAStoreManager.self) private var storeManager
|
||||
|
||||
@State private var isInitializing = true
|
||||
@State private var loadingProgress: Double = 0.0
|
||||
@State private var loadingPhase: String = "Starting…"
|
||||
@State private var showNudge = false
|
||||
|
||||
var body: some View {
|
||||
Group {
|
||||
@@ -32,9 +34,26 @@ struct RootView: View {
|
||||
.animation(.easeInOut(duration: 0.4), value: service.isConnected)
|
||||
.applyTheme()
|
||||
.applyLocale()
|
||||
.sheet(isPresented: $showNudge, onDismiss: {
|
||||
storeManager.recordNudgeShown()
|
||||
}) {
|
||||
SupportNudgeView(isPresented: $showNudge)
|
||||
}
|
||||
.task {
|
||||
await initializeConnection()
|
||||
}
|
||||
.onChange(of: isInitializing) { _, initializing in
|
||||
if !initializing { checkNudge() }
|
||||
}
|
||||
}
|
||||
|
||||
private func checkNudge() {
|
||||
guard storeManager.shouldShowNudge else { return }
|
||||
// Small delay so the main UI settles before the sheet appears
|
||||
Task {
|
||||
try? await Task.sleep(for: .seconds(1))
|
||||
showNudge = true
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Initialization
|
||||
|
||||
Reference in New Issue
Block a user