diff --git a/Examples/FileBrowser/FileBrowser (iOS)/DocumentViewController.swift b/Examples/FileBrowser/FileBrowser (iOS)/DocumentViewController.swift index a441a1c..00123b3 100644 --- a/Examples/FileBrowser/FileBrowser (iOS)/DocumentViewController.swift +++ b/Examples/FileBrowser/FileBrowser (iOS)/DocumentViewController.swift @@ -8,7 +8,7 @@ import SMBClient class DocumentViewController: UIViewController { private let path: String private let treeAccessor: TreeAccessor - private let fileReader: FileReader + private var fileReader: FileReader? private let server: HTTPServer private let port: UInt16 @@ -21,7 +21,6 @@ class DocumentViewController: UIViewController { init(accessor: TreeAccessor, path: String) { treeAccessor = accessor self.path = path - fileReader = accessor.fileReader(path: path) port = UInt16(42000) server = HTTPServer(port: port, logger: .disabled) @@ -74,13 +73,20 @@ class DocumentViewController: UIViewController { ]) let semaphore = self.semaphore - let fileReader = self.fileReader + let treeAccessor = self.treeAccessor + let path = self.path + var fileReader = self.fileReader task = Task { await server.appendRoute("*") { (request) in await semaphore.wait() defer { Task { await semaphore.signal() } } + if fileReader == nil { + fileReader = try await treeAccessor.fileReader(path: path) + } + guard let fileReader else { return HTTPResponse(statusCode: .internalServerError) } + let bufferedResponse = BufferedResponse(fileReader: fileReader) let mimeType = mimeTypeForPath(path: request.path) @@ -142,8 +148,10 @@ class DocumentViewController: UIViewController { override func viewDidDisappear(_ animated: Bool) { super.viewDidDisappear(animated) - Task { - try await fileReader.close() + if let fileReader { + Task { + try await fileReader.close() + } } task?.cancel() } diff --git a/Examples/FileBrowser/FileBrowser (macOS)/DocumentWindowController.swift b/Examples/FileBrowser/FileBrowser (macOS)/DocumentWindowController.swift index 7bebb13..9b5c5e2 100644 --- a/Examples/FileBrowser/FileBrowser (macOS)/DocumentWindowController.swift +++ b/Examples/FileBrowser/FileBrowser (macOS)/DocumentWindowController.swift @@ -8,24 +8,25 @@ import SMBClient private let storyboardID = "DocumentWindowController" class DocumentWindowController: NSWindowController, NSWindowDelegate { + private let treeAccessor: TreeAccessor private let path: String - private let fileReader: FileReader + private var fileReader: FileReader? private let server: HTTPServer private let port: UInt16 private var task: Task<(), any Error>? private let semaphore = Semaphore(value: 1) - static func instantiate(path: String, accessor: TreeAccessor) -> Self { + static func instantiate(accessor: TreeAccessor, path: String) -> Self { let storyboard = NSStoryboard(name: storyboardID, bundle: nil) return storyboard.instantiateController(identifier: storyboardID) { (coder) in - Self(coder: coder, path: path, accessor: accessor) + Self(coder: coder, accessor: accessor, path: path) } } - required init?(coder: NSCoder, path: String, accessor: TreeAccessor) { + required init?(coder: NSCoder, accessor: TreeAccessor, path: String) { + treeAccessor = accessor self.path = path - fileReader = accessor.fileReader(path: path) port = UInt16(42000 + NSApp.windows.count) server = HTTPServer(port: port, logger: .disabled) @@ -43,13 +44,20 @@ class DocumentWindowController: NSWindowController, NSWindowDelegate { window?.delegate = self let semaphore = self.semaphore - let fileReader = self.fileReader + let treeAccessor = self.treeAccessor + let path = self.path + var fileReader = self.fileReader task = Task { await server.appendRoute("*") { (request) in await semaphore.wait() defer { Task { await semaphore.signal() } } + if fileReader == nil { + fileReader = try await treeAccessor.fileReader(path: path) + } + guard let fileReader else { return HTTPResponse(statusCode: .internalServerError) } + let bufferedResponse = BufferedResponse(fileReader: fileReader) let mimeType = mimeTypeForPath(path: request.path) @@ -99,7 +107,7 @@ class DocumentWindowController: NSWindowController, NSWindowDelegate { ) } - try await server.start() + try await server.run() } Task { @MainActor in @@ -111,8 +119,10 @@ class DocumentWindowController: NSWindowController, NSWindowDelegate { } func windowWillClose(_ notification: Notification) { - Task { - try await fileReader.close() + if let fileReader { + Task { + try await fileReader.close() + } } task?.cancel() } diff --git a/Examples/FileBrowser/FileBrowser (macOS)/FilesViewController.swift b/Examples/FileBrowser/FileBrowser (macOS)/FilesViewController.swift index 643ddad..cd7c1fe 100644 --- a/Examples/FileBrowser/FileBrowser (macOS)/FilesViewController.swift +++ b/Examples/FileBrowser/FileBrowser (macOS)/FilesViewController.swift @@ -236,7 +236,7 @@ class FilesViewController: NSViewController { }() Task { do { - try await treeAccessor.createDirectory(share: share, path: join(path, filename)) + try await treeAccessor.createDirectory(path: join(path, filename)) try await dirTree.reload(directory: path, outlineView) updateItemCount() } catch { @@ -290,7 +290,7 @@ class FilesViewController: NSViewController { windowController = MediaPlayerWindowController.instantiate(path: path, accessor: treeAccessor) windowController.showWindow(nil) } else { - windowController = DocumentWindowController.instantiate(path: path, accessor: treeAccessor) + windowController = DocumentWindowController.instantiate(accessor: treeAccessor, path: path) windowController.showWindow(nil) } } @@ -340,9 +340,9 @@ class FilesViewController: NSViewController { let path = fileNode.path if fileNode.isDirectory { - try await treeAccessor.deleteDirectory(share: share, path: path) + try await treeAccessor.deleteDirectory(path: path) } else { - try await treeAccessor.deleteFile(share: share, path: path) + try await treeAccessor.deleteFile(path: path) } reloadPaths.insert(dirname(path)) @@ -525,7 +525,7 @@ extension FilesViewController: NSOutlineViewDataSource { func moveFile(from: String, to: String) async { do { - try await treeAccessor.move(share: share, from: from, to: to) + try await treeAccessor.move(from: from, to: to) try await dirTree.reload(directory: dirname(from), outlineView) try await dirTree.reload(directory: dirname(to), outlineView) @@ -716,7 +716,7 @@ extension FilesViewController: NSTextFieldDelegate { Task { @MainActor in do { - try await treeAccessor.rename(share: share, from: node.path, to: join(dirname(node.path), textField.stringValue)) + try await treeAccessor.rename(from: node.path, to: join(dirname(node.path), textField.stringValue)) try await dirTree.reload(directory: dirname(node.path), outlineView) } catch { textField.stringValue = node.name diff --git a/Examples/FileBrowser/FileBrowser (visionOS)/FileBrowserApp.swift b/Examples/FileBrowser/FileBrowser (visionOS)/FileBrowserApp.swift index c2794fe..6d18fd2 100644 --- a/Examples/FileBrowser/FileBrowser (visionOS)/FileBrowserApp.swift +++ b/Examples/FileBrowser/FileBrowser (visionOS)/FileBrowserApp.swift @@ -1,13 +1,26 @@ import SwiftUI +import SMBClient +import Translation @main struct FileBrowserApp: App { - @UIApplicationDelegateAdaptor(AppDelegate.self) private var appDelegate + @UIApplicationDelegateAdaptor(AppDelegate.self) + private var appDelegate + @State + private var sessionManager = SessionManager() var body: some Scene { WindowGroup { FileBrowserView() } + .environment(\.sessionManager, sessionManager) + + WindowGroup("Video Player", id: "videoPlayer", for: SessionContext.self) { ($context) in + if let context, let client = sessionManager.sessions[ID(context.domain)] { + VideoPlayerView(client: client, sessionContext: context) + } + } + .environment(\.sessionManager, sessionManager) } } @@ -20,3 +33,19 @@ class AppDelegate: NSObject, UIApplicationDelegate { return true } } + + +@Observable +class SessionManager { + var sessions = [ID: SMBClient]() +} + +extension EnvironmentValues { + @Entry var sessionManager = SessionManager() +} + +struct SessionContext: Hashable, Codable { + let domain: String + let share: String + let path: String +} diff --git a/Examples/FileBrowser/FileBrowser (visionOS)/ContentView.swift b/Examples/FileBrowser/FileBrowser (visionOS)/FileBrowserView.swift similarity index 85% rename from Examples/FileBrowser/FileBrowser (visionOS)/ContentView.swift rename to Examples/FileBrowser/FileBrowser (visionOS)/FileBrowserView.swift index 860d24d..7c71fbe 100644 --- a/Examples/FileBrowser/FileBrowser (visionOS)/ContentView.swift +++ b/Examples/FileBrowser/FileBrowser (visionOS)/FileBrowserView.swift @@ -6,11 +6,13 @@ struct FileBrowserView: View { private var services = [Service]() @State private var selection: Service? - @State - private var sessions = [ID: SMBClient]() +// @State +// private var sessions = [ID: SMBClient]() @State private var showingLoginSheet: Bool = false + @Environment(\.sessionManager) var sessionManager: SessionManager + let publisher = NotificationCenter.default.publisher(for: ServiceDiscovery.serviceDidDiscover) var body: some View { @@ -22,7 +24,7 @@ struct FileBrowserView: View { } } .onChange(of: selection, initial: false) { (oldValue, newValue) in - if let selection, sessions[selection.id] == nil { + if let selection, sessionManager.sessions[selection.id] == nil { showingLoginSheet = true } } @@ -32,8 +34,8 @@ struct FileBrowserView: View { .navigationTitle("Services") } detail: { if let selection { - if let client = sessions[selection.id] { - SharesView(client: client) + if let client = sessionManager.sessions[selection.id] { + SharesView(domain: selection.id.rawValue, client: client) .id(selection) } } @@ -71,7 +73,7 @@ struct FileBrowserView: View { let store = CredentialStore.shared store.save(server: server, securityDomain: securityDomain, username: username, password: password) - sessions[ID(securityDomain)] = client + sessionManager.sessions[ID(securityDomain)] = client } } diff --git a/Examples/FileBrowser/FileBrowser (visionOS)/FilesView.swift b/Examples/FileBrowser/FileBrowser (visionOS)/FilesView.swift index 3685ee2..abe7223 100644 --- a/Examples/FileBrowser/FileBrowser (visionOS)/FilesView.swift +++ b/Examples/FileBrowser/FileBrowser (visionOS)/FilesView.swift @@ -12,10 +12,14 @@ struct FilesView: View { @State private var isLoading = false @State private var errorMessage: String? + @Environment(\.openWindow) private var openWindow + + private let domain: String private let treeAccessor: TreeAccessor private let path: String - init(accessor: TreeAccessor, path: String) { + init(domain: String, accessor: TreeAccessor, path: String) { + self.domain = domain treeAccessor = accessor self.path = path } @@ -34,18 +38,24 @@ struct FilesView: View { Label(file.name, systemImage: file.isDirectory ? "folder" : "doc") } } - .navigationDestination(for: Route.self) { (route) in - if route.isDirectory { - FilesView(accessor: treeAccessor, path: route.path) - } else { - let path = URL(fileURLWithPath: route.path) + .onChange(of: selection, initial: false) { (oldValue, newValue) in + if let selection { + let subpath = path.isEmpty ? selection.name : "\(path)/\(selection.name)" + let path = URL(fileURLWithPath: subpath) if VideoPlayerView.supportedExtensions.contains(path.pathExtension) { - VideoPlayerView(accessor: treeAccessor, path: route.path) + openWindow(id: "videoPlayer", value: SessionContext(domain: domain, share: treeAccessor.share, path: subpath)) } else { } } } + .navigationDestination(for: Route.self) { (route) in + if route.isDirectory { + FilesView(domain: domain, accessor: treeAccessor, path: route.path) + } else { + + } + } .foregroundStyle(.primary) } } diff --git a/Examples/FileBrowser/FileBrowser (visionOS)/SharesView.swift b/Examples/FileBrowser/FileBrowser (visionOS)/SharesView.swift index 2f6d4a0..4353fb4 100644 --- a/Examples/FileBrowser/FileBrowser (visionOS)/SharesView.swift +++ b/Examples/FileBrowser/FileBrowser (visionOS)/SharesView.swift @@ -7,11 +7,12 @@ struct SharesView: View { @State private var isLoading = false @State private var errorMessage: String? + private let domain: String private let client: SMBClient - private var host: String - private let id = UUID() + private let host: String - init(client: SMBClient) { + init(domain: String, client: SMBClient) { + self.domain = domain self.client = client host = client.host } @@ -31,7 +32,7 @@ struct SharesView: View { } } .navigationDestination(for: String.self) { (share) in - FilesView(accessor: client.treeAccessor(share: share), path: "") + FilesView(domain: domain, accessor: client.treeAccessor(share: share), path: "") } } .foregroundStyle(.primary) diff --git a/Examples/FileBrowser/FileBrowser (visionOS)/VideoPlayerView.swift b/Examples/FileBrowser/FileBrowser (visionOS)/VideoPlayerView.swift index fc7f175..f481ef8 100644 --- a/Examples/FileBrowser/FileBrowser (visionOS)/VideoPlayerView.swift +++ b/Examples/FileBrowser/FileBrowser (visionOS)/VideoPlayerView.swift @@ -6,9 +6,9 @@ struct VideoPlayerView: View { private let player: AVPlayer private let treeAccessor: TreeAccessor - init(accessor: TreeAccessor, path: String) { - treeAccessor = accessor - player = AVPlayer(playerItem: AVPlayerItem(asset: SMBAVAsset(accessor: accessor, path: path))) + init(client: SMBClient, sessionContext: SessionContext) { + treeAccessor = client.treeAccessor(share: sessionContext.share) + player = AVPlayer(playerItem: AVPlayerItem(asset: SMBAVAsset(accessor: treeAccessor, path: sessionContext.path))) } var body: some View { diff --git a/Examples/FileBrowser/FileBrowser.xcodeproj/project.pbxproj b/Examples/FileBrowser/FileBrowser.xcodeproj/project.pbxproj index 4e05652..fb79ad9 100644 --- a/Examples/FileBrowser/FileBrowser.xcodeproj/project.pbxproj +++ b/Examples/FileBrowser/FileBrowser.xcodeproj/project.pbxproj @@ -3,12 +3,36 @@ archiveVersion = 1; classes = { }; - objectVersion = 70; + objectVersion = 56; objects = { /* Begin PBXBuildFile section */ 141AF3DF2C4A94D30050C7A5 /* NSOutlineView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 141AF3DE2C4A94D30050C7A5 /* NSOutlineView.swift */; }; 141AF3E42C4ABCCA0050C7A5 /* URL.swift in Sources */ = {isa = PBXBuildFile; fileRef = 141AF3E32C4ABCCA0050C7A5 /* URL.swift */; }; + 14288F962CF87E7C0059EA58 /* ID.swift in Sources */ = {isa = PBXBuildFile; fileRef = 14288F902CF87E7C0059EA58 /* ID.swift */; }; + 14288F972CF87E7C0059EA58 /* Server.swift in Sources */ = {isa = PBXBuildFile; fileRef = 14288F912CF87E7C0059EA58 /* Server.swift */; }; + 14288F982CF87E7C0059EA58 /* Service.swift in Sources */ = {isa = PBXBuildFile; fileRef = 14288F922CF87E7C0059EA58 /* Service.swift */; }; + 14288F992CF87E7C0059EA58 /* ServiceDiscovery.swift in Sources */ = {isa = PBXBuildFile; fileRef = 14288F932CF87E7C0059EA58 /* ServiceDiscovery.swift */; }; + 14288F9A2CF87E7C0059EA58 /* SMBAVAsset.swift in Sources */ = {isa = PBXBuildFile; fileRef = 14288F942CF87E7C0059EA58 /* SMBAVAsset.swift */; }; + 14288F9B2CF87E7C0059EA58 /* ID.swift in Sources */ = {isa = PBXBuildFile; fileRef = 14288F902CF87E7C0059EA58 /* ID.swift */; }; + 14288F9C2CF87E7C0059EA58 /* Server.swift in Sources */ = {isa = PBXBuildFile; fileRef = 14288F912CF87E7C0059EA58 /* Server.swift */; }; + 14288F9D2CF87E7C0059EA58 /* Service.swift in Sources */ = {isa = PBXBuildFile; fileRef = 14288F922CF87E7C0059EA58 /* Service.swift */; }; + 14288F9E2CF87E7C0059EA58 /* ServiceDiscovery.swift in Sources */ = {isa = PBXBuildFile; fileRef = 14288F932CF87E7C0059EA58 /* ServiceDiscovery.swift */; }; + 14288F9F2CF87E7C0059EA58 /* SMBAVAsset.swift in Sources */ = {isa = PBXBuildFile; fileRef = 14288F942CF87E7C0059EA58 /* SMBAVAsset.swift */; }; + 14288FA02CF87E7C0059EA58 /* ID.swift in Sources */ = {isa = PBXBuildFile; fileRef = 14288F902CF87E7C0059EA58 /* ID.swift */; }; + 14288FA12CF87E7C0059EA58 /* Server.swift in Sources */ = {isa = PBXBuildFile; fileRef = 14288F912CF87E7C0059EA58 /* Server.swift */; }; + 14288FA22CF87E7C0059EA58 /* Service.swift in Sources */ = {isa = PBXBuildFile; fileRef = 14288F922CF87E7C0059EA58 /* Service.swift */; }; + 14288FA32CF87E7C0059EA58 /* ServiceDiscovery.swift in Sources */ = {isa = PBXBuildFile; fileRef = 14288F932CF87E7C0059EA58 /* ServiceDiscovery.swift */; }; + 14288FA42CF87E7C0059EA58 /* SMBAVAsset.swift in Sources */ = {isa = PBXBuildFile; fileRef = 14288F942CF87E7C0059EA58 /* SMBAVAsset.swift */; }; + 14288FB12CF87E800059EA58 /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 14288FA52CF87E800059EA58 /* Preview Assets.xcassets */; }; + 14288FB22CF87E800059EA58 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 14288FA72CF87E800059EA58 /* Assets.xcassets */; }; + 14288FB42CF87E800059EA58 /* ConnectServiceView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 14288FA82CF87E800059EA58 /* ConnectServiceView.swift */; }; + 14288FB52CF87E800059EA58 /* CredentialStore.swift in Sources */ = {isa = PBXBuildFile; fileRef = 14288FA92CF87E800059EA58 /* CredentialStore.swift */; }; + 14288FB62CF87E800059EA58 /* FileBrowserApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 14288FAA2CF87E800059EA58 /* FileBrowserApp.swift */; }; + 14288FB72CF87E800059EA58 /* FileBrowserView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 14288FAB2CF87E800059EA58 /* FileBrowserView.swift */; }; + 14288FB82CF87E800059EA58 /* FilesView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 14288FAC2CF87E800059EA58 /* FilesView.swift */; }; + 14288FB92CF87E800059EA58 /* SharesView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 14288FAE2CF87E800059EA58 /* SharesView.swift */; }; + 14288FBA2CF87E800059EA58 /* VideoPlayerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 14288FAF2CF87E800059EA58 /* VideoPlayerView.swift */; }; 1446801B2C347E1F0029A1AB /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1446801A2C347E1F0029A1AB /* AppDelegate.swift */; }; 1446801F2C347E200029A1AB /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 1446801E2C347E200029A1AB /* Assets.xcassets */; }; 144680222C347E200029A1AB /* Base in Resources */ = {isa = PBXBuildFile; fileRef = 144680212C347E200029A1AB /* Base */; }; @@ -75,6 +99,21 @@ /* Begin PBXFileReference section */ 141AF3DE2C4A94D30050C7A5 /* NSOutlineView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NSOutlineView.swift; sourceTree = ""; }; 141AF3E32C4ABCCA0050C7A5 /* URL.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = URL.swift; sourceTree = ""; }; + 14288F902CF87E7C0059EA58 /* ID.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ID.swift; sourceTree = ""; }; + 14288F912CF87E7C0059EA58 /* Server.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Server.swift; sourceTree = ""; }; + 14288F922CF87E7C0059EA58 /* Service.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Service.swift; sourceTree = ""; }; + 14288F932CF87E7C0059EA58 /* ServiceDiscovery.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ServiceDiscovery.swift; sourceTree = ""; }; + 14288F942CF87E7C0059EA58 /* SMBAVAsset.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SMBAVAsset.swift; sourceTree = ""; }; + 14288FA52CF87E800059EA58 /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = ""; }; + 14288FA72CF87E800059EA58 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + 14288FA82CF87E800059EA58 /* ConnectServiceView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ConnectServiceView.swift; sourceTree = ""; }; + 14288FA92CF87E800059EA58 /* CredentialStore.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CredentialStore.swift; sourceTree = ""; }; + 14288FAA2CF87E800059EA58 /* FileBrowserApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FileBrowserApp.swift; sourceTree = ""; }; + 14288FAB2CF87E800059EA58 /* FileBrowserView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FileBrowserView.swift; sourceTree = ""; }; + 14288FAC2CF87E800059EA58 /* FilesView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FilesView.swift; sourceTree = ""; }; + 14288FAD2CF87E800059EA58 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 14288FAE2CF87E800059EA58 /* SharesView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SharesView.swift; sourceTree = ""; }; + 14288FAF2CF87E800059EA58 /* VideoPlayerView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VideoPlayerView.swift; sourceTree = ""; }; 144680172C347E1F0029A1AB /* File Browser.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "File Browser.app"; sourceTree = BUILT_PRODUCTS_DIR; }; 1446801A2C347E1F0029A1AB /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 1446801E2C347E200029A1AB /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; @@ -135,24 +174,8 @@ 14C23C9F2C53966A00CEA8CF /* ServersViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ServersViewController.swift; sourceTree = ""; }; 14C23CA12C53966A00CEA8CF /* ServerManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ServerManager.swift; sourceTree = ""; }; 14F80F742CEA933D00C1869A /* File Browser.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "File Browser.app"; sourceTree = BUILT_PRODUCTS_DIR; }; - 14F80F772CEA933D00C1869A /* RealityKitContent */ = {isa = PBXFileReference; lastKnownFileType = wrapper; path = RealityKitContent; sourceTree = ""; }; /* End PBXFileReference section */ -/* Begin PBXFileSystemSynchronizedBuildFileExceptionSet section */ - 14F80F842CEA933E00C1869A /* PBXFileSystemSynchronizedBuildFileExceptionSet */ = { - isa = PBXFileSystemSynchronizedBuildFileExceptionSet; - membershipExceptions = ( - Info.plist, - ); - target = 14F80F732CEA933D00C1869A /* FileBrowser (visionOS) */; - }; -/* End PBXFileSystemSynchronizedBuildFileExceptionSet section */ - -/* Begin PBXFileSystemSynchronizedRootGroup section */ - 14F80F752CEA933D00C1869A /* FileBrowser (visionOS) */ = {isa = PBXFileSystemSynchronizedRootGroup; exceptions = (14F80F842CEA933E00C1869A /* PBXFileSystemSynchronizedBuildFileExceptionSet */, ); explicitFileTypes = {}; explicitFolders = (); path = "FileBrowser (visionOS)"; sourceTree = ""; }; - 14F80FF02CEAF43D00C1869A /* Shared */ = {isa = PBXFileSystemSynchronizedRootGroup; explicitFileTypes = {}; explicitFolders = (); path = Shared; sourceTree = ""; }; -/* End PBXFileSystemSynchronizedRootGroup section */ - /* Begin PBXFrameworksBuildPhase section */ 144680142C347E1F0029A1AB /* Frameworks */ = { isa = PBXFrameworksBuildPhase; @@ -185,14 +208,50 @@ /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ + 14288F952CF87E7C0059EA58 /* Shared */ = { + isa = PBXGroup; + children = ( + 14288F902CF87E7C0059EA58 /* ID.swift */, + 14288F912CF87E7C0059EA58 /* Server.swift */, + 14288F922CF87E7C0059EA58 /* Service.swift */, + 14288F932CF87E7C0059EA58 /* ServiceDiscovery.swift */, + 14288F942CF87E7C0059EA58 /* SMBAVAsset.swift */, + ); + path = Shared; + sourceTree = ""; + }; + 14288FA62CF87E800059EA58 /* Preview Content */ = { + isa = PBXGroup; + children = ( + 14288FA52CF87E800059EA58 /* Preview Assets.xcassets */, + ); + path = "Preview Content"; + sourceTree = ""; + }; + 14288FB02CF87E800059EA58 /* FileBrowser (visionOS) */ = { + isa = PBXGroup; + children = ( + 14288FAA2CF87E800059EA58 /* FileBrowserApp.swift */, + 14288FAB2CF87E800059EA58 /* FileBrowserView.swift */, + 14288FAE2CF87E800059EA58 /* SharesView.swift */, + 14288FAC2CF87E800059EA58 /* FilesView.swift */, + 14288FAF2CF87E800059EA58 /* VideoPlayerView.swift */, + 14288FA82CF87E800059EA58 /* ConnectServiceView.swift */, + 14288FA92CF87E800059EA58 /* CredentialStore.swift */, + 14288FA62CF87E800059EA58 /* Preview Content */, + 14288FA72CF87E800059EA58 /* Assets.xcassets */, + 14288FAD2CF87E800059EA58 /* Info.plist */, + ); + path = "FileBrowser (visionOS)"; + sourceTree = ""; + }; 1446800E2C347E1F0029A1AB = { isa = PBXGroup; children = ( 144680192C347E1F0029A1AB /* FileBrowser (macOS) */, 14C23C812C53962F00CEA8CF /* FileBrowser (iOS) */, - 14F80FF02CEAF43D00C1869A /* Shared */, - 14F80F752CEA933D00C1869A /* FileBrowser (visionOS) */, - 14F80F762CEA933D00C1869A /* Packages */, + 14288F952CF87E7C0059EA58 /* Shared */, + 14288FB02CF87E800059EA58 /* FileBrowser (visionOS) */, 144680182C347E1F0029A1AB /* Products */, 14C23CB02C5396C600CEA8CF /* Frameworks */, ); @@ -288,14 +347,6 @@ name = Frameworks; sourceTree = ""; }; - 14F80F762CEA933D00C1869A /* Packages */ = { - isa = PBXGroup; - children = ( - 14F80F772CEA933D00C1869A /* RealityKitContent */, - ); - path = Packages; - sourceTree = ""; - }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ @@ -311,9 +362,6 @@ ); dependencies = ( ); - fileSystemSynchronizedGroups = ( - 14F80FF02CEAF43D00C1869A /* Shared */, - ); name = "FileBrowser (macOS)"; packageProductDependencies = ( 14F80FC62CEA971B00C1869A /* SMBClient */, @@ -336,9 +384,6 @@ ); dependencies = ( ); - fileSystemSynchronizedGroups = ( - 14F80FF02CEAF43D00C1869A /* Shared */, - ); name = "FileBrowser (iOS)"; packageProductDependencies = ( 14C23CB52C5396C600CEA8CF /* SMBClient */, @@ -361,10 +406,6 @@ ); dependencies = ( ); - fileSystemSynchronizedGroups = ( - 14F80F752CEA933D00C1869A /* FileBrowser (visionOS) */, - 14F80FF02CEAF43D00C1869A /* Shared */, - ); name = "FileBrowser (visionOS)"; packageProductDependencies = ( 14F80F882CEA935400C1869A /* SMBClient */, @@ -451,6 +492,8 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( + 14288FB12CF87E800059EA58 /* Preview Assets.xcassets in Resources */, + 14288FB22CF87E800059EA58 /* Assets.xcassets in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -466,6 +509,11 @@ 14529A1C2C3D26FE003B035C /* ConnectServerViewController.swift in Sources */, 1446802E2C34800B0029A1AB /* SidebarViewController.swift in Sources */, 147EC5B82C40512F00C08ED3 /* TransferQueue.swift in Sources */, + 14288FA02CF87E7C0059EA58 /* ID.swift in Sources */, + 14288FA12CF87E7C0059EA58 /* Server.swift in Sources */, + 14288FA22CF87E7C0059EA58 /* Service.swift in Sources */, + 14288FA32CF87E7C0059EA58 /* ServiceDiscovery.swift in Sources */, + 14288FA42CF87E7C0059EA58 /* SMBAVAsset.swift in Sources */, 145299AA2C356A30003B035C /* FilesViewController.swift in Sources */, 141AF3DF2C4A94D30050C7A5 /* NSOutlineView.swift in Sources */, 14C15E9A2C49F90C00F2F9A9 /* DataRepository.swift in Sources */, @@ -503,6 +551,11 @@ 14C23CA42C53966A00CEA8CF /* CredentialStore.swift in Sources */, 14C23CA72C53966A00CEA8CF /* SharesViewController.swift in Sources */, 14C23CAD2C53966A00CEA8CF /* ServersViewController.swift in Sources */, + 14288F962CF87E7C0059EA58 /* ID.swift in Sources */, + 14288F972CF87E7C0059EA58 /* Server.swift in Sources */, + 14288F982CF87E7C0059EA58 /* Service.swift in Sources */, + 14288F992CF87E7C0059EA58 /* ServiceDiscovery.swift in Sources */, + 14288F9A2CF87E7C0059EA58 /* SMBAVAsset.swift in Sources */, 14C23C832C53962F00CEA8CF /* AppDelegate.swift in Sources */, 14C23CA22C53966A00CEA8CF /* FilesViewController.swift in Sources */, 14C23CA32C53966A00CEA8CF /* ConnectServiceView.swift in Sources */, @@ -518,6 +571,18 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + 14288F9B2CF87E7C0059EA58 /* ID.swift in Sources */, + 14288FB42CF87E800059EA58 /* ConnectServiceView.swift in Sources */, + 14288FB52CF87E800059EA58 /* CredentialStore.swift in Sources */, + 14288FB62CF87E800059EA58 /* FileBrowserApp.swift in Sources */, + 14288FB72CF87E800059EA58 /* FileBrowserView.swift in Sources */, + 14288FB82CF87E800059EA58 /* FilesView.swift in Sources */, + 14288FB92CF87E800059EA58 /* SharesView.swift in Sources */, + 14288FBA2CF87E800059EA58 /* VideoPlayerView.swift in Sources */, + 14288F9C2CF87E7C0059EA58 /* Server.swift in Sources */, + 14288F9D2CF87E7C0059EA58 /* Service.swift in Sources */, + 14288F9E2CF87E7C0059EA58 /* ServiceDiscovery.swift in Sources */, + 14288F9F2CF87E7C0059EA58 /* SMBAVAsset.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -898,7 +963,7 @@ repositoryURL = "https://github.com/kishikawakatsumi/SMBClient.git"; requirement = { kind = upToNextMajorVersion; - minimumVersion = 0.2.1; + minimumVersion = 0.3.0; }; }; 145299EA2C3AC745003B035C /* XCRemoteSwiftPackageReference "FlyingFox" */ = { diff --git a/Examples/FileBrowser/FileBrowser.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/Examples/FileBrowser/FileBrowser.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index 15e6def..17213cc 100644 --- a/Examples/FileBrowser/FileBrowser.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/Examples/FileBrowser/FileBrowser.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -1,5 +1,5 @@ { - "originHash" : "ab960b0baaa125aff3f804cd05035ee32644b1a7380c2d168aee07de14412f44", + "originHash" : "5d4dde8d24dec84f2ef8157fa32beeb36cf583b42ba178f7dcea16c910656995", "pins" : [ { "identity" : "flyingfox", @@ -15,8 +15,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/kishikawakatsumi/SMBClient.git", "state" : { - "revision" : "78ecf6cb8055c4f6d9e6af6022091e06c927004e", - "version" : "0.2.1" + "revision" : "8a2ed059d7056d5d8ea80b0096932cd45b170e18", + "version" : "0.3.0" } } ], diff --git a/Examples/FileBrowser/Packages/RealityKitContent/.swiftpm/xcode/xcshareddata/xcschemes/RealityKitContent.xcscheme b/Examples/FileBrowser/Packages/RealityKitContent/.swiftpm/xcode/xcshareddata/xcschemes/RealityKitContent.xcscheme deleted file mode 100644 index 7bd890b..0000000 --- a/Examples/FileBrowser/Packages/RealityKitContent/.swiftpm/xcode/xcshareddata/xcschemes/RealityKitContent.xcscheme +++ /dev/null @@ -1,67 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Examples/FileBrowser/Packages/RealityKitContent/Package.realitycomposerpro/ProjectData/main.json b/Examples/FileBrowser/Packages/RealityKitContent/Package.realitycomposerpro/ProjectData/main.json deleted file mode 100644 index 4a8c74b..0000000 --- a/Examples/FileBrowser/Packages/RealityKitContent/Package.realitycomposerpro/ProjectData/main.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "pathsToIds" : { - "\/RealityKitContent\/Sources\/RealityKitContent\/RealityKitContent.rkassets\/GridMaterial.usda" : "440DE5B4-E4E4-459B-AABF-9ACE96319272", - "\/RealityKitContent\/Sources\/RealityKitContent\/RealityKitContent.rkassets\/procedural_sphere_grid.usda" : "34C460AE-CA1B-4348-BD05-621ACBDFFE97", - "\/RealityKitContent\/Sources\/RealityKitContent\/RealityKitContent.rkassets\/Scene.usda" : "0A9B4653-B11E-4D6A-850E-C6FCB621626C", - "\/RealityKitContent\/Sources\/RealityKitContent\/RealityKitContent.rkassets\/Untitled Scene.usda" : "03E02005-EFA6-48D6-8A76-05B2822A74E9", - "RealityKitContent\/Sources\/RealityKitContent\/RealityKitContent.rkassets\/GridMaterial.usda" : "FBD8436F-6B8B-4B82-99B5-995D538B4704", - "RealityKitContent\/Sources\/RealityKitContent\/RealityKitContent.rkassets\/procedural_sphere_grid.usda" : "1CBF3893-ABFD-408C-8B91-045BFD257808", - "RealityKitContent\/Sources\/RealityKitContent\/RealityKitContent.rkassets\/Scene.usda" : "26DBAE76-5DD8-47B6-A085-1B4ADA111097" - } -} \ No newline at end of file diff --git a/Examples/FileBrowser/Packages/RealityKitContent/Package.realitycomposerpro/WorkspaceData/SceneMetadataList.json b/Examples/FileBrowser/Packages/RealityKitContent/Package.realitycomposerpro/WorkspaceData/SceneMetadataList.json deleted file mode 100644 index 1d84a75..0000000 --- a/Examples/FileBrowser/Packages/RealityKitContent/Package.realitycomposerpro/WorkspaceData/SceneMetadataList.json +++ /dev/null @@ -1,209 +0,0 @@ -{ - "0A9B4653-B11E-4D6A-850E-C6FCB621626C" : { - "cameraTransform" : [ - 0.9807314, - -1.9820146e-10, - -0.195361, - 0, - -0.10051192, - 0.85749435, - -0.5045798, - 0, - 0.16752096, - 0.51449335, - 0.84097165, - 0, - 0.09084191, - 0.05849296, - 0.13903293, - 1 - ], - "objectMetadataList" : [ - [ - "0A9B4653-B11E-4D6A-850E-C6FCB621626C", - "Root" - ], - { - "isExpanded" : true, - "isLocked" : false - }, - [ - "0A9B4653-B11E-4D6A-850E-C6FCB621626C", - "Root", - "GridMaterial" - ], - { - "isExpanded" : true, - "isLocked" : false - }, - [ - "0A9B4653-B11E-4D6A-850E-C6FCB621626C", - "Root", - "Sphere" - ], - { - "isExpanded" : true, - "isLocked" : false - } - ] - }, - "1CBF3893-ABFD-408C-8B91-045BFD257808" : { - "cameraTransform" : [ - 0.99999994, - 0, - -0, - 0, - -0, - 0.8660255, - -0.49999988, - 0, - 0, - 0.49999988, - 0.8660255, - 0, - 0, - 0.27093542, - 0.46927398, - 1 - ], - "objectMetadataList" : [ - - ] - }, - "03E02005-EFA6-48D6-8A76-05B2822A74E9" : { - "cameraTransform" : [ - 0.99999994, - 0, - -0, - 0, - -0, - 0.8660254, - -0.49999994, - 0, - 0, - 0.49999994, - 0.8660254, - 0, - 0, - 0.5981957, - 1.0361054, - 1 - ], - "objectMetadataList" : [ - - ] - }, - "26DBAE76-5DD8-47B6-A085-1B4ADA111097" : { - "cameraTransform" : [ - 1, - 0, - -0, - 0, - -0, - 0.7071069, - -0.7071067, - 0, - 0, - 0.7071067, - 0.7071069, - 0, - 0, - 0.2681068, - 0.26850593, - 1 - ], - "objectMetadataList" : [ - [ - "26DBAE76-5DD8-47B6-A085-1B4ADA111097", - "Root" - ], - { - "isExpanded" : true, - "isLocked" : false - } - ] - }, - "34C460AE-CA1B-4348-BD05-621ACBDFFE97" : { - "cameraTransform" : [ - 0.99999994, - 0, - -0, - 0, - -0, - 0.8660255, - -0.49999988, - 0, - 0, - 0.49999988, - 0.8660255, - 0, - 0, - 0.27093542, - 0.46927398, - 1 - ], - "objectMetadataList" : [ - - ] - }, - "440DE5B4-E4E4-459B-AABF-9ACE96319272" : { - "cameraTransform" : [ - 0.99999994, - 0, - -0, - 0, - -0, - 0.8660254, - -0.49999994, - 0, - 0, - 0.49999994, - 0.8660254, - 0, - 0, - 0.5981957, - 1.0361054, - 1 - ], - "objectMetadataList" : [ - [ - "440DE5B4-E4E4-459B-AABF-9ACE96319272", - "Root" - ], - { - "isExpanded" : true, - "isLocked" : false - } - ] - }, - "FBD8436F-6B8B-4B82-99B5-995D538B4704" : { - "cameraTransform" : [ - 0.99999994, - 0, - -0, - 0, - -0, - 0.8660254, - -0.49999994, - 0, - 0, - 0.49999994, - 0.8660254, - 0, - 0, - 0.5981957, - 1.0361054, - 1 - ], - "objectMetadataList" : [ - [ - "FBD8436F-6B8B-4B82-99B5-995D538B4704", - "Root" - ], - { - "isExpanded" : true, - "isLocked" : false - } - ] - } -} \ No newline at end of file diff --git a/Examples/FileBrowser/Packages/RealityKitContent/Package.realitycomposerpro/WorkspaceData/Settings.rcprojectdata b/Examples/FileBrowser/Packages/RealityKitContent/Package.realitycomposerpro/WorkspaceData/Settings.rcprojectdata deleted file mode 100644 index 6dea95c..0000000 --- a/Examples/FileBrowser/Packages/RealityKitContent/Package.realitycomposerpro/WorkspaceData/Settings.rcprojectdata +++ /dev/null @@ -1,17 +0,0 @@ -{ - "cameraPresets" : { - - }, - "secondaryToolbarData" : { - "isGridVisible" : true, - "sceneReverbPreset" : -1 - }, - "unitDefaults" : { - "°" : "°", - "kg" : "g", - "m" : "cm", - "m\/s" : "m\/s", - "m\/s²" : "m\/s²", - "s" : "s" - } -} \ No newline at end of file diff --git a/Examples/FileBrowser/Packages/RealityKitContent/Package.swift b/Examples/FileBrowser/Packages/RealityKitContent/Package.swift deleted file mode 100644 index b29e73d..0000000 --- a/Examples/FileBrowser/Packages/RealityKitContent/Package.swift +++ /dev/null @@ -1,30 +0,0 @@ -// swift-tools-version:6.0 -// The swift-tools-version declares the minimum version of Swift required to build this package. - -import PackageDescription - -let package = Package( - name: "RealityKitContent", - platforms: [ - .visionOS(.v2), - .macOS(.v15), - .iOS(.v18) - ], - products: [ - // Products define the executables and libraries a package produces, and make them visible to other packages. - .library( - name: "RealityKitContent", - targets: ["RealityKitContent"]), - ], - dependencies: [ - // Dependencies declare other packages that this package depends on. - // .package(url: /* package url */, from: "1.0.0"), - ], - targets: [ - // Targets are the basic building blocks of a package. A target can define a module or a test suite. - // Targets can depend on other targets in this package, and on products in packages this package depends on. - .target( - name: "RealityKitContent", - dependencies: []), - ] -) \ No newline at end of file diff --git a/Examples/FileBrowser/Packages/RealityKitContent/README.md b/Examples/FileBrowser/Packages/RealityKitContent/README.md deleted file mode 100644 index 486b575..0000000 --- a/Examples/FileBrowser/Packages/RealityKitContent/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# RealityKitContent - -A description of this package. \ No newline at end of file diff --git a/Examples/FileBrowser/Packages/RealityKitContent/Sources/RealityKitContent/RealityKitContent.rkassets/Materials/GridMaterial.usda b/Examples/FileBrowser/Packages/RealityKitContent/Sources/RealityKitContent/RealityKitContent.rkassets/Materials/GridMaterial.usda deleted file mode 100644 index b7afd02..0000000 --- a/Examples/FileBrowser/Packages/RealityKitContent/Sources/RealityKitContent/RealityKitContent.rkassets/Materials/GridMaterial.usda +++ /dev/null @@ -1,216 +0,0 @@ -#usda 1.0 -( - defaultPrim = "Root" - metersPerUnit = 1 - upAxis = "Y" -) - -def Xform "Root" -{ - def Material "GridMaterial" - { - reorder nameChildren = ["", "", "", "", "", "", "", "", "", "", "", "", "", "", "DefaultSurfaceShader", "MaterialXPreviewSurface", "Texcoord", "Add", "Multiply", "Fractional", "LineCounts", "Multiply_1", "Separate2", "Separate2_1", "Ifgreater", "Ifgreater_1", "Max", "Background_Color"] - token outputs:mtlx:surface.connect = - token outputs:realitykit:vertex - token outputs:surface - float2 ui:nodegraph:realitykit:subgraphOutputs:pos = (2222, 300.5) - float2 ui:nodegraph:realitykit:subgraphOutputs:size = (182, 89) - int ui:nodegraph:realitykit:subgraphOutputs:stackingOrder = 749 - - def Shader "DefaultSurfaceShader" - { - uniform token info:id = "UsdPreviewSurface" - color3f inputs:diffuseColor = (1, 1, 1) - float inputs:roughness = 0.75 - token outputs:surface - } - - def Shader "MaterialXPreviewSurface" - { - uniform token info:id = "ND_UsdPreviewSurface_surfaceshader" - float inputs:clearcoat - float inputs:clearcoatRoughness - color3f inputs:diffuseColor.connect = - color3f inputs:emissiveColor - float inputs:ior - float inputs:metallic = 0.15 - float3 inputs:normal - float inputs:occlusion - float inputs:opacity - float inputs:opacityThreshold - float inputs:roughness = 0.5 - token outputs:out - float2 ui:nodegraph:node:pos = (1967, 300.5) - float2 ui:nodegraph:node:size = (208, 297) - int ui:nodegraph:node:stackingOrder = 870 - string[] ui:nodegraph:realitykit:node:attributesShowingChildren = ["Advanced"] - } - - def Shader "Texcoord" - { - uniform token info:id = "ND_texcoord_vector2" - float2 outputs:out - float2 ui:nodegraph:node:pos = (94.14453, 35.29297) - float2 ui:nodegraph:node:size = (182, 43) - int ui:nodegraph:node:stackingOrder = 1358 - } - - def Shader "Multiply" - { - uniform token info:id = "ND_multiply_vector2" - float2 inputs:in1.connect = - float2 inputs:in2 = (32, 15) - float2 inputs:in2.connect = - float2 outputs:out - float2 ui:nodegraph:node:pos = (275.64453, 47.29297) - float2 ui:nodegraph:node:size = (61, 36) - int ui:nodegraph:node:stackingOrder = 1348 - string[] ui:nodegraph:realitykit:node:attributesShowingChildren = ["inputs:in2"] - } - - def Shader "Fractional" - { - uniform token info:id = "ND_realitykit_fractional_vector2" - float2 inputs:in.connect = - float2 outputs:out - float2 ui:nodegraph:node:pos = (440.5, 49.5) - float2 ui:nodegraph:node:size = (155, 99) - int ui:nodegraph:node:stackingOrder = 1345 - } - - def Shader "BaseColor" - { - uniform token info:id = "ND_constant_color3" - color3f inputs:value = (0.89737034, 0.89737034, 0.89737034) ( - colorSpace = "Input - Texture - sRGB - sRGB" - ) - color3f inputs:value.connect = None - color3f outputs:out - float2 ui:nodegraph:node:pos = (1537.5977, 363.07812) - float2 ui:nodegraph:node:size = (150, 43) - int ui:nodegraph:node:stackingOrder = 1353 - } - - def Shader "LineColor" - { - uniform token info:id = "ND_constant_color3" - color3f inputs:value = (0.55945957, 0.55945957, 0.55945957) ( - colorSpace = "Input - Texture - sRGB - sRGB" - ) - color3f inputs:value.connect = None - color3f outputs:out - float2 ui:nodegraph:node:pos = (1536.9844, 287.86328) - float2 ui:nodegraph:node:size = (146, 43) - int ui:nodegraph:node:stackingOrder = 1355 - } - - def Shader "LineWidths" - { - uniform token info:id = "ND_combine2_vector2" - float inputs:in1 = 0.1 - float inputs:in2 = 0.1 - float2 outputs:out - float2 ui:nodegraph:node:pos = (443.64453, 233.79297) - float2 ui:nodegraph:node:size = (151, 43) - int ui:nodegraph:node:stackingOrder = 1361 - } - - def Shader "LineCounts" - { - uniform token info:id = "ND_combine2_vector2" - float inputs:in1 = 24 - float inputs:in2 = 12 - float2 outputs:out - float2 ui:nodegraph:node:pos = (94.14453, 138.29297) - float2 ui:nodegraph:node:size = (153, 43) - int ui:nodegraph:node:stackingOrder = 1359 - } - - def Shader "Remap" - { - uniform token info:id = "ND_remap_color3" - color3f inputs:in.connect = - color3f inputs:inhigh.connect = None - color3f inputs:inlow.connect = None - color3f inputs:outhigh.connect = - color3f inputs:outlow.connect = - color3f outputs:out - float2 ui:nodegraph:node:pos = (1755.5, 300.5) - float2 ui:nodegraph:node:size = (95, 171) - int ui:nodegraph:node:stackingOrder = 1282 - string[] ui:nodegraph:realitykit:node:attributesShowingChildren = ["inputs:outlow"] - } - - def Shader "Separate2" - { - uniform token info:id = "ND_separate2_vector2" - float2 inputs:in.connect = - float outputs:outx - float outputs:outy - float2 ui:nodegraph:node:pos = (1212.6445, 128.91797) - float2 ui:nodegraph:node:size = (116, 117) - int ui:nodegraph:node:stackingOrder = 1363 - } - - def Shader "Combine3" - { - uniform token info:id = "ND_combine3_color3" - float inputs:in1.connect = - float inputs:in2.connect = - float inputs:in3.connect = - color3f outputs:out - float2 ui:nodegraph:node:pos = (1578.1445, 128.91797) - float2 ui:nodegraph:node:size = (146, 54) - int ui:nodegraph:node:stackingOrder = 1348 - } - - def Shader "Range" - { - uniform token info:id = "ND_range_vector2" - bool inputs:doclamp = 1 - float2 inputs:gamma = (2, 2) - float2 inputs:in.connect = - float2 inputs:inhigh.connect = - float2 inputs:inlow = (0.02, 0.02) - float2 inputs:outhigh - float2 inputs:outlow - float2 outputs:out - float2 ui:nodegraph:node:pos = (990.64453, 128.91797) - float2 ui:nodegraph:node:size = (98, 207) - int ui:nodegraph:node:stackingOrder = 1364 - } - - def Shader "Subtract" - { - uniform token info:id = "ND_subtract_vector2" - float2 inputs:in1.connect = - float2 inputs:in2.connect = - float2 outputs:out - float2 ui:nodegraph:node:pos = (612.64453, 87.04297) - float2 ui:nodegraph:node:size = (63, 36) - int ui:nodegraph:node:stackingOrder = 1348 - } - - def Shader "Absval" - { - uniform token info:id = "ND_absval_vector2" - float2 inputs:in.connect = - float2 outputs:out - float2 ui:nodegraph:node:pos = (765.64453, 87.04297) - float2 ui:nodegraph:node:size = (123, 43) - int ui:nodegraph:node:stackingOrder = 1348 - } - - def Shader "Min" - { - uniform token info:id = "ND_min_float" - float inputs:in1.connect = - float inputs:in2.connect = - float outputs:out - float2 ui:nodegraph:node:pos = (1388.1445, 128.91797) - float2 ui:nodegraph:node:size = (114, 36) - int ui:nodegraph:node:stackingOrder = 1363 - } - } -} - diff --git a/Examples/FileBrowser/Packages/RealityKitContent/Sources/RealityKitContent/RealityKitContent.rkassets/Scene.usda b/Examples/FileBrowser/Packages/RealityKitContent/Sources/RealityKitContent/RealityKitContent.rkassets/Scene.usda deleted file mode 100644 index 4cb070b..0000000 --- a/Examples/FileBrowser/Packages/RealityKitContent/Sources/RealityKitContent/RealityKitContent.rkassets/Scene.usda +++ /dev/null @@ -1,59 +0,0 @@ -#usda 1.0 -( - defaultPrim = "Root" - metersPerUnit = 1 - upAxis = "Y" -) - -def Xform "Root" -{ - reorder nameChildren = ["GridMaterial", "Sphere"] - rel material:binding = None ( - bindMaterialAs = "weakerThanDescendants" - ) - - def Sphere "Sphere" ( - active = true - prepend apiSchemas = ["MaterialBindingAPI"] - ) - { - rel material:binding = ( - bindMaterialAs = "weakerThanDescendants" - ) - double radius = 0.05 - quatf xformOp:orient = (1, 0, 0, 0) - float3 xformOp:scale = (1, 1, 1) - float3 xformOp:translate = (0, 0, 0.0004) - uniform token[] xformOpOrder = ["xformOp:translate", "xformOp:orient", "xformOp:scale"] - - def RealityKitComponent "Collider" - { - uint group = 1 - uniform token info:id = "RealityKit.Collider" - uint mask = 4294967295 - token type = "Default" - - def RealityKitStruct "Shape" - { - float3 extent = (0.2, 0.2, 0.2) - float radius = 0.05 - token shapeType = "Sphere" - } - } - - def RealityKitComponent "InputTarget" - { - uniform token info:id = "RealityKit.InputTarget" - } - } - - def "GridMaterial" ( - active = true - prepend references = @Materials/GridMaterial.usda@ - ) - { - float3 xformOp:scale = (1, 1, 1) - uniform token[] xformOpOrder = ["xformOp:translate", "xformOp:orient", "xformOp:scale"] - } -} - diff --git a/Examples/FileBrowser/Packages/RealityKitContent/Sources/RealityKitContent/RealityKitContent.swift b/Examples/FileBrowser/Packages/RealityKitContent/Sources/RealityKitContent/RealityKitContent.swift deleted file mode 100644 index 5caba4e..0000000 --- a/Examples/FileBrowser/Packages/RealityKitContent/Sources/RealityKitContent/RealityKitContent.swift +++ /dev/null @@ -1,4 +0,0 @@ -import Foundation - -/// Bundle for the RealityKitContent project -public let realityKitContentBundle = Bundle.module diff --git a/Examples/FileBrowser/Shared/SMBAVAsset.swift b/Examples/FileBrowser/Shared/SMBAVAsset.swift index 2af8bbf..f072a6f 100644 --- a/Examples/FileBrowser/Shared/SMBAVAsset.swift +++ b/Examples/FileBrowser/Shared/SMBAVAsset.swift @@ -27,22 +27,24 @@ class SMBAVAsset: AVURLAsset { } private class AssetResourceLoaderDelegate: NSObject, AVAssetResourceLoaderDelegate { - private let fileReader: FileReader + private let treeAccessor: TreeAccessor + private var fileReader: FileReader? private let path: String private let contentType: String? private let queue = TaskQueue() init(accessor: TreeAccessor, path: String, contentType: String?) { - fileReader = accessor.fileReader(path: path) + treeAccessor = accessor self.path = path self.contentType = contentType } func close() { - let fileReader = self.fileReader - queue.dispatch { - try await fileReader.close() + if let fileReader = self.fileReader { + queue.dispatch { + try await fileReader.close() + } } } @@ -54,6 +56,11 @@ private class AssetResourceLoaderDelegate: NSObject, AVAssetResourceLoaderDelega queue.dispatch { [weak self] in guard let self else { return } + if fileReader == nil { + fileReader = try await treeAccessor.fileReader(path: path) + } + guard let fileReader else { return } + contentRequest.contentType = self.contentType contentRequest.contentLength = Int64(truncatingIfNeeded: try await fileReader.fileSize) contentRequest.isByteRangeAccessSupported = true @@ -67,6 +74,11 @@ private class AssetResourceLoaderDelegate: NSObject, AVAssetResourceLoaderDelega queue.dispatch { [weak self] in guard let self else { return } + if fileReader == nil { + fileReader = try await treeAccessor.fileReader(path: path) + } + guard let fileReader else { return } + let data = try await fileReader.read( offset: UInt64(dataRequest.requestedOffset), length: readSize @@ -79,6 +91,11 @@ private class AssetResourceLoaderDelegate: NSObject, AVAssetResourceLoaderDelega queue.dispatch { [weak self] in guard let self else { return } + if fileReader == nil { + fileReader = try await treeAccessor.fileReader(path: path) + } + guard let fileReader else { return } + let data = try await fileReader.read( offset: UInt64(dataRequest.requestedOffset), length: readSize