Эх сурвалжийг харах

coding

Signed-off-by: marinofaggiana <ios@nextcloud.com>
marinofaggiana 2 жил өмнө
parent
commit
571566680f

+ 10 - 8
iOSClient/Data/NCDataSource.swift

@@ -82,13 +82,13 @@ class NCDataSource: NSObject {
             if filterLivePhoto && metadata.livePhoto && metadata.ext == "mov" {
                 continue
             }
-            let section = self.getSectionValue(metadata: metadata)
+            let section = NSLocalizedString(self.getSectionValue(metadata: metadata), comment: "").lowercased().firstUppercased
             if !self.sectionsValue.contains(section) {
                 self.sectionsValue.append(section)
             }
         }
 
-        if let providers = self.providers , !providers.isEmpty {
+        if let providers = self.providers, !providers.isEmpty {
             var sectionsDictionary: [String:Int] = [:]
             for section in self.sectionsValue {
                 if let provider = providers.filter({ $0.name.lowercased() == section.lowercased()}).first {
@@ -97,18 +97,20 @@ class NCDataSource: NSObject {
             }
             self.sectionsValue.removeAll()
             let sectionsDictionarySorted = sectionsDictionary.sorted(by: { $0.value < $1.value } )
+            let appName = NSLocalizedString(NCGlobal.shared.appName, comment: "").lowercased().firstUppercased
             for section in sectionsDictionarySorted {
-                if section.key == NCGlobal.shared.appName {
+                if section.key == appName {
                     self.sectionsValue.insert(section.key, at: 0)
                 } else {
                     self.sectionsValue.append(section.key)
                 }
             }
         } else {
+            let directory = NSLocalizedString("directory", comment: "").lowercased().firstUppercased
             self.sectionsValue = self.sectionsValue.sorted {
-                if directoryOnTop && $0.lowercased() == "directory" {
+                if directoryOnTop && $0 == directory {
                     return true
-                } else if directoryOnTop && $1.lowercased() == "directory" {
+                } else if directoryOnTop && $1 == directory {
                     return false
                 }
                 if self.ascending {
@@ -319,11 +321,11 @@ class NCDataSource: NSObject {
 
         switch self.groupByField {
         case "name":
-            return metadata.name
+            return NSLocalizedString(metadata.name, comment: "").lowercased().firstUppercased
         case "classFile":
-            return metadata.classFile
+            return NSLocalizedString(metadata.classFile, comment: "").lowercased().firstUppercased
         default:
-            return metadata.name
+            return NSLocalizedString(metadata.name, comment: "").lowercased().firstUppercased
         }
     }
 }

+ 2 - 2
iOSClient/Main/Collection Common/NCCollectionViewCommon.swift

@@ -1738,7 +1738,7 @@ extension NCCollectionViewCommon: UICollectionViewDataSource {
                 header.setRichWorkspaceText(richWorkspaceText)
 
                 header.setSectionHeight(heightHeaderSection)
-                header.labelSection.text = NSLocalizedString(self.dataSource.getSectionValue(indexPath: indexPath), comment: "").lowercased().firstUppercased
+                header.labelSection.text = self.dataSource.getSectionValue(indexPath: indexPath)
                 header.labelSection.textColor = NCBrandColor.shared.label
 
                 return header
@@ -1747,7 +1747,7 @@ extension NCCollectionViewCommon: UICollectionViewDataSource {
 
                 let header = collectionView.dequeueReusableSupplementaryView(ofKind: kind, withReuseIdentifier: "sectionHeader", for: indexPath) as! NCSectionHeader
 
-                header.labelSection.text = NSLocalizedString(self.dataSource.getSectionValue(indexPath: indexPath), comment: "").lowercased().firstUppercased
+                header.labelSection.text = self.dataSource.getSectionValue(indexPath: indexPath)
                 header.labelSection.textColor = NCBrandColor.shared.label
 
                 return header

+ 2 - 2
iOSClient/Select/NCSelect.swift

@@ -631,7 +631,7 @@ extension NCSelect: UICollectionViewDataSource {
                 header.setRichWorkspaceText(richWorkspaceText)
 
                 header.setSectionHeight(heightHeaderSection)
-                header.labelSection.text = NSLocalizedString(self.dataSource.getSectionValue(indexPath: indexPath), comment: "").lowercased().firstUppercased
+                header.labelSection.text = self.dataSource.getSectionValue(indexPath: indexPath)
                 header.labelSection.textColor = NCBrandColor.shared.label
 
                 return header
@@ -640,7 +640,7 @@ extension NCSelect: UICollectionViewDataSource {
 
                 let header = collectionView.dequeueReusableSupplementaryView(ofKind: kind, withReuseIdentifier: "sectionHeader", for: indexPath) as! NCSectionHeader
 
-                header.labelSection.text = NSLocalizedString(self.dataSource.getSectionValue(indexPath: indexPath), comment: "").lowercased().firstUppercased
+                header.labelSection.text = self.dataSource.getSectionValue(indexPath: indexPath)
                 header.labelSection.textColor = NCBrandColor.shared.brandElement
 
                 return header