remove main-tabs ns

This commit is contained in:
Roman Volosovskyi 2019-02-24 18:14:45 +02:00
parent 8b01ae232c
commit 7a6a508696
No known key found for this signature in database
GPG Key ID: 0238A4B5ECEE70DE
5 changed files with 51 additions and 77 deletions

View File

@ -15,7 +15,8 @@
[status-im.ui.components.icons.vector-icons :as icons] [status-im.ui.components.icons.vector-icons :as icons]
[status-im.utils.datetime :as time] [status-im.utils.datetime :as time]
[status-im.ui.components.react :as components] [status-im.ui.components.react :as components]
[status-im.utils.utils :as utils])) [status-im.utils.utils :as utils]
[status-im.ui.components.status-bar.view :as status-bar]))
(defn- toolbar [show-welcome? show-sync-state sync-state latest-block-number logged-in?] (defn- toolbar [show-welcome? show-sync-state sync-state latest-block-number logged-in?]
(when-not (and show-welcome? (when-not (and show-welcome?
@ -113,22 +114,24 @@
#(re-frame/dispatch [:init-rest-of-chats]) #(re-frame/dispatch [:init-rest-of-chats])
100))))} 100))))}
[react/view styles/container [react/view styles/container
[toolbar show-welcome? (and network-initialized? (not rpc-network?)) sync-state latest-block-number (not logging-in?)] [status-bar/status-bar {:type :main}]
(cond show-welcome? [react/view (assoc styles/container :background-color :white)
[welcome view-id] [toolbar show-welcome? (and network-initialized? (not rpc-network?)) sync-state latest-block-number (not logging-in?)]
loading? (cond show-welcome?
[react/view {:style {:flex 1 [welcome view-id]
:justify-content :center loading?
:align-items :center}} [react/view {:style {:flex 1
[connectivity/connectivity-view] :justify-content :center
[components/activity-indicator {:flex 1 :align-items :center}}
:animating true}]] [connectivity/connectivity-view]
:else [components/activity-indicator {:flex 1
[react/view {:style {:flex 1}} :animating true}]]
[connectivity/connectivity-view] :else
[chats-list]]) [react/view {:style {:flex 1}}
(when platform/android? [connectivity/connectivity-view]
[home-action-button (not logging-in?)])])) [chats-list]])
(when platform/android?
[home-action-button (not logging-in?)])]]))
(views/defview home-wrapper [] (views/defview home-wrapper []
(views/letsubs [loading? [:get :chats/loading?]] (views/letsubs [loading? [:get :chats/loading?]]

View File

@ -1,33 +0,0 @@
(ns status-im.ui.screens.main-tabs.views
(:require-macros [status-im.utils.views :as views])
(:require [status-im.ui.components.react :as react]
[status-im.ui.components.status-bar.view :as status-bar.view]
[status-im.ui.components.styles :as common.styles]
[status-im.ui.screens.home.views :as home]
[status-im.ui.screens.wallet.main.views :as wallet.main]
[status-im.ui.screens.profile.user.views :as profile.user]))
(views/defview main-container [view-id]
;; :should-component-update is called only when props are changed,
;; that's why view-id is passed as a prop here. main-tabs component will be
;; rendered while next screen from stack navigator is shown, so we have
;; to prevent re-rendering to avoid no clause exception in case form
{:should-component-update
(fn [_ _ [_ new-view-id]]
(contains? #{:home :wallet :my-profile} new-view-id))}
[react/view common.styles/main-container
(case view-id
:home [home/home-wrapper]
:wallet [wallet.main/wallet]
:my-profile [profile.user/my-profile]
nil)])
(defn main-tabs [view-id]
[react/view common.styles/flex
[status-bar.view/status-bar
{:type (if (= view-id :wallet) :wallet-tab :main)}]
[main-container view-id]])
(defn get-main-tab [view-id]
(fn []
[main-tabs view-id]))

View File

@ -277,25 +277,27 @@
(js/setTimeout (js/setTimeout
#(.scrollToEnd @scroll {:animated false}) #(.scrollToEnd @scroll {:animated false})
300))] 300))]
[react/view profile.components.styles/profile [react/view {:flex 1}
(if editing? [status-bar/status-bar {:type :main}]
[my-profile-edit-toolbar on-show-edit] [react/view profile.components.styles/profile
[my-profile-toolbar]) (if editing?
[react/scroll-view {:ref #(reset! scroll %) [my-profile-edit-toolbar on-show-edit]
:keyboard-should-persist-taps :handled} [my-profile-toolbar])
[react/view profile.components.styles/profile-form [react/scroll-view {:ref #(reset! scroll %)
[profile.components/profile-header :keyboard-should-persist-taps :handled}
{:contact current-account [react/view profile.components.styles/profile-form
:edited-contact changed-account [profile.components/profile-header
:editing? editing? {:contact current-account
:allow-icon-change? true :edited-contact changed-account
:options (if (not= (identicon/identicon public-key) photo-path) :editing? editing?
(profile-icon-options-ext) :allow-icon-change? true
profile-icon-options) :options (if (not= (identicon/identicon public-key) photo-path)
:on-change-text-event :my-profile/update-name}]] (profile-icon-options-ext)
[share-profile-item (dissoc current-account :mnemonic)] profile-icon-options)
[contacts-list-item active-contacts-count] :on-change-text-event :my-profile/update-name}]]
[react/view styles/my-profile-info-container [share-profile-item (dissoc current-account :mnemonic)]
[my-profile-settings current-account shown-account currency (nil? login-data)]] [contacts-list-item active-contacts-count]
(when (nil? login-data) [react/view styles/my-profile-info-container
[advanced shown-account on-show-advanced])]]))) [my-profile-settings current-account shown-account currency (nil? login-data)]]
(when (nil? login-data)
[advanced shown-account on-show-advanced])]]])))

