From b7b221daffd95c26db20d24017b962b931b028b8 Mon Sep 17 00:00:00 2001 From: Roman Volosovskyi Date: Fri, 1 Mar 2019 14:26:42 +0200 Subject: [PATCH] Remove :wallet-modal screen as it is not used anymore --- .../ui/components/status_bar/view.cljs | 1 - .../ui/screens/routing/chat_stack.cljs | 1 - src/status_im/ui/screens/routing/screens.cljs | 1 - .../ui/screens/wallet/main/views.cljs | 74 ++++++++----------- .../ui/screens/wallet/navigation.cljs | 8 -- 5 files changed, 29 insertions(+), 56 deletions(-) diff --git a/src/status_im/ui/components/status_bar/view.cljs b/src/status_im/ui/components/status_bar/view.cljs index 5aff808174..a596509d33 100644 --- a/src/status_im/ui/components/status_bar/view.cljs +++ b/src/status_im/ui/components/status_bar/view.cljs @@ -64,7 +64,6 @@ :wallet-send-transaction {:type :wallet-tab} :sign-message-modal {:type :modal-wallet} :wallet-transaction-fee {:type :modal-wallet} - :wallet-modal {:type :modal-wallet} :wallet-onboarding-setup-modal {:type :modal-wallet} :wallet-send-transaction-modal {:type :modal-wallet} :wallet-settings-assets {:type :modal-wallet} diff --git a/src/status_im/ui/screens/routing/chat_stack.cljs b/src/status_im/ui/screens/routing/chat_stack.cljs index c126ce8ae3..41c8ff7a78 100644 --- a/src/status_im/ui/screens/routing/chat_stack.cljs +++ b/src/status_im/ui/screens/routing/chat_stack.cljs @@ -25,7 +25,6 @@ config/hardwallet-enabled? (concat [:hardwallet-connect :enter-pin])) :config {:initialRouteName :home}} - :wallet-modal :chat-modal :show-extension-modal :stickers-pack-modal diff --git a/src/status_im/ui/screens/routing/screens.cljs b/src/status_im/ui/screens/routing/screens.cljs index 5dc4eb3f7c..fce5a3a169 100644 --- a/src/status_im/ui/screens/routing/screens.cljs +++ b/src/status_im/ui/screens/routing/screens.cljs @@ -90,7 +90,6 @@ :stickers stickers/packs :stickers-pack stickers/pack :stickers-pack-modal [:modal stickers/pack-modal] - :wallet-modal [:modal wallet.main/wallet-modal] :chat-modal [:modal chat/chat-modal] :show-extension-modal [:modal extensions.add/show-extension-modal] :wallet-send-transaction-modal [:modal send/send-transaction-modal] diff --git a/src/status_im/ui/screens/wallet/main/views.cljs b/src/status_im/ui/screens/wallet/main/views.cljs index 663635480d..da7abe4eaa 100644 --- a/src/status_im/ui/screens/wallet/main/views.cljs +++ b/src/status_im/ui/screens/wallet/main/views.cljs @@ -102,9 +102,9 @@ :style {:width 12} :icon-opts {:color :gray}}]) -(defn- render-collectible [address-hex {:keys [symbol name icon amount] :as collectible} modal?] +(defn- render-collectible [address-hex {:keys [symbol name icon amount] :as collectible}] (let [items-number (money/to-fixed amount) - details? (and (pos? items-number) (not modal?))] + details? (pos? items-number)] [react/touchable-highlight (when details? {:on-press #(re-frame/dispatch [:show-collectibles-list address-hex collectible])}) @@ -127,7 +127,7 @@ (defn group-assets [v] (group-by #(if (:nft? %) :nfts :tokens) v)) -(defn- asset-section [assets currency address-hex modal?] +(defn- asset-section [assets currency address-hex] (let [{:keys [tokens nfts]} (group-assets assets)] [react/view styles/asset-section [list/section-list @@ -144,7 +144,7 @@ {:title (i18n/label :t/wallet-collectibles) :key :collectibles :data nfts - :render-fn #(render-collectible address-hex % modal?)}]}]])) + :render-fn #(render-collectible address-hex %)}]}]])) (defn snackbar [error-message] [react/view styles/snackbar-container @@ -155,53 +155,37 @@ (views/letsubs [assets [:wallet/visible-assets-with-amount] currency [:wallet/currency] portfolio-value [:portfolio-value] - {:keys [modal-history?]} [:get :wallet] {:keys [seed-backed-up?]} [:account/account] error-message [:wallet/error-message] address-hex [:account/hex-address]] [react/view styles/main-section - (when-not modal? - [status-bar.view/status-bar {:type :wallet-tab}]) - (if modal? - [toolbar-modal modal-history?] - [settings/toolbar-view]) - (if (and modal? modal-history?) - [react/view styles/modal-history - [transactions.views/history-list true]] - [react/scroll-view {:refresh-control - (reagent/as-element - [react/refresh-control {:on-refresh #(re-frame/dispatch [:wallet.ui/pull-to-refresh]) - :tint-color :white - :refreshing false}])} - (if error-message - [snackbar error-message] - [total-section portfolio-value currency]) - (when (and (not modal?) - (not seed-backed-up?) - (some (fn [{:keys [amount]}] - (and amount (not (.isZero amount)))) - assets)) - [backup-seed-phrase]) - (if modal? - [react/view styles/address-section - [react/text {:style styles/wallet-address - :accessibility-label :address-text - :selectable true} - address-hex]] - [react/view (merge {:background-color colors/blue} styles/action-section) - [list/flat-list - {:data actions - :key-fn (fn [_ i] (str i)) - :render-fn #(list/render-action % {:action-label-style {:font-size 17}})}]]) - [asset-section assets currency address-hex modal?] - ;; Hack to allow different colors for bottom scroll view (iOS only) - [react/view {:style styles/scroll-bottom}]])])) - -(views/defview wallet-modal [] - [wallet-root true]) + [status-bar.view/status-bar {:type :wallet-tab}] + [settings/toolbar-view] + [react/scroll-view {:refresh-control + (reagent/as-element + [react/refresh-control {:on-refresh #(re-frame/dispatch [:wallet.ui/pull-to-refresh]) + :tint-color :white + :refreshing false}])} + (if error-message + [snackbar error-message] + [total-section portfolio-value currency]) + (when (and (not modal?) + (not seed-backed-up?) + (some (fn [{:keys [amount]}] + (and amount (not (.isZero amount)))) + assets)) + [backup-seed-phrase]) + [react/view (merge {:background-color colors/blue} styles/action-section) + [list/flat-list + {:data actions + :key-fn (fn [_ i] (str i)) + :render-fn #(list/render-action % {:action-label-style {:font-size 17}})}]] + [asset-section assets currency address-hex] + ;; Hack to allow different colors for bottom scroll view (iOS only) + [react/view {:style styles/scroll-bottom}]]])) (views/defview wallet [] (views/letsubs [{:keys [wallet-set-up-passed?]} [:account/account]] (if (not wallet-set-up-passed?) [onboarding.views/onboarding] - [wallet-root false]))) + [wallet-root]))) diff --git a/src/status_im/ui/screens/wallet/navigation.cljs b/src/status_im/ui/screens/wallet/navigation.cljs index cb1f639b13..59570ebc02 100644 --- a/src/status_im/ui/screens/wallet/navigation.cljs +++ b/src/status_im/ui/screens/wallet/navigation.cljs @@ -18,14 +18,6 @@ (re-frame/dispatch [:update-wallet]) (assoc-in db [:wallet :current-tab] 0)) -(defmethod navigation/preload-data! :wallet-modal - [db _] - ;;TODO(goranjovic) - get rid of this preload hook completely - (re-frame/dispatch [:wallet.ui/pull-to-refresh]) - (re-frame/dispatch [:update-wallet]) - (re-frame/dispatch [:update-transactions]) - (assoc-in db [:wallet :modal-history?] false)) - (defmethod navigation/preload-data! :transactions-history [db _] (re-frame/dispatch [:update-transactions])