12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- //
- // DocumentActionViewController.swift
- // File Provider ExtensionUI
- //
- // Created by Marino Faggiana on 26/06/18.
- // Copyright © 2018 TWS. All rights reserved.
- //
- // Author Marino Faggiana <m.faggiana@twsweb.it>
- //
- // This program is free software: you can redistribute it and/or modify
- // it under the terms of the GNU General Public License as published by
- // the Free Software Foundation, either version 3 of the License, or
- // (at your option) any later version.
- //
- // This program is distributed in the hope that it will be useful,
- // but WITHOUT ANY WARRANTY; without even the implied warranty of
- // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- // GNU General Public License for more details.
- //
- // You should have received a copy of the GNU General Public License
- // along with this program. If not, see <http://www.gnu.org/licenses/>.
- //
- import UIKit
- import FileProviderUI
- class DocumentActionViewController: FPUIActionExtensionViewController {
-
- @IBOutlet weak var identifierLabel: UILabel!
- @IBOutlet weak var actionTypeLabel: UILabel!
-
- override func prepare(forAction actionIdentifier: String, itemIdentifiers: [NSFileProviderItemIdentifier]) {
- identifierLabel?.text = actionIdentifier
- actionTypeLabel?.text = "Custom action"
- }
-
- override func prepare(forError error: Error) {
- identifierLabel?.text = error.localizedDescription
- actionTypeLabel?.text = "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))
- }
-
- }
|