From ce34bb4349d0117ee5c7f46f711ee6718e4367a3 Mon Sep 17 00:00:00 2001 From: Foo Pang Date: Sat, 10 Feb 2018 16:28:09 +0800 Subject: [PATCH] Fix broken spec validator for screen params Signed-off-by: Goran Jovic --- .../screens/add_new/open_dapp/navigation.cljs | 4 +-- .../ui/screens/add_new/open_dapp/views.cljs | 2 +- src/status_im/ui/screens/db.cljs | 36 ++++++++++--------- 3 files changed, 23 insertions(+), 19 deletions(-) diff --git a/src/status_im/ui/screens/add_new/open_dapp/navigation.cljs b/src/status_im/ui/screens/add_new/open_dapp/navigation.cljs index a09051071f..95f252659f 100644 --- a/src/status_im/ui/screens/add_new/open_dapp/navigation.cljs +++ b/src/status_im/ui/screens/add_new/open_dapp/navigation.cljs @@ -2,5 +2,5 @@ (:require [status-im.ui.screens.navigation :as navigation])) (defmethod navigation/preload-data! :dapp-description - [db [_ _ dapp]] - (assoc db :new/open-dapp dapp)) \ No newline at end of file + [db [_ _ {:keys [dapp]}]] + (assoc db :new/open-dapp dapp)) diff --git a/src/status_im/ui/screens/add_new/open_dapp/views.cljs b/src/status_im/ui/screens/add_new/open_dapp/views.cljs index 784141e196..d093ba0bb6 100644 --- a/src/status_im/ui/screens/add_new/open_dapp/views.cljs +++ b/src/status_im/ui/screens/add_new/open_dapp/views.cljs @@ -14,7 +14,7 @@ (defn render-row [row _ _] [contact-view/contact-view {:contact row - :on-press #(re-frame/dispatch [:navigate-to :dapp-description row]) + :on-press #(re-frame/dispatch [:navigate-to :dapp-description {:dapp row}]) :show-forward? true}]) (views/defview open-dapp [] diff --git a/src/status_im/ui/screens/db.cljs b/src/status_im/ui/screens/db.cljs index 881b7dd9b1..ead5806e16 100644 --- a/src/status_im/ui/screens/db.cljs +++ b/src/status_im/ui/screens/db.cljs @@ -87,27 +87,31 @@ ;; navigation screen params (spec/def :navigation.screen-params/network-details (allowed-keys :req [:networks/selected-network])) (spec/def :navigation.screen-params/browser (allowed-keys :req [:browser/browser-id])) -(spec/def :navigation.screen-params/contact (spec/nilable map?)) -(spec/def :navigation.screen-params/qr-source (spec/nilable keyword?)) -(spec/def :navigation.screen-params/qr-value (spec/nilable string?)) -(spec/def :navigation.screen-params/qr-viewer (allowed-keys :opt-un [:navigation.screen-params/contact - :navigation.screen-params/qr-source - :navigation.screen-params/qr-value])) -(spec/def :navigation.screen-params/current-qr-context (spec/nilable any?)) -(spec/def :navigation.screen-params/qr-scanner (allowed-keys :opt-un [:navigation.screen-params/current-qr-context])) -(spec/def :navigation.screen-params/show-search? (spec/nilable any?)) +(spec/def :navigation.screen-params.profile-qr-viewer/contact (spec/nilable map?)) +(spec/def :navigation.screen-params.profile-qr-viewer/source (spec/nilable keyword?)) +(spec/def :navigation.screen-params.profile-qr-viewer/value (spec/nilable string?)) +(spec/def :navigation.screen-params/profile-qr-viewer (allowed-keys :opt-un [:navigation.screen-params.profile-qr-viewer/contact + :navigation.screen-params.profile-qr-viewer/source + :navigation.screen-params.profile-qr-viewer/value])) +(spec/def :navigation.screen-params.qr-scanner/current-qr-context (spec/nilable any?)) +(spec/def :navigation.screen-params/qr-scanner (allowed-keys :opt-un [:navigation.screen-params.qr-scanner/current-qr-context])) +(spec/def :navigation.screen-params.group-contacts/show-search? (spec/nilable any?)) (spec/def :navigation.screen-params/group-contacts (allowed-keys :opt [:group/contact-group-id] - :opt-un [:navigation.screen-params/show-search?])) -(spec/def :navigation.screen-params/group (spec/nilable any?)) -(spec/def :navigation.screen-params/group-type (spec/nilable any?)) -(spec/def :navigation.screen-params/edit-contact-group (allowed-keys :opt-un [:navigation.screen-params/group - :navigation.screen-params/group-type])) + :opt-un [:navigation.screen-params.group-contacts/show-search?])) +(spec/def :navigation.screen-params.edit-contact-group/group (spec/nilable any?)) +(spec/def :navigation.screen-params.edit-contact-group/group-type (spec/nilable any?)) +(spec/def :navigation.screen-params/edit-contact-group (allowed-keys :opt-un [:navigation.screen-params.edit-contact-group/group + :navigation.screen-params.edit-contact-group/group-type])) +(spec/def :navigation.screen-params.dapp-description/dapp :new/open-dapp) +(spec/def :navigation.screen-params/dapp-description (allowed-keys :opt-un [:navigation.screen-params.dapp-description/dapp])) + (spec/def :navigation/screen-params (spec/nilable (allowed-keys :opt-un [:navigation.screen-params/network-details :navigation.screen-params/browser - :navigation.screen-params/qr-viewer + :navigation.screen-params/profile-qr-viewer :navigation.screen-params/qr-scanner :navigation.screen-params/group-contacts - :navigation.screen-params/edit-contact-group]))) + :navigation.screen-params/edit-contact-group + :navigation.screen-params/dapp-description]))) ;;;;NETWORK