mirror of
https://github.com/sudosylabs/vnidrop.git
synced 2026-08-05 10:29:58 +02:00
feat(apple): native SwiftUI app for iOS and macOS
Add a native SwiftUI VniDrop app (Send/Receive/Settings) talking to the Rust core via generated UniFFI Swift bindings, plus the uniffi-bindgen helper crate. iOS uses a TabView, macOS a NavigationSplitView sidebar.
This commit is contained in:
43
apple/VniDrop/App/AppGraph.swift
Normal file
43
apple/VniDrop/App/AppGraph.swift
Normal file
@@ -0,0 +1,43 @@
|
||||
import Foundation
|
||||
import Combine
|
||||
|
||||
/// Object graph wiring the repositories and coordinators together, ported from
|
||||
/// `AppGraph.kt`. Owned by the app root for the process lifetime.
|
||||
@MainActor
|
||||
final class AppGraph: ObservableObject {
|
||||
let dependencies: AppDependencies
|
||||
let coreRepository: CoreRepository
|
||||
let visibility = AppVisibility()
|
||||
let messages = UiMessageController()
|
||||
let preferencesRepository: AppPreferencesRepository
|
||||
let filePreviewRepository: FilePreviewRepository
|
||||
let approvalCoordinator: ApprovalCoordinator
|
||||
|
||||
init(dependencies: AppDependencies, coreRepository: CoreRepository? = nil) {
|
||||
self.dependencies = dependencies
|
||||
let coreRepository = coreRepository ?? CoreRepository()
|
||||
self.coreRepository = coreRepository
|
||||
self.filePreviewRepository = FilePreviewRepository(appDataDir: dependencies.environment.defaultCoreDataDir)
|
||||
self.preferencesRepository = AppPreferencesRepository(
|
||||
fallback: AppPreferencesDefaults(
|
||||
username: dependencies.environment.defaultUsername,
|
||||
receiveFolder: dependencies.fileSystemService.defaultReceiveFolder(),
|
||||
themeMode: .system,
|
||||
notificationsEnabled: false,
|
||||
diagnosticsEnabled: false
|
||||
)
|
||||
)
|
||||
self.approvalCoordinator = ApprovalCoordinator(
|
||||
repository: coreRepository,
|
||||
preferences: preferencesRepository,
|
||||
notifications: dependencies.notificationService,
|
||||
visibility: visibility,
|
||||
messages: messages
|
||||
)
|
||||
AppLogger.info("lifecycle", "graph created", ["platform": dependencies.environment.name])
|
||||
}
|
||||
|
||||
func close() {
|
||||
coreRepository.shutdown()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user