marinofaggiana 4 éve
szülő
commit
3803b6f507

+ 0 - 3
iOSClient/AppDelegate.h

@@ -84,9 +84,6 @@
 // Push Norification Token
 @property (nonatomic, strong) NSString *pushKitToken;
 
-// ProgressView Detail
-@property (nonatomic, strong) UIProgressView *progressViewDetail;
-
 @property (nonatomic, retain) TOPasscodeViewController *passcodeViewController;
 
 @property (nonatomic, retain) NSString *activeServerUrl;

+ 0 - 3
iOSClient/AppDelegate.m

@@ -124,9 +124,6 @@
     //AV Session
     [[AVAudioSession sharedInstance] setCategory: AVAudioSessionCategoryPlayback error:nil];
     [[UIApplication sharedApplication] beginReceivingRemoteControlEvents];
-
-    // ProgressView Detail
-    self.progressViewDetail = [[UIProgressView alloc] initWithProgressViewStyle: UIProgressViewStyleBar];
     
     // Start Timer
     self.timerUpdateApplicationIconBadgeNumber = [NSTimer scheduledTimerWithTimeInterval:k_timerUpdateApplicationIconBadgeNumber target:self selector:@selector(updateApplicationIconBadgeNumber) userInfo:nil repeats:YES];

+ 14 - 1
iOSClient/Viewer/NCViewerImage/NCViewerImage.storyboard

@@ -27,11 +27,21 @@
                                     <segue destination="A4d-OP-AMT" kind="embed" id="sDx-bX-1Jt"/>
                                 </connections>
                             </containerView>
+                            <progressView opaque="NO" contentMode="scaleToFill" verticalHuggingPriority="750" progress="0.5" translatesAutoresizingMaskIntoConstraints="NO" id="sD9-1i-ZdY">
+                                <rect key="frame" x="0.0" y="44" width="414" height="1"/>
+                                <constraints>
+                                    <constraint firstAttribute="height" constant="1" id="F4E-lI-3jZ"/>
+                                </constraints>
+                            </progressView>
                         </subviews>
                         <viewLayoutGuide key="safeArea" id="Ozy-9S-dMl"/>
                         <color key="backgroundColor" systemColor="systemBackgroundColor"/>
                         <constraints>
                             <constraint firstAttribute="bottom" secondItem="fpt-Rz-5fT" secondAttribute="bottom" id="4Xy-Dl-e47"/>
+                            <constraint firstItem="sD9-1i-ZdY" firstAttribute="leading" secondItem="Ozy-9S-dMl" secondAttribute="leading" id="8Dv-gf-lFy"/>
+                            <constraint firstItem="fpt-Rz-5fT" firstAttribute="leading" secondItem="Ozy-9S-dMl" secondAttribute="leading" id="J6h-qF-6dx"/>
+                            <constraint firstItem="sD9-1i-ZdY" firstAttribute="top" secondItem="Ozy-9S-dMl" secondAttribute="top" id="JUh-my-qNG"/>
+                            <constraint firstItem="Ozy-9S-dMl" firstAttribute="trailing" secondItem="sD9-1i-ZdY" secondAttribute="trailing" id="KQa-Ni-1TC"/>
                             <constraint firstItem="fpt-Rz-5fT" firstAttribute="leading" secondItem="wvY-tB-6ZK" secondAttribute="leading" id="Kzi-Hg-Ocf"/>
                             <constraint firstItem="fpt-Rz-5fT" firstAttribute="top" secondItem="wvY-tB-6ZK" secondAttribute="top" id="NnL-9A-ht1"/>
                             <constraint firstAttribute="trailing" secondItem="fpt-Rz-5fT" secondAttribute="trailing" id="xh9-IP-ti7"/>
@@ -39,10 +49,13 @@
                     </view>
                     <navigationItem key="navigationItem" id="azh-DM-TLz"/>
                     <nil key="simulatedBottomBarMetrics"/>
