From 05d787bd86f3a0003a963aad71e34ac2b8e38ac5 Mon Sep 17 00:00:00 2001 From: Roman Volosovskyi Date: Wed, 4 Apr 2018 13:32:03 +0100 Subject: [PATCH] upgrade rn-camera (attempt to fix #3289) --- .../im/status/ethereum/MainApplication.java | 4 +- ios/StatusIm.xcodeproj/project.pbxproj | 86 +++++++------------ package-lock.json | 7 +- package.json | 2 +- scripts/run-osx | 2 +- src/status_im/ui/components/camera.cljs | 7 +- .../screens/profile/photo_capture/views.cljs | 17 ++-- .../react_native/js_dependencies.cljs | 2 +- 8 files changed, 50 insertions(+), 77 deletions(-) diff --git a/android/app/src/main/java/im/status/ethereum/MainApplication.java b/android/app/src/main/java/im/status/ethereum/MainApplication.java index 79411d02f5a..14714aa56ff 100644 --- a/android/app/src/main/java/im/status/ethereum/MainApplication.java +++ b/android/app/src/main/java/im/status/ethereum/MainApplication.java @@ -16,7 +16,7 @@ import com.facebook.soloader.SoLoader; import com.github.alinz.reactnativewebviewbridge.WebViewBridgePackage; import com.AlexanderZaytsev.RNI18n.RNI18nPackage; -import com.lwansbrough.RCTCamera.RCTCameraPackage; +import org.reactnative.camera.RNCameraPackage; import com.reactnative.ivpusic.imagepicker.PickerPackage; import com.rnfs.RNFSPackage; import es.tiarg.nfcreactnative.NfcReactNativePackage; @@ -65,7 +65,7 @@ protected List getPackages() { new RealmReactPackage(), new RNI18nPackage(), new RandomBytesPackage(), - new RCTCameraPackage(), + new RNCameraPackage(), new RNFSPackage(), new ReactNativeDialogsPackage(), new ImageResizerPackage(), diff --git a/ios/StatusIm.xcodeproj/project.pbxproj b/ios/StatusIm.xcodeproj/project.pbxproj index adccea095ca..716e38e89e4 100644 --- a/ios/StatusIm.xcodeproj/project.pbxproj +++ b/ios/StatusIm.xcodeproj/project.pbxproj @@ -34,6 +34,7 @@ 3A8BF31C42291E324219071C /* InstabugCore.framework in Embed Instabug Framework */ = {isa = PBXBuildFile; fileRef = EA36FD18BC2ECACF0A8B83DE /* InstabugCore.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 3E15DFEC1F6F4D7CAE088F49 /* libTcpSockets.a in Frameworks */ = {isa = PBXBuildFile; fileRef = C2A4E93F6B154AEFA3485B45 /* libTcpSockets.a */; }; 4C16DE0C1F89508700AA10DB /* JavaScriptCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4C16DE0B1F89508700AA10DB /* JavaScriptCore.framework */; }; + 4C8F6CF72074F84200F605CA /* libRNCamera.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 4C8F6CF62074F83C00F605CA /* libRNCamera.a */; }; 4CA4DA1B206D105D006A98B0 /* libRNInstabug.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 9E3F1C121DDAE781005E4779 /* libRNInstabug.a */; }; 4FFAE7B0414A463991039A2E /* libRNRandomBytes.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 78C55F15EB4D4DAF9202A662 /* libRNRandomBytes.a */; }; 5974D2035B8B47E0946B63B6 /* libRNFIRMessaging.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 7F752F17B1E04216B1337A72 /* libRNFIRMessaging.a */; }; @@ -52,7 +53,6 @@ 98482A6F2065257B00263651 /* libReactNativeTestFairy.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 9880471C20650CBC00CEBFE0 /* libReactNativeTestFairy.a */; }; 9E0B01A11DDC5DA7002B0359 /* SF-UI-Text-Light.otf in Resources */ = {isa = PBXBuildFile; fileRef = 9E0B01A01DDC5DA7002B0359 /* SF-UI-Text-Light.otf */; }; 9E3AB6D01D87DB2B008846B4 /* libReact-Native-Webview-Bridge.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 9E3AB6C61D87DA2B008846B4 /* libReact-Native-Webview-Bridge.a */; }; - 9E7C64731E03FDDE004C7042 /* libRCTCamera.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 20B7D1151D3F74CD00B70F14 /* libRCTCamera.a */; }; 9ED2F45E1D9D535A00B36508 /* SF-UI-Text-Regular.otf in Resources */ = {isa = PBXBuildFile; fileRef = 9ED2F45D1D9D52DD00B36508 /* SF-UI-Text-Regular.otf */; }; 9ED2F45F1D9D535A00B36508 /* SF-UI-Text-Medium.otf in Resources */ = {isa = PBXBuildFile; fileRef = 9ED2F45C1D9D52C100B36508 /* SF-UI-Text-Medium.otf */; }; 9ED2F4611D9D579900B36508 /* SF-UI-Text-Bold.otf in Resources */ = {isa = PBXBuildFile; fileRef = 9ED2F4601D9D577B00B36508 /* SF-UI-Text-Bold.otf */; }; @@ -174,13 +174,6 @@ remoteGlobalIDString = CDD7BF781B2D5125006FDA75; remoteInfo = RNI18n; }; - 20B7D1141D3F74CD00B70F14 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 9F1854E6D9654226B1FC8308 /* RCTCamera.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 4107012F1ACB723B00C6AA39; - remoteInfo = RCTCamera; - }; 20B7D1191D3F74CD00B70F14 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 305F194186D848FDB07AF34C /* RNFS.xcodeproj */; @@ -195,6 +188,13 @@ remoteGlobalIDString = F60690131CA2766F0003FB26; remoteInfo = RealmReact; }; + 4C8F6CF52074F83C00F605CA /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 4C8F6CF12074F83C00F605CA /* RNCamera.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = 4107012F1ACB723B00C6AA39; + remoteInfo = RNCamera; + }; 5537E2A920650E640085CED4 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */; @@ -300,13 +300,6 @@ remoteGlobalIDString = 24DF11ED1DA3A2B90056F77C; remoteInfo = RNInstabug; }; - 9EC013781E06FB1900155B5C /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 9EC0135C1E06FB1900155B5C /* RCTWKWebView.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 0974579A1D2A440A000D9368; - remoteInfo = RCTWKWebView; - }; 9EF083601F3B538B00876A8F /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 9EF083381F3B538A00876A8F /* ReactNativeConfig.xcodeproj */; @@ -566,6 +559,7 @@ 45FB5F523DE04BDE9877869C /* RNRandomBytes.xcodeproj */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = "wrapper.pb-project"; name = RNRandomBytes.xcodeproj; path = "../node_modules/react-native-randombytes/RNRandomBytes.xcodeproj"; sourceTree = ""; }; 46E2F6052EB44C698C680894 /* RNI18n.xcodeproj */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = "wrapper.pb-project"; name = RNI18n.xcodeproj; path = "../node_modules/react-native-i18n/ios/RNI18n.xcodeproj"; sourceTree = ""; }; 4C16DE0B1F89508700AA10DB /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = System/Library/Frameworks/JavaScriptCore.framework; sourceTree = SDKROOT; }; + 4C8F6CF12074F83C00F605CA /* RNCamera.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RNCamera.xcodeproj; path = "../node_modules/react-native-camera/ios/RNCamera.xcodeproj"; sourceTree = ""; }; 4E586E1B0E544F64AA9F5BD1 /* libz.tbd */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libz.tbd; path = usr/lib/libz.tbd; sourceTree = SDKROOT; }; 4EC426A98043452BB6F9C134 /* libRNInstabug.a */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = archive.ar; path = libRNInstabug.a; sourceTree = ""; }; 52F6ED6465184513A082652B /* libRNI18n.a */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = archive.ar; path = libRNI18n.a; sourceTree = ""; }; @@ -588,12 +582,10 @@ 9880471720650CBC00CEBFE0 /* ReactNativeTestFairy.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = ReactNativeTestFairy.xcodeproj; path = "../node_modules/react-native-testfairy/ios/ReactNativeTestFairy.xcodeproj"; sourceTree = ""; }; 9E0B01A01DDC5DA7002B0359 /* SF-UI-Text-Light.otf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "SF-UI-Text-Light.otf"; sourceTree = ""; }; 9E3AB6B21D87DA2A008846B4 /* React-Native-Webview-Bridge.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = "React-Native-Webview-Bridge.xcodeproj"; path = "../node_modules/react-native-webview-bridge/ios/React-Native-Webview-Bridge.xcodeproj"; sourceTree = ""; }; - 9EC0135C1E06FB1900155B5C /* RCTWKWebView.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTWKWebView.xcodeproj; path = "../node_modules/react-native-wkwebview-reborn/ios/RCTWKWebView.xcodeproj"; sourceTree = ""; }; 9ED2F45C1D9D52C100B36508 /* SF-UI-Text-Medium.otf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "SF-UI-Text-Medium.otf"; sourceTree = ""; }; 9ED2F45D1D9D52DD00B36508 /* SF-UI-Text-Regular.otf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "SF-UI-Text-Regular.otf"; sourceTree = ""; }; 9ED2F4601D9D577B00B36508 /* SF-UI-Text-Bold.otf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "SF-UI-Text-Bold.otf"; sourceTree = ""; }; 9EF083381F3B538A00876A8F /* ReactNativeConfig.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = ReactNativeConfig.xcodeproj; path = "../node_modules/react-native-config/ios/ReactNativeConfig.xcodeproj"; sourceTree = ""; }; - 9F1854E6D9654226B1FC8308 /* RCTCamera.xcodeproj */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = "wrapper.pb-project"; name = RCTCamera.xcodeproj; path = "../node_modules/react-native-camera/ios/RCTCamera.xcodeproj"; sourceTree = ""; }; ACA66A8F16CD2FE21F38738B /* Pods-StatusIm.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-StatusIm.debug.xcconfig"; path = "Pods/Target Support Files/Pods-StatusIm/Pods-StatusIm.debug.xcconfig"; sourceTree = ""; }; ADBDB91F1DFEBF0600ED6528 /* RCTBlob.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTBlob.xcodeproj; path = "../node_modules/react-native/Libraries/Blob/RCTBlob.xcodeproj"; sourceTree = ""; }; AF2BF381BC7B4EB0887F0091 /* libRNSVG.a */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = archive.ar; path = libRNSVG.a; sourceTree = ""; }; @@ -633,6 +625,7 @@ 98482A6F2065257B00263651 /* libReactNativeTestFairy.a in Frameworks */, C93242561FE1C68C00FE7099 /* libRCTAnimation.a in Frameworks */, 4C16DE0C1F89508700AA10DB /* JavaScriptCore.framework in Frameworks */, + 4C8F6CF72074F84200F605CA /* libRNCamera.a in Frameworks */, B2DEA0D01E49E33300FA28D6 /* libRCTHttpServer.a in Frameworks */, 925C1F481F7B73B20063DFA0 /* FirebaseCoreDiagnostics.framework in Frameworks */, 9EE89E271E03FCB7007D3C25 /* libSplashScreen.a in Frameworks */, @@ -659,7 +652,6 @@ 832341BD1AAA6AB300B99B32 /* libRCTText.a in Frameworks */, 00C302EA1ABCBA2D00DB3ED1 /* libRCTVibration.a in Frameworks */, 139FDEF61B0652A700C62182 /* libRCTWebSocket.a in Frameworks */, - 9E7C64731E03FDDE004C7042 /* libRCTCamera.a in Frameworks */, FD4F213C3873473CB703B1D2 /* libRNFS.a in Frameworks */, 213311F38CA74CE280FD09AD /* libRNI18n.a in Frameworks */, 4FFAE7B0414A463991039A2E /* libRNRandomBytes.a in Frameworks */, @@ -863,27 +855,27 @@ name = Products; sourceTree = ""; }; - 20B7D1111D3F74CD00B70F14 /* Products */ = { + 20B7D1161D3F74CD00B70F14 /* Products */ = { isa = PBXGroup; children = ( - 20B7D1151D3F74CD00B70F14 /* libRCTCamera.a */, + 20B7D11A1D3F74CD00B70F14 /* libRNFS.a */, + C900481D1FC47AF50002B8EA /* libRNFS.a */, ); name = Products; sourceTree = ""; }; - 20B7D1161D3F74CD00B70F14 /* Products */ = { + 20B7D1251D3F74CD00B70F14 /* Products */ = { isa = PBXGroup; children = ( - 20B7D11A1D3F74CD00B70F14 /* libRNFS.a */, - C900481D1FC47AF50002B8EA /* libRNFS.a */, + 20B7D1291D3F74CD00B70F14 /* libRealmReact.a */, ); name = Products; sourceTree = ""; }; - 20B7D1251D3F74CD00B70F14 /* Products */ = { + 4C8F6CF22074F83C00F605CA /* Products */ = { isa = PBXGroup; children = ( - 20B7D1291D3F74CD00B70F14 /* libRealmReact.a */, + 4C8F6CF62074F83C00F605CA /* libRNCamera.a */, ); name = Products; sourceTree = ""; @@ -911,10 +903,10 @@ 832341AE1AAA6A7D00B99B32 /* Libraries */ = { isa = PBXGroup; children = ( + 4C8F6CF12074F83C00F605CA /* RNCamera.xcodeproj */, 9880471720650CBC00CEBFE0 /* ReactNativeTestFairy.xcodeproj */, 9EF083381F3B538A00876A8F /* ReactNativeConfig.xcodeproj */, B2DEA0A41E49E32000FA28D6 /* RCTHttpServer.xcodeproj */, - 9EC0135C1E06FB1900155B5C /* RCTWKWebView.xcodeproj */, B2A5F42F1DEC36B200174F4D /* RCTAnimation.xcodeproj */, 3A7EB0491DD9CABC00A4FCC8 /* SplashScreen.xcodeproj */, 20A5C94B1D927137002C4965 /* imageCropPicker.xcodeproj */, @@ -930,7 +922,6 @@ 832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */, 00C302DF1ABCB9EE00DB3ED1 /* RCTVibration.xcodeproj */, 139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */, - 9F1854E6D9654226B1FC8308 /* RCTCamera.xcodeproj */, 305F194186D848FDB07AF34C /* RNFS.xcodeproj */, 46E2F6052EB44C698C680894 /* RNI18n.xcodeproj */, 45FB5F523DE04BDE9877869C /* RNRandomBytes.xcodeproj */, @@ -1024,14 +1015,6 @@ name = Products; sourceTree = ""; }; - 9EC0135D1E06FB1900155B5C /* Products */ = { - isa = PBXGroup; - children = ( - 9EC013791E06FB1900155B5C /* libRCTWKWebView.a */, - ); - name = Products; - sourceTree = ""; - }; 9EF083391F3B538A00876A8F /* Products */ = { isa = PBXGroup; children = ( @@ -1232,10 +1215,6 @@ ProductGroup = ADBDB9201DFEBF0600ED6528 /* Products */; ProjectRef = ADBDB91F1DFEBF0600ED6528 /* RCTBlob.xcodeproj */; }, - { - ProductGroup = 20B7D1111D3F74CD00B70F14 /* Products */; - ProjectRef = 9F1854E6D9654226B1FC8308 /* RCTCamera.xcodeproj */; - }, { ProductGroup = 00C302B61ABCB90400DB3ED1 /* Products */; ProjectRef = 00C302B51ABCB90400DB3ED1 /* RCTGeolocation.xcodeproj */; @@ -1280,10 +1259,6 @@ ProductGroup = 139FDEE71B06529A00C62182 /* Products */; ProjectRef = 139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */; }, - { - ProductGroup = 9EC0135D1E06FB1900155B5C /* Products */; - ProjectRef = 9EC0135C1E06FB1900155B5C /* RCTWKWebView.xcodeproj */; - }, { ProductGroup = 9E3AB6B31D87DA2A008846B4 /* Products */; ProjectRef = 9E3AB6B21D87DA2A008846B4 /* React-Native-Webview-Bridge.xcodeproj */; @@ -1304,6 +1279,10 @@ ProductGroup = 20B7D1251D3F74CD00B70F14 /* Products */; ProjectRef = F090E261B9854867A728CE4F /* RealmReact.xcodeproj */; }, + { + ProductGroup = 4C8F6CF22074F83C00F605CA /* Products */; + ProjectRef = 4C8F6CF12074F83C00F605CA /* RNCamera.xcodeproj */; + }, { ProductGroup = 922C4C211F4D5C3F0033C753 /* Products */; ProjectRef = F89A8F8005874B86B63C22E3 /* RNFIRMessaging.xcodeproj */; @@ -1437,13 +1416,6 @@ remoteRef = 20B7D10D1D3F74CD00B70F14 /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; - 20B7D1151D3F74CD00B70F14 /* libRCTCamera.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = libRCTCamera.a; - remoteRef = 20B7D1141D3F74CD00B70F14 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; 20B7D11A1D3F74CD00B70F14 /* libRNFS.a */ = { isa = PBXReferenceProxy; fileType = archive.ar; @@ -1458,6 +1430,13 @@ remoteRef = 20B7D1281D3F74CD00B70F14 /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; + 4C8F6CF62074F83C00F605CA /* libRNCamera.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libRNCamera.a; + remoteRef = 4C8F6CF52074F83C00F605CA /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; 5537E2AA20650E640085CED4 /* libjsinspector.a */ = { isa = PBXReferenceProxy; fileType = archive.ar; @@ -1563,13 +1542,6 @@ remoteRef = 9E3F1C111DDAE781005E4779 /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; - 9EC013791E06FB1900155B5C /* libRCTWKWebView.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = libRCTWKWebView.a; - remoteRef = 9EC013781E06FB1900155B5C /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; 9EF083611F3B538B00876A8F /* libReactNativeConfig.a */ = { isa = PBXReferenceProxy; fileType = archive.ar; diff --git a/package-lock.json b/package-lock.json index e755a09a03a..f1f400315e4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1926,7 +1926,7 @@ }, "compression": { "version": "1.5.2", - "resolved": "http://registry.npmjs.org/compression/-/compression-1.5.2.tgz", + "resolved": "https://registry.npmjs.org/compression/-/compression-1.5.2.tgz", "integrity": "sha1-sDuNhub4rSloPLqN+R3cb/x3s5U=", "requires": { "accepts": "1.2.13", @@ -8044,10 +8044,9 @@ "integrity": "sha512-vLNJIedXQZN4p3ChFsAgVHacnJqQMnLl+wBsnZuliRkmsjEHo8kQOA9fnLih/OoiDi1O3eHQvXC5L8f+RYiKgw==" }, "react-native-camera": { - "version": "0.10.0", - "resolved": "https://registry.npmjs.org/react-native-camera/-/react-native-camera-0.10.0.tgz", - "integrity": "sha512-qum5zdJ3GQZ/mB+SYdT8EhQVnIfmyLzwyIK9Ss4vsTGLKxKmt9tf7oGigT2t52aOy6tNglKcgYuU0cZREKGDDA==", + "version": "git+https://github.com/status-im/react-native-camera.git#bd2d47a3e1a8e8abdf34c7b5884e710b1e10829c", "requires": { + "lodash": "4.17.4", "prop-types": "15.6.0" } }, diff --git a/package.json b/package.json index faee866352d..050de83c233 100644 --- a/package.json +++ b/package.json @@ -47,7 +47,7 @@ "react-dom": "16.2.0", "react-native": "0.53.3", "react-native-background-timer": "2.0.0", - "react-native-camera": "0.10.0", + "react-native-camera": "git+https://github.com/status-im/react-native-camera.git#status-1.0.3", "react-native-config": "0.9.0", "react-native-crypto": "2.1.1", "react-native-dialogs": "0.0.20", diff --git a/scripts/run-osx b/scripts/run-osx index 109e5be39ab..d8df163da2b 100755 --- a/scripts/run-osx +++ b/scripts/run-osx @@ -61,7 +61,7 @@ open -a /Applications/Genymotion.app/Contents/MacOS/player.app --args --vm-name fi # Install deps, prepare for genymotion and figwheel -lein deps && ./re-natal deps && ./re-natal use-android-device "${device_type}" && ./re-natal use-figwheel +lein deps && npm install && ./re-natal use-android-device "${device_type}" && ./re-natal use-figwheel && npm install # open figwheel in new tab tab "lein figwheel-repl ${cljs_build}" diff --git a/src/status_im/ui/components/camera.cljs b/src/status_im/ui/components/camera.cljs index f562c83d3f7..670dcec0c8b 100644 --- a/src/status_im/ui/components/camera.cljs +++ b/src/status_im/ui/components/camera.cljs @@ -4,10 +4,11 @@ [clojure.walk :as walk] [status-im.react-native.js-dependencies :as js-dependecies])) +(def rn-camera (.-RNCamera js-dependecies/camera)) (def default-camera (.-default js-dependecies/camera)) (defn constants [t] - (-> js-dependecies/camera + (-> default-camera (object/get "constants") (object/get t) (js->clj) @@ -18,7 +19,7 @@ (def torch-modes (constants "TorchMode")) (defn set-torch [state] - (set! (.-torchMode default-camera) (get torch-modes state))) + (set! (.-torchMode rn-camera) (get torch-modes state))) (defn request-access-ios [then else] (-> (.checkVideoAuthorizationStatus default-camera) @@ -26,7 +27,7 @@ (.catch else))) (defn camera [props] - (reagent/create-element default-camera (clj->js (merge {:inverted true} props)))) + (reagent/create-element rn-camera (clj->js (merge {:inverted true} props)))) (defn get-qr-code-data [code] (.-data code)) diff --git a/src/status_im/ui/screens/profile/photo_capture/views.cljs b/src/status_im/ui/screens/profile/photo_capture/views.cljs index 18b35deb812..3b7dbbd2424 100644 --- a/src/status_im/ui/screens/profile/photo_capture/views.cljs +++ b/src/status_im/ui/screens/profile/photo_capture/views.cljs @@ -12,7 +12,7 @@ [status-im.ui.components.icons.vector-icons :as icons])) (defn image-captured [data] - (let [path (.-path data) + (let [path (.-uri data) _ (log/debug "Captured image: " path) on-success (fn [base64] (log/debug "Captured success: " base64) @@ -29,18 +29,19 @@ [toolbar/toolbar {} toolbar/default-nav-back [toolbar/content-title (i18n/label :t/image-source-title)]] - [camera/camera {:style {:flex 1} - :aspect (:fill camera/aspects) + [camera/camera {:style {:flex 1 :width 400 :height 300} + :aspect (:fill camera/aspects) + :ratio "4:3" :captureQuality "480p" - :captureTarget (:disk camera/capture-targets) - :type "front" - :ref #(reset! camera-ref %)}] + :captureTarget (:disk camera/capture-targets) + :type "front" + :ref #(reset! camera-ref %)}] [react/view styles/button-container [react/view styles/button [react/touchable-highlight {:on-press (fn [] (let [camera @camera-ref] - (-> (.capture camera) + (-> (.takePictureAsync camera) (.then image-captured) - (.catch #(log/debug "Error capturing image: " %)))))} + (.catch #(log/warn "Error capturing image: " %)))))} [react/view [icons/icon :icons/camera {:color :white}]]]]]])) diff --git a/test/cljs/status_im/react_native/js_dependencies.cljs b/test/cljs/status_im/react_native/js_dependencies.cljs index 9e605c5ac3e..c8e20ec8c56 100644 --- a/test/cljs/status_im/react_native/js_dependencies.cljs +++ b/test/cljs/status_im/react_native/js_dependencies.cljs @@ -2,7 +2,7 @@ (def action-button #js {:default #js {:Item #js {}}}) (def config #js {:default #js {}}) -(def camera #js {:constants #js {}}) +(def camera #js {:default #js {:constants #js {}}}) (def dialogs #js {}) (def dismiss-keyboard #js {}) (def emoji-picker #js {:default #js {}})