You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by ti...@apache.org on 2019/09/16 09:40:58 UTC
[cordova-plugin-camera] branch master updated: ImagePicker
returning same image (#306)
This is an automated email from the ASF dual-hosted git repository.
timbru31 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cordova-plugin-camera.git
The following commit(s) were added to refs/heads/master by this push:
new a9436b1 ImagePicker returning same image (#306)
a9436b1 is described below
commit a9436b1a185b37269366ec3e2c5f337fb14cba61
Author: klodha <kl...@users.noreply.github.com>
AuthorDate: Mon Sep 16 15:10:54 2019 +0530
ImagePicker returning same image (#306)
ImagePicker returning same image
Co-authored-by: Jan Piotrowski <pi...@gmail.com>
Co-authored-by: Tim Brust <gi...@timbrust.de>
---
src/ios/CDVCamera.m | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/src/ios/CDVCamera.m b/src/ios/CDVCamera.m
index bf02ca2..1dca07c 100644
--- a/src/ios/CDVCamera.m
+++ b/src/ios/CDVCamera.m
@@ -398,11 +398,12 @@ static NSString* toBase64(NSData* data) {
NSString* docsPath = [NSTemporaryDirectory()stringByStandardizingPath];
NSFileManager* fileMgr = [[NSFileManager alloc] init]; // recommended by Apple (vs [NSFileManager defaultManager]) to be threadsafe
NSString* filePath;
-
- // generate unique file name
- int i = 1;
+
+ // unique file name
+ NSTimeInterval timeStamp = [[NSDate date] timeIntervalSince1970];
+ NSNumber *timeStampObj = [NSNumber numberWithDouble: timeStamp];
do {
- filePath = [NSString stringWithFormat:@"%@/%@%03d.%@", docsPath, CDV_PHOTO_PREFIX, i++, extension];
+ filePath = [NSString stringWithFormat:@"%@/%@%ld.%@", docsPath, CDV_PHOTO_PREFIX, [timeStampObj longValue], extension];
} while ([fileMgr fileExistsAtPath:filePath]);
return filePath;
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org