+                    <connections>
+                        <outlet property="progressView" destination="sD9-1i-ZdY" id="nag-cc-Up3"/>
+                    </connections>
                 </viewController>
                 <placeholder placeholderIdentifier="IBFirstResponder" id="qhs-BU-mEq" userLabel="First Responder" sceneMemberID="firstResponder"/>
             </objects>
-            <point key="canvasLocation" x="2911.1999999999998" y="777.66116941529242"/>
+            <point key="canvasLocation" x="2910.144927536232" y="777.45535714285711"/>
         </scene>
         <!--Page View Controller-->
         <scene sceneID="qwx-FP-Pov">

+ 25 - 3
iOSClient/Viewer/NCViewerImage/NCViewerImagePageContainer.swift

@@ -26,6 +26,8 @@ import SVGKit
 
 class NCViewerImagePageContainer: UIViewController, UIGestureRecognizerDelegate {
 
+    @IBOutlet weak var progressView: UIProgressView!
+
     enum ScreenMode {
         case full, normal
     }
@@ -77,16 +79,21 @@ class NCViewerImagePageContainer: UIViewController, UIGestureRecognizerDelegate
         
         NotificationCenter.default.addObserver(self, selector: #selector(changeTheming), name: NSNotification.Name(rawValue: k_notificationCenter_changeTheming), object: nil)
         NotificationCenter.default.addObserver(self, selector: #selector(downloadedFile(_:)), name: NSNotification.Name(rawValue: k_notificationCenter_downloadedFile), object: nil)
+        NotificationCenter.default.addObserver(self, selector: #selector(triggerProgressTask(_:)), name: NSNotification.Name(rawValue: k_notificationCenter_progressTask), object:nil)
         /*
         NotificationCenter.default.addObserver(self, selector: #selector(uploadedFile(_:)), name: NSNotification.Name(rawValue: k_notificationCenter_uploadedFile), object: nil)
         NotificationCenter.default.addObserver(self, selector: #selector(deleteFile(_:)), name: NSNotification.Name(rawValue: k_notificationCenter_deleteFile), object: nil)
         NotificationCenter.default.addObserver(self, selector: #selector(renameFile(_:)), name: NSNotification.Name(rawValue: k_notificationCenter_renameFile), object: nil)
         NotificationCenter.default.addObserver(self, selector: #selector(moveFile(_:)), name: NSNotification.Name(rawValue: k_notificationCenter_moveFile), object: nil)
-        NotificationCenter.default.addObserver(self, selector: #selector(triggerProgressTask(_:)), name: NSNotification.Name(rawValue: k_notificationCenter_progressTask), object:nil)
+       
                
         NotificationCenter.default.addObserver(self, selector: #selector(saveLivePhoto(_:)), name: NSNotification.Name(rawValue: k_notificationCenter_menuSaveLivePhoto), object: nil)
         */
         NotificationCenter.default.addObserver(self, selector: #selector(viewUnload), name: NSNotification.Name(rawValue: k_notificationCenter_menuDetailClose), object: nil)
+        
+        progressView.tintColor = NCBrandColor.sharedInstance.brandElement
+        progressView.trackTintColor = .clear
+        progressView.progress = 0
     }
     
     override func viewWillAppear(_ animated: Bool) {
@@ -116,8 +123,23 @@ class NCViewerImagePageContainer: UIViewController, UIGestureRecognizerDelegate
                     currentViewerImageZoom?.image = image
                     currentViewerImageZoom?.imageView.image = image
                 }
-                
-                //progress(0)
+                if self.metadatas.first(where: { $0.ocId == metadata.ocId }) != nil {
+                    progressView.progress = 0
+                }
+            }
+        }
+    }
+    
+    @objc func triggerProgressTask(_ notification: NSNotification) {
+        if self.view?.window == nil { return }
+        
+        if let userInfo = notification.userInfo as NSDictionary? {
+            if let ocId = userInfo["ocId"] as? String {
+                if self.metadatas.first(where: { $0.ocId == ocId }) != nil {
+                    let progressNumber = userInfo["progress"] as? NSNumber ?? 0
+                    let progress = progressNumber.floatValue
+                    self.progressView.progress = progress
+                }
             }
         }
     }