[#5698] null is not an object .sendToBridge

Signed-off-by: Andrey Shovkoplyas <motor4ik@gmail.com>
This commit is contained in:
Andrey Shovkoplyas 2018-09-24 13:50:46 +02:00
parent acb8c7905d
commit 9175f2e124
No known key found for this signature in database
GPG Key ID: EAAB7C8622D860A4
4 changed files with 6 additions and 13 deletions

View File

@ -20,10 +20,7 @@ window.addEventListener('message', function (event) {
WebViewBridge.onMessage = function (message) {
data = JSON.parse(message);
if (data.type === "navigate-to-blank")
window.location.href = "about:blank";
else if (data.type === "status-api-success")
if (data.type === "status-api-success")
{
window.dispatchEvent(new CustomEvent('statusapi', { detail: { permissions: data.keys,
data: data.data

View File

@ -21,10 +21,7 @@ window.addEventListener('message', function (event) {
WebViewBridge.onMessage = function (message) {
data = JSON.parse(message);
if (data.type === "navigate-to-blank")
window.location.href = "about:blank";
else if (data.type === "status-api-success")
if (data.type === "status-api-success")
{
if (data.keys == 'WEB3')
{

View File

@ -322,7 +322,8 @@
(re-frame/reg-fx
:browser/send-to-bridge
(fn [{:keys [message webview]}]
(.sendToBridge webview (types/clj->json message))))
(when (and message webview)
(.sendToBridge webview (types/clj->json message)))))
(re-frame/reg-fx
:browser/call-rpc

View File

@ -48,12 +48,10 @@
[react/touchable-highlight {:style {:flex 1} :on-press #(re-frame/dispatch [:browser.ui/url-input-pressed])}
[react/text {:style styles/url-text} (http/url-host url)]])]]))
(defn toolbar [webview error? url browser browser-id url-editing?]
(defn toolbar [error? url browser browser-id url-editing?]
[toolbar.view/toolbar {}
[toolbar.view/nav-button-with-count
(actions/close (fn []
(when @webview
(.sendToBridge @webview "navigate-to-blank"))
(re-frame/dispatch [:navigate-back])
(when error?
(re-frame/dispatch [:browser.ui/remove-browser-pressed browser-id]))))]
@ -108,7 +106,7 @@
(not (nil? (:url props)))))}
[react/view styles/browser
[status-bar/status-bar]
[toolbar webview error? url browser browser-id url-editing?]
[toolbar error? url browser browser-id url-editing?]
[react/view components.styles/flex
(if unsafe?
[site-blocked.views/view {:can-go-back? can-go-back?