瀏覽代碼

coding

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

+ 1 - 1
Nextcloud.xcodeproj/project.pbxproj

@@ -1763,8 +1763,8 @@
 				F70211F31BAC56E9003FC03E /* Main */,
 				F7CA213725F1372B00826ABB /* Account Request */,
 				F7A321621E9E37960069AD1B /* Activity */,
-				F70B866A2642A21300ED5349 /* Color */,
 				F7AE00F6230E8191007ACF8A /* BrowserWeb */,
+				F70B866A2642A21300ED5349 /* Color */,
 				F7BAAD951ED5A63D00B7EAD4 /* Data */,
 				F73FAEE224D2CA830090692E /* Diagnostics */,
 				F723986F253D867900257F49 /* EmptyView */,

+ 0 - 19
iOSClient/Color/NCColorPicker.storyboard

@@ -146,18 +146,6 @@
                                 <nil key="textColor"/>
                                 <nil key="highlightedColor"/>
                             </label>
-                            <switch opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" contentHorizontalAlignment="center" contentVerticalAlignment="center" on="YES" translatesAutoresizingMaskIntoConstraints="NO" id="tmW-pC-mup">
-                                <rect key="frame" x="10" y="415" width="51" height="31"/>
-                                <connections>
-                                    <action selector="backgroundSwitchAction:" destination="Y6W-OH-hqX" eventType="valueChanged" id="y79-eX-Hyf"/>
-                                </connections>
-                            </switch>
-                            <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="PIJ-97-HAZ">
-                                <rect key="frame" x="69" y="430.5" width="241" height="0.0"/>
-                                <fontDescription key="fontDescription" type="system" pointSize="14"/>
-                                <nil key="textColor"/>
-                                <nil key="highlightedColor"/>
-                            </label>
                         </subviews>
                         <viewLayoutGuide key="safeArea" id="vDu-zF-Fre"/>
                         <color key="backgroundColor" systemColor="systemBackgroundColor"/>
@@ -165,13 +153,11 @@
                             <constraint firstItem="I9w-cx-QlY" firstAttribute="leading" secondItem="vDu-zF-Fre" secondAttribute="leading" constant="10" id="22D-Yw-5lN"/>
                             <constraint firstItem="vDu-zF-Fre" firstAttribute="trailing" secondItem="gSF-6R-gbh" secondAttribute="trailing" constant="10" id="2Ou-LZ-bi8"/>
                             <constraint firstItem="I9w-cx-QlY" firstAttribute="top" secondItem="C2a-jB-FVB" secondAttribute="bottom" constant="10" id="2g7-M8-2kL"/>
-                            <constraint firstItem="PIJ-97-HAZ" firstAttribute="centerY" secondItem="tmW-pC-mup" secondAttribute="centerY" id="2nu-C9-LUC"/>
                             <constraint firstItem="Dmu-fr-Dtf" firstAttribute="leading" secondItem="C2a-jB-FVB" secondAttribute="trailing" constant="10" id="4XN-rH-Gte"/>
                             <constraint firstItem="AVl-ZW-qt0" firstAttribute="centerY" secondItem="Uaq-hC-U4a" secondAttribute="centerY" id="7a6-NR-1eL"/>
                             <constraint firstItem="Jc0-7X-JuE" firstAttribute="leading" secondItem="JUR-Vj-yBU" secondAttribute="trailing" constant="10" id="7em-8z-JQY"/>
                             <constraint firstItem="gSF-6R-gbh" firstAttribute="leading" secondItem="I9w-cx-QlY" secondAttribute="trailing" constant="10" id="7o7-14-0zf"/>
                             <constraint firstItem="vDu-zF-Fre" firstAttribute="trailing" secondItem="Jc0-7X-JuE" secondAttribute="trailing" constant="10" id="8gW-Zv-r2i"/>
-                            <constraint firstItem="PIJ-97-HAZ" firstAttribute="leading" secondItem="tmW-pC-mup" secondAttribute="trailing" constant="10" id="CPI-et-epQ"/>
                             <constraint firstItem="5XA-n8-8l6" firstAttribute="centerY" secondItem="8xv-8Y-A50" secondAttribute="centerY" id="FJZ-6Q-Ozk"/>
                             <constraint firstItem="DFY-QC-J1R" firstAttribute="centerY" secondItem="LwF-26-oss" secondAttribute="centerY" id="HHZ-nb-ljA"/>
                             <constraint firstItem="vDu-zF-Fre" firstAttribute="trailing" secondItem="DFY-QC-J1R" secondAttribute="trailing" constant="10" id="HVw-JZ-pxs"/>
