mirror of
https://github.com/sudosylabs/vnidrop.git
synced 2026-08-05 18:39:55 +02:00
- Introduce a CoreGateway protocol so feature models depend on a seam (CoreRepository conforms); enables faking the core in tests - Add a VniDropTests target with 42 tests mirroring the KMP suites: approval coordinator, send/receive/settings/app models, preferences, file previews, invitation decode, message queue, error mapping - Add a fake gateway/file-system/device-info and fixtures - Add .github/workflows/apple.yml: build the Rust core, generate the project, and run the tests on an iOS Simulator
39 lines
1.6 KiB
Swift
39 lines
1.6 KiB
Swift
import Foundation
|
|
import Combine
|
|
import VnidropCore
|
|
|
|
/// Seam between the feature models and the Rust core, mirroring `CoreGateway`
|
|
/// in the KMP `shared` module. `CoreRepository` is the production implementation;
|
|
/// tests substitute a fake so the models can be exercised without the FFI.
|
|
@MainActor
|
|
protocol CoreGateway: AnyObject {
|
|
/// Latest published core state.
|
|
var state: CoreState { get }
|
|
/// Publisher of core-state changes (the models subscribe to this).
|
|
var statePublisher: AnyPublisher<CoreState, Never> { get }
|
|
/// Coalesced change hints emitted by the event sink.
|
|
var signals: AnyPublisher<CoreSignal, Never> { get }
|
|
|
|
func initialize(appDataDir: String) async -> Result<Void, Error>
|
|
func shutdown()
|
|
func shareSources(
|
|
_ sources: [ShareSource],
|
|
transferName: String,
|
|
senderName: String,
|
|
accessPolicy: ShareAccessPolicy
|
|
) async -> Result<Share, Error>
|
|
func inspectTicket(_ ticket: String) async -> Result<TicketInspectionModel, Error>
|
|
func receive(ticket: String, outputDir: String, receiverName: String) async -> Result<Void, Error>
|
|
func receiveIntoSecurityScopedDirectory(
|
|
ticket: String,
|
|
outputDirectoryUrl: String,
|
|
receiverName: String
|
|
) async -> Result<Void, Error>
|
|
func cancel(transferId: UInt64) async -> Result<Void, Error>
|
|
func delete(transferId: UInt64) async -> Result<Void, Error>
|
|
func clearReceiveHistory() async -> Result<UInt64, Error>
|
|
func receiverRequests(transferId: UInt64) async -> Result<[ReceiverRequestModel], Error>
|
|
func respondReceiverRequest(requestId: String, accepted: Bool, reason: String?) async -> Result<Void, Error>
|
|
func refresh() async -> Result<Void, Error>
|
|
}
|