fix font size, back button and add account button

This commit is contained in:
Adrian Tiberius 2016-07-06 23:10:41 +03:00
parent ee443d113f
commit a2e6701db7
5 changed files with 41 additions and 42 deletions

View File

@ -25,7 +25,7 @@
(defn save-password [password]
(storage/put kv/kv-store :password password))
(defn account-created [result password]
(defn account-created [db result password]
(let [data (json->clj result)
public-key (:pubkey data)
address (:address data)
@ -38,11 +38,11 @@
(do
(save-password password)
(dispatch [:add-account account])
(dispatch [:login-account address password])))))
(when (not (:signed-up db)) (dispatch [:login-account address password]))))))
(register-handler :create-account
(-> (fn [db [_ password]]
(.createAccount geth password (fn [result] (account-created result password)))
(.createAccount geth password (fn [result] (account-created db result password)))
db)))
(register-handler :login-account
@ -53,7 +53,7 @@
(dispatch [:set :login {}])
(dispatch [:set :current-account account])
(dispatch [:initialize-protocol account])
(dispatch [:navigate-to-clean default-view]))))
(when (:signed-up db) (dispatch [:navigate-to-clean default-view])))))
db)))
(defn load-accounts! [db _]

View File

@ -44,38 +44,35 @@
(dispatch [:navigate-to :chat "console"]))
(defview accounts []
[accounts [:get :accounts]]
(let [accounts (vals accounts)]
[view st/screen-container
[linear-gradient {:colors ["rgba(182, 116, 241, 1)" "rgba(107, 147, 231, 1)" "rgba(43, 171, 238, 1)"]
:start [0, 0]
:end [0.5, 1]
:locations [0, 0.8 ,1]
:style st/gradient-background}]
[toolbar {:background-color :transparent
:nav-action {:image {:source {:uri :icon_back_white}
:style icon-back}
:handler #(dispatch [:navigate-back])}
:custom-content toolbar-title
:action {:image {:style icon-search}
:handler #()}}]
[view st/accounts-container
[view st/account-list-view-container
[list-view {:dataSource (lw/to-datasource accounts)
:enableEmptySections true
:renderRow render-row
;:renderSeparator render-separator
:style st/account-list}]]]
[view st/add-account-button-container
[touchable-highlight {:on-press create-account}
[view st/add-account-button
[image {:source {:uri :icon_add}
:style st/icon-plus}]
[text {:style st/add-account-text} (label :t/add-account)]]]]]))
[accounts [:get :accounts]
stack [:get :navigation-stack]]
(let [accounts (vals accounts)
show-back? (> (count stack) 1)]
[view st/screen-container
[linear-gradient {:colors ["rgba(182, 116, 241, 1)" "rgba(107, 147, 231, 1)" "rgba(43, 171, 238, 1)"]
:start [0, 0]
:end [0.5, 1]
:locations [0, 0.8, 1]
:style st/gradient-background}]
[toolbar {:background-color :transparent
:nav-action {:image {:source (if show-back? {:uri :icon_back_white} nil)
:style icon-back}
:handler (if show-back? #(dispatch [:navigate-back]) nil)}
:custom-content toolbar-title
:action {:image {:style icon-search}
:handler #()}}]
[view st/accounts-container
[view st/account-list-view-container
[list-view {:dataSource (lw/to-datasource accounts)
:enableEmptySections true
:renderRow render-row
;:renderSeparator render-separator
:style st/account-list}]]]
[view st/add-account-button-container
[touchable-highlight {:on-press create-account}
[view st/add-account-button
[image {:source {:uri :icon_add}
:style st/icon-plus}]
[text {:style st/add-account-text} (label :t/add-account)]]]]]))
;(re-frame.core/dispatch [:set :view-id :users])
;{:name (label :t/add-account)
;:address "0x0"
;:photo-path :icon_plus}

View File

@ -76,10 +76,12 @@
:flexDirection :column})
(def name-text
{:color color-white})
{:color color-white
:fontSize 16})
(def address-text
{:color color-white})
{:color color-white
:fontSize 12})
(def online-container
{:flex 0.2

View File

@ -67,7 +67,7 @@
#(dispatch [:set :keyboard-height 0]))))
:render
(fn []
(let [startup-view (if @account @view-id (if (= @view-id :login) :login :users))]
(let [startup-view (if @account @view-id (if (contains? #{:login :chat} @view-id) @view-id :accounts))]
(log/debug startup-view)
(case (if @signed-up startup-view :chat)
:discovery [main-tabs]
@ -83,7 +83,7 @@
:qr-scanner [qr-scanner]
:chat [chat]
:profile [profile]
:users [accounts]
:accounts [accounts]
:login [login]
:my-profile [my-profile])))})))

View File

@ -65,7 +65,7 @@
[view st/switch-users-container
[touchable-opacity {:onPress (fn []
(close-drawer)
(dispatch [:navigate-to :users])
(dispatch [:navigate-to :accounts])
;; TODO not implemented
)}
[text {:style st/switch-users-text}