mirror of
https://github.com/sudosylabs/vnidrop.git
synced 2026-08-05 02:29:55 +02:00
refactor(platform): remove Apple targets from KMP
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
A native SwiftUI app for Apple platforms, sharing the existing Rust transfer core
|
||||
(`crates/vnidrop`) through UniFFI-generated Swift bindings. The Rust crate is not
|
||||
modified; the Kotlin/Compose app layer is ported to Swift and mirrors the Compose
|
||||
UI screen-for-screen. Android and desktop JVM continue to use `shared/` + Compose.
|
||||
UI screen-for-screen. Android, Windows, and Linux continue to use `shared/` + Compose.
|
||||
|
||||
## Layout
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import SwiftUI
|
||||
|
||||
/// App entry point for iOS/iPadOS/macOS, ported from `iOSApp.swift` + `App.kt`.
|
||||
/// Native app entry point for iOS, iPadOS, and macOS.
|
||||
/// Opens `.vnd` invitations via `onOpenURL` and routes them to the receive flow.
|
||||
@main
|
||||
struct VniDropApp: App {
|
||||
|
||||
@@ -16,8 +16,7 @@ struct LocalNotification {
|
||||
let body: String
|
||||
}
|
||||
|
||||
/// Local notification service, ported from `LocalNotificationService.kt` /
|
||||
/// `.ios.kt`, backed by `UNUserNotificationCenter`.
|
||||
/// Local notification service backed by `UNUserNotificationCenter`.
|
||||
@MainActor
|
||||
final class LocalNotificationService: ObservableObject {
|
||||
@Published private(set) var permission: NotificationPermission = .notDetermined
|
||||
|
||||
@@ -2,7 +2,7 @@ import SwiftUI
|
||||
|
||||
enum ReceiveMethodAvailability { case available, unavailable, hidden }
|
||||
|
||||
/// Invitation acquisition actions, ported from `ReceiveInvitationActions` (iosMain).
|
||||
/// Invitation acquisition actions shared by the native Apple feature models.
|
||||
@MainActor
|
||||
protocol ReceiveInvitationActions: AnyObject {
|
||||
var fileAvailability: ReceiveMethodAvailability { get }
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
import Foundation
|
||||
import Combine
|
||||
|
||||
/// Persisted per-transfer thumbnail store, ported from
|
||||
/// `feature/send/FilePreviewRepository.kt` + `PlatformPreviewStore.ios.kt`.
|
||||
/// Native Apple preview cache and thumbnail loader.
|
||||
/// Only small PNG/JPEG/WEBP previews are retained, under a total quota.
|
||||
struct PreviewStoragePolicy {
|
||||
var maxEntryBytes: Int = 512 * 1024
|
||||
|
||||
@@ -2,7 +2,7 @@ import SwiftUI
|
||||
|
||||
enum NfcShareAvailability { case available, unavailable, hidden }
|
||||
|
||||
/// Invitation delivery actions, ported from `TransferShareActions` (iosMain).
|
||||
/// Invitation delivery actions shared by the native Apple feature models.
|
||||
/// Platform implementations perform export, native share, and NFC write.
|
||||
@MainActor
|
||||
protocol TransferShareActions: AnyObject {
|
||||
|
||||
@@ -3,7 +3,7 @@ import Foundation
|
||||
import UIKit
|
||||
import VnidropCore
|
||||
|
||||
/// iOS file system service, ported from `FileSystemService.ios.kt`.
|
||||
/// Native iOS file system service.
|
||||
/// App-owned Documents is the fixed receive folder; custom folders are not
|
||||
/// supported because raw external picker URLs do not survive relaunch.
|
||||
struct IosFileSystemService: FileSystemService {
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import Foundation
|
||||
|
||||
/// Builds a `.vnd` invitation filename from a transfer name, mirroring the iOS
|
||||
/// helper in `TransferShareActions.ios.kt`.
|
||||
/// Builds a `.vnd` invitation filename from a transfer name.
|
||||
func invitationFileName(_ transferName: String) -> String {
|
||||
let trimmed = transferName.trimmingCharacters(in: .whitespacesAndNewlines)
|
||||
let base = trimmed.isEmpty ? "invitation" : trimmed
|
||||
|
||||
@@ -7,7 +7,7 @@ import UniformTypeIdentifiers
|
||||
@MainActor
|
||||
func makeReceiveInvitationActions() -> ReceiveInvitationActions { IosReceiveInvitationActions() }
|
||||
|
||||
/// iOS invitation acquisition, ported from `ReceiveInvitationActions.ios.kt`:
|
||||
/// iOS invitation acquisition:
|
||||
/// document picker, camera QR scanner, and NFC read.
|
||||
final class IosReceiveInvitationActions: NSObject, ReceiveInvitationActions, UIDocumentPickerDelegate {
|
||||
private var documentResult: ((Result<String, Error>) -> Void)?
|
||||
|
||||
@@ -5,7 +5,7 @@ import UIKit
|
||||
@MainActor
|
||||
func makePlatformShareActions() -> TransferShareActions { IosTransferShareActions() }
|
||||
|
||||
/// iOS invitation delivery, ported from `TransferShareActions.ios.kt`: export via
|
||||
/// iOS invitation delivery: export via
|
||||
/// document picker, native share via `UIActivityViewController`, and NFC write.
|
||||
final class IosTransferShareActions: NSObject, TransferShareActions {
|
||||
private var nfcWriter: InvitationNfcWriter?
|
||||
@@ -61,8 +61,7 @@ final class IosTransferShareActions: NSObject, TransferShareActions {
|
||||
}
|
||||
}
|
||||
|
||||
/// Writes a VniDrop invitation to a writable NDEF tag, ported from
|
||||
/// `InvitationNfcWriter` in `TransferShareActions.ios.kt`.
|
||||
/// Writes a VniDrop invitation to a writable NDEF tag.
|
||||
// Runs entirely on the NFC session's `.main` delegate queue.
|
||||
final class InvitationNfcWriter: NSObject, NFCNDEFReaderSessionDelegate, @unchecked Sendable {
|
||||
private let ticket: String
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<!-- iOS: NFC NDEF reading (matches the original iosApp entitlements). -->
|
||||
<!-- iOS: NFC NDEF reading. -->
|
||||
<key>com.apple.developer.nfc.readersession.formats</key>
|
||||
<array>
|
||||
<string>NDEF</string>
|
||||
|
||||
Reference in New Issue
Block a user