From d2eb84be68773c37825f1473e8d0af7d6ed6bb2b Mon Sep 17 00:00:00 2001 From: Adrian Tiberius Date: Thu, 30 Jun 2016 20:28:51 +0300 Subject: [PATCH] login to account after creating it to enable it in whisper Former-commit-id: df229035e72723fff5266a0a5cec5128ca424c85 --- .../java/com/statusim/geth/service/GethService.java | 2 +- src/status_im/accounts/handlers.cljs | 12 +++++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/android/app/src/main/java/com/statusim/geth/service/GethService.java b/android/app/src/main/java/com/statusim/geth/service/GethService.java index c0af872fe6..295cacd2c1 100644 --- a/android/app/src/main/java/com/statusim/geth/service/GethService.java +++ b/android/app/src/main/java/com/statusim/geth/service/GethService.java @@ -8,7 +8,7 @@ import android.util.Log; import java.lang.ref.WeakReference; -import com.github.ethereum.go_ethereum.Statusgo; +import com.github.status_im.status_go.Statusgo; import java.io.File; diff --git a/src/status_im/accounts/handlers.cljs b/src/status_im/accounts/handlers.cljs index 8ea9cf3e60..cb64243e8f 100644 --- a/src/status_im/accounts/handlers.cljs +++ b/src/status_im/accounts/handlers.cljs @@ -15,7 +15,7 @@ (update db :accounts assoc address account)) ((after save-account)))) -(defn account-created [result] +(defn account-created [result password] (let [data (json->clj result) public-key (:pubkey data) address (:address data) @@ -24,10 +24,16 @@ (log/debug "Created account: " result) (when (not (str/blank? public-key)) (do + (dispatch [:login-account address password]) (dispatch [:initialize-protocol account]) (dispatch [:add-account account]))))) (register-handler :create-account (-> (fn [db [_ password]] - (.createAccount geth password (fn [result] (account-created result))) - db))) \ No newline at end of file + (.createAccount geth password (fn [result] (account-created result password))) + db))) + +(register-handler :login-account + (-> (fn [db [_ address password]] + (.login geth address password (fn [result] (log/debug "Logged in account: " address result))) + db))) \ No newline at end of file