Enable main wallet screen. WIP features are hidden behind flag

This commit is contained in:
Julien Eluard 2017-08-22 12:38:57 +02:00 committed by Roman Volosovskyi
parent ad65070fcf
commit 2585a32c7a
11 changed files with 59 additions and 44 deletions

2
.env
View File

@ -1,2 +1,2 @@
TESTFAIRY_ENABLED=0 TESTFAIRY_ENABLED=0
WALLET_TAB_ENABLED=0 WALLET_WIP_ENABLED=0

View File

@ -1,2 +1,2 @@
TESTFAIRY_ENABLED=1 TESTFAIRY_ENABLED=1
WALLET_TAB_ENABLED=1 WALLET_WIP_ENABLED=0

View File

@ -1 +1,2 @@
TESTFAIRY_ENABLED=0 TESTFAIRY_ENABLED=0
WALLET_WIP_ENABLED=0

View File

@ -11,7 +11,6 @@
[status-im.ui.screens.discover.views :refer [discover]] [status-im.ui.screens.discover.views :refer [discover]]
[status-im.ui.screens.contacts.views :refer [contact-groups-list]] [status-im.ui.screens.contacts.views :refer [contact-groups-list]]
[status-im.ui.screens.wallet.main.views :refer [wallet]] [status-im.ui.screens.wallet.main.views :refer [wallet]]
[status-im.utils.config :as config]
[status-im.components.tabs.views :refer [tabs]] [status-im.components.tabs.views :refer [tabs]]
[status-im.components.tabs.styles :as st] [status-im.components.tabs.styles :as st]
[status-im.components.styles :as common-st] [status-im.components.styles :as common-st]
@ -19,28 +18,26 @@
[cljs.core.async :as a])) [cljs.core.async :as a]))
(def tab-list (def tab-list
(concat [{:view-id :wallet
(when config/wallet-tab-enabled? :title (label :t/wallet)
[{:view-id :wallet :screen wallet
:title (label :t/wallet) :icon-inactive :icon_wallet_gray
:screen wallet :icon-active :icon_wallet_active}
:icon-inactive :icon_wallet_gray {:view-id :chat-list
:icon-active :icon_wallet_active}]) :title (label :t/chats)
[{:view-id :chat-list :screen chats-list
:title (label :t/chats) :icon-inactive :icon_chats
:screen chats-list :icon-active :icon_chats_active}
:icon-inactive :icon_chats {:view-id :discover
:icon-active :icon_chats_active} :title (label :t/discover)
{:view-id :discover :screen discover
:title (label :t/discover) :icon-inactive :icon_discover
:screen discover :icon-active :icon_discover_active}
:icon-inactive :icon_discover {:view-id :contact-list
:icon-active :icon_discover_active} :title (label :t/contacts)
{:view-id :contact-list :screen contact-groups-list
:title (label :t/contacts) :icon-inactive :icon_contacts
:screen contact-groups-list :icon-active :icon_contacts_active}])
:icon-inactive :icon_contacts
:icon-active :icon_contacts_active}]))
(def tab->index (reduce #(assoc %1 (:view-id %2) (count %1)) {} tab-list)) (def tab->index (reduce #(assoc %1 (:view-id %2) (count %1)) {} tab-list))

View File

@ -115,6 +115,11 @@
(merge {:underlay-color :transparent} props) (merge {:underlay-color :transparent} props)
content]) content])
(defn touchable-icon [n style handler]
[touchable-highlight {:on-press handler}
[view
[icon n style]]])
(def picker-item (def picker-item
(when-let [picker (get-react-property "Picker")] (when-let [picker (get-react-property "Picker")]
(adapt-class (.-Item picker)))) (adapt-class (.-Item picker))))

View File

