fix(ios): tempFilePath called twice if using CameraUsesGeolocation (#612)

This commit is contained in:
jcesarmobile
2020-06-25 18:23:01 +02:00
committed by GitHub
parent ba4f77468f
commit d89c25cd82
+2 -6
View File
@@ -383,6 +383,7 @@ static NSString* toBase64(NSData* data) {
}
[[self locationManager] startUpdatingLocation];
}
data = nil;
}
}
break;
@@ -396,15 +397,10 @@ static NSString* toBase64(NSData* data) {
- (NSString*)tempFilePath:(NSString*)extension
{
NSString* docsPath = [NSTemporaryDirectory()stringByStandardizingPath];
NSFileManager* fileMgr = [[NSFileManager alloc] init]; // recommended by Apple (vs [NSFileManager defaultManager]) to be threadsafe
NSString* filePath;
// unique file name
NSTimeInterval timeStamp = [[NSDate date] timeIntervalSince1970];
NSNumber *timeStampObj = [NSNumber numberWithDouble: timeStamp];
do {
filePath = [NSString stringWithFormat:@"%@/%@%ld.%@", docsPath, CDV_PHOTO_PREFIX, [timeStampObj longValue], extension];
} while ([fileMgr fileExistsAtPath:filePath]);
NSString* filePath = [NSString stringWithFormat:@"%@/%@%ld.%@", docsPath, CDV_PHOTO_PREFIX, [timeStampObj longValue], extension];
return filePath;
}