@@ -181,7 +167,6 @@
                             <constraint firstItem="gSF-6R-gbh" firstAttribute="centerY" secondItem="I9w-cx-QlY" secondAttribute="centerY" id="Pve-wf-jna"/>
                             <constraint firstItem="DFY-QC-J1R" firstAttribute="leading" secondItem="LwF-26-oss" secondAttribute="trailing" constant="10" id="QRT-pf-6SQ"/>
                             <constraint firstItem="vDu-zF-Fre" firstAttribute="trailing" secondItem="DoG-RI-jcO" secondAttribute="trailing" constant="10" id="QU9-5b-yb2"/>
-                            <constraint firstItem="tmW-pC-mup" firstAttribute="top" secondItem="Uaq-hC-U4a" secondAttribute="bottom" constant="15" id="RHt-Lb-9D8"/>
                             <constraint firstItem="vDu-zF-Fre" firstAttribute="trailing" secondItem="Dmu-fr-Dtf" secondAttribute="trailing" constant="10" id="Xcf-y2-1ic"/>
                             <constraint firstItem="vDu-zF-Fre" firstAttribute="trailing" secondItem="5XA-n8-8l6" secondAttribute="trailing" constant="10" id="Xfw-0h-dgq"/>
                             <constraint firstItem="vDu-zF-Fre" firstAttribute="trailing" secondItem="p7z-g7-hkV" secondAttribute="trailing" constant="10" id="YOZ-Wq-rX9"/>
@@ -195,9 +180,7 @@
                             <constraint firstItem="Jc0-7X-JuE" firstAttribute="centerY" secondItem="JUR-Vj-yBU" secondAttribute="centerY" id="fR6-2Q-pkZ"/>
                             <constraint firstItem="dOn-SY-wnl" firstAttribute="leading" secondItem="vDu-zF-Fre" secondAttribute="leading" constant="10" id="gfe-aq-7nk"/>
                             <constraint firstItem="LwF-26-oss" firstAttribute="leading" secondItem="vDu-zF-Fre" secondAttribute="leading" constant="10" id="hNZ-DW-g0s"/>
-                            <constraint firstItem="tmW-pC-mup" firstAttribute="leading" secondItem="vDu-zF-Fre" secondAttribute="leading" constant="10" id="i3h-bE-HlW"/>
                             <constraint firstItem="Uaq-hC-U4a" firstAttribute="top" secondItem="LwF-26-oss" secondAttribute="bottom" constant="10" id="ih7-Kg-mhn"/>
-                            <constraint firstItem="vDu-zF-Fre" firstAttribute="trailing" secondItem="PIJ-97-HAZ" secondAttribute="trailing" constant="10" id="jDB-Wv-JES"/>
                             <constraint firstItem="vDu-zF-Fre" firstAttribute="trailing" secondItem="AVl-ZW-qt0" secondAttribute="trailing" constant="10" id="kDH-fe-OjZ"/>
                             <constraint firstItem="Zr2-rF-YUt" firstAttribute="top" secondItem="JUR-Vj-yBU" secondAttribute="bottom" constant="10" id="kLH-Zl-k0m"/>
                             <constraint firstItem="LwF-26-oss" firstAttribute="top" secondItem="8xv-8Y-A50" secondAttribute="bottom" constant="10" id="oom-Ex-tY4"/>
@@ -210,8 +193,6 @@
                         </constraints>
                     </view>
                     <connections>
-                        <outlet property="backgroundLabel" destination="PIJ-97-HAZ" id="kfR-8W-m8e"/>
-                        <outlet property="backgroundSwitch" destination="tmW-pC-mup" id="abs-rv-Xcm"/>
                         <outlet property="blackButton" destination="I9w-cx-QlY" id="lB1-aF-eee"/>
                         <outlet property="blackText" destination="gSF-6R-gbh" id="Jll-za-OcY"/>
                         <outlet property="blueButton" destination="C2a-jB-FVB" id="lIY-Ag-Nkv"/>

+ 1 - 17
iOSClient/Color/NCColorPicker.swift

