mirror of
https://github.com/nextcloud/desktop.git
synced 2025-10-26 11:17:43 +00:00
36 lines
1.3 KiB
Swift
36 lines
1.3 KiB
Swift
//
|
|
// DocumentActionViewController.swift
|
|
// FileProviderUIExt
|
|
//
|
|
// Created by Claudio Cambra on 20/2/24.
|
|
//
|
|
|
|
import FileProviderUI
|
|
|
|
class DocumentActionViewController: FPUIActionExtensionViewController {
|
|
|
|
@IBOutlet weak var identifierLabel: NSTextField!
|
|
@IBOutlet weak var actionTypeLabel: NSTextField!
|
|
|
|
override func prepare(forAction actionIdentifier: String, itemIdentifiers: [NSFileProviderItemIdentifier]) {
|
|
identifierLabel?.stringValue = actionIdentifier
|
|
actionTypeLabel?.stringValue = "Custom action"
|
|
}
|
|
|
|
override func prepare(forError error: Error) {
|
|
identifierLabel?.stringValue = error.localizedDescription
|
|
actionTypeLabel?.stringValue = "Authenticate"
|
|
}
|
|
|
|
@IBAction func doneButtonTapped(_ sender: Any) {
|
|
// Perform the action and call the completion block. If an unrecoverable error occurs you must still call the completion block with an error. Use the error code FPUIExtensionErrorCode.failed to signal the failure.
|
|
extensionContext.completeRequest()
|
|
}
|
|
|
|
@IBAction func cancelButtonTapped(_ sender: Any) {
|
|
extensionContext.cancelRequest(withError: NSError(domain: FPUIErrorDomain, code: Int(FPUIExtensionErrorCode.userCancelled.rawValue), userInfo: nil))
|
|
}
|
|
|
|
}
|
|
|