// // NCCapabilitiesViewController.swift // Nextcloud // // Created by Marino Faggiana on 28/07/2020. // Copyright © 2020 Marino Faggiana. All rights reserved. // // Author Marino Faggiana // // 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 . // import UIKit class NCCapabilitiesViewController: UIViewController { @IBOutlet weak var textView: UITextView! override func viewDidLoad() { super.viewDidLoad() self.title = NSLocalizedString("_capabilities_", comment: "") let closeButton : UIBarButtonItem = UIBarButtonItem(title: NSLocalizedString("_done_", comment: ""), style: UIBarButtonItem.Style.plain, target: self, action: #selector(close)) self.navigationItem.leftBarButtonItem = closeButton guard let account = NCManageDatabase.sharedInstance.getAccountActive() else { return } if let jsonText = NCManageDatabase.sharedInstance.getCapabilities(account: account.account) { textView.text = jsonText } else { NCContentPresenter.shared.messageNotification("_error_", description: "_no_capabilities_found_", delay: TimeInterval(k_dismissAfterSecond), type: NCContentPresenter.messageType.info, errorCode: Int(k_CCErrorInternalError), forced: true) DispatchQueue.main.asyncAfter(deadline: .now() + 0.3) { self.dismiss(animated: true, completion: nil) } } } @objc func close() { self.dismiss(animated: true, completion: nil) } }