diff --git a/src/status_im/accounts/handlers.cljs b/src/status_im/accounts/handlers.cljs index 6f8d0ab569..2f9e3b0d27 100644 --- a/src/status_im/accounts/handlers.cljs +++ b/src/status_im/accounts/handlers.cljs @@ -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 _] diff --git a/src/status_im/accounts/screen.cljs b/src/status_im/accounts/screen.cljs index a11cfcab3b..61ab31be7c 100644 --- a/src/status_im/accounts/screen.cljs +++ b/src/status_im/accounts/screen.cljs @@ -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} diff --git a/src/status_im/accounts/styles.cljs b/src/status_im/accounts/styles.cljs index ab20bcd40e..6ad1c9c930 100644 --- a/src/status_im/accounts/styles.cljs +++ b/src/status_im/accounts/styles.cljs @@ -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 diff --git a/src/status_im/android/core.cljs b/src/status_im/android/core.cljs index e591c69abb..6f7eff59f2 100644 --- a/src/status_im/android/core.cljs +++ b/src/status_im/android/core.cljs @@ -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])))}))) diff --git a/src/status_im/components/drawer/view.cljs b/src/status_im/components/drawer/view.cljs index c040b8cb7c..726f9251d4 100644 --- a/src/status_im/components/drawer/view.cljs +++ b/src/status_im/components/drawer/view.cljs @@ -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}