Files
edgeever/apps/ios/EdgeEver/App/RootView.swift
T
tianma-if cd4f010d8f feat(ios): add native SwiftUI client with Android UI parity
Replace the abandoned RN iOS path with a SwiftUI app (iOS 17+) that reuses
the shared TipTap editor bundle, GRDB local mirror/outbox, and Android-aligned
shell chrome for list, create, detail, and Me. Package the editor HTML in the
app resources so Markdown renders, present edit from the workspace root with a
UIKit FAB, and keep caret stable while typing.
2026-08-07 02:52:01 +08:00

36 lines
1.0 KiB
Swift

import SwiftUI
struct RootView: View {
@Environment(AppEnvironment.self) private var env
var body: some View {
Group {
if env.session.isLoading {
ProgressView("启动中…")
} else if env.session.isSignedIn {
WorkspaceView()
} else {
LoginView()
}
}
.task {
await env.bootstrap()
await AutoLogin.attemptIfConfigured(env: env)
}
.onReceive(NotificationCenter.default.publisher(for: UIApplication.willEnterForegroundNotification)) { _ in
Task {
if env.session.isSignedIn {
await env.runSyncCycle()
}
}
}
.onReceive(NotificationCenter.default.publisher(for: UIApplication.didEnterBackgroundNotification)) { _ in
Task {
if let scope = env.session.dataScope {
_ = try? await env.outboxFlusher.flush(scope: scope)
}
}
}
}
}