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
WALLET_TAB_ENABLED=0
WALLET_WIP_ENABLED=0

View File

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

View File

@ -1 +1,2 @@
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.contacts.views :refer [contact-groups-list]]
[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.styles :as st]
[status-im.components.styles :as common-st]
@ -19,14 +18,12 @@
[cljs.core.async :as a]))
(def tab-list
(concat
(when config/wallet-tab-enabled?
[{:view-id :wallet
:title (label :t/wallet)
:screen wallet
:icon-inactive :icon_wallet_gray
:icon-active :icon_wallet_active}])
[{:view-id :chat-list
:icon-active :icon_wallet_active}
{:view-id :chat-list
:title (label :t/chats)
:screen chats-list
:icon-inactive :icon_chats
@ -40,7 +37,7 @@
:title (label :t/contacts)
:screen contact-groups-list
:icon-inactive :icon_contacts
:icon-active :icon_contacts_active}]))
:icon-active :icon_contacts_active}])
(def tab->index (reduce #(assoc %1 (:view-id %2) (count %1)) {} tab-list))

View File

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

View File

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

View File

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

View File

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

View File

@ -9,26 +9,36 @@
[status-im.components.toolbar-new.view :as toolbar]
[status-im.components.toolbar-new.actions :as act]
[status-im.i18n :as i18n]
[status-im.utils.config :as config]
[status-im.utils.listview :as lw]
[status-im.utils.platform :as platform]
[status-im.utils.utils :as utils]
[status-im.ui.screens.wallet.main.styles :as st]
[status-im.utils.money :as money]))
(defn- show-not-implemented! []
(utils/show-popup "TODO" "Not implemented yet!"))
(defn toolbar-title []
[rn/view {:style st/toolbar-title-container}
[rn/text {:style st/toolbar-title-text
:font :toolbar-title}
"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 []
[rn/view {:style st/toolbar-buttons-container}
[rn/icon :dots_vertical_white st/toolbar-icon]
[rn/icon :qr_white st/toolbar-icon]])
[rn/touchable-icon :dots_vertical_white st/toolbar-icon show-not-implemented!]
[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 []
[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-action [toolbar-buttons]}])
@ -45,9 +55,11 @@
[rn/text {:style st/today-variation} change]]]
[btn/buttons st/buttons
[{: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"
: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"
:disabled? true}]]]])
@ -60,7 +72,7 @@
[rn/text {:style st/asset-item-currency
:uppercase? true}
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]
(fn [_ row-id _]

View File

@ -10,4 +10,4 @@
(defn enabled? [v] (= "1" v))
(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
(is (contains? tabs/tab->index :chat-list))
(is (= 1 (:discover tabs/tab->index))))
(is (= 2 (:discover tabs/tab->index))))