Skip to content

Commit 85d0022

Browse files
author
Vitaliy Vlasov
committed
Use community WebView
Signed-off-by: Vitaliy Vlasov <[email protected]>
1 parent 86d85df commit 85d0022

File tree

23 files changed

+73
-101
lines changed

23 files changed

+73
-101
lines changed

android/app/build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,7 @@ android {
284284
}
285285

286286
dependencies {
287+
implementation project(':react-native-webview')
287288
implementation fileTree(dir: "libs", include: ["*.jar"])
288289
implementation "com.facebook.react:react-native:+" // From node_modules
289290

@@ -307,7 +308,6 @@ dependencies {
307308
// NOTE: Uncomment if building RN from a fork
308309
//compile ("com.facebook.react:react-native:0.55.4") { force = true } // From node_modules
309310
implementation project(':react-native-status')
310-
implementation project(':react-native-webview-bridge')
311311
implementation project(':react-native-status-keycard')
312312
implementation 'com.github.status-im:function:0.0.1'
313313
implementation 'com.facebook.fresco:fresco:2.0.0'

android/app/src/main/java/im/status/ethereum/MainActivity.java

-4
Original file line numberDiff line numberDiff line change
@@ -230,10 +230,6 @@ public void onRequestPermissionsResult(int requestCode, String[] permissions, in
230230
if (mPermissionListener != null && mPermissionListener.onRequestPermissionsResult(requestCode, permissions, grantResults)) {
231231
mPermissionListener = null;
232232
}
233-
if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
234-
// Permission has been granted. Start camera preview Activity.
235-
com.github.alinz.reactnativewebviewbridge.WebViewBridgeManager.grantAccess(requestCode);
236-
}
237233
}
238234

239235
@Override

android/app/src/main/java/im/status/ethereum/MainApplication.java

+1-2
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@
88

99
import com.aakashns.reactnativedialogs.ReactNativeDialogsPackage;
1010
import com.facebook.react.ReactApplication;
11+
import com.reactnativecommunity.webview.RNCWebViewPackage;
1112
import com.facebook.react.ReactNativeHost;
1213
import com.facebook.react.ReactPackage;
1314
import com.facebook.soloader.SoLoader;
14-
import com.github.alinz.reactnativewebviewbridge.WebViewBridgePackage;
1515

1616
import java.util.List;
1717

@@ -33,7 +33,6 @@ protected List<ReactPackage> getPackages() {
3333
packages.add(statusPackage);
3434
packages.add(new ReactNativeDialogsPackage());
3535
packages.add(new RNStatusKeycardPackage());
36-
packages.add(new WebViewBridgePackage(BuildConfig.DEBUG_WEBVIEW == "1"));
3736
return packages;
3837
}
3938

android/gradle.properties

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
# $keytool -genkey -v -keystore ./status-keystore.jks -keyalg RSA -keysize 2048 -validity 10000 -alias status
2222

2323
# Version requirements used throughout the Gradle scripts
24+
kotlinVersion=1.3.11
2425
minSdkVersion=23
2526
compileSdkVersion=29
2627
targetSdkVersion=29

android/settings.gradle

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
pluginManagement {
2+
include ':react-native-webview'
3+
project(':react-native-webview').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-webview/android')
24
repositories {
35
mavenLocal() // Let's prioritize local Maven repos so that Nix can provide them offline
46
gradlePluginPortal()
@@ -16,5 +18,3 @@ include ':react-native-status'
1618
project(':react-native-status').projectDir = new File(rootProject.projectDir, '../modules/react-native-status/android')
1719
include ':react-native-status-keycard'
1820
project(':react-native-status-keycard').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-status-keycard/android')
19-
include ':react-native-webview-bridge'
20-
project(':react-native-webview-bridge').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-webview-bridge/android')

clj-rn.conf.edn

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"react-native-image-resizer"
1919
"react-native-image-crop-picker"
2020
"react-native-svg"
21-
"react-native-webview-bridge"
21+
"react-native-webview"
2222
"react-native-touch-id"
2323
"web3-utils"
2424
"chance"

externs.js

-1
Original file line numberDiff line numberDiff line change
@@ -563,7 +563,6 @@ var TopLevel = {
563563
"FlatList" : function () {},
564564
"warn" : function () {},
565565
"WebView" : function () {},
566-
"WebViewBridgeModule" : function () {},
567566
"width" : function () {},
568567
"window" : function () {},
569568
"writeCopyTo" : function () {},

fiddle/src/status_im/react_native/js_dependencies.cljs

-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
:DeviceEventEmitter #js {:addListener (fn [])}
2121
:Dimensions #js {:get (fn [])}})
2222
(def vector-icons (fn [] #js {:default #js {}}))
23-
(def webview-bridge (fn [] #js {:default #js {}}))
2423
(def webview (fn [] #js {:WebView #js {}}))
2524
(def touchid (fn [] #js {}))
2625
(def svg (fn [] #js {:default #js {}}))

ios/Podfile

+2
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ target 'StatusIm' do
4545
pod 'SQLCipher', '~>3.0'
4646
pod 'SSZipArchive'
4747

48+
pod 'react-native-webview', :path => '../node_modules/react-native-webview'
49+
4850
target 'StatusImTests' do
4951
inherit! :search_paths
5052
# Pods for testing

ios/Podfile.lock

+4-10
Original file line numberDiff line numberDiff line change
@@ -205,9 +205,7 @@ PODS:
205205
- React
206206
- react-native-splash-screen (3.2.0):
207207
- React
208-
- react-native-webview (6.11.1):
209-
- React
210-
- react-native-webview-bridge (0.33.17):
208+
- react-native-webview (8.0.6):
211209
- React
212210
- React-RCTActionSheet (0.61.5):
213211
- React-Core/RCTActionSheetHeaders (= 0.61.5)
@@ -302,7 +300,6 @@ DEPENDENCIES:
302300
- react-native-shake (from `../node_modules/react-native-shake`)
303301
- react-native-splash-screen (from `../node_modules/react-native-splash-screen`)
304302
- react-native-webview (from `../node_modules/react-native-webview`)
305-
- react-native-webview-bridge (from `../node_modules/react-native-webview-bridge`)
306303
- React-RCTActionSheet (from `../node_modules/react-native/Libraries/ActionSheetIOS`)
307304
- React-RCTAnimation (from `../node_modules/react-native/Libraries/NativeAnimation`)
308305
- React-RCTBlob (from `../node_modules/react-native/Libraries/Blob`)
@@ -383,8 +380,6 @@ EXTERNAL SOURCES:
383380
:path: "../node_modules/react-native-splash-screen"
384381
react-native-webview:
385382
:path: "../node_modules/react-native-webview"
386-
react-native-webview-bridge:
387-
:path: "../node_modules/react-native-webview-bridge"
388383
React-RCTActionSheet:
389384
:path: "../node_modules/react-native/Libraries/ActionSheetIOS"
390385
React-RCTAnimation:
@@ -434,7 +429,7 @@ SPEC CHECKSUMS:
434429
FBLazyVector: aaeaf388755e4f29cd74acbc9e3b8da6d807c37f
435430
FBReactNativeSpec: 118d0d177724c2d67f08a59136eb29ef5943ec75
436431
Folly: 30e7936e1c45c08d884aa59369ed951a8e68cf51
437-
glog: 353a32027a69db3807b94c7cbc2900fc4370098c
432+
glog: 1f3da668190260b06b429bb211bfbee5cd790c28
438433
QBImagePickerController: d54cf93db6decf26baf6ed3472f336ef35cae022
439434
RCTRequired: b153add4da6e7dbc44aebf93f3cf4fcae392ddf1
440435
RCTTypeSafety: 9aa1b91d7f9310fc6eadc3cf95126ffe818af320
@@ -453,8 +448,7 @@ SPEC CHECKSUMS:
453448
react-native-safe-area-context: e200d4433aba6b7e60b52da5f37af11f7a0b0392
454449
react-native-shake: de052eaa3eadc4a326b8ddd7ac80c06e8d84528c
455450
react-native-splash-screen: 200d11d188e2e78cea3ad319964f6142b6384865
456-
react-native-webview: 0658813bcc4b6c22f3cbb035a2227aa896a8cbc0
457-
react-native-webview-bridge: 3023f6b0e84cdf8e4a96511d2b04e73b038f95f0
451+
react-native-webview: e32e5ced4c99d7240362690a65e3467d7ef535ef
458452
React-RCTActionSheet: 600b4d10e3aea0913b5a92256d2719c0cdd26d76
459453
React-RCTAnimation: 791a87558389c80908ed06cc5dfc5e7920dfa360
460454
React-RCTBlob: d89293cc0236d9cb0933d85e430b0bbe81ad1d72
@@ -480,6 +474,6 @@ SPEC CHECKSUMS:
480474
TouchID: ba4c656d849cceabc2e4eef722dea5e55959ecf4
481475
Yoga: f2a7cd4280bfe2cca5a7aed98ba0eb3d1310f18b
482476

483-
PODFILE CHECKSUM: 0483a7693bfa7c6ef9f214cdc7f614f67dec7448
477+
PODFILE CHECKSUM: 6133ef51e21994956d642302ee6b9f5a96c6dcd5
484478

485479
COCOAPODS: 1.8.4

ios/StatusIm.xcodeproj/project.pbxproj

+4
Original file line numberDiff line numberDiff line change
@@ -647,6 +647,7 @@
647647
"$(SRCROOT)/../node_modules/react-native-image-resizer/ios/RCTImageResizer",
648648
"$(SRCROOT)/../node_modules/react-native-splash-screen/ios",
649649
"$(SRCROOT)/../node_modules/react-native-config/ios/**",
650+
"$(SRCROOT)/../node_modules/react-native-webview/ios",
650651
"$(SRCROOT)/../node_modules/react-native/Libraries/LinkingIOS",
651652
);
652653
INFOPLIST_FILE = StatusIm/Info.plist;
@@ -696,6 +697,7 @@
696697
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
697698
"$(SRCROOT)/../node_modules/react-native/React/**",
698699
"$(SRCROOT)/../node_modules/react-native-camera/ios",
700+
"$(SRCROOT)/../node_modules/react-native-webview/ios",
699701
"$(SRCROOT)/../node_modules/react-native-fs/**",
700702
"$(SRCROOT)/../node_modules/react-native-languages/RNLanguages",
701703
"$(SRCROOT)/../modules/react-native-status/ios/RCTStatus/**",
@@ -782,6 +784,7 @@
782784
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
783785
"$(SRCROOT)/../node_modules/react-native/React/**",
784786
"$(SRCROOT)/../node_modules/react-native-camera/ios",
787+
"$(SRCROOT)/../node_modules/react-native-webview/ios",
785788
"$(SRCROOT)/../node_modules/react-native-fs/**",
786789
"$(SRCROOT)/../node_modules/react-native-languages/RNLanguages",
787790
"$(SRCROOT)/../modules/react-native-status/ios/RCTStatus/**",
@@ -845,6 +848,7 @@
845848
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
846849
"$(SRCROOT)/../node_modules/react-native/React/**",
847850
"$(SRCROOT)/../node_modules/react-native-camera/ios",
851+
"$(SRCROOT)/../node_modules/react-native-webview/ios",
848852
"$(SRCROOT)/../node_modules/react-native-fs/**",
849853
"$(SRCROOT)/../node_modules/react-native-languages/RNLanguages",
850854
"$(SRCROOT)/../modules/react-native-status/ios/RCTStatus/**",

mobile/js_files/DEPENDENCIES.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ TODO: updating requires a pod update on iOS
152152

153153
used for touch-id identification
154154

155-
## "react-native-webview-bridge": "git+https://github.com/status-im/react-native-webview-bridge.git#fix/classnames-colision"
155+
## "react-native-webview": "git+https://github.com/status-im/react-native-webview.git#v8.0.7_3"
156156

157157
used for browser
158158

mobile/js_files/package.json

+1-2
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,7 @@
4646
"react-native-status-keycard": "git+https://github.com/status-im/react-native-status-keycard.git#v2.5.20",
4747
"react-native-svg": "^9.8.4",
4848
"react-native-touch-id": "^4.4.1",
49-
"react-native-webview": "^6.11.1",
50-
"react-native-webview-bridge": "git+https://github.com/status-im/react-native-webview-bridge.git#fix/community-webview",
49+
"react-native-webview": "git+https://github.com/status-im/react-native-webview#v8.0.7_3",
5150
"web3-utils": "^1.2.1"
5251
},
5352
"devDependencies": {

mobile/js_files/yarn.lock

+10-26
Original file line numberDiff line numberDiff line change
@@ -2247,7 +2247,12 @@ escape-html@~1.0.3:
22472247
resolved "https://registry.yarnpkg.com/escape-html/-/escape-html-1.0.3.tgz#0258eae4d3d0c0974de1c169188ef0051d1d1988"
22482248
integrity sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg=
22492249

2250-
[email protected], escape-string-regexp@^1.0.5:
2250+
2251+
version "2.0.0"
2252+
resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-2.0.0.tgz#a30304e99daa32e23b2fd20f51babd07cffca344"
2253+
integrity sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w==
2254+
2255+
escape-string-regexp@^1.0.5:
22512256
version "1.0.5"
22522257
resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4"
22532258
integrity sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=
@@ -2986,13 +2991,6 @@ inquirer@^3.0.6:
29862991
strip-ansi "^4.0.0"
29872992
through "^2.3.6"
29882993

2989-
2990-
version "2.2.0"
2991-
resolved "https://registry.yarnpkg.com/invariant/-/invariant-2.2.0.tgz#c8d7e847366a49cc18b622f058a689d481e895f2"
2992-
integrity sha1-yNfoRzZqScwYtiLwWKaJ1IHolfI=
2993-
dependencies:
2994-
loose-envify "^1.0.0"
2995-
29962994
[email protected], invariant@^2.2.2, invariant@^2.2.4, invariant@^2.2.x:
29972995
version "2.2.4"
29982996
resolved "https://registry.yarnpkg.com/invariant/-/invariant-2.2.4.tgz#610f3c92c9359ce1db616e538008d23ff35158e6"
@@ -3471,11 +3469,6 @@ jsx-ast-utils@^1.4.0:
34713469
resolved "https://registry.yarnpkg.com/jsx-ast-utils/-/jsx-ast-utils-1.4.1.tgz#3867213e8dd79bf1e8f2300c0cfc1efb182c0df1"
34723470
integrity sha1-OGchPo3Xm/Ho8jAMDPwe+xgsDfE=
34733471

3474-
3475-
version "0.1.1"
3476-
resolved "https://registry.yarnpkg.com/keymirror/-/keymirror-0.1.1.tgz#918889ea13f8d0a42e7c557250eee713adc95c35"
3477-
integrity sha1-kYiJ6hP40KQufFVyUO7nE63JXDU=
3478-
34793472
kind-of@^1.1.0:
34803473
version "1.1.0"
34813474
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:
49624955
resolved "https://registry.yarnpkg.com/react-native-touch-id/-/react-native-touch-id-4.4.1.tgz#8b1bb2d04c30bac36bb9696d2d723e719c4a8b08"
49634956
integrity sha512-1jTl8fC+0fxvqegy/XXTyo6vMvPhjzkoDdaqoYZx0OH8AT250NuXnNPyKktvigIcys3+2acciqOeaCall7lrvg==
49644957

4965-
"react-native-webview-bridge@git+https://github.com/status-im/react-native-webview-bridge.git#fix/community-webview":
4966-
version "0.33.17"
4967-
resolved "git+https://github.com/status-im/react-native-webview-bridge.git#55acc0cb683dc239673bbe5a94b1f13e7b90e1f7"
4968-
dependencies:
4969-
invariant "2.2.0"
4970-
keymirror "0.1.1"
4971-
react-native-webview "^6.11.1"
4972-
4973-
react-native-webview@^6.11.1:
4974-
version "6.11.1"
4975-
resolved "https://registry.yarnpkg.com/react-native-webview/-/react-native-webview-6.11.1.tgz#51fab0838ef9bdf3efd0d3f27147dddda5119f94"
4976-
integrity sha512-0OaNCEzdyywJZ70y6Z4fmmuAd2AHYq2AEByIr15z3YetpMXhm9lXUe2V/8BXQIZXeC9FJosj2DAKu48lpZ0nEg==
4958+
"react-native-webview@git+https://github.com/status-im/react-native-webview#v8.0.7_3":
4959+
version "8.0.7"
4960+
resolved "git+https://github.com/status-im/react-native-webview#fb3f4d616381a3c201272c32ced44ab1fc2d16be"
49774961
dependencies:
4978-
escape-string-regexp "1.0.5"
4962+
escape-string-regexp "2.0.0"
49794963
invariant "2.2.4"
49804964

49814965

react-native.config.js

-5
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,5 @@ module.exports = {
2222
ios: null,
2323
},
2424
},
25-
'react-native-webview-bridge': {
26-
platforms: {
27-
android: null,
28-
},
29-
},
3025
},
3126
};

react-native/src/mobile/status_im/react_native/js_dependencies.cljs

+1-2
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,9 @@
77
(def react (js/require "react"))
88
(def react-native (js/require "react-native"))
99
(def status-keycard (js/require "react-native-status-keycard"))
10-
(def webview-bridge (js/require "react-native-webview-bridge"))
10+
(def webview (js/require "react-native-webview"))
1111
(def touchid-class (js/require "react-native-touch-id"))
1212
(def touchid (.-default touchid-class))
13-
;(defn webview [] (js/require "react-native-webview"))
1413
(def EventEmmiter (js/require "react-native/Libraries/vendor/emitter/EventEmitter"))
1514
(def fetch-polyfill (js/require "react-native-fetch-polyfill"))
1615
(def fetch (.-default fetch-polyfill))

resources/js/provider.js

+6-7
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
if(typeof EthereumProvider === "undefined"){
22
var callbackId = 0;
33
var callbacks = {};
4-
var currentAccountAddress;
54

6-
function bridgeSend(data){
7-
WebViewBridge.send(JSON.stringify(data));
5+
bridgeSend = function (data) {
6+
ReactNativeWebView.postMessage(JSON.stringify(data));
87
}
98

109
function sendAPIrequest(permission, params) {
@@ -58,7 +57,7 @@ function UserRejectedRequest() {
5857
}
5958
UserRejectedRequest.prototype = Object.create(Error.prototype);
6059

61-
WebViewBridge.onMessage = function (message)
60+
ReactNativeWebView.onMessage = function (message)
6261
{
6362
data = JSON.parse(message);
6463
var id = data.messageId;
@@ -117,9 +116,9 @@ function web3Response (payload, result){
117116
}
118117

119118
function getSyncResponse (payload) {
120-
if (payload.method == "eth_accounts" && currentAccountAddress){
119+
if (payload.method == "eth_accounts" && (typeof currentAccountAddress !== "undefined")) {
121120
return web3Response(payload, [currentAccountAddress])
122-
} else if (payload.method == "eth_coinbase" && currentAccountAddress){
121+
} else if (payload.method == "eth_coinbase" && (typeof currentAccountAddress !== "undefined")) {
123122
return web3Response(payload, currentAccountAddress)
124123
} else if (payload.method == "net_version" || payload.method == "eth_chainId"){
125124
return web3Response(payload, networkId)
@@ -240,4 +239,4 @@ EthereumProvider.prototype.sendAsync = function (payload, callback)
240239
};
241240
}
242241

243-
ethereum = new EthereumProvider();
242+
ethereum = new EthereumProvider();

src/status_im/browser/core.cljs

+5-3
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,6 @@
378378
dapp-name (if dapp? name (http/url-host url-original))]
379379
(cond
380380
(and (= type constants/history-state-changed)
381-
platform/ios?
382381
(not= "about:blank" url))
383382
(fx/merge cofx
384383
(update-browser-history browser url)
@@ -417,9 +416,12 @@
417416
(re-frame/reg-fx
418417
:browser/send-to-bridge
419418
(fn [message]
420-
(let [webview @webview-ref/webview-ref]
419+
(let [webview @webview-ref/webview-ref
420+
msg (str "ReactNativeWebView.onMessage('"
421+
(types/clj->json message)
422+
"');")]
421423
(when (and message webview)
422-
(.sendToBridge webview (types/clj->json message))))))
424+
(.injectJavaScript webview msg)))))
423425

424426
(re-frame/reg-fx
425427
:browser/call-rpc

src/status_im/ui/components/svgimage.cljs

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
[reagent.core :as reagent]
44
[status-im.utils.platform :as platform]
55
[status-im.utils.http :as http]
6-
[status-im.ui.components.webview-bridge :as components.webview-bridge]))
6+
[status-im.ui.components.webview :as components.webview]))
77

88
(defn html [uri width height]
99
(str
@@ -46,7 +46,7 @@
4646
(fn []
4747
[react/view {:style style
4848
:on-layout #(reset! width (-> % .-nativeEvent .-layout .-width))}
49-
[components.webview-bridge/webview-bridge
49+
[components.webview/webview
5050
{:java-script-enabled false
5151
:third-party-cookies-enabled false
5252
:scroll-enabled false

0 commit comments

Comments
 (0)