mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-29 12:19:03 +03:00
ac1b11708f
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
57 lines
1.8 KiB
Swift
57 lines
1.8 KiB
Swift
//
|
|
// DocumentActionViewController.swift
|
|
// FileProviderUIExt
|
|
//
|
|
// Created by Claudio Cambra on 20/2/24.
|
|
//
|
|
|
|
import FileProviderUI
|
|
import OSLog
|
|
|
|
class DocumentActionViewController: FPUIActionExtensionViewController {
|
|
var domain: NSFileProviderDomain {
|
|
guard let identifier = extensionContext.domainIdentifier else {
|
|
fatalError("not expected to be called with default domain")
|
|
}
|
|
return NSFileProviderDomain(
|
|
identifier: NSFileProviderDomainIdentifier(rawValue: identifier.rawValue),
|
|
displayName: ""
|
|
)
|
|
}
|
|
|
|
func prepare(childViewController: NSViewController) {
|
|
addChild(childViewController)
|
|
view.addSubview(childViewController.view)
|
|
|
|
NSLayoutConstraint.activate([
|
|
view.leadingAnchor.constraint(equalTo: childViewController.view.leadingAnchor),
|
|
view.trailingAnchor.constraint(equalTo: childViewController.view.trailingAnchor),
|
|
view.topAnchor.constraint(equalTo: childViewController.view.topAnchor),
|
|
view.bottomAnchor.constraint(equalTo: childViewController.view.bottomAnchor)
|
|
])
|
|
}
|
|
|
|
override func prepare(
|
|
forAction actionIdentifier: String, itemIdentifiers: [NSFileProviderItemIdentifier]
|
|
) {
|
|
Logger.actionViewController.info("Preparing action: \(actionIdentifier, privacy: .public)")
|
|
|
|
if actionIdentifier == "com.nextcloud.desktopclient.FileProviderUIExt.ShareAction" {
|
|
prepare(childViewController: ShareViewController(itemIdentifiers))
|
|
}
|
|
|
|
}
|
|
|
|
override func prepare(forError error: Error) {
|
|
Logger.actionViewController.info(
|
|
"""
|
|
Preparing for error: \(error.localizedDescription, privacy: .public)
|
|
"""
|
|
)
|
|
}
|
|
|
|
override public func loadView() {
|
|
self.view = NSView()
|
|
}
|
|
}
|
|
|