marinofaggiana 4 years ago
parent
commit
b0794d28fd

+ 1 - 0
Cartfile

@@ -19,6 +19,7 @@ github "ivanbruel/MarkdownKit"
 github "getsentry/sentry-cocoa"
 github "FabrizioBrancati/Queuer"
 github "xmartlabs/XLForm" ~> 4.1
+github "AssistoLab/DropDown" "v2.3.13"
 
 github "https://github.com/marinofaggiana/KTVHTTPCache" "2.0.2"
 github "https://github.com/marinofaggiana/TOPasscodeViewController" "0.0.7"

+ 1 - 1
Cartfile.resolved

@@ -8,7 +8,7 @@ github "SwiftyJSON/SwiftyJSON" "5.0.0"
 github "WeTransfer/WeScan" "1.2.0"
 github "WenchaoD/FSCalendar" "2.8.0"
 github "dzenbot/DZNEmptyDataSet" "v1.8.1"
-github "getsentry/sentry-cocoa" "5.2.1"
+github "getsentry/sentry-cocoa" "5.2.2"
 github "huri000/QuickLayout" "3.0.0"
 github "huri000/SwiftEntryKit" "1.2.3"
 github "ivanbruel/MarkdownKit" "1.6"

+ 4 - 2
iOSClient/Main/CCMain.m

@@ -706,7 +706,7 @@
         }
     }
     
-    [self SetSortButtonText];
+    //[self SetSortButtonText];
 }
 
 - (void)setUINavigationBarDefault
@@ -1582,7 +1582,9 @@
 
 - (void)toggleSortMenu
 {
-    [self toggleMenuWithViewController:self.navigationController];
+    NCSortMenu *sortMenu = [NCSortMenu new];
+    [sortMenu toggleMenuWithViewController:self layout:k_layout_view_main sortButton:self.sortButton serverUrl:self.serverUrl hideDirectoryOnTop:false];
+    //[self toggleMenuWithViewController:self.navigationController];
 }
 
 - (void)toggleSelectMenu

+ 3 - 2
iOSClient/Main/Menu/CCMain+Menu.swift

@@ -29,7 +29,7 @@ import NCCommunication
 extension CCMain {
 
     // MARK: - Sort Menu
-    
+    /*
     @objc func toggleMenu(viewController: UIViewController) {
         let mainMenuViewController = UIStoryboard.init(name: "NCMenu", bundle: nil).instantiateViewController(withIdentifier: "NCMainMenuTableViewController") as! NCMainMenuTableViewController
         mainMenuViewController.actions = self.initSortMenu()
@@ -135,7 +135,8 @@ extension CCMain {
 
         return actions
     }
-
+    */
+    
     // MARK: - Select Menu
     
     @objc func toggleSelectMenu(viewController: UIViewController) {

+ 37 - 4
iOSClient/Utility/NCUtility.swift

@@ -167,15 +167,48 @@ class NCUtility: NSObject {
         setLayoutForView(key: key, layout: layout, sort: datasourceSorted, ascending: datasourceAscending, groupBy: datasourceGroupBy, directoryOnTop: datasourceDirectoryOnTop, titleButton: datasourceTitleButton)
     }
     
-    func getLayoutForView(key: String) -> (String) {
+    @objc func getLayoutForView(key: String) -> (String) {
         
         var typeLayout = ""
-        
         (typeLayout, _, _, _, _, _) = NCUtility.shared.getLayoutForView(key: key)
-        
         return typeLayout
     }
     
+    @objc func getSortedForView(key: String) -> (String) {
+        
+        var sorted = ""
+        (_, sorted, _, _, _, _) = NCUtility.shared.getLayoutForView(key: key)
+        return sorted
+    }
+    
+    @objc func getAscendingForView(key: String) -> (Bool) {
+        
+        var ascending: Bool
+        (_, _, ascending, _, _, _) = NCUtility.shared.getLayoutForView(key: key)
+        return ascending
+    }
+    
+    @objc func getGroupByForView(key: String) -> (String) {
+        
+        var groupBy: String
+        (_, _, _, groupBy, _, _) = NCUtility.shared.getLayoutForView(key: key)
+        return groupBy
+    }
+    
+    @objc func getDirectoryOnTopForView(key: String) -> (Bool) {
+        
+        var directoryOnTop: Bool
+        (_, _, _, _, directoryOnTop, _) = NCUtility.shared.getLayoutForView(key: key)
+        return directoryOnTop
+    }
+    
+    @objc func getTitleButtonForView(key: String) -> (String) {
+        
+        var title: String
+        (_, _, _, _, _, title) = NCUtility.shared.getLayoutForView(key: key)
+        return title
+    }
+    
     func getLayoutForView(key: String) -> (String, String, Bool, String, Bool, String) {
         
         guard let string = UICKeyChainStore.string(forKey: key, service: k_serviceShareKeyChain) else {
@@ -192,7 +225,7 @@ class NCUtility: NSObject {
         
         return (k_layout_list, "fileName", true, "none", true, "_sorted_by_name_a_z_")
     }
-    
+        
     func convertSVGtoPNGWriteToUserData(svgUrlString: String, fileName: String?, width: CGFloat?, rewrite: Bool, account: String, closure: @escaping (String?) -> ()) {
         
         var fileNamePNG = ""