marinofaggiana 4 years ago
parent
commit
7236334a8b
2 changed files with 6 additions and 20 deletions
  1. 1 1
      iOSClient/Trash/NCTrash.swift
  2. 5 19
      iOSClient/Utility/NCUtility.swift

+ 1 - 1
iOSClient/Trash/NCTrash.swift

@@ -97,7 +97,7 @@ class NCTrash: UIViewController, UIGestureRecognizerDelegate, NCTrashListCellDel
         
         self.navigationItem.title = titleCurrentFolder
 
-        (layout, sort, ascending, groupBy, directoryOnTop, titleButton, itemForLine) = NCUtility.shared.getLayoutForView(key: NCGlobal.shared.layoutViewTrash, serverUrl: "", sort: "date", ascending: false)
+        (layout, sort, ascending, groupBy, directoryOnTop, titleButton, itemForLine) = NCUtility.shared.getLayoutForView(key: NCGlobal.shared.layoutViewTrash, serverUrl: "", sort: "date", ascending: false, titleButton: "_sorted_by_date_more_recent_")
         gridLayout.itemForLine = CGFloat(itemForLine)
         
         if layout == NCGlobal.shared.layoutList {

+ 5 - 19
iOSClient/Utility/NCUtility.swift

@@ -64,21 +64,7 @@ class NCUtility: NSObject {
         setLayoutForView(key: key, serverUrl: serverUrl, layout: layout, sort: sort, ascending: ascending, groupBy: groupBy, directoryOnTop: directoryOnTop, titleButton: titleButton, itemForLine: itemForLine)
     }
     
-    @objc func getLayoutForView(key: String, serverUrl: String) -> (String) {
-        
-        var layout: String
-        (layout, _, _, _, _, _, _) = NCUtility.shared.getLayoutForView(key: key, serverUrl: serverUrl)
-        return layout
-    }
-    
-    @objc func getSortedForView(key: String, serverUrl: String) -> (String) {
-        
-        var sort: String
-        (_, sort, _, _, _, _, _) = NCUtility.shared.getLayoutForView(key: key, serverUrl: serverUrl)
-        return sort
-    }
-    
-    func getLayoutForView(key: String, serverUrl: String, sort: String = "fileName", ascending: Bool = true) -> (layout: String, sort: String, ascending: Bool, groupBy: String, directoryOnTop: Bool, titleButton: String, itemForLine: Int) {
+    func getLayoutForView(key: String, serverUrl: String, sort: String = "fileName", ascending: Bool = true, titleButton: String = "_sorted_by_name_a_z_") -> (layout: String, sort: String, ascending: Bool, groupBy: String, directoryOnTop: Bool, titleButton: String, itemForLine: Int) {
         
         var keyStore = key
         
@@ -87,8 +73,8 @@ class NCUtility: NSObject {
         }
         
         guard let string = UICKeyChainStore.string(forKey: keyStore, service: NCGlobal.shared.serviceShareKeyChain) else {
-            setLayoutForView(key: key, serverUrl: serverUrl, layout: NCGlobal.shared.layoutList, sort: sort, ascending: ascending, groupBy: "none", directoryOnTop: true, titleButton: "_sorted_by_name_a_z_", itemForLine: 3)
-            return (NCGlobal.shared.layoutList, sort, ascending, "none", true, "_sorted_by_name_a_z_", 3)
+            setLayoutForView(key: key, serverUrl: serverUrl, layout: NCGlobal.shared.layoutList, sort: sort, ascending: ascending, groupBy: "none", directoryOnTop: true, titleButton: titleButton, itemForLine: 3)
+            return (NCGlobal.shared.layoutList, sort, ascending, "none", true, titleButton, 3)
         }
 
         let array = string.components(separatedBy: "|")
@@ -100,9 +86,9 @@ class NCUtility: NSObject {
             return (array[0], array[1], sort.boolValue, array[3], directoryOnTop.boolValue, array[5], Int(itemForLine.intValue))
         }
         
-        setLayoutForView(key: key, serverUrl: serverUrl, layout: NCGlobal.shared.layoutList, sort: sort, ascending: ascending, groupBy: "none", directoryOnTop: true, titleButton: "_sorted_by_name_a_z_", itemForLine: 3)
+        setLayoutForView(key: key, serverUrl: serverUrl, layout: NCGlobal.shared.layoutList, sort: sort, ascending: ascending, groupBy: "none", directoryOnTop: true, titleButton: titleButton, itemForLine: 3)
         
-        return (NCGlobal.shared.layoutList, sort, ascending, "none", true, "_sorted_by_name_a_z_", 3)
+        return (NCGlobal.shared.layoutList, sort, ascending, "none", true, titleButton, 3)
     }
         
     func convertSVGtoPNGWriteToUserData(svgUrlString: String, fileName: String?, width: CGFloat?, rewrite: Bool, account: String, closure: @escaping (String?) -> ()) {