瀏覽代碼

coding

Signed-off-by: marinofaggiana <ios@nextcloud.com>
marinofaggiana 2 年之前
父節點
當前提交
3212e59911

+ 2 - 2
Nextcloud.xcodeproj/project.pbxproj

@@ -2995,7 +2995,7 @@
 				CLANG_WARN_UNREACHABLE_CODE = YES;
 				CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
 				COPY_PHASE_STRIP = NO;
-				CURRENT_PROJECT_VERSION = 11;
+				CURRENT_PROJECT_VERSION = 12;
 				DEVELOPMENT_TEAM = 6JLRKY9ZV7;
 				ENABLE_BITCODE = YES;
 				ENABLE_STRICT_OBJC_MSGSEND = YES;
@@ -3058,7 +3058,7 @@
 				CLANG_WARN_UNREACHABLE_CODE = YES;
 				CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
 				COPY_PHASE_STRIP = NO;
-				CURRENT_PROJECT_VERSION = 11;
+				CURRENT_PROJECT_VERSION = 12;
 				DEVELOPMENT_TEAM = 6JLRKY9ZV7;
 				ENABLE_BITCODE = YES;
 				ENABLE_STRICT_OBJC_MSGSEND = YES;

+ 21 - 0
iOSClient/Menu/NCCollectionViewCommon+Menu.swift

@@ -299,6 +299,10 @@ extension NCCollectionViewCommon {
         // CHANGE COLOR
         //
         if #available(iOS 14.0, *), metadata.directory {
+
+            let serverUrl = metadata.serverUrl + "/" + metadata.fileName
+            let tableDirectory = NCManageDatabase.shared.getTableDirectory(predicate: NSPredicate(format: "account == %@ AND serverUrl == %@", metadata.account, serverUrl))
+
             actions.append(
                 NCMenuAction(
                     title: NSLocalizedString("_change_color_", comment: ""),
@@ -306,11 +310,28 @@ extension NCCollectionViewCommon {
                     action: { _ in
                         let picker = UIColorPickerViewController()
                         picker.delegate = self
+                        if let colorFolderHex = tableDirectory?.colorFolder, let color = UIColor(hex: colorFolderHex) {
+                            picker.selectedColor = color
+                        }
                         self.present(picker, animated: true, completion: nil)
                     }
                 )
             )
+
+            if tableDirectory?.colorFolder != nil {
+                actions.append(
+                    NCMenuAction(
+                        title: NSLocalizedString("_remove_color_", comment: ""),
+                        icon: NCUtility.shared.loadImage(named: "palette"),
+                        action: { _ in
+                            NCManageDatabase.shared.setDirectory(serverUrl: serverUrl, colorFolder: nil, account: metadata.account)
+                            self.reloadDataSource()
+                        }
+                    )
+                )
+            }
         }
+        
         //
         // DELETE
         //

+ 1 - 0
iOSClient/Supporting Files/en.lproj/Localizable.strings

@@ -877,6 +877,7 @@
 "_ITMS-90076_"              = "Due to a change in the Nextcloud application identifier, the settings and password for accessing your cloud are reset, so please re-enter your account data and check your Settings. We are sorry about that.";
 "_copy_passphrase_"         = "Copy passphrase";
 "_change_color_"            = "Change color";
+"_remove_color_"            = "Remove color";
 
 // Video
 "_select_trace_"            = "Select the trace";