added add account button functionality

Former-commit-id: 1555002bcd
This commit is contained in:
Adrian Tiberius 2016-07-05 22:24:09 +03:00
parent f36bfd21ce
commit 460d29c053
2 changed files with 29 additions and 6 deletions

View File

@ -8,6 +8,9 @@
[status-im.protocol.state.storage :as storage]
[status-im.utils.identicon :refer [identicon]]
[status-im.db :refer [default-view]]
[status-im.utils.random :as random]
[status-im.i18n :refer [label]]
[status-im.constants :refer [content-type-command-request]]
[clojure.string :as str]))
@ -61,3 +64,17 @@
(assoc db :accounts accounts)))
(register-handler :load-accounts load-accounts!)
(defn console-create-account [db _]
(let [msg-id (random/id)]
(dispatch [:received-msg
{:msg-id msg-id
:content {:command (name :keypair)
:content (label :t/keypair-generated)}
:content-type content-type-command-request
:outgoing false
:from "console"
:to "me"}])
db))
(register-handler :console-create-account console-create-account)

View File

@ -24,7 +24,8 @@
[status-im.utils.listview :as lw]
[status-im.accounts.views.account :refer [account-view]]
[status-im.i18n :refer [label]]
[status-im.accounts.styles :as st]))
[status-im.accounts.styles :as st]
[status-im.utils.logging :as log]))
(def toolbar-title
[view toolbar-title-container
@ -38,6 +39,10 @@
(list-item [view {:style st/row-separator
:key row-id}]))
(defn create-account [event]
(dispatch [:console-create-account])
(dispatch [:navigate-to :chat "console"]))
(defview accounts []
[accounts [:get :accounts]]
(let [accounts (vals accounts)]
@ -63,10 +68,11 @@
: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)]]]]))
[text {:style st/add-account-text} (label :t/add-account)]]]]]))
;(re-frame.core/dispatch [:set :view-id :users])