Merge pull request #310 from status-im/bug/#289

Allow the user to start using chat after account's creation 

Former-commit-id: 4099cb5733
This commit is contained in:
Roman Volosovskyi 2016-10-04 11:30:36 +03:00 committed by GitHub
commit 8b86e421b7
3 changed files with 11 additions and 5 deletions

View File

@ -36,6 +36,7 @@
account {:public-key public-key account {:public-key public-key
:address address :address address
:name address :name address
:signed-up? true
:updates-public-key public :updates-public-key public
:updates-private-key private :updates-private-key private
:photo-path (identicon public-key)}] :photo-path (identicon public-key)}]

View File

@ -5,7 +5,8 @@
[status-im.utils.types :refer [json->clj]] [status-im.utils.types :refer [json->clj]]
[status-im.db :refer [default-view]] [status-im.db :refer [default-view]]
[status-im.persistence.realm.core :as realm] [status-im.persistence.realm.core :as realm]
[status-im.components.status :as status])) [status-im.components.status :as status]
[status-im.constants :refer [console-chat-id]]))
(defn set-login-from-qr (defn set-login-from-qr
@ -19,7 +20,10 @@
(dispatch [:set :login {}]) (dispatch [:set :login {}])
(dispatch [:set-current-account address]) (dispatch [:set-current-account address])
(dispatch [:initialize-account address]) (dispatch [:initialize-account address])
(when new-account? (if new-account?
(do
(dispatch [:navigate-to-clean :chat-list])
(dispatch [:navigate-to :chat console-chat-id]))
(do (do
(dispatch [:navigate-to-clean :accounts]) (dispatch [:navigate-to-clean :accounts])
(dispatch [:navigate-to default-view])))) (dispatch [:navigate-to default-view]))))
@ -34,7 +38,7 @@
(defn on-account-changed (defn on-account-changed
[error address new-account?] [error address new-account?]
(if (nil? error) (if (nil? error)
(initialize-account address true) (initialize-account address new-account?)
(log/debug "Error changing acount realm: " error))) (log/debug "Error changing acount realm: " error)))
(defn logged-in (defn logged-in

View File

@ -10,7 +10,8 @@
[status-im.utils.handlers :as u] [status-im.utils.handlers :as u]
[status-im.utils.utils :refer [require]] [status-im.utils.utils :refer [require]]
[status-im.navigation.handlers :as nav] [status-im.navigation.handlers :as nav]
[status-im.utils.random :as random])) [status-im.utils.random :as random]
[taoensso.timbre :as log]))
(defmethod nav/preload-data! :group-contacts (defmethod nav/preload-data! :group-contacts
@ -94,7 +95,7 @@
(.getAll react-native-contacts (.getAll react-native-contacts
(fn [error contacts] (fn [error contacts]
(if error (if error
(dispatch [:error-on-fetching-loading error]) (log/debug :error-on-fetching-loading error)
(let [contacts' (normalize-phone-contacts contacts)] (let [contacts' (normalize-phone-contacts contacts)]
(dispatch [:get-contacts-identities contacts'])))))) (dispatch [:get-contacts-identities contacts']))))))