Files
edgeever/apps/ios/EdgeEver/App/EdgeEverApp.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

53 lines
2.0 KiB
Swift

import SwiftUI
@main
struct EdgeEverApp: App {
@State private var env = AppEnvironment()
var body: some Scene {
WindowGroup {
RootView()
.environment(env)
.onOpenURL { url in
// Share Extension opens edgeever://share after writing App Group payload.
guard url.scheme == "edgeever" else { return }
// WorkspaceView consumes pending share payloads on appear / foreground.
NotificationCenter.default.post(name: .edgeEverShareReceived, object: nil)
}
}
}
}
/// Simulator / debug helper. Enabled only when launch args provide credentials:
/// `-EdgeEverAutoLoginURL` `-EdgeEverAutoLoginUser` `-EdgeEverAutoLoginPassword`
enum AutoLogin {
@MainActor
static func attemptIfConfigured(env: AppEnvironment) async {
let args = ProcessInfo.processInfo.arguments
func value(for flag: String) -> String? {
guard let idx = args.firstIndex(of: flag), args.index(after: idx) < args.endIndex else {
return nil
}
return args[args.index(after: idx)]
}
guard
let base = value(for: "-EdgeEverAutoLoginURL"),
let user = value(for: "-EdgeEverAutoLoginUser"),
let password = value(for: "-EdgeEverAutoLoginPassword")
else { return }
guard !env.session.isSignedIn else { return }
do {
try await env.session.signIn(baseUrl: base, username: user, password: password)
await env.runSyncCycle()
} catch {
// Surface on login screen via next manual attempt; keep silent for automation logs.
print("AutoLogin failed: \(error.localizedDescription)")
}
}
}
extension Notification.Name {
static let edgeEverShareReceived = Notification.Name("edgeEverShareReceived")
static let edgeEverResourcePress = Notification.Name("edgeEverResourcePress")
}