File tree Expand file tree Collapse file tree 3 files changed +10
-4
lines changed
Expand file tree Collapse file tree 3 files changed +10
-4
lines changed Original file line number Diff line number Diff line change 1010@property (nonatomic , assign ) float quality;
1111@property (nonatomic , assign ) BOOL useBase64;
1212@property (nonatomic , assign ) BOOL captureMultiple;
13+ @property (nonatomic , assign ) BOOL saveInAppDocument;
1314
1415- (void ) capture ;
1516
Original file line number Diff line number Diff line change @@ -57,15 +57,19 @@ - (void) capture {
5757 @" bottomLeft" : @{ @" y" : @(rectangleFeature.bottomRight .x ), @" x" : @(rectangleFeature.bottomRight .y )},
5858 @" bottomRight" : @{ @" y" : @(rectangleFeature.topRight .x ), @" x" : @(rectangleFeature.topRight .y )},
5959 } : [NSNull null ];
60-
6160 if (self.useBase64 ) {
6261 self.onPictureTaken (@{
6362 @" croppedImage" : [croppedImageData base64EncodedStringWithOptions: NSDataBase64Encoding64CharacterLineLength ],
6463 @" initialImage" : [initialImageData base64EncodedStringWithOptions: NSDataBase64Encoding64CharacterLineLength ],
6564 @" rectangleCoordinates" : rectangleCoordinates });
66- } else {
67- NSString *croppedFilePath = [NSTemporaryDirectory () stringByAppendingPathComponent: [NSString stringWithFormat: @" cropped_img_%i .jpeg" ,(int )[NSDate date ].timeIntervalSince1970]];
68- NSString *initialFilePath = [NSTemporaryDirectory () stringByAppendingPathComponent: [NSString stringWithFormat: @" initial_img_%i .jpeg" ,(int )[NSDate date ].timeIntervalSince1970]];
65+ }
66+ else {
67+ NSString *dir = NSTemporaryDirectory ();
68+ if (self.saveInAppDocument ) {
69+ dir = [NSSearchPathForDirectoriesInDomains (NSDocumentDirectory, NSUserDomainMask, YES ) firstObject ];
70+ }
71+ NSString *croppedFilePath = [dir stringByAppendingPathComponent: [NSString stringWithFormat: @" cropped_img_%i .jpeg" ,(int )[NSDate date ].timeIntervalSince1970]];
72+ NSString *initialFilePath = [dir stringByAppendingPathComponent: [NSString stringWithFormat: @" initial_img_%i .jpeg" ,(int )[NSDate date ].timeIntervalSince1970]];
6973
7074 [croppedImageData writeToFile: croppedFilePath atomically: YES ];
7175 [initialImageData writeToFile: initialFilePath atomically: YES ];
Original file line number Diff line number Diff line change @@ -23,6 +23,7 @@ - (dispatch_queue_t)methodQueue
2323RCT_EXPORT_VIEW_PROPERTY(enableTorch, BOOL )
2424RCT_EXPORT_VIEW_PROPERTY(useFrontCam, BOOL )
2525RCT_EXPORT_VIEW_PROPERTY(useBase64, BOOL )
26+ RCT_EXPORT_VIEW_PROPERTY(saveInAppDocument, BOOL )
2627RCT_EXPORT_VIEW_PROPERTY(captureMultiple, BOOL )
2728RCT_EXPORT_VIEW_PROPERTY(detectionCountBeforeCapture, NSInteger )
2829RCT_EXPORT_VIEW_PROPERTY(detectionRefreshRateInMS, NSInteger )
You can’t perform that action at this time.
0 commit comments