mirror of
https://github.com/status-im/status-react.git
synced 2025-01-11 03:26:31 +00:00
[#4201] Remove browser item from home on back button if current page has error
Signed-off-by: Julien Eluard <julien.eluard@gmail.com>
This commit is contained in:
parent
5f430d2cc8
commit
d4d4406341
@ -12,13 +12,15 @@
|
|||||||
(spec/def :browser/fullscreen? (spec/nilable boolean?))
|
(spec/def :browser/fullscreen? (spec/nilable boolean?))
|
||||||
(spec/def :browser/can-go-back? (spec/nilable boolean?))
|
(spec/def :browser/can-go-back? (spec/nilable boolean?))
|
||||||
(spec/def :browser/can-go-forward? (spec/nilable boolean?))
|
(spec/def :browser/can-go-forward? (spec/nilable boolean?))
|
||||||
|
(spec/def :browser/error? (spec/nilable boolean?))
|
||||||
|
|
||||||
(spec/def :browser/options
|
(spec/def :browser/options
|
||||||
(allowed-keys
|
(allowed-keys
|
||||||
:opt-un [:browser/browser-id
|
:opt-un [:browser/browser-id
|
||||||
:browser/can-go-back?
|
:browser/can-go-back?
|
||||||
:browser/can-go-forward?
|
:browser/can-go-forward?
|
||||||
:browser/fullscreen?]))
|
:browser/fullscreen?
|
||||||
|
:browser/error?]))
|
||||||
|
|
||||||
(spec/def :browser/browser
|
(spec/def :browser/browser
|
||||||
(allowed-keys
|
(allowed-keys
|
||||||
|
@ -79,15 +79,19 @@
|
|||||||
(views/defview browser []
|
(views/defview browser []
|
||||||
(views/letsubs [webview (atom nil)
|
(views/letsubs [webview (atom nil)
|
||||||
{:keys [address]} [:get-current-account]
|
{:keys [address]} [:get-current-account]
|
||||||
{:keys [dapp? contact url] :as browser} [:get-current-browser]
|
{:keys [dapp? contact url browser-id] :as browser} [:get-current-browser]
|
||||||
{:keys [can-go-back? can-go-forward?]} [:get :browser/options]
|
{:keys [can-go-back? can-go-forward? error?]} [:get :browser/options]
|
||||||
extra-js [:web-view-extra-js]
|
extra-js [:web-view-extra-js]
|
||||||
rpc-url [:get :rpc-url]
|
rpc-url [:get :rpc-url]
|
||||||
network-id [:get-network-id]]
|
network-id [:get-network-id]]
|
||||||
[react/keyboard-avoiding-view styles/browser
|
[react/keyboard-avoiding-view styles/browser
|
||||||
[status-bar/status-bar]
|
[status-bar/status-bar]
|
||||||
[toolbar.view/toolbar {}
|
[toolbar.view/toolbar {}
|
||||||
[toolbar.view/nav-button-with-count actions/default-close]
|
[toolbar.view/nav-button-with-count
|
||||||
|
(actions/close (fn []
|
||||||
|
(re-frame/dispatch [:navigate-back])
|
||||||
|
(when error?
|
||||||
|
(re-frame/dispatch [:remove-browser browser-id]))))]
|
||||||
(if dapp?
|
(if dapp?
|
||||||
[toolbar-content-dapp contact]
|
[toolbar-content-dapp contact]
|
||||||
[toolbar-content browser])]
|
[toolbar-content browser])]
|
||||||
@ -102,6 +106,8 @@
|
|||||||
:render-error web-view-error
|
:render-error web-view-error
|
||||||
:render-loading web-view-loading
|
:render-loading web-view-loading
|
||||||
:on-navigation-state-change #(on-navigation-change % browser)
|
:on-navigation-state-change #(on-navigation-change % browser)
|
||||||
|
:on-load #(re-frame/dispatch [:update-browser-options {:error? false}])
|
||||||
|
:on-error #(re-frame/dispatch [:update-browser-options {:error? true}])
|
||||||
:injected-on-start-loading-java-script (str js-res/web3
|
:injected-on-start-loading-java-script (str js-res/web3
|
||||||
js-res/jquery
|
js-res/jquery
|
||||||
(get-inject-js url)
|
(get-inject-js url)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user