|
@@ -28,7 +28,7 @@ import NCCommunication
|
|
|
|
|
|
//MARK: - Main Common
|
|
|
|
|
|
-class NCMainCommon: NSObject, NCAudioRecorderViewControllerDelegate, UIDocumentInteractionControllerDelegate {
|
|
|
+class NCMainCommon: NSObject, NCAudioRecorderViewControllerDelegate, UIDocumentInteractionControllerDelegate, UITextViewDelegate {
|
|
|
@objc static let shared: NCMainCommon = {
|
|
|
let instance = NCMainCommon()
|
|
|
instance.createImagesThemingColor()
|
|
@@ -80,11 +80,43 @@ class NCMainCommon: NSObject, NCAudioRecorderViewControllerDelegate, UIDocumentI
|
|
|
NCMainCommonImages.cellPlayImage = CCGraphics.changeThemingColorImage(UIImage.init(named: "play"), width: 100, height: 100, color: .white)
|
|
|
}
|
|
|
|
|
|
+ // MARK: -
|
|
|
+
|
|
|
+ func createFolder() {
|
|
|
+
|
|
|
+ let appDelegate = UIApplication.shared.delegate as! AppDelegate
|
|
|
+ guard let serverUrl = appDelegate.activeServerUrl else { return }
|
|
|
+
|
|
|
+ let alertController = UIAlertController(title: NSLocalizedString("_create_folder_on_", comment: ""), message: nil, preferredStyle: .alert)
|
|
|
+
|
|
|
+ alertController.addTextField { (textField) in
|
|
|
+ //[textField addTarget:self action:@selector(minCharTextFieldDidChange:) forControlEvents:UIControlEventEditingChanged];
|
|
|
+ textField.autocapitalizationType = UITextAutocapitalizationType.sentences
|
|
|
+ }
|
|
|
+
|
|
|
+ let cancelAction = UIAlertAction(title: NSLocalizedString("_cancel_", comment: ""), style: .cancel, handler: nil)
|
|
|
+ let okAction = UIAlertAction(title: NSLocalizedString("_ok_", comment: ""), style: .default, handler: { action in
|
|
|
+ if let fileNameFolder = alertController.textFields?.first?.text {
|
|
|
+ NCNetworking.shared.createFolder(fileName: fileNameFolder, serverUrl: serverUrl, account: appDelegate.account, urlBase: appDelegate.urlBase, overwrite: false) { (errorCode, errorDescription) in
|
|
|
+ if errorCode != 0 {
|
|
|
+ NCContentPresenter.shared.messageNotification("_error_", description: errorDescription, delay: TimeInterval(k_dismissAfterSecond), type: NCContentPresenter.messageType.error, errorCode: errorCode)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
+ //okAction.enabled = NO;
|
|
|
+ alertController.addAction(cancelAction)
|
|
|
+ alertController.addAction(okAction)
|
|
|
+
|
|
|
+ appDelegate.window.rootViewController?.present(alertController, animated: true, completion: nil)
|
|
|
+ }
|
|
|
+
|
|
|
//MARK: -
|
|
|
|
|
|
@objc func triggerProgressTask(_ notification: Notification, sectionDataSourceocIdIndexPath: NSDictionary, tableView: UITableView, viewController: UIViewController, serverUrlViewController: String?) {
|
|
|
- let appDelegate = UIApplication.shared.delegate as! AppDelegate
|
|
|
|
|
|
+ let appDelegate = UIApplication.shared.delegate as! AppDelegate
|
|
|
if viewController.viewIfLoaded?.window == nil {
|
|
|
return
|
|
|
}
|
|
@@ -188,6 +220,7 @@ class NCMainCommon: NSObject, NCAudioRecorderViewControllerDelegate, UIDocumentI
|
|
|
}
|
|
|
|
|
|
@objc func cancelAllTransfer() {
|
|
|
+
|
|
|
let appDelegate = UIApplication.shared.delegate as! AppDelegate
|
|
|
|
|
|
// Delete k_metadataStatusWaitUpload OR k_metadataStatusUploadError
|
|
@@ -215,6 +248,7 @@ class NCMainCommon: NSObject, NCAudioRecorderViewControllerDelegate, UIDocumentI
|
|
|
//MARK: -
|
|
|
|
|
|
@objc func cellForRowAtIndexPath(_ indexPath: IndexPath, tableView: UITableView ,metadata: tableMetadata, metadataFolder: tableMetadata?, serverUrl: String, autoUploadFileName: String, autoUploadDirectory: String, tableShare: tableShare?, livePhoto: Bool) -> UITableViewCell {
|
|
|
+
|
|
|
let appDelegate = UIApplication.shared.delegate as! AppDelegate
|
|
|
|
|
|
// Create File System
|