From 7f2a2182529983434a68e430f34819a619642590 Mon Sep 17 00:00:00 2001 From: Sunny Luo Date: Tue, 21 Jun 2022 16:57:41 +0800 Subject: [PATCH] fix: Revert "feat: retry v8 (#916)" (#937) This reverts commit e24406af3ccec0c56bef0b6e14ecc66f0d2fb77a. # Conflicts: # packages/app/scripts/eas-build-pre-install.sh --- package.json | 3 +- packages/app/android/app/build.gradle | 8 ++-- .../so/onekey/app/wallet/MainApplication.java | 18 ++++---- packages/app/ios/Podfile.lock | 4 +- packages/app/package.json | 5 +-- packages/app/react-native.config.js | 28 ++++++------ .../src/views/ScanQrcode/ScanCamera.ios.tsx | 44 ------------------- .../kit/src/views/ScanQrcode/ScanCamera.tsx | 42 ++++++++++++------ .../src/views/ScanQrcode/ScanCamera.web.tsx | 28 ++++++++++++ patches/@starcoin+starcoin+2.1.5.patch | 26 +++++++++++ yarn.lock | 20 +++------ 11 files changed, 121 insertions(+), 105 deletions(-) delete mode 100644 packages/kit/src/views/ScanQrcode/ScanCamera.ios.tsx create mode 100644 packages/kit/src/views/ScanQrcode/ScanCamera.web.tsx create mode 100644 patches/@starcoin+starcoin+2.1.5.patch diff --git a/package.json b/package.json index 28f186ac5dc..66ab7e5536b 100644 --- a/package.json +++ b/package.json @@ -117,6 +117,7 @@ "**/browserslist": "^4", "**/immer": "^9", "**/node-fetch": "^2", - "**/metro-react-native-babel-preset": "0.70.0" + "**/metro-react-native-babel-preset": "0.70.0", + "**/jsc-android": "npm:@onekeyfe/jsc-android" } } diff --git a/packages/app/android/app/build.gradle b/packages/app/android/app/build.gradle index 090985c6a87..2da2910224d 100644 --- a/packages/app/android/app/build.gradle +++ b/packages/app/android/app/build.gradle @@ -311,10 +311,10 @@ android { } - packagingOptions { - // Make sure libjsc.so does not packed in APK - exclude "**/libjsc.so" - } + // packagingOptions { + // // Make sure libjsc.so does not packed in APK + // exclude "**/libjsc.so" + // } } diff --git a/packages/app/android/app/src/main/java/so/onekey/app/wallet/MainApplication.java b/packages/app/android/app/src/main/java/so/onekey/app/wallet/MainApplication.java index 2ef375d0bae..db1c9900678 100644 --- a/packages/app/android/app/src/main/java/so/onekey/app/wallet/MainApplication.java +++ b/packages/app/android/app/src/main/java/so/onekey/app/wallet/MainApplication.java @@ -31,7 +31,7 @@ import java.util.List; import android.webkit.WebView; -import io.csie.kudo.reactnative.v8.executor.V8ExecutorFactory; +// import io.csie.kudo.reactnative.v8.executor.V8ExecutorFactory; public class MainApplication extends Application implements ReactApplication , ViewModelStoreOwner { private final ViewModelStore mViewModelStore = new ViewModelStore(); @@ -61,14 +61,14 @@ protected String getJSMainModuleName() { return "__generated__/AppEntry.js"; } - @Override - protected JavaScriptExecutorFactory getJavaScriptExecutorFactory() { - return new V8ExecutorFactory( - getApplicationContext(), - getPackageName(), - AndroidInfoHelpers.getFriendlyDeviceName(), - getUseDeveloperSupport()); - } + // @Override + // protected JavaScriptExecutorFactory getJavaScriptExecutorFactory() { + // return new V8ExecutorFactory( + // getApplicationContext(), + // getPackageName(), + // AndroidInfoHelpers.getFriendlyDeviceName(), + // getUseDeveloperSupport()); + // } }); diff --git a/packages/app/ios/Podfile.lock b/packages/app/ios/Podfile.lock index 2596d2fafc9..1250ca0969c 100644 --- a/packages/app/ios/Podfile.lock +++ b/packages/app/ios/Podfile.lock @@ -507,7 +507,7 @@ PODS: - RNFBApp - RNGestureHandler (2.4.2): - React-Core - - RNReanimated (3.0.0-rc.0): + - RNReanimated (2.8.0): - DoubleConversion - FBLazyVector - FBReactNativeSpec @@ -910,7 +910,7 @@ SPEC CHECKSUMS: RNFBApp: ca5f49bbe21f663142320337eb39956b04de4d12 RNFBCrashlytics: 97bf2b05e4a5523c57adc8f9e5bf6e1b17804482 RNGestureHandler: 61628a2c859172551aa2100d3e73d1e57878392f - RNReanimated: 536c4a11a340b5e0e94629b24101decc2df3126e + RNReanimated: 64573e25e078ae6bec03b891586d50b9ec284393 RNScreens: 4d83613b50b74ed277026375dc0810893b0c347f RNSVG: 302bfc9905bd8122f08966dc2ce2d07b7b52b9f8 SDWebImage: a7f831e1a65eb5e285e3fb046a23fcfbf08e696d diff --git a/packages/app/package.json b/packages/app/package.json index 78578a81e4e..daf2c801034 100644 --- a/packages/app/package.json +++ b/packages/app/package.json @@ -39,6 +39,7 @@ "expo-location": "^14.2.2", "expo-media-library": "^14.1.0", "expo-splash-screen": "^0.15.1", + "jsc-android": "npm:@onekeyfe/jsc-android", "lottie-ios": "3.2.3", "lottie-react": "^2.2.1", "lottie-react-native": "5.0.1", @@ -61,20 +62,18 @@ "react-native-keyboard-manager": "^6.5.4-4", "react-native-pager-view": "5.4.15", "react-native-randombytes": "^3.6.1", - "react-native-reanimated": "npm:@onekeyfe/react-native-reanimated", + "react-native-reanimated": "^2.8.0", "react-native-restart": "0.0.24", "react-native-safe-area-context": "4.2.4", "react-native-screens": "3.11.1", "react-native-svg": "^12.3.0", "react-native-toast-message": "2.1.2", - "react-native-v8": "^1.4.1", "react-native-vision-camera": "^2.13.3", "react-native-web": "0.17.7", "react-native-webview": "11.18.1", "readable-stream": "^3.6.0", "realm": "10.20.0-beta.2", "text-encoding": "^0.7.0", - "v8-android-jit": "^10.100.0", "vision-camera-code-scanner": "^0.2.0" }, "devDependencies": { diff --git a/packages/app/react-native.config.js b/packages/app/react-native.config.js index 4928f27c264..93c35f5d8a7 100644 --- a/packages/app/react-native.config.js +++ b/packages/app/react-native.config.js @@ -1,16 +1,16 @@ module.exports = { - dependencies: { - // disable frameprocessor and vision-camera-code-scanner - // until reanimated v3 offcially supports v8 - 'vision-camera-code-scanner': { - platforms: { - android: null, // disable Android platform, other platforms will still autolink if provided - }, - }, - 'react-native-vision-camera': { - platforms: { - android: null, // disable Android platform, other platforms will still autolink if provided - }, - }, - }, + // dependencies: { + // // disable frameprocessor and vision-camera-code-scanner + // // until reanimated v3 offcially supports v8 + // 'vision-camera-code-scanner': { + // platforms: { + // android: null, // disable Android platform, other platforms will still autolink if provided + // }, + // }, + // 'react-native-vision-camera': { + // platforms: { + // android: null, // disable Android platform, other platforms will still autolink if provided + // }, + // }, + // }, }; diff --git a/packages/kit/src/views/ScanQrcode/ScanCamera.ios.tsx b/packages/kit/src/views/ScanQrcode/ScanCamera.ios.tsx deleted file mode 100644 index 908458633e8..00000000000 --- a/packages/kit/src/views/ScanQrcode/ScanCamera.ios.tsx +++ /dev/null @@ -1,44 +0,0 @@ -import React, { FC } from 'react'; - -import { runOnJS } from 'react-native-reanimated'; -import { - Camera, - useCameraDevices, - useFrameProcessor, -} from 'react-native-vision-camera'; -import { BarcodeFormat, scanBarcodes } from 'vision-camera-code-scanner'; - -import { ScanCameraProps } from './types'; - -const ScanCamera: FC = ({ - style, - isActive, - children, - onQrcodeScanned, -}) => { - const devices = useCameraDevices(); - const device = devices.back; - const frameProcessor = useFrameProcessor((frame) => { - 'worklet'; - - const detectedBarcodes = scanBarcodes(frame, [BarcodeFormat.QR_CODE], { - checkInverted: true, - }); - runOnJS(onQrcodeScanned)(detectedBarcodes[0]?.rawValue); - }, []); - return device ? ( - <> - - {children} - - ) : null; -}; -ScanCamera.displayName = 'ScanCamera'; - -export default ScanCamera; diff --git a/packages/kit/src/views/ScanQrcode/ScanCamera.tsx b/packages/kit/src/views/ScanQrcode/ScanCamera.tsx index c6824f24322..908458633e8 100644 --- a/packages/kit/src/views/ScanQrcode/ScanCamera.tsx +++ b/packages/kit/src/views/ScanQrcode/ScanCamera.tsx @@ -1,7 +1,12 @@ import React, { FC } from 'react'; -import { BarCodeScanner } from 'expo-barcode-scanner'; -import { Camera } from 'expo-camera'; +import { runOnJS } from 'react-native-reanimated'; +import { + Camera, + useCameraDevices, + useFrameProcessor, +} from 'react-native-vision-camera'; +import { BarcodeFormat, scanBarcodes } from 'vision-camera-code-scanner'; import { ScanCameraProps } from './types'; @@ -10,19 +15,30 @@ const ScanCamera: FC = ({ isActive, children, onQrcodeScanned, -}) => - isActive ? ( - onQrcodeScanned(data)} - barCodeScannerSettings={{ - // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access - barCodeTypes: [BarCodeScanner.Constants.BarCodeType.qr], - }} - > +}) => { + const devices = useCameraDevices(); + const device = devices.back; + const frameProcessor = useFrameProcessor((frame) => { + 'worklet'; + + const detectedBarcodes = scanBarcodes(frame, [BarcodeFormat.QR_CODE], { + checkInverted: true, + }); + runOnJS(onQrcodeScanned)(detectedBarcodes[0]?.rawValue); + }, []); + return device ? ( + <> + {children} - + ) : null; +}; ScanCamera.displayName = 'ScanCamera'; export default ScanCamera; diff --git a/packages/kit/src/views/ScanQrcode/ScanCamera.web.tsx b/packages/kit/src/views/ScanQrcode/ScanCamera.web.tsx new file mode 100644 index 00000000000..c6824f24322 --- /dev/null +++ b/packages/kit/src/views/ScanQrcode/ScanCamera.web.tsx @@ -0,0 +1,28 @@ +import React, { FC } from 'react'; + +import { BarCodeScanner } from 'expo-barcode-scanner'; +import { Camera } from 'expo-camera'; + +import { ScanCameraProps } from './types'; + +const ScanCamera: FC = ({ + style, + isActive, + children, + onQrcodeScanned, +}) => + isActive ? ( + onQrcodeScanned(data)} + barCodeScannerSettings={{ + // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access + barCodeTypes: [BarCodeScanner.Constants.BarCodeType.qr], + }} + > + {children} + + ) : null; +ScanCamera.displayName = 'ScanCamera'; + +export default ScanCamera; diff --git a/patches/@starcoin+starcoin+2.1.5.patch b/patches/@starcoin+starcoin+2.1.5.patch new file mode 100644 index 00000000000..0f760beb3a0 --- /dev/null +++ b/patches/@starcoin+starcoin+2.1.5.patch @@ -0,0 +1,26 @@ +diff --git a/node_modules/@starcoin/starcoin/dist/starcoin.js b/node_modules/@starcoin/starcoin/dist/starcoin.js +index cd80f13..80fb4b9 100644 +--- a/node_modules/@starcoin/starcoin/dist/starcoin.js ++++ b/node_modules/@starcoin/starcoin/dist/starcoin.js +@@ -438,8 +438,8 @@ var BinarySerializer = /*#__PURE__*/function () { + var low = BigInt(value) & BinarySerializer.BIG_32Fs; + var high = BigInt(value) >> BinarySerializer.BIG_32; // write little endian number + +- this.serializeU32(Number(low)); +- this.serializeU32(Number(high)); ++ this.serializeU32(parseInt(low)); ++ this.serializeU32(parseInt(high)); + }; + + _proto.serializeU128 = function serializeU128(value) { +@@ -475,8 +475,8 @@ var BinarySerializer = /*#__PURE__*/function () { + var low = BigInt(value) & BinarySerializer.BIG_32Fs; + var high = BigInt(value) >> BinarySerializer.BIG_32; // write little endian number + +- this.serializeI32(Number(low)); +- this.serializeI32(Number(high)); ++ this.serializeI32(parseInt(low)); ++ this.serializeI32(parseInt(high)); + }; + + _proto.serializeI128 = function serializeI128(value) { diff --git a/yarn.lock b/yarn.lock index dd8ce01a241..6c4f1eab9cf 100644 --- a/yarn.lock +++ b/yarn.lock @@ -14617,7 +14617,7 @@ jsbn@~0.1.0: resolved "https://registry.nlark.com/jsbn/download/jsbn-0.1.1.tgz#a5e654c2e5a2deb5f201d96cefbca80c0ef2f513" integrity sha1-peZUwuWi3rXyAdls77yoDA7y9RM= -jsc-android@^250230.2.1: +jsc-android@^250230.2.1, "jsc-android@npm:@onekeyfe/jsc-android": version "250230.2.1" resolved "https://registry.yarnpkg.com/@onekeyfe/jsc-android/-/jsc-android-250230.2.1.tgz#26917ac7e409642c00df70d4afb390ff708a91f1" integrity sha512-qZgN2vF/5O8PxC+5ivQL8H4nAPymXfCNtdMDV3nMqtqznWYtL0TwTdk6Ct2WdiOpIwE82klmbBzIlyUCQPYh2Q== @@ -18650,10 +18650,10 @@ react-native-randombytes@^3.6.1: buffer "^4.9.1" sjcl "^1.0.3" -"react-native-reanimated@npm:@onekeyfe/react-native-reanimated": - version "3.0.0-rc.0" - resolved "https://registry.yarnpkg.com/@onekeyfe/react-native-reanimated/-/react-native-reanimated-3.0.0-rc.0.tgz#53d980a6ee28f85be5bc604c495edfbea42d13d3" - integrity sha512-YcU9aYFA/faxW/i7g8cP4rLfg79H0ylq19+RwOaJX0n9OpOUV2ydzYuRFpF3N3H9maAWm4rRYvJyS82XzPqgEA== +react-native-reanimated@^2.8.0: + version "2.8.0" + resolved "https://registry.yarnpkg.com/react-native-reanimated/-/react-native-reanimated-2.8.0.tgz#93c06ca84d91fb3865110b0857c49a24e316130e" + integrity sha512-kJvf/UWLBMaGCs9X66MKq5zdFMgwx8D0nHnolbHR7s8ZnbLdb7TlQ/yuzIXqn/9wABfnwtNRI3CyaP1aHWMmZg== dependencies: "@babel/plugin-transform-object-assign" "^7.16.7" "@babel/preset-typescript" "^7.16.7" @@ -18756,11 +18756,6 @@ react-native-uuid@^2.0.1: resolved "https://registry.yarnpkg.com/react-native-uuid/-/react-native-uuid-2.0.1.tgz#ed4e2dfb1683eddb66967eb5dca140dfe1abddb9" integrity sha512-cptnoIbL53GTCrWlb/+jrDC6tvb7ypIyzbXNJcpR3Vab0mkeaaVd5qnB3f0whXYzS+SMoSQLcUUB0gEWqkPC0g== -react-native-v8@^1.4.1: - version "1.4.1" - resolved "https://registry.yarnpkg.com/react-native-v8/-/react-native-v8-1.4.1.tgz#52129a0f6c52d3fa3d392474b5d7ac6b2e6500e4" - integrity sha512-5HTfa8H4kK2xv1VunT5zZOJxiuPh12VdBoZEBO4i4TTWBNCtuB6VKmHFkAidKXEc8otH6JLYtgVdLe97qnS0mQ== - react-native-vision-camera@^2.13.3: version "2.13.3" resolved "https://registry.yarnpkg.com/react-native-vision-camera/-/react-native-vision-camera-2.13.3.tgz#cacd20b7f3fd777691496f007a47a34c02be93be" @@ -22004,11 +21999,6 @@ uuid@^8.0.0, uuid@^8.3.0, uuid@^8.3.2: resolved "https://registry.yarnpkg.com/uuid/-/uuid-8.3.2.tgz#80d5b5ced271bb9af6c445f21a1a04c606cefbe2" integrity sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg== -v8-android-jit@^10.100.0: - version "10.100.0" - resolved "https://registry.yarnpkg.com/v8-android-jit/-/v8-android-jit-10.100.0.tgz#7d939ce615b1e8457e5ff52056d01cb5a5bdcefa" - integrity sha512-jakoPAKXK6a/q7LFx2ZjrdcVfR0V4jXaoDAyrWOt3SiPQGL6uq+3tdyQxX6OdPqYrK8xz8HGjW4EhD9xY1fC1Q== - v8-compile-cache@^2.0.3: version "2.3.0" resolved "https://registry.yarnpkg.com/v8-compile-cache/-/v8-compile-cache-2.3.0.tgz#2de19618c66dc247dcfb6f99338035d8245a2cee"