merge master
This commit is contained in:
commit
e253ffd575
|
@ -279,7 +279,7 @@ public class CameraViewManager extends SimpleViewManager<CameraView> {
|
|||
public void handleResult(Result rawResult) {
|
||||
Log.i("NIGA", "result = " + rawResult.getText());
|
||||
WritableMap event = Arguments.createMap();
|
||||
event.putString("receivedCodeStringValue", rawResult.getText());
|
||||
event.putString("qrcodeStringValue", rawResult.getText());
|
||||
reactContext.getJSModule(RCTEventEmitter.class).receiveEvent(cameraViews.peek().getId(), "onReadCode", event);
|
||||
}
|
||||
});
|
||||
|
|
|
@ -145,6 +145,62 @@
|
|||
remoteGlobalIDString = 2D2A28131D9B038B00D4039D;
|
||||
remoteInfo = "React-tvOS";
|
||||
};
|
||||
26472F751FFA1C2600C4F2B0 /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */;
|
||||
proxyType = 2;
|
||||
remoteGlobalIDString = 3DBE0D001F3B181A0099AA32;
|
||||
remoteInfo = fishhook;
|
||||
};
|
||||
26472F771FFA1C2600C4F2B0 /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */;
|
||||
proxyType = 2;
|
||||
remoteGlobalIDString = 3DBE0D0D1F3B181C0099AA32;
|
||||
remoteInfo = "fishhook-tvOS";
|
||||
};
|
||||
26472F871FFA1C2600C4F2B0 /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */;
|
||||
proxyType = 2;
|
||||
remoteGlobalIDString = 139D7ECE1E25DB7D00323FB7;
|
||||
remoteInfo = "third-party";
|
||||
};
|
||||
26472F891FFA1C2600C4F2B0 /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */;
|
||||
proxyType = 2;
|
||||
remoteGlobalIDString = 3D383D3C1EBD27B6005632C8;
|
||||
remoteInfo = "third-party-tvOS";
|
||||
};
|
||||
26472F8B1FFA1C2600C4F2B0 /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */;
|
||||
proxyType = 2;
|
||||
remoteGlobalIDString = 139D7E881E25C6D100323FB7;
|
||||
remoteInfo = "double-conversion";
|
||||
};
|
||||
26472F8D1FFA1C2600C4F2B0 /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */;
|
||||
proxyType = 2;
|
||||
remoteGlobalIDString = 3D383D621EBD27B9005632C8;
|
||||
remoteInfo = "double-conversion-tvOS";
|
||||
};
|
||||
26472F8F1FFA1C2600C4F2B0 /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */;
|
||||
proxyType = 2;
|
||||
remoteGlobalIDString = 9936F3131F5F2E4B0010BF04;
|
||||
remoteInfo = privatedata;
|
||||
};
|
||||
26472F911FFA1C2600C4F2B0 /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */;
|
||||
proxyType = 2;
|
||||
remoteGlobalIDString = 9936F32F1F5F2E5B0010BF04;
|
||||
remoteInfo = "privatedata-tvOS";
|
||||
};
|
||||
264D62401D2EF175009AA839 /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 264D623C1D2EF175009AA839 /* ReactNativeCameraKit.xcodeproj */;
|
||||
|
@ -270,6 +326,8 @@
|
|||
children = (
|
||||
139FDEF41B06529B00C62182 /* libRCTWebSocket.a */,
|
||||
2646EEC11DED691800EABBFC /* libRCTWebSocket-tvOS.a */,
|
||||
26472F761FFA1C2600C4F2B0 /* libfishhook.a */,
|
||||
26472F781FFA1C2600C4F2B0 /* libfishhook-tvOS.a */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
|
@ -291,8 +349,14 @@
|
|||
146834001AC3E56700842450 /* Products */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
146834041AC3E56700842450 /* libReact.a */,
|
||||
2646EEC51DED691800EABBFC /* libReact-tvOS.a */,
|
||||
2646EEC51DED691800EABBFC /* libReact.a */,
|
||||
36A0021B1EAE14E6002D9978 /* libyoga.a */,
|
||||
36A0021F1EAE14E6002D9978 /* libcxxreact.a */,
|
||||
36A002231EAE14E6002D9978 /* libjschelpers.a */,
|
||||
26472F8A1FFA1C2600C4F2B0 /* libthird-party.a */,
|
||||
26472F8E1FFA1C2600C4F2B0 /* libdouble-conversion.a */,
|
||||
26472F901FFA1C2600C4F2B0 /* libprivatedata.a */,
|
||||
26472F921FFA1C2600C4F2B0 /* libprivatedata-tvOS.a */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
|
@ -301,7 +365,7 @@
|
|||
isa = PBXGroup;
|
||||
children = (
|
||||
2646EEA51DED691800EABBFC /* libRCTAnimation.a */,
|
||||
2646EEA71DED691800EABBFC /* libRCTAnimation-tvOS.a */,
|
||||
2646EEA71DED691800EABBFC /* libRCTAnimation.a */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
|
@ -538,10 +602,10 @@
|
|||
remoteRef = 2646EEA41DED691800EABBFC /* PBXContainerItemProxy */;
|
||||
sourceTree = BUILT_PRODUCTS_DIR;
|
||||
};
|
||||
2646EEA71DED691800EABBFC /* libRCTAnimation-tvOS.a */ = {
|
||||
2646EEA71DED691800EABBFC /* libRCTAnimation.a */ = {
|
||||
isa = PBXReferenceProxy;
|
||||
fileType = archive.ar;
|
||||
path = "libRCTAnimation-tvOS.a";
|
||||
path = libRCTAnimation.a;
|
||||
remoteRef = 2646EEA61DED691800EABBFC /* PBXContainerItemProxy */;
|
||||
sourceTree = BUILT_PRODUCTS_DIR;
|
||||
};
|
||||
|
@ -594,6 +658,62 @@
|
|||
remoteRef = 2646EEC41DED691800EABBFC /* PBXContainerItemProxy */;
|
||||
sourceTree = BUILT_PRODUCTS_DIR;
|
||||
};
|
||||
26472F761FFA1C2600C4F2B0 /* libfishhook.a */ = {
|
||||
isa = PBXReferenceProxy;
|
||||
fileType = archive.ar;
|
||||
path = libfishhook.a;
|
||||
remoteRef = 26472F751FFA1C2600C4F2B0 /* PBXContainerItemProxy */;
|
||||
sourceTree = BUILT_PRODUCTS_DIR;
|
||||
};
|
||||
26472F781FFA1C2600C4F2B0 /* libfishhook-tvOS.a */ = {
|
||||
isa = PBXReferenceProxy;
|
||||
fileType = archive.ar;
|
||||
path = "libfishhook-tvOS.a";
|
||||
remoteRef = 26472F771FFA1C2600C4F2B0 /* PBXContainerItemProxy */;
|
||||
sourceTree = BUILT_PRODUCTS_DIR;
|
||||
};
|
||||
26472F881FFA1C2600C4F2B0 /* libthird-party.a */ = {
|
||||
isa = PBXReferenceProxy;
|
||||
fileType = archive.ar;
|
||||
path = "libthird-party.a";
|
||||
remoteRef = 26472F871FFA1C2600C4F2B0 /* PBXContainerItemProxy */;
|
||||
sourceTree = BUILT_PRODUCTS_DIR;
|
||||
};
|
||||
26472F8A1FFA1C2600C4F2B0 /* libthird-party.a */ = {
|
||||
isa = PBXReferenceProxy;
|
||||
fileType = archive.ar;
|
||||
path = "libthird-party.a";
|
||||
remoteRef = 26472F891FFA1C2600C4F2B0 /* PBXContainerItemProxy */;
|
||||
sourceTree = BUILT_PRODUCTS_DIR;
|
||||
};
|
||||
26472F8C1FFA1C2600C4F2B0 /* libdouble-conversion.a */ = {
|
||||
isa = PBXReferenceProxy;
|
||||
fileType = archive.ar;
|
||||
path = "libdouble-conversion.a";
|
||||
remoteRef = 26472F8B1FFA1C2600C4F2B0 /* PBXContainerItemProxy */;
|
||||
sourceTree = BUILT_PRODUCTS_DIR;
|
||||
};
|
||||
26472F8E1FFA1C2600C4F2B0 /* libdouble-conversion.a */ = {
|
||||
isa = PBXReferenceProxy;
|
||||
fileType = archive.ar;
|
||||
path = "libdouble-conversion.a";
|
||||
remoteRef = 26472F8D1FFA1C2600C4F2B0 /* PBXContainerItemProxy */;
|
||||
sourceTree = BUILT_PRODUCTS_DIR;
|
||||
};
|
||||
26472F901FFA1C2600C4F2B0 /* libprivatedata.a */ = {
|
||||
isa = PBXReferenceProxy;
|
||||
fileType = archive.ar;
|
||||
path = libprivatedata.a;
|
||||
remoteRef = 26472F8F1FFA1C2600C4F2B0 /* PBXContainerItemProxy */;
|
||||
sourceTree = BUILT_PRODUCTS_DIR;
|
||||
};
|
||||
26472F921FFA1C2600C4F2B0 /* libprivatedata-tvOS.a */ = {
|
||||
isa = PBXReferenceProxy;
|
||||
fileType = archive.ar;
|
||||
path = "libprivatedata-tvOS.a";
|
||||
remoteRef = 26472F911FFA1C2600C4F2B0 /* PBXContainerItemProxy */;
|
||||
sourceTree = BUILT_PRODUCTS_DIR;
|
||||
};
|
||||
264D62411D2EF175009AA839 /* libReactNativeCameraKit.a */ = {
|
||||
isa = PBXReferenceProxy;
|
||||
fileType = archive.ar;
|
||||
|
@ -642,7 +762,7 @@
|
|||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "export NODE_BINARY=node\n../node_modules/react-native/packager/react-native-xcode.sh";
|
||||
shellScript = "export NODE_BINARY=node\n../node_modules/react-native/scripts/react-native-xcode.sh";
|
||||
};
|
||||
/* End PBXShellScriptBuildPhase section */
|
||||
|
||||
|
|
|
@ -9,8 +9,8 @@
|
|||
},
|
||||
"dependencies": {
|
||||
"lodash": "^4.13.1",
|
||||
"react": "16.0.0-alpha.6",
|
||||
"react-native": "0.43.4",
|
||||
"react": "16.0.0",
|
||||
"react-native": "0.51.0",
|
||||
"react-native-camera-kit": "file:../",
|
||||
"seamless-immutable": "^6.1.0"
|
||||
}
|
||||
|
|
|
@ -66,7 +66,7 @@ RCT_ENUM_CONVERTER(CKCameraZoomMode, (@{
|
|||
#define CAMERA_OPTION_ZOOM_MODE @"zoomMode"
|
||||
#define CAMERA_OPTION_CAMERA_RATIO_OVERLAY @"ratioOverlay"
|
||||
#define CAMERA_OPTION_CAMERA_RATIO_OVERLAY_COLOR @"ratioOverlayColor"
|
||||
#define CAMERA_OPTION_ON_READ_CODE @"onReadCode"
|
||||
#define CAMERA_OPTION_ON_READ_QR_CODE @"onReadQRCode"
|
||||
#define TIMER_FOCUS_TIME_SECONDS 5
|
||||
|
||||
@interface CKCamera () <AVCaptureFileOutputRecordingDelegate, AVCaptureMetadataOutputObjectsDelegate>
|
||||
|
@ -85,7 +85,7 @@ RCT_ENUM_CONVERTER(CKCameraZoomMode, (@{
|
|||
@property (nonatomic) AVCaptureMovieFileOutput *movieFileOutput;
|
||||
@property (nonatomic) AVCaptureStillImageOutput *stillImageOutput;
|
||||
@property (nonatomic, strong) AVCaptureMetadataOutput *metadataOutput;
|
||||
@property (nonatomic, strong) NSString *recievedCodeStringValue;
|
||||
@property (nonatomic, strong) NSString *qrcodeStringValue;
|
||||
|
||||
|
||||
// utilities
|
||||
|
@ -99,7 +99,7 @@ RCT_ENUM_CONVERTER(CKCameraZoomMode, (@{
|
|||
@property (nonatomic) CKCameraZoomMode zoomMode;
|
||||
@property (nonatomic, strong) NSString* ratioOverlayString;
|
||||
@property (nonatomic, strong) UIColor *ratioOverlayColor;
|
||||
@property (nonatomic, strong) RCTDirectEventBlock onReadCode;
|
||||
@property (nonatomic, strong) RCTDirectEventBlock onReadQRCode;
|
||||
|
||||
@property (nonatomic) BOOL isAddedOberver;
|
||||
|
||||
|
@ -287,11 +287,11 @@ RCT_ENUM_CONVERTER(CKCameraZoomMode, (@{
|
|||
else {
|
||||
self.setupResult = CKSetupResultSessionConfigurationFailed;
|
||||
}
|
||||
if (self.onReadCode) {//TODO check if qrcode mode is on
|
||||
if (self.onReadQRCode) {//TODO check if qrcode mode is on
|
||||
self.metadataOutput = [[AVCaptureMetadataOutput alloc] init];
|
||||
[self.session addOutput:self.metadataOutput];
|
||||
[self.metadataOutput setMetadataObjectsDelegate:self queue:dispatch_get_main_queue()];
|
||||
[self.metadataOutput setMetadataObjectTypes:[self.metadataOutput availableMetadataObjectTypes]];
|
||||
[self.metadataOutput setMetadataObjectTypes:@[AVMetadataObjectTypeEAN13Code, AVMetadataObjectTypeQRCode]];
|
||||
}
|
||||
|
||||
|
||||
|
@ -919,34 +919,23 @@ RCT_ENUM_CONVERTER(CKCameraZoomMode, (@{
|
|||
|
||||
#pragma mark - AVCaptureMetadataOutputObjectsDelegate
|
||||
|
||||
- (void)captureOutput:(AVCaptureOutput *)output didOutputMetadataObjects:(NSArray<__kindof AVMetadataObject *> *)metadataObjects fromConnection:(AVCaptureConnection *)connection {
|
||||
for(AVMetadataObject *metadataObject in metadataObjects) {
|
||||
if ([metadataObject isKindOfClass:[AVMetadataMachineReadableCodeObject class]] && [self isSupportedBarCodeType:metadataObject.type]) {
|
||||
- (void)captureOutput:(AVCaptureOutput *)output
|
||||
didOutputMetadataObjects:(NSArray<__kindof AVMetadataObject *> *)metadataObjects
|
||||
fromConnection:(AVCaptureConnection *)connection {
|
||||
|
||||
for(AVMetadataObject *metadataObject in metadataObjects)
|
||||
{
|
||||
if ([metadataObject isKindOfClass:[AVMetadataMachineReadableCodeObject class]]) {
|
||||
AVMetadataMachineReadableCodeObject *code = (AVMetadataMachineReadableCodeObject*)[self.previewLayer transformedMetadataObjectForMetadataObject:metadataObject];
|
||||
if (code.stringValue && ![code.stringValue isEqualToString:self.recievedCodeStringValue]) {
|
||||
self.recievedCodeStringValue = code.stringValue;
|
||||
if (self.onReadCode) {
|
||||
self.onReadCode(@{@"receivedCodeStringValue": code.stringValue});
|
||||
}
|
||||
|
||||
if (self.onReadQRCode && code.stringValue && ![code.stringValue isEqualToString:self.qrcodeStringValue]) {
|
||||
self.qrcodeStringValue = code.stringValue;
|
||||
self.onReadQRCode(@{@"qrcodeStringValue": code.stringValue});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (BOOL)isSupportedBarCodeType:(AVMetadataObjectType)currentType {
|
||||
BOOL result = NO;
|
||||
NSArray *supportedBarcodeTypes = @[AVMetadataObjectTypeUPCECode, AVMetadataObjectTypeCode39Code, AVMetadataObjectTypeCode39Mod43Code,
|
||||
AVMetadataObjectTypeEAN13Code,AVMetadataObjectTypeEAN8Code, AVMetadataObjectTypeCode93Code,
|
||||
AVMetadataObjectTypeCode128Code, AVMetadataObjectTypePDF417Code, AVMetadataObjectTypeQRCode,
|
||||
AVMetadataObjectTypeAztecCode];
|
||||
for (NSString* object in supportedBarcodeTypes) {
|
||||
if ([currentType isEqualToString:object]) {
|
||||
result = YES;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@end
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
"publishConfig": {
|
||||
"registry": "https://registry.npmjs.org/"
|
||||
},
|
||||
"version": "5.3.18",
|
||||
"version": "5.3.20",
|
||||
"description": "Advanced native camera control with pre-defined aspect ratio, crop, etc",
|
||||
"author": "Ran Greenberg <rang@wix.com>",
|
||||
"nativePackage": true,
|
||||
|
|
|
@ -37,14 +37,14 @@ export default class CameraScreenBase extends Component {
|
|||
mode: FLASH_MODE_AUTO,
|
||||
image: _.get(this.props, 'flashImages.auto')
|
||||
},
|
||||
{
|
||||
mode: FLASH_MODE_ON,
|
||||
image: _.get(this.props, 'flashImages.on')
|
||||
},
|
||||
{
|
||||
mode: FLASH_MODE_OFF,
|
||||
image: _.get(this.props, 'flashImages.off')
|
||||
}
|
||||
{
|
||||
mode: FLASH_MODE_ON,
|
||||
image: _.get(this.props, 'flashImages.on')
|
||||
},
|
||||
{
|
||||
mode: FLASH_MODE_OFF,
|
||||
image: _.get(this.props, 'flashImages.off')
|
||||
}
|
||||
];
|
||||
this.state = {
|
||||
captureImages: [],
|
||||
|
@ -130,16 +130,15 @@ export default class CameraScreenBase extends Component {
|
|||
<View style={styles.cameraContainer}>
|
||||
{
|
||||
this.isCaptureRetakeMode() ?
|
||||
<Image
|
||||
style={{ flex: 1, justifyContent: 'flex-end' }}
|
||||
source={{ uri: this.state.imageCaptured.uri }}
|
||||
/> :
|
||||
<CameraKitCamera
|
||||
ref={(cam) => this.camera = cam}
|
||||
style={{ flex: 1, justifyContent: 'flex-end' }}
|
||||
cameraOptions={this.state.cameraOptions}
|
||||
onReadCode={this.propss.onReadCode}
|
||||
/>
|
||||
<Image
|
||||
style={{flex: 1, justifyContent: 'flex-end'}}
|
||||
source={{uri: this.state.imageCaptured.uri}}
|
||||
/> :
|
||||
<CameraKitCamera
|
||||
ref={(cam) => this.camera = cam}
|
||||
style={{flex: 1, justifyContent: 'flex-end'}}
|
||||
cameraOptions={this.state.cameraOptions}
|
||||
/>
|
||||
}
|
||||
</View>
|
||||
);
|
||||
|
@ -163,14 +162,15 @@ export default class CameraScreenBase extends Component {
|
|||
onPress={() => this.onCaptureImagePressed()}
|
||||
>
|
||||
<Image
|
||||
style={styles.captureButton}
|
||||
source={this.props.captureButtonImage}
|
||||
resizeMode={'contain'}
|
||||
>
|
||||
<Text style={styles.captureNumber}>
|
||||
/>
|
||||
<View style={styles.textNumberContainer}>
|
||||
<Text>
|
||||
{this.numberOfImagesTaken()}
|
||||
</Text>
|
||||
</Image>
|
||||
</View>
|
||||
|
||||
</TouchableOpacity>
|
||||
</View >
|
||||
}
|
||||
|
@ -318,16 +318,14 @@ const styles = StyleSheet.create(_.merge(styleObject, {
|
|||
justifyContent: 'center',
|
||||
alignItems: 'center',
|
||||
},
|
||||
captureButton: {
|
||||
flex: 1,
|
||||
alignSelf: 'center',
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center'
|
||||
},
|
||||
captureNumber: {
|
||||
textNumberContainer: {
|
||||
position: 'absolute',
|
||||
top: 0,
|
||||
left: 0,
|
||||
bottom: 0,
|
||||
right: 0,
|
||||
justifyContent: 'center',
|
||||
color: 'black',
|
||||
backgroundColor: 'transparent'
|
||||
alignItems: 'center'
|
||||
},
|
||||
bottomButton: {
|
||||
flex: 1,
|
||||
|
|
Loading…
Reference in New Issue