marinofaggiana 5 years ago
parent
commit
adf597009e

+ 1 - 1
Libraries external/Imagemeter/IMCreate.swift

@@ -24,7 +24,7 @@
 import Foundation
 
 class IMCreate: NSObject {
-    init(fileName: String, directory: String) {
+    init(serverUrl: String) {
         super.init()
     }
 }

+ 2 - 21
iOSClient/Main/Create cloud/NCCreateFormUploadAssets.swift

@@ -107,7 +107,7 @@ class NCCreateFormUploadAssets: XLFormViewController, NCSelectDelegate, PhotoEdi
         var section : XLFormSectionDescriptor
         var row : XLFormRowDescriptor
         
-        // Section Photo Editor only for one photo & IMI
+        // Section Photo Editor only for one photo
         
         if assets.count == 1 && (assets[0] as! PHAsset).mediaType == PHAssetMediaType.image && self.imagePreview != nil {
             
@@ -124,18 +124,6 @@ class NCCreateFormUploadAssets: XLFormViewController, NCSelectDelegate, PhotoEdi
             row.cellConfig["textLabel.font"] = UIFont.systemFont(ofSize: 15.0)
             
             section.addFormRow(row)
-            
-            if NCBrandOptions.sharedInstance.use_imi_viewer {
-                
-                row = XLFormRowDescriptor(tag: "createIMI", rowType: XLFormRowDescriptorTypeBooleanSwitch, title: NSLocalizedString("_im_create_new_file", tableName: "IMLocalizable", bundle: Bundle.main, value: "", comment: ""))
-                row.value = 0
-                row.cellConfig["backgroundColor"] = NCBrandColor.sharedInstance.backgroundForm
-                
-                row.cellConfig["textLabel.font"] = UIFont.systemFont(ofSize: 15.0)
-                row.cellConfig["textLabel.textColor"] = NCBrandColor.sharedInstance.textView
-                
-                section.addFormRow(row)
-            }
         }
         
         // Section: Destination Folder
@@ -249,14 +237,7 @@ class NCCreateFormUploadAssets: XLFormViewController, NCSelectDelegate, PhotoEdi
         
         super.formRowDescriptorValueHasChanged(formRow, oldValue: oldValue, newValue: newValue)
         
-        if formRow.tag == "createIMI" {
-            if (formRow.value! as AnyObject).boolValue  == true {
-                
-            } else {
-                
-            }
-        }
-        else if formRow.tag == "useFolderAutoUpload" {
+        if formRow.tag == "useFolderAutoUpload" {
             
             if (formRow.value! as AnyObject).boolValue  == true {
                 

+ 25 - 18
iOSClient/Main/Create cloud/NCCreateMenuAdd.swift

@@ -39,27 +39,31 @@ class NCCreateMenuAdd: NSObject {
         ActionSheetItemCell.appearance().backgroundColor = NCBrandColor.sharedInstance.backgroundForm
         ActionSheetItemCell.appearance().titleColor = NCBrandColor.sharedInstance.textView
         
-        items.append(ActionSheetItem(title: NSLocalizedString("_upload_photos_videos_", comment: ""), value: 1, image: CCGraphics.changeThemingColorImage(UIImage.init(named: "file_photo"), width: 50, height: 50, color: NCBrandColor.sharedInstance.icon)))
+        items.append(ActionSheetItem(title: NSLocalizedString("_upload_photos_videos_", comment: ""), value: 10, image: CCGraphics.changeThemingColorImage(UIImage.init(named: "file_photo"), width: 50, height: 50, color: NCBrandColor.sharedInstance.icon)))
         
-        items.append(ActionSheetItem(title: NSLocalizedString("_upload_file_", comment: ""), value: 2, image: CCGraphics.changeThemingColorImage(UIImage.init(named: "file"), width: 50, height: 50, color: NCBrandColor.sharedInstance.icon)))
+        items.append(ActionSheetItem(title: NSLocalizedString("_upload_file_", comment: ""), value: 20, image: CCGraphics.changeThemingColorImage(UIImage.init(named: "file"), width: 50, height: 50, color: NCBrandColor.sharedInstance.icon)))
         
-        items.append(ActionSheetItem(title: NSLocalizedString("_upload_file_text_", comment: ""), value: 3, image: CCGraphics.changeThemingColorImage(UIImage.init(named: "file_txt"), width: 50, height: 50, color: NCBrandColor.sharedInstance.icon)))
+        if NCBrandOptions.sharedInstance.use_imi_viewer {
+            items.append(ActionSheetItem(title: NSLocalizedString("_im_create_new_file", tableName: "IMLocalizable", bundle: Bundle.main, value: "", comment: ""), value: 21, image: CCGraphics.scale(UIImage.init(named: "imagemeter"), to: CGSize(width: 25, height: 25), isAspectRation: true)))
+        }
+        
+        items.append(ActionSheetItem(title: NSLocalizedString("_upload_file_text_", comment: ""), value: 30, image: CCGraphics.changeThemingColorImage(UIImage.init(named: "file_txt"), width: 50, height: 50, color: NCBrandColor.sharedInstance.icon)))
         
 #if !targetEnvironment(simulator)
         if #available(iOS 11.0, *) {
-            items.append(ActionSheetItem(title: NSLocalizedString("_scans_document_", comment: ""), value: 4, image: CCGraphics.changeThemingColorImage(UIImage.init(named: "scan"), width: 50, height: 50, color: NCBrandColor.sharedInstance.icon)))
+            items.append(ActionSheetItem(title: NSLocalizedString("_scans_document_", comment: ""), value: 40, image: CCGraphics.changeThemingColorImage(UIImage.init(named: "scan"), width: 50, height: 50, color: NCBrandColor.sharedInstance.icon)))
         }
 #endif
         
-        items.append(ActionSheetItem(title: NSLocalizedString("_create_voice_memo_", comment: ""), value: 5, image: CCGraphics.changeThemingColorImage(UIImage.init(named: "microphone"), width: 50, height: 50, color: NCBrandColor.sharedInstance.icon)))
+        items.append(ActionSheetItem(title: NSLocalizedString("_create_voice_memo_", comment: ""), value: 50, image: CCGraphics.changeThemingColorImage(UIImage.init(named: "microphone"), width: 50, height: 50, color: NCBrandColor.sharedInstance.icon)))
 
-        items.append(ActionSheetItem(title: NSLocalizedString("_create_folder_", comment: ""), value: 6, image: CCGraphics.changeThemingColorImage(UIImage.init(named: "folder"), width: 50, height: 50, color: NCBrandColor.sharedInstance.brandElement)))
+        items.append(ActionSheetItem(title: NSLocalizedString("_create_folder_", comment: ""), value: 60, image: CCGraphics.changeThemingColorImage(UIImage.init(named: "folder"), width: 50, height: 50, color: NCBrandColor.sharedInstance.brandElement)))
         
         if let richdocumentsMimetypes = NCManageDatabase.sharedInstance.getRichdocumentsMimetypes(account: appDelegate.activeAccount) {
             if richdocumentsMimetypes.count > 0 {
-                items.append(ActionSheetItem(title: NSLocalizedString("_create_new_document_", comment: ""), value: 7, image: UIImage.init(named: "create_file_document")))
-                items.append(ActionSheetItem(title: NSLocalizedString("_create_new_spreadsheet_", comment: ""), value: 8, image: UIImage(named: "create_file_xls")))
-                items.append(ActionSheetItem(title: NSLocalizedString("_create_new_presentation_", comment: ""), value: 9, image: UIImage(named: "create_file_ppt")))
+                items.append(ActionSheetItem(title: NSLocalizedString("_create_new_document_", comment: ""), value: 70, image: UIImage.init(named: "create_file_document")))
+                items.append(ActionSheetItem(title: NSLocalizedString("_create_new_spreadsheet_", comment: ""), value: 80, image: UIImage(named: "create_file_xls")))
+                items.append(ActionSheetItem(title: NSLocalizedString("_create_new_presentation_", comment: ""), value: 90, image: UIImage(named: "create_file_ppt")))
             }
         }
         
@@ -67,25 +71,28 @@ class NCCreateMenuAdd: NSObject {
         
         let actionSheet = ActionSheet(items: items) { sheet, item in
             
-            if item.value as? Int == 1 { self.appDelegate.activeMain.openAssetsPickerController() }
-            if item.value as? Int == 2 { self.appDelegate.activeMain.openImportDocumentPicker() }
-            if item.value as? Int == 3 {
+            if item.value as? Int == 10 { self.appDelegate.activeMain.openAssetsPickerController() }
+            if item.value as? Int == 20 { self.appDelegate.activeMain.openImportDocumentPicker() }
+            if item.value as? Int == 21 {
+                _ = IMCreate.init(serverUrl: self.appDelegate.activeMain.serverUrl)
+            }
+            if item.value as? Int == 30 {
                 let storyboard = UIStoryboard(name: "NCText", bundle: nil)
                 let controller = storyboard.instantiateViewController(withIdentifier: "NCText")
                 controller.modalPresentationStyle = UIModalPresentationStyle.pageSheet
                 self.appDelegate.activeMain.present(controller, animated: true, completion: nil)
             }
-            if item.value as? Int == 4 {
+            if item.value as? Int == 40 {
                 if #available(iOS 11.0, *) {
                     NCCreateScanDocument.sharedInstance.openScannerDocument(viewController: self.appDelegate.activeMain, openScan: true)
                 }
             }
             
-            if item.value as? Int == 5 { NCMainCommon.sharedInstance.startAudioRecorder() }
+            if item.value as? Int == 50 { NCMainCommon.sharedInstance.startAudioRecorder() }
             
-            if item.value as? Int == 6 { self.appDelegate.activeMain.createFolder() }
+            if item.value as? Int == 60 { self.appDelegate.activeMain.createFolder() }
             
-            if item.value as? Int == 7 {
+            if item.value as? Int == 70 {
                 guard let navigationController = UIStoryboard(name: "NCCreateFormUploadRichdocuments", bundle: nil).instantiateInitialViewController() else {
                     return
                 }
@@ -98,7 +105,7 @@ class NCCreateMenuAdd: NSObject {
                 
                 self.appDelegate.window.rootViewController?.present(navigationController, animated: true, completion: nil)
             }
-            if item.value as? Int == 8 {
+            if item.value as? Int == 80 {
                 guard let navigationController = UIStoryboard(name: "NCCreateFormUploadRichdocuments", bundle: nil).instantiateInitialViewController() else {
                     return
                 }
@@ -111,7 +118,7 @@ class NCCreateMenuAdd: NSObject {
                 
                 self.appDelegate.window.rootViewController?.present(navigationController, animated: true, completion: nil)
             }
-            if item.value as? Int == 9 {
+            if item.value as? Int == 90 {
                 guard let navigationController = UIStoryboard(name: "NCCreateFormUploadRichdocuments", bundle: nil).instantiateInitialViewController() else {
                     return
                 }