Jelajahi Sumber

new variable for mode

Marino Faggiana 8 tahun lalu
induk
melakukan
ed170856cc

+ 11 - 6
Picker/DocumentPickerViewController.swift

@@ -36,7 +36,8 @@ class DocumentPickerViewController: UIDocumentPickerExtensionViewController, CCN
         return fileCoordinator
         
     }()
-    
+    var mode : UIDocumentPickerMode?
+
     var metadata : CCMetadata?
     var recordsTableMetadata : [TableMetadata]?
     var titleFolder : String?
@@ -121,6 +122,13 @@ class DocumentPickerViewController: UIDocumentPickerExtensionViewController, CCN
         // COLOR_SEPARATOR_TABLE
         self.tableView.separatorColor = UIColor(colorLiteralRed: 153.0/255.0, green: 153.0/255.0, blue: 153.0/255.0, alpha: 0.2)
         
+        // (save) type of presentation -> pass variable for pushViewController
+        if self.mode == nil {
+            self.mode = documentPickerMode
+        } else {
+            prepareForPresentation(in: self.mode!)
+        }
+        
         readFolder()
     }
     
@@ -340,11 +348,7 @@ class DocumentPickerViewController: UIDocumentPickerExtensionViewController, CCN
         
         hud.hideHud()
         
-        //let metadata = CCCoreData.getMetadataWithPreficate(NSPredicate(format: "(account == '\(activeAccount!)') AND (fileID == '\(fileID!)')"), context: nil)
-
-        let destinationURL = URL(string: "file://\(directoryUser!)/\(fileID!)".addingPercentEncoding(withAllowedCharacters: .urlPathAllowed)!)
-        
-        dismissGrantingAccess(to: destinationURL)
+        dismissGrantingAccess(to: originalURL)
     }
     
     //  MARK: - Download Thumbnail
@@ -557,6 +561,7 @@ extension DocumentPickerViewController: UITableViewDataSource {
                 dir = CCUtility.trasformedFileNamePlist(inCrypto: recordTableMetadata!.fileName)
             }
         
+            nextViewController.mode = self.mode
             nextViewController.localServerUrl = CCUtility.stringAppendServerUrl(localServerUrl!, addServerUrl: dir)
             nextViewController.titleFolder = recordTableMetadata?.fileNamePrint
         

+ 0 - 2
Picker/Picker-Bridging-Header.h

@@ -3,8 +3,6 @@
 //
 
 #import <MagicalRecord/MagicalRecord.h>
-
-
 #import "TableAccount.h"
 #import "CCNetworking.h"
 #import "OCNetworking.h"