View File

@ -1,6 +1,5 @@
(ns status-im.ui.screens.routing.screens (ns status-im.ui.screens.routing.screens
(:require (:require
[status-im.ui.screens.main-tabs.views :as main-tabs]
[status-im.ui.screens.accounts.login.views :as login] [status-im.ui.screens.accounts.login.views :as login]
[status-im.ui.screens.accounts.recover.views :as recover] [status-im.ui.screens.accounts.recover.views :as recover]
[status-im.ui.screens.accounts.views :as accounts] [status-im.ui.screens.accounts.views :as accounts]
@ -55,7 +54,8 @@
[status-im.ui.screens.about-app.views :as about-app] [status-im.ui.screens.about-app.views :as about-app]
[status-im.ui.screens.stickers.views :as stickers] [status-im.ui.screens.stickers.views :as stickers]
[status-im.ui.screens.dapps-permissions.views :as dapps-permissions] [status-im.ui.screens.dapps-permissions.views :as dapps-permissions]
[status-im.ui.screens.mobile-network-settings.view :as mobile-network-settings])) [status-im.ui.screens.mobile-network-settings.view :as mobile-network-settings]
[status-im.ui.screens.home.views :as home]))
(def all-screens (def all-screens
{:login login/login {:login login/login
@ -69,7 +69,7 @@
:enter-pin hardwallet.pin/enter-pin :enter-pin hardwallet.pin/enter-pin
:hardwallet-setup hardwallet.setup/hardwallet-setup :hardwallet-setup hardwallet.setup/hardwallet-setup
:hardwallet-success hardwallet.success/hardwallet-success :hardwallet-success hardwallet.success/hardwallet-success
:home (main-tabs/get-main-tab :home) :home home/home-wrapper
:chat chat/chat :chat chat/chat
:profile profile.contact/profile :profile profile.contact/profile
:new add-new/add-new :new add-new/add-new
@ -96,7 +96,7 @@
:wallet-transaction-fee [:modal wallet.transaction-fee/transaction-fee] :wallet-transaction-fee [:modal wallet.transaction-fee/transaction-fee]
:wallet-onboarding-setup-modal [:modal wallet.onboarding/modal] :wallet-onboarding-setup-modal [:modal wallet.onboarding/modal]
:wallet-sign-message-modal [:modal send/sign-message-modal] :wallet-sign-message-modal [:modal send/sign-message-modal]
:wallet (main-tabs/get-main-tab :wallet) :wallet wallet.main/wallet
:collectibles-list collectibles/collectibles-list :collectibles-list collectibles/collectibles-list
:wallet-onboarding-setup wallet.onboarding/screen :wallet-onboarding-setup wallet.onboarding/screen
:wallet-send-transaction-chat send/send-transaction :wallet-send-transaction-chat send/send-transaction
@ -116,7 +116,7 @@
:selection-modal-screen [:modal screens.extensions/selection-modal-screen] :selection-modal-screen [:modal screens.extensions/selection-modal-screen]
:wallet-settings-assets [:modal wallet-settings/manage-assets] :wallet-settings-assets [:modal wallet-settings/manage-assets]
:wallet-transactions-filter [:modal wallet-transactions/filter-history] :wallet-transactions-filter [:modal wallet-transactions/filter-history]
:my-profile (main-tabs/get-main-tab :my-profile) :my-profile profile.user/my-profile
:contacts-list contacts-list/contacts-list :contacts-list contacts-list/contacts-list
:blocked-users-list contacts-list/blocked-users-list :blocked-users-list contacts-list/blocked-users-list
:profile-photo-capture photo-capture/profile-photo-capture :profile-photo-capture photo-capture/profile-photo-capture

View File

@ -160,6 +160,8 @@
error-message [:wallet/error-message] error-message [:wallet/error-message]
address-hex [:account/hex-address]] address-hex [:account/hex-address]]
[react/view styles/main-section [react/view styles/main-section
(when-not modal?
[status-bar.view/status-bar {:type :wallet-tab}])
(if modal? (if modal?
[toolbar-modal modal-history?] [toolbar-modal modal-history?]
[settings/toolbar-view]) [settings/toolbar-view])