marinofaggiana 4 лет назад
Родитель
Сommit
b7b955a77c

+ 50 - 4
iOSClient/Settings/NCCapabilitiesViewController.storyboard

@@ -24,12 +24,12 @@
                                         <subviews>
                                             <textView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" scrollEnabled="NO" editable="NO" textAlignment="natural" translatesAutoresizingMaskIntoConstraints="NO" id="RIO-6X-GG1">
                                                 <rect key="frame" x="5" y="5" width="404" height="33"/>
-                                                <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
+                                                <color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
                                                 <fontDescription key="fontDescription" type="system" pointSize="14"/>
                                                 <textInputTraits key="textInputTraits" autocapitalizationType="sentences"/>
                                             </textView>
                                         </subviews>
-                                        <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
+                                        <color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
                                         <constraints>
                                             <constraint firstItem="RIO-6X-GG1" firstAttribute="leading" secondItem="OO4-N7-9vp" secondAttribute="leading" constant="5" id="63w-yC-mGi"/>
                                             <constraint firstAttribute="trailing" secondItem="RIO-6X-GG1" secondAttribute="trailing" constant="5" id="9cj-M6-K3f"/>
@@ -39,9 +39,50 @@
                                     </view>
                                     <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Sms-Ez-fLO">
                                         <rect key="frame" x="5" y="5" width="404" height="140"/>
-                                        <color key="backgroundColor" systemColor="systemRedColor" red="1" green="0.23137254900000001" blue="0.18823529410000001" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+                                        <subviews>
+                                            <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="jdW-oZ-cH8">
+                                                <rect key="frame" x="0.0" y="6" width="404" height="50"/>
+                                                <subviews>
+                                                    <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="share" translatesAutoresizingMaskIntoConstraints="NO" id="G9c-Nd-Ikl">
+                                                        <rect key="frame" x="0.0" y="5" width="40" height="40"/>
+                                                        <constraints>
+                                                            <constraint firstAttribute="width" constant="40" id="2jt-3Q-W9U"/>
+                                                            <constraint firstAttribute="height" constant="40" id="qw0-LB-a0S"/>
+                                                        </constraints>
+                                                    </imageView>
+                                                    <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="File sharing" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Olg-V3-URE">
+                                                        <rect key="frame" x="50" y="14.5" width="309" height="21"/>
+                                                        <fontDescription key="fontDescription" type="system" pointSize="17"/>
+                                                        <nil key="textColor"/>
+                                                        <nil key="highlightedColor"/>
+                                                    </label>
+                                                    <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="lGk-Lk-3Ya">
+                                                        <rect key="frame" x="369" y="12.5" width="25" height="25"/>
+                                                        <constraints>
+                                                            <constraint firstAttribute="height" constant="25" id="F1b-ve-eI1"/>
+                                                            <constraint firstAttribute="width" constant="25" id="kg0-Ii-p7a"/>
+                                                        </constraints>
+                                                    </imageView>
+                                                </subviews>
+                                                <color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
+                                                <constraints>
+                                                    <constraint firstAttribute="trailing" secondItem="lGk-Lk-3Ya" secondAttribute="trailing" constant="10" id="3q5-Rv-UgT"/>
+                                                    <constraint firstAttribute="height" constant="50" id="486-j7-SKp"/>
+                                                    <constraint firstItem="G9c-Nd-Ikl" firstAttribute="leading" secondItem="jdW-oZ-cH8" secondAttribute="leading" id="Bnm-Im-c7M"/>
+                                                    <constraint firstItem="G9c-Nd-Ikl" firstAttribute="centerY" secondItem="jdW-oZ-cH8" secondAttribute="centerY" id="Jxk-cZ-ezx"/>
+                                                    <constraint firstItem="lGk-Lk-3Ya" firstAttribute="leading" secondItem="Olg-V3-URE" secondAttribute="trailing" constant="10" id="KsG-sO-Ifp"/>
+                                                    <constraint firstItem="lGk-Lk-3Ya" firstAttribute="centerY" secondItem="jdW-oZ-cH8" secondAttribute="centerY" id="LnL-I4-6bN"/>
+                                                    <constraint firstItem="Olg-V3-URE" firstAttribute="centerY" secondItem="jdW-oZ-cH8" secondAttribute="centerY" id="RXs-zW-MT4"/>
+                                                    <constraint firstItem="Olg-V3-URE" firstAttribute="leading" secondItem="G9c-Nd-Ikl" secondAttribute="trailing" constant="10" id="XZo-QH-gpr"/>
+                                                </constraints>
+                                            </view>
+                                        </subviews>
+                                        <color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
                                         <constraints>
                                             <constraint firstAttribute="height" constant="140" id="6nU-Cb-MzH"/>
