the manager lands in manager/, next to ios/ and web/. it is a fork of this repo's own app, not of feather, so scripts/apply-rebrand.sh excludes it the same way it excludes web/ — the generic feather-to- ftstore rule would rewrite its app.ftstore.manager identity and mangle the lineage notes in its docs. zsign and idevicekitten were vendored copies in the old repo. they are registered as submodules here instead, pinned to the same commits ios/ uses and verified byte-identical to what was vendored. that keeps 71 MB of duplicated source out of the tree and leaves the xcode project's relative paths intact, so project.pbxproj needed no edits. the server moves to ftstore.app in both apps: managerrepoclient, the seeded default source and managerconfig's fallback. downloadmanager keeps the old admin host in its user-agent allowlist — that check is permissive, not identifying, and dropping it would stop sending the header to installs whose stored override still names the old host. the rest of the admin rename lands too: the client id, the base-url environment variable, the info.plist key, and user-facing errors. the userdefaults override key is renamed with a one-time migration read, so an existing install keeps the address its owner configured instead of falling back to the default. tags gain a third namespace: manager-v* for releases, manager-dev for the rolling prerelease. both repos published to a tag called `dev` before; sharing it here would make each build overwrite the other's release assets.
55 lines
1.6 KiB
Swift
55 lines
1.6 KiB
Swift
//
|
|
// UIKitFileImporter.swift
|
|
// Feather
|
|
//
|
|
// Created by samara on 23.04.2025.
|
|
//
|
|
|
|
import SwiftUI
|
|
import UniformTypeIdentifiers
|
|
|
|
public struct FileImporterRepresentableView: UIViewControllerRepresentable {
|
|
public var allowedContentTypes: [UTType]
|
|
public var allowsMultipleSelection: Bool = false
|
|
public var onDocumentsPicked: ([URL]) -> Void
|
|
|
|
public init(
|
|
allowedContentTypes: [UTType],
|
|
allowsMultipleSelection: Bool = false,
|
|
onDocumentsPicked: @escaping ([URL]) -> Void
|
|
) {
|
|
self.allowedContentTypes = allowedContentTypes
|
|
self.allowsMultipleSelection = allowsMultipleSelection
|
|
self.onDocumentsPicked = onDocumentsPicked
|
|
}
|
|
|
|
public func makeCoordinator() -> Coordinator {
|
|
Coordinator(onDocumentsPicked: onDocumentsPicked)
|
|
}
|
|
|
|
public func makeUIViewController(context: Context) -> UIDocumentPickerViewController {
|
|
let picker = UIDocumentPickerViewController(forOpeningContentTypes: allowedContentTypes, asCopy: true)
|
|
picker.delegate = context.coordinator
|
|
picker.allowsMultipleSelection = allowsMultipleSelection
|
|
return picker
|
|
}
|
|
|
|
public func updateUIViewController(_ uiViewController: UIDocumentPickerViewController, context: Context) {}
|
|
|
|
public class Coordinator: NSObject, UIDocumentPickerDelegate {
|
|
var onDocumentsPicked: ([URL]) -> Void
|
|
|
|
init(onDocumentsPicked: @escaping ([URL]) -> Void) {
|
|
self.onDocumentsPicked = onDocumentsPicked
|
|
}
|
|
|
|
public func documentPicker(_ controller: UIDocumentPickerViewController, didPickDocumentsAt urls: [URL]) {
|
|
onDocumentsPicked(urls)
|
|
}
|
|
|
|
public func documentPickerWasCancelled(_ controller: UIDocumentPickerViewController) {
|
|
onDocumentsPicked([])
|
|
}
|
|
}
|
|
}
|