Browse Source

update old EXIF

marinofaggiana 4 years ago
parent
commit
1197583b57

+ 17 - 0
iOSClient/Data/NCManageDatabase.swift

@@ -1536,6 +1536,23 @@ class NCManageDatabase: NSObject {
         }
     }
     
+    @objc func setLocalFile(ocId: String, exifDate: NSDate?, exifLatitude: String, exifLongitude: String) {
+        
+        let realm = try! Realm()
+
+        do {
+            try realm.safeWrite {
+                if let result = realm.objects(tableLocalFile.self).filter("ocId == %@", ocId).first {
+                    result.exifDate = exifDate
+                    result.exifLatitude = exifLatitude
+                    result.exifLongitude = exifLongitude
+                }
+            }
+        } catch let error {
+            NCCommunicationCommon.shared.writeLog("Could not write to database: \(error)")
+        }
+    }
+    
     @objc func getTableLocalFile(predicate: NSPredicate) -> tableLocalFile? {
         
         let realm = try! Realm()

+ 5 - 5
iOSClient/Utility/CCExifGeo.m

@@ -41,7 +41,7 @@
     }
 }
 
-- (void)setExifLocalTableEtag:(tableMetadata *)metadata
+- (void)setExif:(tableMetadata *)metadata
 {
     NSString *dateTime;
     NSString *latitudeRef;
@@ -112,10 +112,10 @@
     }
 
     // Wite data EXIF in TableLocalFile
-    /*
-    if (tiff || gps)
-        [[NCManageDatabase sharedInstance] setLocalFileWithOcId:metadata.ocId date:nil exifDate:date exifLatitude:stringLatitude exifLongitude:stringLongitude fileName:nil etag:nil];
-    */
+    if (tiff || gps) {
+        [[NCManageDatabase sharedInstance] setLocalFileWithOcId:metadata.ocId exifDate:date exifLatitude:stringLatitude exifLongitude:stringLongitude];
+    }
+       
     CFRelease(originalSource);
     CFRelease(imageProperties);
 }

+ 4 - 7
iOSClient/Viewer/NCViewerImage/NCViewerImage.storyboard

@@ -112,14 +112,14 @@
                                         <rect key="frame" x="5" y="662" width="404" height="200"/>
                                         <subviews>
                                             <mapView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" mapType="standard" translatesAutoresizingMaskIntoConstraints="NO" id="Typ-A8-XIO">
-                                                <rect key="frame" x="0.0" y="50" width="404" height="150"/>
+                                                <rect key="frame" x="0.0" y="30" width="404" height="140"/>
                                             </mapView>
                                         </subviews>
-                                        <color key="backgroundColor" systemColor="systemPinkColor"/>
+                                        <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
                                         <constraints>
                                             <constraint firstItem="Typ-A8-XIO" firstAttribute="leading" secondItem="P8R-4f-zAl" secondAttribute="leading" id="Cbn-gO-P9h"/>
-                                            <constraint firstItem="Typ-A8-XIO" firstAttribute="top" secondItem="P8R-4f-zAl" secondAttribute="top" constant="50" id="bjV-ga-4qI"/>
-                                            <constraint firstAttribute="bottom" secondItem="Typ-A8-XIO" secondAttribute="bottom" id="y8c-iL-fAs"/>
+                                            <constraint firstItem="Typ-A8-XIO" firstAttribute="top" secondItem="P8R-4f-zAl" secondAttribute="top" constant="30" id="bjV-ga-4qI"/>
+                                            <constraint firstAttribute="bottom" secondItem="Typ-A8-XIO" secondAttribute="bottom" constant="30" id="y8c-iL-fAs"/>
                                             <constraint firstAttribute="trailing" secondItem="Typ-A8-XIO" secondAttribute="trailing" id="yaK-cw-jqm"/>
                                             <constraint firstAttribute="height" constant="200" id="z82-KD-lOv"/>
                                         </constraints>
@@ -178,8 +178,5 @@
         <systemColor name="systemBackgroundColor">
             <color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
         </systemColor>
-        <systemColor name="systemPinkColor">
-            <color red="1" green="0.17647058823529413" blue="0.33333333333333331" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
-        </systemColor>
     </resources>
 </document>