+                                            <constraint firstItem="jdW-oZ-cH8" firstAttribute="top" secondItem="Sms-Ez-fLO" secondAttribute="top" constant="6" id="UBW-Mx-NTs"/>
+                                            <constraint firstItem="jdW-oZ-cH8" firstAttribute="leading" secondItem="Sms-Ez-fLO" secondAttribute="leading" id="eNi-cO-UFd"/>
+                                            <constraint firstAttribute="trailing" secondItem="jdW-oZ-cH8" secondAttribute="trailing" id="k81-ap-Nwy"/>
                                         </constraints>
                                     </view>
                                 </subviews>
@@ -57,7 +98,7 @@
                                 </constraints>
                             </scrollView>
                         </subviews>
-                        <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+                        <color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
                         <constraints>
                             <constraint firstItem="uBS-U0-Obf" firstAttribute="trailing" secondItem="hTE-ys-qsF" secondAttribute="trailing" id="CvM-Hx-Hy6"/>
                             <constraint firstItem="hTE-ys-qsF" firstAttribute="top" secondItem="uBS-U0-Obf" secondAttribute="top" id="Lar-wg-a7V"/>
@@ -68,6 +109,8 @@
                     </view>
                     <navigationItem key="navigationItem" id="fnR-ht-Muv"/>
                     <connections>
+                        <outlet property="imageFileSharing" destination="G9c-Nd-Ikl" id="Wha-2g-8o0"/>
+                        <outlet property="imageStatusFileSharing" destination="lGk-Lk-3Ya" id="i7x-7x-TtE"/>
                         <outlet property="textView" destination="RIO-6X-GG1" id="lPs-Ev-hQf"/>
                     </connections>
                 </viewController>
@@ -94,4 +137,7 @@
             <point key="canvasLocation" x="0.0" y="133.25892857142856"/>
         </scene>
     </scenes>
+    <resources>
+        <image name="share" width="512" height="512"/>
+    </resources>
 </document>

+ 22 - 1
iOSClient/Settings/NCCapabilitiesViewController.swift

@@ -26,7 +26,13 @@ import UIKit
 class NCCapabilitiesViewController: UIViewController {
 
     @IBOutlet weak var textView: UITextView!
+    @IBOutlet weak var imageFileSharing: UIImageView!
+    @IBOutlet weak var imageStatusFileSharing: UIImageView!
     
+    private var account: String = ""
+    private var imageEnable: UIImage?
+    private var imageDisable: UIImage?
+
     override func viewDidLoad() {
         super.viewDidLoad()
         
@@ -35,10 +41,16 @@ class NCCapabilitiesViewController: UIViewController {
         let closeButton : UIBarButtonItem = UIBarButtonItem(title: NSLocalizedString("_done_", comment: ""), style: UIBarButtonItem.Style.plain, target: self, action: #selector(close))
         self.navigationItem.leftBarButtonItem = closeButton
         
+        imageEnable = CCGraphics.changeThemingColorImage(UIImage.init(named: "circle"), width: 50, height: 50, color: .green)
+        imageDisable = CCGraphics.changeThemingColorImage(UIImage.init(named: "circle"), width: 50, height: 50, color: .red)
+        imageFileSharing.image = CCGraphics.changeThemingColorImage(UIImage.init(named: "share"), width: 100, height: 100, color: .gray)
+
         guard let account = NCManageDatabase.sharedInstance.getAccountActive() else { return }
+        self.account = account.account
         
         if let jsonText = NCManageDatabase.sharedInstance.getCapabilities(account: account.account) {
             textView.text = jsonText
+            readCapabilities()
         } else {
             NCContentPresenter.shared.messageNotification("_error_", description: "_no_capabilities_found_", delay: TimeInterval(k_dismissAfterSecond), type: NCContentPresenter.messageType.info, errorCode: Int(k_CCErrorInternalError), forced: true)
             
@@ -47,9 +59,18 @@ class NCCapabilitiesViewController: UIViewController {
             }
         }
     }
-    
+   
     @objc func close() {
         
         self.dismiss(animated: true, completion: nil)
     }
+    
+    func readCapabilities() {
+        
+        if NCManageDatabase.sharedInstance.getCapabilitiesServerBool(account: account, elements: NCElementsJSON.shared.capabilitiesFileSharingApiEnabled, exists: false) {
+            imageStatusFileSharing.image = imageEnable
+        } else {
+            imageStatusFileSharing.image = imageDisable
+        }
+    }
 }