Merge webview.js into provider.js

Signed-off-by: Vitaliy Vlasov <siphiuel@gmail.com>
This commit is contained in:
Vitaliy Vlasov 2020-06-22 17:26:36 +03:00
parent 98229c46cf
commit 84e50ffe4e
No known key found for this signature in database
GPG Key ID: A7D57C347F2B2964
4 changed files with 13 additions and 16 deletions

View File

@ -7,6 +7,18 @@
ReactNativeWebView.postMessage(JSON.stringify(data)); ReactNativeWebView.postMessage(JSON.stringify(data));
} }
var history = window.history;
var pushState = history.pushState;
history.pushState = function(state) {
setTimeout(function () {
bridgeSend({
type: 'history-state-changed',
navState: { url: location.href, title: document.title }
});
}, 100);
return pushState.apply(history, arguments);
};
function sendAPIrequest(permission, params) { function sendAPIrequest(permission, params) {
var messageId = callbackId++; var messageId = callbackId++;
var params = params || {}; var params = params || {};

View File

@ -1,13 +0,0 @@
(function () {
var history = window.history;
var pushState = history.pushState;
history.pushState = function(state) {
setTimeout(function () {
bridgeSend({
type: 'history-state-changed',
navState: { url: location.href, title: document.title }
});
}, 100);
return pushState.apply(history, arguments);
};
})();

View File

@ -136,8 +136,7 @@
:on-message #(re-frame/dispatch [:browser/bridge-message-received (.. ^js % -nativeEvent -data)]) :on-message #(re-frame/dispatch [:browser/bridge-message-received (.. ^js % -nativeEvent -data)])
:on-load #(re-frame/dispatch [:browser/loading-started]) :on-load #(re-frame/dispatch [:browser/loading-started])
:on-error #(re-frame/dispatch [:browser/error-occured]) :on-error #(re-frame/dispatch [:browser/error-occured])
:injected-java-script-before-content-loaded (js-res/ethereum-provider (str network-id)) :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] [navigation url-original can-go-back? can-go-forward? dapps-account]
[permissions.views/permissions-panel [(:dapp? browser) (:dapp browser) dapps-account] show-permission] [permissions.views/permissions-panel [(:dapp? browser) (:dapp browser) dapps-account] show-permission]
(when show-tooltip (when show-tooltip

View File

@ -1,7 +1,6 @@
(ns status-im.utils.js-resources (ns status-im.utils.js-resources
(:require-macros [status-im.utils.slurp :refer [slurp]])) (:require-macros [status-im.utils.slurp :refer [slurp]]))
(def webview-js (slurp "resources/js/webview.js"))
(def provider-file (slurp "resources/js/provider.js")) (def provider-file (slurp "resources/js/provider.js"))
(defn ethereum-provider [network-id] (defn ethereum-provider [network-id]
(str "window.statusAppNetworkId = \"" network-id "\";" (str "window.statusAppNetworkId = \"" network-id "\";"