Browse Source

improved Share account view

Signed-off-by: Marino Faggiana <96728420+MarinoFaggianaAstraIridium@users.noreply.github.com>
Marino Faggiana 2 years ago
parent
commit
6f82351681

+ 0 - 14
iOSClient/Account Request/NCShareAccounts.storyboard

@@ -89,32 +89,21 @@
                                     <outlet property="delegate" destination="V0q-CP-xMJ" id="j64-3x-N2u"/>
                                 </connections>
                             </tableView>
-                            <progressView opaque="NO" contentMode="scaleToFill" verticalHuggingPriority="750" progress="0.5" translatesAutoresizingMaskIntoConstraints="NO" id="e8R-j7-ObS">
-                                <rect key="frame" x="0.0" y="308" width="300" height="2"/>
-                                <constraints>
-                                    <constraint firstAttribute="height" constant="2" id="G3U-2x-imL"/>
-                                </constraints>
-                                <color key="progressTintColor" systemColor="systemBlueColor"/>
-                            </progressView>
                         </subviews>
                         <color key="backgroundColor" systemColor="secondarySystemGroupedBackgroundColor"/>
                         <constraints>
-                            <constraint firstItem="e8R-j7-ObS" firstAttribute="leading" secondItem="gzh-6E-hc4" secondAttribute="leading" id="1gS-Ca-1Ov"/>
                             <constraint firstItem="Pdo-MB-AhU" firstAttribute="top" secondItem="nZr-nE-ths" secondAttribute="bottom" constant="5" id="5vV-YC-uzH"/>
                             <constraint firstAttribute="trailing" secondItem="Pdo-MB-AhU" secondAttribute="trailing" constant="7" id="819-yV-vz7"/>
-                            <constraint firstItem="hTI-Bw-Fws" firstAttribute="top" secondItem="e8R-j7-ObS" secondAttribute="bottom" id="Cko-PC-TiW"/>
                             <constraint firstAttribute="trailing" secondItem="nZr-nE-ths" secondAttribute="trailing" constant="5" id="DPW-MV-oKc"/>
                             <constraint firstItem="hTI-Bw-Fws" firstAttribute="top" secondItem="Pdo-MB-AhU" secondAttribute="bottom" id="Ife-Ku-hGQ"/>
                             <constraint firstItem="nZr-nE-ths" firstAttribute="leading" secondItem="gzh-6E-hc4" secondAttribute="leading" constant="5" id="SI9-xL-6s8"/>
                             <constraint firstItem="Pdo-MB-AhU" firstAttribute="leading" secondItem="gzh-6E-hc4" secondAttribute="leading" constant="7" id="Y5n-ju-hts"/>
-                            <constraint firstAttribute="trailing" secondItem="e8R-j7-ObS" secondAttribute="trailing" id="chh-t9-vJN"/>
                             <constraint firstItem="nZr-nE-ths" firstAttribute="top" secondItem="4vK-ua-S0e" secondAttribute="bottom" constant="5" id="oyJ-sj-j5N"/>
                         </constraints>
                     </view>
                     <navigationItem key="navigationItem" id="Zon-2j-rsc"/>
                     <size key="freeformSize" width="300" height="310"/>
                     <connections>
-                        <outlet property="progressView" destination="e8R-j7-ObS" id="2gM-MB-IhE"/>
                         <outlet property="tableView" destination="Pdo-MB-AhU" id="AcD-SW-2ga"/>
                         <outlet property="titleLabel" destination="nZr-nE-ths" id="UbA-Dl-0Ad"/>
                     </connections>
@@ -133,9 +122,6 @@
         <systemColor name="systemBackgroundColor">
             <color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
         </systemColor>
-        <systemColor name="systemBlueColor">
-            <color red="0.0" green="0.47843137254901963" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
-        </systemColor>
         <systemColor name="systemGray2Color">
             <color red="0.68235294117647061" green="0.68235294117647061" blue="0.69803921568627447" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
         </systemColor>

+ 4 - 50
iOSClient/Account Request/NCShareAccounts.swift

@@ -37,7 +37,6 @@ class NCShareAccounts: UIViewController {
 
     @IBOutlet weak var titleLabel: UILabel!
     @IBOutlet weak var tableView: UITableView!
-    @IBOutlet weak var progressView: UIProgressView!
 
     public var accounts: [NKShareAccounts.DataAccounts] = []
     public let heightCell: CGFloat = 60
@@ -45,10 +44,6 @@ class NCShareAccounts: UIViewController {
     public var dismissDidEnterBackground: Bool = true
     public weak var delegate: NCShareAccountsDelegate?
 
-    private var timer: Timer?
-    private var time: Float = 0
-    private let secondsAutoDismiss: Float = 3
-
     // MARK: - View Life Cycle
 
     override func viewDidLoad() {
@@ -57,21 +52,10 @@ class NCShareAccounts: UIViewController {
         titleLabel.text = NSLocalizedString("_account_select_to_add_", comment: "")
 
         tableView.tableFooterView = UIView(frame: CGRect(x: 0, y: 0, width: tableView.frame.size.width, height: 1))
-        // tableView.separatorStyle = UITableViewCell.SeparatorStyle.none
+        tableView.separatorStyle = UITableViewCell.SeparatorStyle.none
 
         view.backgroundColor = .secondarySystemBackground
         tableView.backgroundColor = .secondarySystemBackground
-
-        progressView.trackTintColor = .clear
-        progressView.progress = 1
-        if enableTimerProgress {
-            progressView.isHidden = false
-        } else {
-            progressView.isHidden = true
-        }
-
-        NotificationCenter.default.addObserver(self, selector: #selector(startTimer), name: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterApplicationDidBecomeActive), object: nil)
-        NotificationCenter.default.addObserver(self, selector: #selector(applicationDidEnterBackground), name: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterApplicationDidEnterBackground), object: nil)
     }
 
     override func viewWillAppear(_ animated: Bool) {
@@ -88,10 +72,10 @@ class NCShareAccounts: UIViewController {
         }
     }
 
-    override func viewWillDisappear(_ animated: Bool) {
-        super.viewWillDisappear(animated)
+    override func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator) {
+        super.viewWillTransition(to: size, with: coordinator)
 
-        timer?.invalidate()
+        tableView.reloadData()
     }
 
     // MARK: - NotificationCenter
@@ -102,40 +86,10 @@ class NCShareAccounts: UIViewController {
             dismiss(animated: false)
         }
     }
-
-    // MARK: - Progress
-
-    @objc func startTimer() {
-
-        if enableTimerProgress {
-            time = 0
-            timer?.invalidate()
-            timer = Timer.scheduledTimer(timeInterval: 0.1, target: self, selector: #selector(updateProgress), userInfo: nil, repeats: true)
-            progressView.isHidden = false
-        } else {
-            progressView.isHidden = true
-        }
-    }
-
-    @objc func updateProgress() {
-
-        time += 0.1
-        if time >= secondsAutoDismiss {
-            dismiss(animated: true)
-        } else {
-            progressView.progress = 1 - (time / secondsAutoDismiss)
-        }
-    }
 }
 
 extension NCShareAccounts: UITableViewDelegate {
 
-    func scrollViewWillBeginDragging(_ scrollView: UIScrollView) {
-
-        timer?.invalidate()
-        progressView.progress = 0
-    }
-
     func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
         return heightCell
     }