marinofaggiana 4 жил өмнө
parent
commit
80bcc86a9d

+ 6 - 5
iOSClient/Login/CCLogin.storyboard

@@ -22,7 +22,7 @@
                                     <constraint firstAttribute="height" constant="44" id="JYC-15-QFZ"/>
                                 </constraints>
                                 <color key="textColor" red="0.33333333333333331" green="0.33333333333333331" blue="0.33333333333333331" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
-                                <fontDescription key="fontDescription" type="system" pointSize="16"/>
+                                <fontDescription key="fontDescription" type="system" pointSize="13"/>
                                 <textInputTraits key="textInputTraits" autocorrectionType="no" returnKeyType="done"/>
                             </textField>
                             <textField opaque="NO" clipsSubviews="YES" tag="3" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" placeholder="Password" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="jU7-Iw-XfU">
@@ -31,7 +31,7 @@
                                     <constraint firstAttribute="height" constant="44" id="SHB-pM-p1U"/>
                                 </constraints>
                                 <color key="textColor" red="0.33333333333333331" green="0.33333333333333331" blue="0.33333333333333331" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
-                                <fontDescription key="fontDescription" type="system" pointSize="16"/>
+                                <fontDescription key="fontDescription" type="system" pointSize="13"/>
                                 <textInputTraits key="textInputTraits" returnKeyType="done" secureTextEntry="YES"/>
                             </textField>
                             <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="HQd-pF-3cE">
@@ -40,7 +40,7 @@
                                 <constraints>
                                     <constraint firstAttribute="height" constant="40" id="S6Y-YG-g6O"/>
                                 </constraints>
-                                <fontDescription key="fontDescription" type="system" pointSize="14"/>
+                                <fontDescription key="fontDescription" type="system" pointSize="13"/>
                                 <color key="tintColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
                                 <state key="normal" title="Accedi">
                                     <color key="titleShadowColor" red="0.5" green="0.5" blue="0.5" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
@@ -76,7 +76,7 @@
                                     <constraint firstAttribute="height" constant="44" id="I2v-Zr-IWf"/>
                                 </constraints>
                                 <color key="textColor" red="0.33333333333333331" green="0.33333333333333331" blue="0.33333333333333331" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
-                                <fontDescription key="fontDescription" type="system" pointSize="16"/>
+                                <fontDescription key="fontDescription" type="system" pointSize="13"/>
                                 <textInputTraits key="textInputTraits" autocorrectionType="no" keyboardType="URL" returnKeyType="done"/>
                                 <connections>
                                     <action selector="handlebaseUrlchange:" destination="yj9-jo-WIn" eventType="editingDidEnd" id="efj-33-NT5"/>
@@ -90,10 +90,11 @@
                                 </constraints>
                             </imageView>
                             <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="owR-PS-F32" userLabel="loginTypeView">
-                                <rect key="frame" x="153.5" y="822" width="107" height="40"/>
+                                <rect key="frame" x="159.5" y="822" width="95" height="40"/>
                                 <constraints>
                                     <constraint firstAttribute="height" constant="40" id="PaU-7J-gkn"/>
                                 </constraints>
+                                <fontDescription key="fontDescription" type="system" pointSize="13"/>
                                 <state key="normal" title="Login type view"/>
                                 <connections>
                                     <action selector="handleLoginTypeView:" destination="yj9-jo-WIn" eventType="touchUpInside" id="V2I-Nr-nOu"/>

+ 90 - 0
iOSClient/Login/NCLogin.swift

@@ -45,10 +45,100 @@ class NCLogin: UIViewController, UITextFieldDelegate, NCLoginQRCodeDelegate {
     @IBOutlet weak var qrCode: UIButton!
 
     let appDelegate = UIApplication.shared.delegate as! AppDelegate
+    var textColor: UIColor = .white
+    var textColorOpponent: UIColor = .black
+    var cancelButton: UIBarButtonItem?
 
 
     // MARK: - Life Cycle
 
+    override func viewDidLoad() {
+        super.viewDidLoad()
+        
+        view.backgroundColor = NCBrandColor.shared.customer
+        
+        // Text color
+        if NCBrandColor.shared.customer.isTooLight() {
+            textColor = .black
+            textColorOpponent = .white
+        } else if NCBrandColor.shared.customer.isTooDark() {
+            textColor = .white
+            textColorOpponent = .black
+        } else {
+            textColor = .white
+            textColorOpponent = .black
+        }
+        
+        // Image Brand
+        imageBrand.image = UIImage(named: "logo")
+        
+        // Cancel Button
+        cancelButton = UIBarButtonItem.init(barButtonSystemItem: .stop, target: self, action: #selector(self.actionCancel))
+        cancelButton?.tintColor = textColor
+        
+        // Url
+        imageBaseUrl.image = UIImage(named: "loginURL")?.image(color: textColor, size: 50)
+        baseUrl.textColor = textColor
+        baseUrl.tintColor = textColor
+        baseUrl.attributedPlaceholder = NSAttributedString(string: NSLocalizedString("_login_url_", comment: ""), attributes: [NSAttributedString.Key.foregroundColor: textColor.withAlphaComponent(0.5)])
+        baseUrl.delegate = self
+        
+        // User
+        imageUser.image = UIImage(named: "loginUser")?.image(color: textColor, size: 50)
+        user.textColor = textColor
+        user.tintColor = textColor
+        user.attributedPlaceholder = NSAttributedString(string: NSLocalizedString("_username_", comment: ""), attributes: [NSAttributedString.Key.foregroundColor: textColor.withAlphaComponent(0.5)])
+        user.delegate = self
+        
+        // password
+        imagePassword.image = UIImage(named: "loginPassword")?.image(color: textColor, size: 50)
+        password.textColor = textColor
+        password.tintColor = textColor
+        password.attributedPlaceholder = NSAttributedString(string: NSLocalizedString("_password_", comment: ""), attributes: [NSAttributedString.Key.foregroundColor: textColor.withAlphaComponent(0.5)])
+        password.delegate = self
+        
+        // toggle visible password
+        toggleVisiblePassword.setImage(UIImage(named: "visiblePassword")?.image(color: textColor, size: 50), for: .normal)
+        
+        // login
+        login.setTitle(NSLocalizedString("_login_", comment: ""), for: .normal)
+        login.backgroundColor = textColor
+        login.tintColor = textColor
+        login.layer.cornerRadius = 20
+        login.clipsToBounds = true
+        
+        // type of login
+        loginTypeView.setTitle(NSLocalizedString("_traditional_login_", comment: ""), for: .normal)
+        loginTypeView.setTitleColor(textColor.withAlphaComponent(0.5), for: .normal)
+     
+        // brand
+        if NCBrandOptions.shared.disable_request_login_url {
+            baseUrl.text = NCBrandOptions.shared.loginBaseUrl
+            imageBaseUrl.isHidden = true
+            baseUrl.isHidden = true
+        }
+        
+        // qrcode
+        qrCode.setImage(UIImage(named: "qrcode")?.image(color: textColor, size: 100), for: .normal)
+        
+        if NCManageDatabase.shared.getAccounts()?.count ?? 0 == 0 {
+            imageUser.isHidden = true
+            user.isHidden = true
+            imagePassword.isHidden = true
+            password.isHidden = true
+        } else {
+            imageUser.isHidden = true
+            user.isHidden = true
+            imagePassword.isHidden = true
+            password.isHidden = true
+            navigationItem.leftBarButtonItem = cancelButton
+        }
+
+    }
+    
+    @objc func actionCancel() {
+        dismiss(animated: true) { }
+    }
     
     
     // MARK: - QRCode