Use community WebView
Signed-off-by: Vitaliy Vlasov <siphiuel@gmail.com>
This commit is contained in:
parent
86d85df5d3
commit
85d0022b26
|
@ -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'
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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')
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -563,7 +563,6 @@ var TopLevel = {
|
|||
"FlatList" : function () {},
|
||||
"warn" : function () {},
|
||||
"WebView" : function () {},
|
||||
"WebViewBridgeModule" : function () {},
|
||||
"width" : function () {},
|
||||
"window" : function () {},
|
||||
"writeCopyTo" : function () {},
|
||||
|
|
|
@ -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 {}}))
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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/**",
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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": {
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -22,10 +22,5 @@ module.exports = {
|
|||
ios: null,
|
||||
},
|
||||
},
|
||||
'react-native-webview-bridge': {
|
||||
platforms: {
|
||||
android: null,
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
|
|
|
@ -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))
|
||||
|
|
|
@ -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();
|
||||
ethereum = new EthereumProvider();
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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]))
|
|
@ -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
|
||||
|
|
|
@ -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?))
|
||||
|
|
|
@ -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 {}})
|
||||
|
||||
|
|
Loading…
Reference in New Issue