diff --git a/android/app/build.gradle b/android/app/build.gradle index eeecc16d04..d84b9986b9 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -284,6 +284,7 @@ android { } dependencies { + implementation project(':react-native-webview') implementation fileTree(dir: "libs", include: ["*.jar"]) implementation "com.facebook.react:react-native:+" // From node_modules @@ -307,7 +308,6 @@ dependencies { // NOTE: Uncomment if building RN from a fork //compile ("com.facebook.react:react-native:0.55.4") { force = true } // From node_modules implementation project(':react-native-status') - implementation project(':react-native-webview-bridge') implementation project(':react-native-status-keycard') implementation 'com.github.status-im:function:0.0.1' implementation 'com.facebook.fresco:fresco:2.0.0' diff --git a/android/app/src/main/java/im/status/ethereum/MainActivity.java b/android/app/src/main/java/im/status/ethereum/MainActivity.java index 70aadc012a..5161f5cd63 100644 --- a/android/app/src/main/java/im/status/ethereum/MainActivity.java +++ b/android/app/src/main/java/im/status/ethereum/MainActivity.java @@ -230,10 +230,6 @@ public class MainActivity extends ReactFragmentActivity if (mPermissionListener != null && mPermissionListener.onRequestPermissionsResult(requestCode, permissions, grantResults)) { mPermissionListener = null; } - if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) { - // Permission has been granted. Start camera preview Activity. - com.github.alinz.reactnativewebviewbridge.WebViewBridgeManager.grantAccess(requestCode); - } } @Override 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 8333515247..4e970355e5 100644 --- a/android/app/src/main/java/im/status/ethereum/MainApplication.java +++ b/android/app/src/main/java/im/status/ethereum/MainApplication.java @@ -8,10 +8,10 @@ import com.facebook.react.bridge.JavaScriptExecutorFactory; import com.aakashns.reactnativedialogs.ReactNativeDialogsPackage; import com.facebook.react.ReactApplication; +import com.reactnativecommunity.webview.RNCWebViewPackage; import com.facebook.react.ReactNativeHost; import com.facebook.react.ReactPackage; import com.facebook.soloader.SoLoader; -import com.github.alinz.reactnativewebviewbridge.WebViewBridgePackage; import java.util.List; @@ -33,7 +33,6 @@ public class MainApplication extends MultiDexApplication implements ReactApplica packages.add(statusPackage); packages.add(new ReactNativeDialogsPackage()); packages.add(new RNStatusKeycardPackage()); - packages.add(new WebViewBridgePackage(BuildConfig.DEBUG_WEBVIEW == "1")); return packages; } diff --git a/android/gradle.properties b/android/gradle.properties index 03a37582dd..1f9655f265 100644 --- a/android/gradle.properties +++ b/android/gradle.properties @@ -21,6 +21,7 @@ # $keytool -genkey -v -keystore ./status-keystore.jks -keyalg RSA -keysize 2048 -validity 10000 -alias status # Version requirements used throughout the Gradle scripts +kotlinVersion=1.3.11 minSdkVersion=23 compileSdkVersion=29 targetSdkVersion=29 diff --git a/android/settings.gradle b/android/settings.gradle index 3dadae46ba..b2ff478070 100644 --- a/android/settings.gradle +++ b/android/settings.gradle @@ -1,4 +1,6 @@ pluginManagement { +include ':react-native-webview' +project(':react-native-webview').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-webview/android') repositories { mavenLocal() // Let's prioritize local Maven repos so that Nix can provide them offline gradlePluginPortal() @@ -16,5 +18,3 @@ include ':react-native-status' project(':react-native-status').projectDir = new File(rootProject.projectDir, '../modules/react-native-status/android') include ':react-native-status-keycard' project(':react-native-status-keycard').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-status-keycard/android') -include ':react-native-webview-bridge' -project(':react-native-webview-bridge').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-webview-bridge/android') diff --git a/clj-rn.conf.edn b/clj-rn.conf.edn index 9e82b7f798..7716bb03c3 100644 --- a/clj-rn.conf.edn +++ b/clj-rn.conf.edn @@ -18,7 +18,7 @@ "react-native-image-resizer" "react-native-image-crop-picker" "react-native-svg" - "react-native-webview-bridge" + "react-native-webview" "react-native-touch-id" "web3-utils" "chance" diff --git a/externs.js b/externs.js index d49c0b0f23..e9afb45002 100644 --- a/externs.js +++ b/externs.js @@ -563,7 +563,6 @@ var TopLevel = { "FlatList" : function () {}, "warn" : function () {}, "WebView" : function () {}, - "WebViewBridgeModule" : function () {}, "width" : function () {}, "window" : function () {}, "writeCopyTo" : function () {}, diff --git a/fiddle/src/status_im/react_native/js_dependencies.cljs b/fiddle/src/status_im/react_native/js_dependencies.cljs index 4e50ee99de..396d9f3e8f 100644 --- a/fiddle/src/status_im/react_native/js_dependencies.cljs +++ b/fiddle/src/status_im/react_native/js_dependencies.cljs @@ -20,7 +20,6 @@ :DeviceEventEmitter #js {:addListener (fn [])} :Dimensions #js {:get (fn [])}}) (def vector-icons (fn [] #js {:default #js {}})) -(def webview-bridge (fn [] #js {:default #js {}})) (def webview (fn [] #js {:WebView #js {}})) (def touchid (fn [] #js {})) (def svg (fn [] #js {:default #js {}})) diff --git a/ios/Podfile b/ios/Podfile index 73c8ff4d55..a9592c61f4 100644 --- a/ios/Podfile +++ b/ios/Podfile @@ -45,6 +45,8 @@ target 'StatusIm' do pod 'SQLCipher', '~>3.0' pod 'SSZipArchive' + pod 'react-native-webview', :path => '../node_modules/react-native-webview' + target 'StatusImTests' do inherit! :search_paths # Pods for testing diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 2c552ee3a8..3e1a5461d8 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -205,9 +205,7 @@ PODS: - React - react-native-splash-screen (3.2.0): - React - - react-native-webview (6.11.1): - - React - - react-native-webview-bridge (0.33.17): + - react-native-webview (8.0.6): - React - React-RCTActionSheet (0.61.5): - React-Core/RCTActionSheetHeaders (= 0.61.5) @@ -302,7 +300,6 @@ DEPENDENCIES: - react-native-shake (from `../node_modules/react-native-shake`) - react-native-splash-screen (from `../node_modules/react-native-splash-screen`) - react-native-webview (from `../node_modules/react-native-webview`) - - react-native-webview-bridge (from `../node_modules/react-native-webview-bridge`) - React-RCTActionSheet (from `../node_modules/react-native/Libraries/ActionSheetIOS`) - React-RCTAnimation (from `../node_modules/react-native/Libraries/NativeAnimation`) - React-RCTBlob (from `../node_modules/react-native/Libraries/Blob`) @@ -383,8 +380,6 @@ EXTERNAL SOURCES: :path: "../node_modules/react-native-splash-screen" react-native-webview: :path: "../node_modules/react-native-webview" - react-native-webview-bridge: - :path: "../node_modules/react-native-webview-bridge" React-RCTActionSheet: :path: "../node_modules/react-native/Libraries/ActionSheetIOS" React-RCTAnimation: @@ -434,7 +429,7 @@ SPEC CHECKSUMS: FBLazyVector: aaeaf388755e4f29cd74acbc9e3b8da6d807c37f FBReactNativeSpec: 118d0d177724c2d67f08a59136eb29ef5943ec75 Folly: 30e7936e1c45c08d884aa59369ed951a8e68cf51 - glog: 353a32027a69db3807b94c7cbc2900fc4370098c + glog: 1f3da668190260b06b429bb211bfbee5cd790c28 QBImagePickerController: d54cf93db6decf26baf6ed3472f336ef35cae022 RCTRequired: b153add4da6e7dbc44aebf93f3cf4fcae392ddf1 RCTTypeSafety: 9aa1b91d7f9310fc6eadc3cf95126ffe818af320 @@ -453,8 +448,7 @@ SPEC CHECKSUMS: react-native-safe-area-context: e200d4433aba6b7e60b52da5f37af11f7a0b0392 react-native-shake: de052eaa3eadc4a326b8ddd7ac80c06e8d84528c react-native-splash-screen: 200d11d188e2e78cea3ad319964f6142b6384865 - react-native-webview: 0658813bcc4b6c22f3cbb035a2227aa896a8cbc0 - react-native-webview-bridge: 3023f6b0e84cdf8e4a96511d2b04e73b038f95f0 + react-native-webview: e32e5ced4c99d7240362690a65e3467d7ef535ef React-RCTActionSheet: 600b4d10e3aea0913b5a92256d2719c0cdd26d76 React-RCTAnimation: 791a87558389c80908ed06cc5dfc5e7920dfa360 React-RCTBlob: d89293cc0236d9cb0933d85e430b0bbe81ad1d72 @@ -480,6 +474,6 @@ SPEC CHECKSUMS: TouchID: ba4c656d849cceabc2e4eef722dea5e55959ecf4 Yoga: f2a7cd4280bfe2cca5a7aed98ba0eb3d1310f18b -PODFILE CHECKSUM: 0483a7693bfa7c6ef9f214cdc7f614f67dec7448 +PODFILE CHECKSUM: 6133ef51e21994956d642302ee6b9f5a96c6dcd5 COCOAPODS: 1.8.4 diff --git a/ios/StatusIm.xcodeproj/project.pbxproj b/ios/StatusIm.xcodeproj/project.pbxproj index 6137e922de..5d19c378c0 100644 --- a/ios/StatusIm.xcodeproj/project.pbxproj +++ b/ios/StatusIm.xcodeproj/project.pbxproj @@ -647,6 +647,7 @@ "$(SRCROOT)/../node_modules/react-native-image-resizer/ios/RCTImageResizer", "$(SRCROOT)/../node_modules/react-native-splash-screen/ios", "$(SRCROOT)/../node_modules/react-native-config/ios/**", + "$(SRCROOT)/../node_modules/react-native-webview/ios", "$(SRCROOT)/../node_modules/react-native/Libraries/LinkingIOS", ); INFOPLIST_FILE = StatusIm/Info.plist; @@ -696,6 +697,7 @@ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, "$(SRCROOT)/../node_modules/react-native/React/**", "$(SRCROOT)/../node_modules/react-native-camera/ios", + "$(SRCROOT)/../node_modules/react-native-webview/ios", "$(SRCROOT)/../node_modules/react-native-fs/**", "$(SRCROOT)/../node_modules/react-native-languages/RNLanguages", "$(SRCROOT)/../modules/react-native-status/ios/RCTStatus/**", @@ -782,6 +784,7 @@ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, "$(SRCROOT)/../node_modules/react-native/React/**", "$(SRCROOT)/../node_modules/react-native-camera/ios", + "$(SRCROOT)/../node_modules/react-native-webview/ios", "$(SRCROOT)/../node_modules/react-native-fs/**", "$(SRCROOT)/../node_modules/react-native-languages/RNLanguages", "$(SRCROOT)/../modules/react-native-status/ios/RCTStatus/**", @@ -845,6 +848,7 @@ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, "$(SRCROOT)/../node_modules/react-native/React/**", "$(SRCROOT)/../node_modules/react-native-camera/ios", + "$(SRCROOT)/../node_modules/react-native-webview/ios", "$(SRCROOT)/../node_modules/react-native-fs/**", "$(SRCROOT)/../node_modules/react-native-languages/RNLanguages", "$(SRCROOT)/../modules/react-native-status/ios/RCTStatus/**", diff --git a/mobile/js_files/DEPENDENCIES.md b/mobile/js_files/DEPENDENCIES.md index 0aef6c38ce..088055d38a 100644 --- a/mobile/js_files/DEPENDENCIES.md +++ b/mobile/js_files/DEPENDENCIES.md @@ -152,7 +152,7 @@ TODO: updating requires a pod update on iOS used for touch-id identification -## "react-native-webview-bridge": "git+https://github.com/status-im/react-native-webview-bridge.git#fix/classnames-colision" +## "react-native-webview": "git+https://github.com/status-im/react-native-webview.git#v8.0.7_3" used for browser diff --git a/mobile/js_files/package.json b/mobile/js_files/package.json index ca3d3b4ff4..dda59f039d 100644 --- a/mobile/js_files/package.json +++ b/mobile/js_files/package.json @@ -46,8 +46,7 @@ "react-native-status-keycard": "git+https://github.com/status-im/react-native-status-keycard.git#v2.5.20", "react-native-svg": "^9.8.4", "react-native-touch-id": "^4.4.1", - "react-native-webview": "^6.11.1", - "react-native-webview-bridge": "git+https://github.com/status-im/react-native-webview-bridge.git#fix/community-webview", + "react-native-webview": "git+https://github.com/status-im/react-native-webview#v8.0.7_3", "web3-utils": "^1.2.1" }, "devDependencies": { diff --git a/mobile/js_files/yarn.lock b/mobile/js_files/yarn.lock index 7a5bf2afd3..e3bcb70769 100644 --- a/mobile/js_files/yarn.lock +++ b/mobile/js_files/yarn.lock @@ -2247,7 +2247,12 @@ escape-html@~1.0.3: resolved "https://registry.yarnpkg.com/escape-html/-/escape-html-1.0.3.tgz#0258eae4d3d0c0974de1c169188ef0051d1d1988" integrity sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg= -escape-string-regexp@1.0.5, escape-string-regexp@^1.0.5: +escape-string-regexp@2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-2.0.0.tgz#a30304e99daa32e23b2fd20f51babd07cffca344" + integrity sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w== + +escape-string-regexp@^1.0.5: version "1.0.5" resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" integrity sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ= @@ -2986,13 +2991,6 @@ inquirer@^3.0.6: strip-ansi "^4.0.0" through "^2.3.6" -invariant@2.2.0: - version "2.2.0" - resolved "https://registry.yarnpkg.com/invariant/-/invariant-2.2.0.tgz#c8d7e847366a49cc18b622f058a689d481e895f2" - integrity sha1-yNfoRzZqScwYtiLwWKaJ1IHolfI= - dependencies: - loose-envify "^1.0.0" - invariant@2.2.4, invariant@^2.2.2, invariant@^2.2.4, invariant@^2.2.x: version "2.2.4" resolved "https://registry.yarnpkg.com/invariant/-/invariant-2.2.4.tgz#610f3c92c9359ce1db616e538008d23ff35158e6" @@ -3471,11 +3469,6 @@ jsx-ast-utils@^1.4.0: resolved "https://registry.yarnpkg.com/jsx-ast-utils/-/jsx-ast-utils-1.4.1.tgz#3867213e8dd79bf1e8f2300c0cfc1efb182c0df1" integrity sha1-OGchPo3Xm/Ho8jAMDPwe+xgsDfE= -keymirror@0.1.1: - version "0.1.1" - resolved "https://registry.yarnpkg.com/keymirror/-/keymirror-0.1.1.tgz#918889ea13f8d0a42e7c557250eee713adc95c35" - integrity sha1-kYiJ6hP40KQufFVyUO7nE63JXDU= - kind-of@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-1.1.0.tgz#140a3d2d41a36d2efcfa9377b62c24f8495a5c44" @@ -4962,20 +4955,11 @@ react-native-touch-id@^4.4.1: resolved "https://registry.yarnpkg.com/react-native-touch-id/-/react-native-touch-id-4.4.1.tgz#8b1bb2d04c30bac36bb9696d2d723e719c4a8b08" integrity sha512-1jTl8fC+0fxvqegy/XXTyo6vMvPhjzkoDdaqoYZx0OH8AT250NuXnNPyKktvigIcys3+2acciqOeaCall7lrvg== -"react-native-webview-bridge@git+https://github.com/status-im/react-native-webview-bridge.git#fix/community-webview": - version "0.33.17" - resolved "git+https://github.com/status-im/react-native-webview-bridge.git#55acc0cb683dc239673bbe5a94b1f13e7b90e1f7" +"react-native-webview@git+https://github.com/status-im/react-native-webview#v8.0.7_3": + version "8.0.7" + resolved "git+https://github.com/status-im/react-native-webview#fb3f4d616381a3c201272c32ced44ab1fc2d16be" dependencies: - invariant "2.2.0" - keymirror "0.1.1" - react-native-webview "^6.11.1" - -react-native-webview@^6.11.1: - version "6.11.1" - resolved "https://registry.yarnpkg.com/react-native-webview/-/react-native-webview-6.11.1.tgz#51fab0838ef9bdf3efd0d3f27147dddda5119f94" - integrity sha512-0OaNCEzdyywJZ70y6Z4fmmuAd2AHYq2AEByIr15z3YetpMXhm9lXUe2V/8BXQIZXeC9FJosj2DAKu48lpZ0nEg== - dependencies: - escape-string-regexp "1.0.5" + escape-string-regexp "2.0.0" invariant "2.2.4" react-native@0.61.5: diff --git a/react-native.config.js b/react-native.config.js index f624194541..3357184d96 100644 --- a/react-native.config.js +++ b/react-native.config.js @@ -22,10 +22,5 @@ module.exports = { ios: null, }, }, - 'react-native-webview-bridge': { - platforms: { - android: null, - }, - }, }, }; diff --git a/react-native/src/mobile/status_im/react_native/js_dependencies.cljs b/react-native/src/mobile/status_im/react_native/js_dependencies.cljs index 74a70cc1d7..6f292d7ef8 100644 --- a/react-native/src/mobile/status_im/react_native/js_dependencies.cljs +++ b/react-native/src/mobile/status_im/react_native/js_dependencies.cljs @@ -7,10 +7,9 @@ (def react (js/require "react")) (def react-native (js/require "react-native")) (def status-keycard (js/require "react-native-status-keycard")) -(def webview-bridge (js/require "react-native-webview-bridge")) +(def webview (js/require "react-native-webview")) (def touchid-class (js/require "react-native-touch-id")) (def touchid (.-default touchid-class)) -;(defn webview [] (js/require "react-native-webview")) (def EventEmmiter (js/require "react-native/Libraries/vendor/emitter/EventEmitter")) (def fetch-polyfill (js/require "react-native-fetch-polyfill")) (def fetch (.-default fetch-polyfill)) diff --git a/resources/js/provider.js b/resources/js/provider.js index 8fa080568a..8b5dd18efc 100644 --- a/resources/js/provider.js +++ b/resources/js/provider.js @@ -1,10 +1,9 @@ if(typeof EthereumProvider === "undefined"){ var callbackId = 0; var callbacks = {}; -var currentAccountAddress; -function bridgeSend(data){ - WebViewBridge.send(JSON.stringify(data)); +bridgeSend = function (data) { + ReactNativeWebView.postMessage(JSON.stringify(data)); } function sendAPIrequest(permission, params) { @@ -58,7 +57,7 @@ function UserRejectedRequest() { } UserRejectedRequest.prototype = Object.create(Error.prototype); -WebViewBridge.onMessage = function (message) +ReactNativeWebView.onMessage = function (message) { data = JSON.parse(message); var id = data.messageId; @@ -117,9 +116,9 @@ function web3Response (payload, result){ } function getSyncResponse (payload) { - if (payload.method == "eth_accounts" && currentAccountAddress){ + if (payload.method == "eth_accounts" && (typeof currentAccountAddress !== "undefined")) { return web3Response(payload, [currentAccountAddress]) - } else if (payload.method == "eth_coinbase" && currentAccountAddress){ + } else if (payload.method == "eth_coinbase" && (typeof currentAccountAddress !== "undefined")) { return web3Response(payload, currentAccountAddress) } else if (payload.method == "net_version" || payload.method == "eth_chainId"){ return web3Response(payload, networkId) @@ -240,4 +239,4 @@ EthereumProvider.prototype.sendAsync = function (payload, callback) }; } -ethereum = new EthereumProvider(); \ No newline at end of file +ethereum = new EthereumProvider(); diff --git a/src/status_im/browser/core.cljs b/src/status_im/browser/core.cljs index e4eadbb34c..f6a6c4447c 100644 --- a/src/status_im/browser/core.cljs +++ b/src/status_im/browser/core.cljs @@ -378,7 +378,6 @@ dapp-name (if dapp? name (http/url-host url-original))] (cond (and (= type constants/history-state-changed) - platform/ios? (not= "about:blank" url)) (fx/merge cofx (update-browser-history browser url) @@ -417,9 +416,12 @@ (re-frame/reg-fx :browser/send-to-bridge (fn [message] - (let [webview @webview-ref/webview-ref] + (let [webview @webview-ref/webview-ref + msg (str "ReactNativeWebView.onMessage('" + (types/clj->json message) + "');")] (when (and message webview) - (.sendToBridge webview (types/clj->json message)))))) + (.injectJavaScript webview msg))))) (re-frame/reg-fx :browser/call-rpc diff --git a/src/status_im/ui/components/svgimage.cljs b/src/status_im/ui/components/svgimage.cljs index 55e061baac..c9ec6571d8 100644 --- a/src/status_im/ui/components/svgimage.cljs +++ b/src/status_im/ui/components/svgimage.cljs @@ -3,7 +3,7 @@ [reagent.core :as reagent] [status-im.utils.platform :as platform] [status-im.utils.http :as http] - [status-im.ui.components.webview-bridge :as components.webview-bridge])) + [status-im.ui.components.webview :as components.webview])) (defn html [uri width height] (str @@ -46,7 +46,7 @@ (fn [] [react/view {:style style :on-layout #(reset! width (-> % .-nativeEvent .-layout .-width))} - [components.webview-bridge/webview-bridge + [components.webview/webview {:java-script-enabled false :third-party-cookies-enabled false :scroll-enabled false diff --git a/src/status_im/ui/components/webview_bridge.cljs b/src/status_im/ui/components/webview.cljs similarity index 65% rename from src/status_im/ui/components/webview_bridge.cljs rename to src/status_im/ui/components/webview.cljs index 72bad351e3..5b04b79244 100644 --- a/src/status_im/ui/components/webview_bridge.cljs +++ b/src/status_im/ui/components/webview.cljs @@ -1,18 +1,18 @@ -(ns status-im.ui.components.webview-bridge +(ns status-im.ui.components.webview (:require [reagent.core :as reagent] [status-im.react-native.js-dependencies :as js-dependencies] [reagent.core :as reagent.core] [status-im.utils.platform :as platform] [status-im.utils.config :as config])) -(def webview-bridge-class +(def webview-class (memoize (fn [] - (reagent/adapt-react-class (.-default js-dependencies/webview-bridge))))) + (reagent/adapt-react-class (.-default js-dependencies/webview))))) -(defn module [] (.-WebViewBridgeModule (.-NativeModules js-dependencies/react-native))) +(defn module [] (.-WebViewModule (.-NativeModules js-dependencies/react-native))) -(defn webview-bridge [{:keys [dapp? dapp-name] :as opts}] +(defn webview [{:keys [dapp? dapp-name] :as opts}] (if (and config/cached-webviews-enabled? platform/android? dapp?) (reagent.core/create-class (let [dapp-name-sent? (reagent.core/atom false)] @@ -21,10 +21,10 @@ ;; unfortunately it's impossible to pass some initial params ;; to view, that's why we have to pass dapp-name to the module ;; before showing webview - (.setCurrentDapp (module) dapp-name - (fn [] (reset! dapp-name-sent? true)))) + #_(.setCurrentDapp (module) dapp-name + (fn [] (reset! dapp-name-sent? true)))) :reagent-render (fn [opts] (when @dapp-name-sent? - [(webview-bridge-class) opts]))})) - [(webview-bridge-class) opts])) + [(webview-class) opts]))})) + [(webview-class) opts])) diff --git a/src/status_im/ui/screens/browser/views.cljs b/src/status_im/ui/screens/browser/views.cljs index 99e97352e2..88f9990693 100644 --- a/src/status_im/ui/screens/browser/views.cljs +++ b/src/status_im/ui/screens/browser/views.cljs @@ -13,7 +13,7 @@ [status-im.ui.components.toolbar.actions :as actions] [status-im.ui.components.toolbar.view :as toolbar.view] [status-im.ui.components.tooltip.views :as tooltip] - [status-im.ui.components.webview-bridge :as components.webview-bridge] + [status-im.ui.components.webview :as components.webview] [status-im.ui.screens.browser.permissions.views :as permissions.views] [status-im.ui.screens.browser.site-blocked.views :as site-blocked.views] [status-im.ui.screens.browser.styles :as styles] @@ -118,25 +118,27 @@ (if unsafe? [site-blocked.views/view {:can-go-back? can-go-back? :site browser-id}] - [components.webview-bridge/webview-bridge - {:dapp? dapp? - :dapp-name name - :ref #(reset! webview-ref/webview-ref %) - :source (when (and url (not resolving?)) {:uri url}) - :java-script-enabled true - :bounces false - :local-storage-enabled true - :render-error web-view-error - :on-navigation-state-change #(do - (re-frame/dispatch [:set-in [:ens/registration :state] :searching]) - (debounce/debounce-and-dispatch - [:browser/navigation-state-changed % error?] - 500)) - :on-bridge-message #(re-frame/dispatch [:browser/bridge-message-received %]) - :on-load #(re-frame/dispatch [:browser/loading-started]) - :on-error #(re-frame/dispatch [:browser/error-occured]) - :injected-on-start-loading-java-script (js-res/ethereum-provider (str network-id)) - :injected-java-script (js-res/webview-js)}])] + [components.webview/webview + {:dapp? dapp? + :dapp-name name + :ref #(reset! webview-ref/webview-ref %) + :source (when (and url (not resolving?)) {:uri url}) + :java-script-enabled true + :bounces false + :local-storage-enabled true + :render-error web-view-error + :on-navigation-state-change #(do + (re-frame/dispatch [:set-in [:ens/registration :state] :searching]) + (debounce/debounce-and-dispatch + [:browser/navigation-state-changed % error?] + 500)) + ;; Extract event data here due to + ;; https://reactjs.org/docs/events.html#event-pooling + :on-message #(re-frame/dispatch [:browser/bridge-message-received (.. % -nativeEvent -data)]) + :on-load #(re-frame/dispatch [:browser/loading-started]) + :on-error #(re-frame/dispatch [:browser/error-occured]) + :injected-java-script-before-content-loaded (js-res/ethereum-provider (str network-id)) + :injected-java-script (js-res/webview-js)}])] [navigation url-original can-go-back? can-go-forward? dapps-account] [permissions.views/permissions-panel [(:dapp? browser) (:dapp browser) dapps-account] show-permission] (when show-tooltip diff --git a/src/status_im/ui/screens/db.cljs b/src/status_im/ui/screens/db.cljs index 0c15c5a96f..b7c7006480 100644 --- a/src/status_im/ui/screens/db.cljs +++ b/src/status_im/ui/screens/db.cljs @@ -67,7 +67,6 @@ ;;object? doesn't work (spec/def ::web3 (spec/nilable any?)) (spec/def ::web3-node-version (spec/nilable string?)) -;;object? ;;height of native keyboard if shown (spec/def ::keyboard-height (spec/nilable number?)) diff --git a/test/cljs/status_im/react_native/js_dependencies.cljs b/test/cljs/status_im/react_native/js_dependencies.cljs index 8abcdb9f10..224ca1caa6 100644 --- a/test/cljs/status_im/react_native/js_dependencies.cljs +++ b/test/cljs/status_im/react_native/js_dependencies.cljs @@ -26,7 +26,6 @@ (set! js/ReactNative react-native) (def vector-icons #js {:default #js {}}) -(def webview-bridge #js {:default #js {}}) (def webview #js {:WebView #js {}}) (def status-keycard #js {:default #js {}})