fix font size, back button and add account button
Former-commit-id: a2e6701db7
This commit is contained in:
parent
34a31dbb45
commit
762aa20613
|
@ -25,7 +25,7 @@
|
||||||
(defn save-password [password]
|
(defn save-password [password]
|
||||||
(storage/put kv/kv-store :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)
|
(let [data (json->clj result)
|
||||||
public-key (:pubkey data)
|
public-key (:pubkey data)
|
||||||
address (:address data)
|
address (:address data)
|
||||||
|
@ -38,11 +38,11 @@
|
||||||
(do
|
(do
|
||||||
(save-password password)
|
(save-password password)
|
||||||
(dispatch [:add-account account])
|
(dispatch [:add-account account])
|
||||||
(dispatch [:login-account address password])))))
|
(when (not (:signed-up db)) (dispatch [:login-account address password]))))))
|
||||||
|
|
||||||
(register-handler :create-account
|
(register-handler :create-account
|
||||||
(-> (fn [db [_ password]]
|
(-> (fn [db [_ password]]
|
||||||
(.createAccount geth password (fn [result] (account-created result password)))
|
(.createAccount geth password (fn [result] (account-created db result password)))
|
||||||
db)))
|
db)))
|
||||||
|
|
||||||
(register-handler :login-account
|
(register-handler :login-account
|
||||||
|
@ -53,7 +53,7 @@
|
||||||
(dispatch [:set :login {}])
|
(dispatch [:set :login {}])
|
||||||
(dispatch [:set :current-account account])
|
(dispatch [:set :current-account account])
|
||||||
(dispatch [:initialize-protocol account])
|
(dispatch [:initialize-protocol account])
|
||||||
(dispatch [:navigate-to-clean default-view]))))
|
(when (:signed-up db) (dispatch [:navigate-to-clean default-view])))))
|
||||||
db)))
|
db)))
|
||||||
|
|
||||||
(defn load-accounts! [db _]
|
(defn load-accounts! [db _]
|
||||||
|
|
|
@ -44,19 +44,20 @@
|
||||||
(dispatch [:navigate-to :chat "console"]))
|
(dispatch [:navigate-to :chat "console"]))
|
||||||
|
|
||||||
(defview accounts []
|
(defview accounts []
|
||||||
[accounts [:get :accounts]]
|
[accounts [:get :accounts]
|
||||||
(let [accounts (vals accounts)]
|
stack [:get :navigation-stack]]
|
||||||
|
(let [accounts (vals accounts)
|
||||||
|
show-back? (> (count stack) 1)]
|
||||||
[view st/screen-container
|
[view st/screen-container
|
||||||
[linear-gradient {:colors ["rgba(182, 116, 241, 1)" "rgba(107, 147, 231, 1)" "rgba(43, 171, 238, 1)"]
|
[linear-gradient {:colors ["rgba(182, 116, 241, 1)" "rgba(107, 147, 231, 1)" "rgba(43, 171, 238, 1)"]
|
||||||
:start [0, 0]
|
:start [0, 0]
|
||||||
:end [0.5, 1]
|
:end [0.5, 1]
|
||||||
:locations [0, 0.8, 1]
|
:locations [0, 0.8, 1]
|
||||||
:style st/gradient-background}]
|
:style st/gradient-background}]
|
||||||
|
|
||||||
[toolbar {:background-color :transparent
|
[toolbar {:background-color :transparent
|
||||||
:nav-action {:image {:source {:uri :icon_back_white}
|
:nav-action {:image {:source (if show-back? {:uri :icon_back_white} nil)
|
||||||
:style icon-back}
|
:style icon-back}
|
||||||
:handler #(dispatch [:navigate-back])}
|
:handler (if show-back? #(dispatch [:navigate-back]) nil)}
|
||||||
:custom-content toolbar-title
|
:custom-content toolbar-title
|
||||||
:action {:image {:style icon-search}
|
:action {:image {:style icon-search}
|
||||||
:handler #()}}]
|
:handler #()}}]
|
||||||
|
@ -74,8 +75,4 @@
|
||||||
:style st/icon-plus}]
|
:style st/icon-plus}]
|
||||||
[text {:style st/add-account-text} (label :t/add-account)]]]]]))
|
[text {:style st/add-account-text} (label :t/add-account)]]]]]))
|
||||||
|
|
||||||
|
|
||||||
;(re-frame.core/dispatch [:set :view-id :users])
|
;(re-frame.core/dispatch [:set :view-id :users])
|
||||||
;{:name (label :t/add-account)
|
|
||||||
;:address "0x0"
|
|
||||||
;:photo-path :icon_plus}
|
|
||||||
|
|
|
@ -76,10 +76,12 @@
|
||||||
:flexDirection :column})
|
:flexDirection :column})
|
||||||
|
|
||||||
(def name-text
|
(def name-text
|
||||||
{:color color-white})
|
{:color color-white
|
||||||
|
:fontSize 16})
|
||||||
|
|
||||||
(def address-text
|
(def address-text
|
||||||
{:color color-white})
|
{:color color-white
|
||||||
|
:fontSize 12})
|
||||||
|
|
||||||
(def online-container
|
(def online-container
|
||||||
{:flex 0.2
|
{:flex 0.2
|
||||||
|
|
|
@ -67,7 +67,7 @@
|
||||||
#(dispatch [:set :keyboard-height 0]))))
|
#(dispatch [:set :keyboard-height 0]))))
|
||||||
:render
|
:render
|
||||||
(fn []
|
(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)
|
(log/debug startup-view)
|
||||||
(case (if @signed-up startup-view :chat)
|
(case (if @signed-up startup-view :chat)
|
||||||
:discovery [main-tabs]
|
:discovery [main-tabs]
|
||||||
|
@ -83,7 +83,7 @@
|
||||||
:qr-scanner [qr-scanner]
|
:qr-scanner [qr-scanner]
|
||||||
:chat [chat]
|
:chat [chat]
|
||||||
:profile [profile]
|
:profile [profile]
|
||||||
:users [accounts]
|
:accounts [accounts]
|
||||||
:login [login]
|
:login [login]
|
||||||
:my-profile [my-profile])))})))
|
:my-profile [my-profile])))})))
|
||||||
|
|
||||||
|
|
|
@ -65,7 +65,7 @@
|
||||||
[view st/switch-users-container
|
[view st/switch-users-container
|
||||||
[touchable-opacity {:onPress (fn []
|
[touchable-opacity {:onPress (fn []
|
||||||
(close-drawer)
|
(close-drawer)
|
||||||
(dispatch [:navigate-to :users])
|
(dispatch [:navigate-to :accounts])
|
||||||
;; TODO not implemented
|
;; TODO not implemented
|
||||||
)}
|
)}
|
||||||
[text {:style st/switch-users-text}
|
[text {:style st/switch-users-text}
|
||||||
|
|
Loading…
Reference in New Issue