marinofaggiana 5 years ago
parent
commit
add8bf824a
3 changed files with 15 additions and 13 deletions
  1. 3 0
      iOSClient/AppDelegate.h
  2. 3 0
      iOSClient/AppDelegate.m
  3. 9 13
      iOSClient/Main/NCDetailViewController.swift

+ 3 - 0
iOSClient/AppDelegate.h

@@ -84,6 +84,9 @@
 // Push Norification Token
 @property (nonatomic, strong) NSString *pushKitToken;
 
+// ProgressView Detail
+@property (nonatomic, strong) UIProgressView *progressViewDetail;
+
 // Reachability
 @property (nonatomic, strong) Reachability *reachability;
 @property BOOL lastReachability;

+ 3 - 0
iOSClient/AppDelegate.m

@@ -116,6 +116,9 @@
     [[UINavigationBar appearance] setShadowImage:[[UIImage alloc] init]];
     [UINavigationBar appearance].translucent = NO;
     
+    // ProgressView Detail
+    self.progressViewDetail = [[UIProgressView alloc] initWithProgressViewStyle: UIProgressViewStyleBar];
+    
     // passcode
     [[BKPasscodeLockScreenManager sharedManager] setDelegate:self];
     

+ 9 - 13
iOSClient/Main/NCDetailViewController.swift

@@ -41,7 +41,6 @@ class NCDetailViewController: UIViewController {
     @objc var viewerImageViewController: NCViewerImageViewController?
     @objc var metadatas = [tableMetadata]()
     
-    private var progressView: UIProgressView?
     private let progressHeight: CGFloat = 1.5
         
     //MARK: -
@@ -106,30 +105,27 @@ class NCDetailViewController: UIViewController {
 
     @objc func setProgressBar() {
         
-        progressView?.removeFromSuperview()
-        self.progressView = UIProgressView.init(progressViewStyle: .bar)
+        appDelegate.progressViewDetail.removeFromSuperview()
 
         guard let navigationController = splitViewController?.viewControllers.last as? UINavigationController else { return }
-        guard let progressView = self.progressView else { return }
                         
-        progressView.frame = CGRect(x: 0, y: navigationController.navigationBar.frame.height - (progressHeight*2), width: navigationController.navigationBar.frame.width, height: progressHeight)
-        progressView.setProgress(0, animated: false)
+        appDelegate.progressViewDetail.frame = CGRect(x: 0, y: navigationController.navigationBar.frame.height - (progressHeight*2), width: navigationController.navigationBar.frame.width, height: progressHeight)
+        appDelegate.progressViewDetail.setProgress(0, animated: false)
         
         if NCBrandColor.sharedInstance.brand.isLight() {
-            progressView.tintColor = NCBrandColor.sharedInstance.brand.darker(by: 10)
+            appDelegate.progressViewDetail.tintColor = NCBrandColor.sharedInstance.brand.darker(by: 10)
         } else {
-            progressView.tintColor = NCBrandColor.sharedInstance.brand.lighter(by: 20)
+            appDelegate.progressViewDetail.tintColor = NCBrandColor.sharedInstance.brand.lighter(by: 20)
         }
         
-        progressView.trackTintColor = .clear
-        progressView.transform = CGAffineTransform(scaleX: 1, y: progressHeight)
+        appDelegate.progressViewDetail.trackTintColor = .clear
+        appDelegate.progressViewDetail.transform = CGAffineTransform(scaleX: 1, y: progressHeight)
         
-        navigationController.navigationBar.addSubview(progressView)
+        navigationController.navigationBar.addSubview(appDelegate.progressViewDetail)
     }
     
     @objc func progress(_ progress: Float) {
-        guard let progressView = self.progressView else { return }
-        progressView.progress = progress
+        appDelegate.progressViewDetail.progress = progress
     }
     
     //MARK: - Utility