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 <[email protected]>
AuthorDate: Mon Sep 16 15:10:54 2019 +0530

    ImagePicker returning same image (#306)
    
    ImagePicker returning same image
    
    Co-authored-by: Jan Piotrowski <[email protected]>
    Co-authored-by: Tim Brust <[email protected]>
---
 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: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to