marinofaggiana 3 years ago
parent
commit
fa44bbcd1a

+ 3 - 10
iOSClient/Viewer/NCViewerMedia/NCViewerMediaDetailView.swift

@@ -80,13 +80,11 @@ class NCViewerMediaDetailView: UIView {
         self.date = date
         self.lensModel = lensModel
         
-        if (latitude != -1 && latitude != 0 && longitude != -1 && longitude != 0) {
+        if mapView == nil && (latitude != -1 && latitude != 0 && longitude != -1 && longitude != 0) {
             
             let annotation = MKPointAnnotation()
             annotation.coordinate = CLLocationCoordinate2D(latitude: latitude, longitude: longitude)
             
-            self.mapView?.removeFromSuperview()
-            self.mapView = nil
             self.mapView = MKMapView.init()
             if let mapView = self.mapView {
                 mapView.translatesAutoresizingMaskIntoConstraints = false
@@ -100,9 +98,9 @@ class NCViewerMediaDetailView: UIView {
                 ])
                 
                 mapView.layer.cornerRadius = 6
-                mapView.isZoomEnabled = false
+                mapView.isZoomEnabled = true
                 mapView.isScrollEnabled = false
-                mapView.isUserInteractionEnabled = false
+                mapView.isUserInteractionEnabled = true
                 mapView.addAnnotation(annotation)
                 mapView.setRegion(MKCoordinateRegion(center: annotation.coordinate, latitudinalMeters: 500, longitudinalMeters: 500), animated: false)
             }
@@ -127,7 +125,6 @@ class NCViewerMediaDetailView: UIView {
             dateValue.text = NSLocalizedString("_not_available_", comment: "")
         }
         dateValue.textColor = textColor
-
         
         // Dimension / Duration
         if metadata.classFile == NCCommunicationCommon.typeClassFile.image.rawValue {
@@ -166,10 +163,6 @@ class NCViewerMediaDetailView: UIView {
     }
     
     func hide() {
-        
-        self.mapView?.removeFromSuperview()
-        self.mapView = nil
-        
         self.isHidden = true
     }
     

+ 9 - 13
iOSClient/Viewer/NCViewerMedia/NCViewerMediaZoom.swift

@@ -46,7 +46,7 @@ class NCViewerMediaZoom: UIViewController {
     var isShowDetail: Bool = false
     var doubleTapGestureRecognizer: UITapGestureRecognizer = UITapGestureRecognizer()
     var imageViewConstraint: CGFloat = 0
-    var isMapAvailable: Bool = false
+    var isDetailViewInitializze: Bool = false
                 
     // MARK: - View Life Cycle
 
@@ -164,8 +164,9 @@ class NCViewerMediaZoom: UIViewController {
             self.scrollView.zoom(to: CGRect(x: 0, y: 0, width: self.scrollView.bounds.width, height: self.scrollView.bounds.height), animated: false)
             self.view.layoutIfNeeded()
             UIView.animate(withDuration: context.transitionDuration) {
-                self.closeDetail()
-                self.openDetail()
+                if self.detailView.isShow() {
+                    self.openDetail()
+                }
             }
         }) { (_) in }
     }
@@ -209,21 +210,16 @@ class NCViewerMediaZoom: UIViewController {
     @objc func didPanWith(gestureRecognizer: UIPanGestureRecognizer) {
                 
         let currentLocation = gestureRecognizer.translation(in: self.view)
-//        let velocity = gestureRecognizer.velocity(in: self.view)
         
         switch gestureRecognizer.state {
         
         case .began:
             
+//        let velocity = gestureRecognizer.velocity(in: self.view)
+
 //            gesture moving Up
 //            if velocity.y < 0 {
-//                detailView.isMapAvailable(metadata: metadata, completion: { available in
-//                    if available {
-//                        self.detailViewHeighConstraint.constant = self.view.frame.height / 2
-//                    } else {
-//                        self.detailViewHeighConstraint.constant = 0
-//                    }
-//                })
+
 //            }
             break
 
@@ -280,11 +276,11 @@ extension NCViewerMediaZoom {
             if (latitude != -1 && latitude != 0 && longitude != -1 && longitude != 0) {
                 self.detailViewHeighConstraint.constant = self.view.bounds.height / 2
             } else {
-                self.detailViewHeighConstraint.constant = self.view.bounds.height / 3
+                self.detailViewHeighConstraint.constant = 200
             }
             self.view.layoutIfNeeded()
             
-            self.detailView.show(metadata:self.metadata, image: self.image, textColor: self.viewerMedia?.textColor, latitude: latitude, longitude: longitude, location: location, date: date, lensModel: lensModel)
+           self.detailView.show(metadata:self.metadata, image: self.image, textColor: self.viewerMedia?.textColor, latitude: latitude, longitude: longitude, location: location, date: date, lensModel: lensModel)
                 
             if let image = self.imageVideoContainer.image {
                 let ratioW = self.imageVideoContainer.frame.width / image.size.width