@ -2,7 +2,7 @@
(:require-macros [status-im.utils.views :refer [defview letsubs]]) (:require-macros [status-im.utils.views :refer [defview letsubs]])
(:require [re-frame.core :refer [dispatch dispatch-sync]] (:require [re-frame.core :refer [dispatch dispatch-sync]]
[status-im.ui.screens.accounts.styles :as ast] [status-im.ui.screens.accounts.styles :as ast]
[status-im.ui.screens.accounts.views :refer [account-bage]] [status-im.ui.screens.accounts.views :refer [account-badge]]
[status-im.components.text-input-with-label.view :refer [text-input-with-label]] [status-im.components.text-input-with-label.view :refer [text-input-with-label]]
[status-im.components.status-bar :refer [status-bar]] [status-im.components.status-bar :refer [status-bar]]
[status-im.components.toolbar-new.view :refer [toolbar]] [status-im.components.toolbar-new.view :refer [toolbar]]
@ -35,7 +35,7 @@
[login-toolbar] [login-toolbar]
[view st/login-view [view st/login-view
[view st/login-badge-container [view st/login-badge-container
[account-bage address photo-path name] [account-badge address photo-path name]
[view {:height 8}] [view {:height 8}]
[text-input-with-label {:ref #(reset! password-text-input %) [text-input-with-label {:ref #(reset! password-text-input %)
:label (i18n/label :t/password) :label (i18n/label :t/password)

View File

@ -52,16 +52,16 @@
:ios {:border-radius 8} :ios {:border-radius 8}
:android {:border-radius 4}}) :android {:border-radius 4}})
(def account-bage (def account-badge
{:flex-direction :row {:flex-direction :row
:align-items :center :align-items :center
:padding-horizontal 16}) :padding-horizontal 16})
(def account-bage-text-view (def account-badge-text-view
{:margin-left 16 {:margin-left 16
:flex-shrink 1}) :flex-shrink 1})
(defstyle account-bage-text (defstyle account-badge-text
{:ios {:font-size 17 {:ios {:font-size 17
:letter-spacing -0.2} :letter-spacing -0.2}
:android {:font-size 16 :android {:font-size 16

View File

@ -18,12 +18,12 @@
[status-im.i18n :as i18n] [status-im.i18n :as i18n]
[clojure.string :as str])) [clojure.string :as str]))
(defn account-bage [address photo-path name] (defn account-badge [address photo-path name]
[view st/account-bage [view st/account-badge
[image {:source {:uri (if (str/blank? photo-path) :avatar photo-path)} [image {:source {:uri (if (str/blank? photo-path) :avatar photo-path)}
:style st/photo-image}] :style st/photo-image}]
[view st/account-bage-text-view [view st/account-badge-text-view
[text {:style st/account-bage-text [text {:style st/account-badge-text
:numberOfLines 1} :numberOfLines 1}
(or name address)]]]) (or name address)]]])
@ -31,7 +31,7 @@
[view [view
[touchable-highlight {:on-press #(dispatch [:open-login address photo-path name])} [touchable-highlight {:on-press #(dispatch [:open-login address photo-path name])}
[view st/account-view [view st/account-view
[account-bage address photo-path name]]]]) [account-badge address photo-path name]]]])
(defview accounts [] (defview accounts []
[accounts [:get-accounts]] [accounts [:get-accounts]]

View File

@ -9,26 +9,36 @@
[status-im.components.toolbar-new.view :as toolbar] [status-im.components.toolbar-new.view :as toolbar]
[status-im.components.toolbar-new.actions :as act] [status-im.components.toolbar-new.actions :as act]
[status-im.i18n :as i18n] [status-im.i18n :as i18n]
[status-im.utils.config :as config]
[status-im.utils.listview :as lw] [status-im.utils.listview :as lw]
[status-im.utils.platform :as platform] [status-im.utils.platform :as platform]
[status-im.utils.utils :as utils]
[status-im.ui.screens.wallet.main.styles :as st] [status-im.ui.screens.wallet.main.styles :as st]
[status-im.utils.money :as money])) [status-im.utils.money :as money]))
(defn- show-not-implemented! []
(utils/show-popup "TODO" "Not implemented yet!"))
(defn toolbar-title [] (defn toolbar-title []
[rn/view {:style st/toolbar-title-container} [rn/view {:style st/toolbar-title-container}
[rn/text {:style st/toolbar-title-text [rn/text {:style st/toolbar-title-text
:font :toolbar-title} :font :toolbar-title}
"Main Wallet"] "Main Wallet"]
[rn/icon :dropdown_white st/toolbar-title-icon]]) [rn/touchable-icon :dropdown_white st/toolbar-title-icon show-not-implemented!]])
(defn toolbar-buttons [] (defn toolbar-buttons []
[rn/view {:style st/toolbar-buttons-container} [rn/view {:style st/toolbar-buttons-container}
[rn/icon :dots_vertical_white st/toolbar-icon] [rn/touchable-icon :dots_vertical_white st/toolbar-icon show-not-implemented!]
[rn/icon :qr_white st/toolbar-icon]]) [rn/touchable-icon :qr_white st/toolbar-icon show-not-implemented!]])
(defn- show-wallet-transactions []
(if config/wallet-wip-enabled?
(rf/dispatch [:navigate-to-modal :wallet-transactions])
(show-not-implemented!)))
(defn toolbar-view [] (defn toolbar-view []
[toolbar/toolbar {:style st/toolbar [toolbar/toolbar {:style st/toolbar
:nav-action (act/list-white #(rf/dispatch [:navigate-to-modal :wallet-transactions])) :nav-action (act/list-white show-wallet-transactions)
:custom-content [toolbar-title] :custom-content [toolbar-title]
:custom-action [toolbar-buttons]}]) :custom-action [toolbar-buttons]}])
@ -45,9 +55,11 @@
[rn/text {:style st/today-variation} change]]] [rn/text {:style st/today-variation} change]]]
[btn/buttons st/buttons [btn/buttons st/buttons
[{:text "Send" [{:text "Send"
:on-press #(rf/dispatch [:navigate-to :wallet-send-transaction])} :on-press #(rf/dispatch [:navigate-to :wallet-send-transaction])
:disabled? (not config/wallet-wip-enabled?)}
{:text "Request" {:text "Request"
:on-press #(rf/dispatch [:navigate-to :wallet-request-transaction])} :on-press #(rf/dispatch [:navigate-to :wallet-request-transaction])
:disabled? (not config/wallet-wip-enabled?)}
{:text "Exchange" {:text "Exchange"
:disabled? true}]]]]) :disabled? true}]]]])
@ -60,7 +72,7 @@
[rn/text {:style st/asset-item-currency [rn/text {:style st/asset-item-currency
:uppercase? true} :uppercase? true}
id]] id]]
[rn/icon :forward_gray st/asset-item-details-icon]]) [rn/touchable-icon :forward_gray st/asset-item-details-icon show-not-implemented!]])
(defn render-separator-fn [assets-count] (defn render-separator-fn [assets-count]
(fn [_ row-id _] (fn [_ row-id _]

View File

@ -10,4 +10,4 @@
(defn enabled? [v] (= "1" v)) (defn enabled? [v] (= "1" v))
(def testfairy-enabled? (enabled? (get-config :TESTFAIRY_ENABLED))) (def testfairy-enabled? (enabled? (get-config :TESTFAIRY_ENABLED)))
(def wallet-tab-enabled? (enabled? (get-config :WALLET_TAB_ENABLED 0))) (def wallet-wip-enabled? (enabled? (get-config :WALLET_WIP_ENABLED 0)))

View File

@ -4,5 +4,5 @@
(deftest tab->index (deftest tab->index
(is (contains? tabs/tab->index :chat-list)) (is (contains? tabs/tab->index :chat-list))
(is (= 1 (:discover tabs/tab->index)))) (is (= 2 (:discover tabs/tab->index))))