upgrade rn-camera (attempt to fix #3289)

Signed-off-by: Eric Dvorsak <eric@dvorsak.fr>
This commit is contained in:
Roman Volosovskyi 2018-02-13 12:32:32 +08:00 committed by Eric Dvorsak
parent 8fa22831ee
commit 032c5b42eb
No known key found for this signature in database
GPG Key ID: 932AC1CE5F05DE0C
8 changed files with 1315 additions and 289 deletions

View File

@ -203,7 +203,17 @@ dependencies {
implementation "com.facebook.react:react-native:+" // From node_modules
implementation project(':react-native-i18n')
implementation project(':react-native-linear-gradient')
implementation project(':react-native-camera')
compile (project(':react-native-camera')) {
exclude group: "com.google.android.gms"
exclude group: "com.android.support"
}
compile ('com.google.android.gms:play-services-vision:11.6.0') {
force = true;
}
compile ('com.android.support:exifinterface:26.0.1') {
force = true;
}
implementation project(':react-native-status')
implementation project(':react-native-orientation')
implementation project(':react-native-fs')

View File

@ -18,7 +18,7 @@ import com.github.alinz.reactnativewebviewbridge.WebViewBridgePackage;
import com.github.yamill.orientation.OrientationPackage;
import com.AlexanderZaytsev.RNI18n.RNI18nPackage;
import com.instabug.reactlibrary.RNInstabugReactnativePackage;
import com.lwansbrough.RCTCamera.RCTCameraPackage;
import org.reactnative.camera.RNCameraPackage;
import com.oblador.vectoricons.VectorIconsPackage;
import com.reactnative.ivpusic.imagepicker.PickerPackage;
import com.rnfs.RNFSPackage;
@ -69,7 +69,7 @@ public class MainApplication extends MultiDexApplication implements ReactApplica
new RNI18nPackage(),
new RandomBytesPackage(),
new LinearGradientPackage(),
new RCTCameraPackage(),
new RNCameraPackage(),
new OrientationPackage(),
new RNFSPackage(),
new ReactNativeDialogsPackage(),

View File

@ -34,6 +34,7 @@
25DC9C9DC25846BD8D084888 /* libc++.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 8B9A886A2CB448B1ABA0EB62 /* libc++.tbd */; };
3E15DFEC1F6F4D7CAE088F49 /* libTcpSockets.a in Frameworks */ = {isa = PBXBuildFile; fileRef = C2A4E93F6B154AEFA3485B45 /* libTcpSockets.a */; };
4C16DE0C1F89508700AA10DB /* JavaScriptCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4C16DE0B1F89508700AA10DB /* JavaScriptCore.framework */; };
4C940F89203294A300D5D14A /* libRNCamera.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 4C940F882032947C00D5D14A /* libRNCamera.a */; };
4D3D740D5EFA4F8592B048D7 /* libBVLinearGradient.a in Frameworks */ = {isa = PBXBuildFile; fileRef = DF1CD4C3D1254774ACCAE4E8 /* libBVLinearGradient.a */; };
4FFAE7B0414A463991039A2E /* libRNRandomBytes.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 78C55F15EB4D4DAF9202A662 /* libRNRandomBytes.a */; };
5974D2035B8B47E0946B63B6 /* libRNFIRMessaging.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 7F752F17B1E04216B1337A72 /* libRNFIRMessaging.a */; };
@ -56,7 +57,6 @@
9E3AB6D01D87DB2B008846B4 /* libReact-Native-Webview-Bridge.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 9E3AB6C61D87DA2B008846B4 /* libReact-Native-Webview-Bridge.a */; };
9E54D6001F17A5DB009F0C16 /* libTestFairy.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 9E54D5FD1F17A5DB009F0C16 /* libTestFairy.a */; };
9E54D6011F17A5DB009F0C16 /* upload-dsym.sh in Resources */ = {isa = PBXBuildFile; fileRef = 9E54D5FF1F17A5DB009F0C16 /* upload-dsym.sh */; };
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 */; };
@ -189,13 +189,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 */;
@ -224,6 +217,13 @@
remoteGlobalIDString = F60690131CA2766F0003FB26;
remoteInfo = RealmReact;
};
4C940F872032947C00D5D14A /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 4C940F832032947C00D5D14A /* RNCamera.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 4107012F1ACB723B00C6AA39;
remoteInfo = RNCamera;
};
78C398B81ACF4ADC00677621 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 78C398B01ACF4ADC00677621 /* RCTLinking.xcodeproj */;
@ -571,6 +571,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 = "<group>"; };
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 = "<group>"; };
4C16DE0B1F89508700AA10DB /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = System/Library/Frameworks/JavaScriptCore.framework; sourceTree = SDKROOT; };
4C940F832032947C00D5D14A /* RNCamera.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RNCamera.xcodeproj; path = "../node_modules/react-native-camera/ios/RNCamera.xcodeproj"; sourceTree = "<group>"; };
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 = "<group>"; };
52E205D210BC48B7A553BB62 /* Entypo.ttf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = Entypo.ttf; path = "../node_modules/react-native-vector-icons/Fonts/Entypo.ttf"; sourceTree = "<group>"; };
@ -606,7 +607,6 @@
9ED2F45D1D9D52DD00B36508 /* SF-UI-Text-Regular.otf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "SF-UI-Text-Regular.otf"; sourceTree = "<group>"; };
9ED2F4601D9D577B00B36508 /* SF-UI-Text-Bold.otf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "SF-UI-Text-Bold.otf"; sourceTree = "<group>"; };
9EF083381F3B538A00876A8F /* ReactNativeConfig.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = ReactNativeConfig.xcodeproj; path = "../node_modules/react-native-config/ios/ReactNativeConfig.xcodeproj"; sourceTree = "<group>"; };
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 = "<group>"; };
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 = "<group>"; };
ADBDB91F1DFEBF0600ED6528 /* RCTBlob.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTBlob.xcodeproj; path = "../node_modules/react-native/Libraries/Blob/RCTBlob.xcodeproj"; sourceTree = "<group>"; };
AF2BF381BC7B4EB0887F0091 /* libRNSVG.a */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = archive.ar; path = libRNSVG.a; sourceTree = "<group>"; };
@ -643,6 +643,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
4C940F89203294A300D5D14A /* libRNCamera.a in Frameworks */,
C93242561FE1C68C00FE7099 /* libRCTAnimation.a in Frameworks */,
4C16DE0C1F89508700AA10DB /* JavaScriptCore.framework in Frameworks */,
B2DEA0D01E49E33300FA28D6 /* libRCTHttpServer.a in Frameworks */,
@ -671,7 +672,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 */,
4D3D740D5EFA4F8592B048D7 /* libBVLinearGradient.a in Frameworks */,
@ -895,14 +895,6 @@
name = Products;
sourceTree = "<group>";
};
20B7D1111D3F74CD00B70F14 /* Products */ = {
isa = PBXGroup;
children = (
20B7D1151D3F74CD00B70F14 /* libRCTCamera.a */,
);
name = Products;
sourceTree = "<group>";
};
20B7D1161D3F74CD00B70F14 /* Products */ = {
isa = PBXGroup;
children = (
@ -937,6 +929,14 @@
name = Products;
sourceTree = "<group>";
};
4C940F842032947C00D5D14A /* Products */ = {
isa = PBXGroup;
children = (
4C940F882032947C00D5D14A /* libRNCamera.a */,
);
name = Products;
sourceTree = "<group>";
};
5C1C8762251D6EF495FB2384 /* Pods */ = {
isa = PBXGroup;
children = (
@ -960,6 +960,7 @@
832341AE1AAA6A7D00B99B32 /* Libraries */ = {
isa = PBXGroup;
children = (
4C940F832032947C00D5D14A /* RNCamera.xcodeproj */,
9EF083381F3B538A00876A8F /* ReactNativeConfig.xcodeproj */,
B2DEA0A41E49E32000FA28D6 /* RCTHttpServer.xcodeproj */,
9EC0135C1E06FB1900155B5C /* RCTWKWebView.xcodeproj */,
@ -978,7 +979,6 @@
832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */,
00C302DF1ABCB9EE00DB3ED1 /* RCTVibration.xcodeproj */,
139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */,
9F1854E6D9654226B1FC8308 /* RCTCamera.xcodeproj */,
305F194186D848FDB07AF34C /* RNFS.xcodeproj */,
46E2F6052EB44C698C680894 /* RNI18n.xcodeproj */,
807594C429CA44128AB5666B /* BVLinearGradient.xcodeproj */,
@ -1275,10 +1275,6 @@
ProductGroup = ADBDB9201DFEBF0600ED6528 /* Products */;
ProjectRef = ADBDB91F1DFEBF0600ED6528 /* RCTBlob.xcodeproj */;
},
{
ProductGroup = 20B7D1111D3F74CD00B70F14 /* Products */;
ProjectRef = 9F1854E6D9654226B1FC8308 /* RCTCamera.xcodeproj */;
},
{
ProductGroup = 00C302B61ABCB90400DB3ED1 /* Products */;
ProjectRef = 00C302B51ABCB90400DB3ED1 /* RCTGeolocation.xcodeproj */;
@ -1347,6 +1343,10 @@
ProductGroup = 20B7D1251D3F74CD00B70F14 /* Products */;
ProjectRef = F090E261B9854867A728CE4F /* RealmReact.xcodeproj */;
},
{
ProductGroup = 4C940F842032947C00D5D14A /* Products */;
ProjectRef = 4C940F832032947C00D5D14A /* RNCamera.xcodeproj */;
},
{
ProductGroup = 922C4C211F4D5C3F0033C753 /* Products */;
ProjectRef = F89A8F8005874B86B63C22E3 /* RNFIRMessaging.xcodeproj */;
@ -1491,13 +1491,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;
@ -1526,6 +1519,13 @@
remoteRef = 20B7D1281D3F74CD00B70F14 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
4C940F882032947C00D5D14A /* libRNCamera.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
path = libRNCamera.a;
remoteRef = 4C940F872032947C00D5D14A /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
78C398B91ACF4ADC00677621 /* libRCTLinking.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;

1510
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -49,7 +49,7 @@
"react-native-action-button": "2.8.1",
"react-native-autolink": "1.1.1",
"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.0",
"react-native-config": "0.9.0",
"react-native-crypto": "2.1.1",
"react-native-dialogs": "0.0.20",

View File

@ -4,11 +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
(object/get "constants")
(-> (object/get default-camera "constants")
(object/get t)
(js->clj)
(walk/keywordize-keys)))
@ -18,7 +18,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 +26,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))

View File

@ -12,7 +12,7 @@
[taoensso.timbre :as log]))
(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)
@ -39,9 +39,9 @@
[react/touchable-highlight {:style {:align-self "center"}
: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
[custom-icons/ion-icon {:name :md-camera
:style {:font-size 36}}]]]]]))

View File

@ -3,7 +3,7 @@
(def action-button #js {:default #js {:Item #js {}}})
(def autolink #js {:default #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 {}})