@@ -29,11 +29,7 @@ class NCColorPicker: UIViewController {
     @IBOutlet weak var grayText: UITextField!
     @IBOutlet weak var defaultLabel: UILabel!
 
-    @IBOutlet weak var backgroundSwitch: UISwitch!
-    @IBOutlet weak var backgroundLabel: UILabel!
-
     var metadata: tableMetadata?
-    var isBackgroundColor: Bool = false
 
     // MARK: - View Life Cycle
 
@@ -79,10 +75,6 @@ class NCColorPicker: UIViewController {
         defaultButton.layer.cornerRadius = 5
         defaultButton.layer.masksToBounds = true
         defaultLabel.text = NSLocalizedString("_default_", comment: "")
-
-        backgroundSwitch.isOn = false
-        backgroundLabel.text = NSLocalizedString("_background_color_", comment: "")
-
     }
 
     @IBAction func orangeButtonAction(_ sender: UIButton) {
@@ -117,18 +109,10 @@ class NCColorPicker: UIViewController {
         updateColor(hexColor: NCBrandColor.shared.brandElement.hexString)
     }
 
-    @IBAction func backgroundSwitchAction(_ sender: UISwitch) {
-        isBackgroundColor = backgroundSwitch.isOn
-    }
-
     func updateColor(hexColor: String?) {
         if let metadata = metadata {
             let serverUrl = metadata.serverUrl + "/" + metadata.fileName
-            var colorBackground: String?
-            if isBackgroundColor {
-                colorBackground = hexColor
-            }
-            if NCManageDatabase.shared.setDirectory(serverUrl: serverUrl, colorFolder: hexColor, colorBackground: colorBackground, account: metadata.account) != nil {
+            if NCManageDatabase.shared.setDirectory(serverUrl: serverUrl, colorFolder: hexColor, account: metadata.account) != nil {
                 self.dismiss(animated: true)
                 NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterReloadDataSource, userInfo: ["serverUrl": metadata.serverUrl])
             }

+ 0 - 1
iOSClient/Data/NCDatabase.swift

@@ -257,7 +257,6 @@ class tableDirectory: Object {
 
     @objc dynamic var account = ""
     @objc dynamic var colorFolder: String?
-    @objc dynamic var colorBackground: String?
     @objc dynamic var e2eEncrypted: Bool = false
     @objc dynamic var etag = ""
     @objc dynamic var favorite: Bool = false

+ 1 - 2
iOSClient/Data/NCManageDatabase.swift

@@ -871,7 +871,7 @@ class NCManageDatabase: NSObject {
     }
 
     @discardableResult
-    @objc func setDirectory(serverUrl: String, colorFolder: String?, colorBackground: String?, account: String) -> tableDirectory? {
+    @objc func setDirectory(serverUrl: String, colorFolder: String?, account: String) -> tableDirectory? {
 
         let realm = try! Realm()
         var result: tableDirectory?
@@ -880,7 +880,6 @@ class NCManageDatabase: NSObject {
             try realm.safeWrite {
                 result = realm.objects(tableDirectory.self).filter("account == %@ AND serverUrl == %@", account, serverUrl).first
                 result?.colorFolder = colorFolder
-                result?.colorBackground = colorBackground
             }
         } catch let error {
             NCCommunicationCommon.shared.writeLog("Could not write to database: \(error)")

+ 0 - 7
iOSClient/Main/Collection Common/NCCollectionViewCommon.swift

@@ -328,13 +328,6 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS
         view.backgroundColor = NCBrandColor.shared.systemBackground
         collectionView.backgroundColor = NCBrandColor.shared.systemBackground
         refreshControl.tintColor = .gray
-
-        // COLOR BACKGROUND
-        if let tableDirectory = NCManageDatabase.shared.getTableDirectory(predicate: NSPredicate(format: "account == %@ AND serverUrl == %@", appDelegate.account, self.serverUrl)) {
-            if let colorBackground = tableDirectory.colorBackground, let color = UIColor(hex: colorBackground)  {
-                collectionView.backgroundColor = color
-            }
-        }
     }
 
     @objc func reloadDataSource(_ notification: NSNotification) {

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

@@ -297,11 +297,7 @@ extension NCCollectionViewCommon {
         //
         // COLOR FOLDER
         //
-        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))
-
+        if metadata.directory {
             actions.append(
                 NCMenuAction(
                     title: NSLocalizedString("_change_color_", comment: ""),
@@ -316,22 +312,6 @@ extension NCCollectionViewCommon {
                     }
                 )
             )
-            /*
-            if tableDirectory?.colorFolder != nil {
-                actions.append(
-                    NCMenuAction(
-                        title: NSLocalizedString("_remove_color_", comment: ""),
-                        icon: NCUtility.shared.loadImage(named: "removepalette"),
-                        action: { _ in
-                            NCManageDatabase.shared.setDirectory(serverUrl: serverUrl, colorFolder: nil, account: metadata.account)
-                            self.reloadDataSource()
-                        }
-                    )
-                )
-            } else {
-
-            }
-            */
         }
         
         //

+ 1 - 1
iOSClient/NCGlobal.swift

@@ -113,7 +113,7 @@ class NCGlobal: NSObject {
     // Database Realm
     //
     let databaseDefault                             = "nextcloud.realm"
-    let databaseSchemaVersion: UInt64               = 234
+    let databaseSchemaVersion: UInt64               = 235
 
     // Intro selector
     //