fix protocol's initialization on js reloading
Former-commit-id: 55a5b96ad7
This commit is contained in:
parent
02c2d4deae
commit
aa89c0f85d
|
@ -128,7 +128,12 @@ public class GethModule extends ReactContextBaseJavaModule implements LifecycleE
|
|||
}
|
||||
|
||||
@ReactMethod
|
||||
public void startNode(Callback callback) {
|
||||
public void startNode(Callback callback, Callback onAlreadyRunning) {
|
||||
|
||||
if(GethService.isRunning()){
|
||||
onAlreadyRunning.invoke();
|
||||
return;
|
||||
}
|
||||
|
||||
Activity currentActivity = getCurrentActivity();
|
||||
|
||||
|
|
|
@ -588,7 +588,9 @@
|
|||
|
||||
(register-handler :send-seen!
|
||||
(after (fn [_ [_ chat-id message-id]]
|
||||
(when-not (= "console" chat-id))
|
||||
(dispatch [:msg-seen chat-id message-id])))
|
||||
(u/side-effect!
|
||||
(fn [_ [_ chat-id message-id]]
|
||||
(api/send-seen chat-id message-id))))
|
||||
(when-not (= "console" chat-id)
|
||||
(api/send-seen chat-id message-id)))))
|
||||
|
|
|
@ -88,7 +88,9 @@
|
|||
(u/side-effect!
|
||||
(fn [db _]
|
||||
(log/debug "Starting node")
|
||||
(.startNode geth (fn [result] (node-started db result))))))
|
||||
(.startNode geth
|
||||
(fn [result] (node-started db result))
|
||||
#(dispatch [:initialize-protocol])))))
|
||||
|
||||
(register-handler :crypt-initialized
|
||||
(u/side-effect!
|
||||
|
|
|
@ -26,7 +26,8 @@
|
|||
|
||||
(defn save-message
|
||||
;; todo remove chat-id parameter
|
||||
[chat-id {:keys [msg-id content]
|
||||
[chat-id {:keys [delivery-status msg-id content]
|
||||
:or {delivery-status :pending}
|
||||
:as message}]
|
||||
(when-not (r/exists? :msgs :msg-id msg-id)
|
||||
(r/write
|
||||
|
@ -38,6 +39,7 @@
|
|||
message
|
||||
{:chat-id chat-id
|
||||
:content content'
|
||||
:delivery-status delivery-status
|
||||
:timestamp (timestamp)})]
|
||||
(r/create :msgs message' true))))))
|
||||
|
||||
|
|
|
@ -18,8 +18,8 @@
|
|||
|
||||
(register-handler :initialize-protocol
|
||||
(u/side-effect!
|
||||
(fn [db [_ account]]
|
||||
(init-protocol account (make-handler db)))))
|
||||
(fn [{:keys [user-identity] :as db} [_ account]]
|
||||
(init-protocol (or account user-identity) (make-handler db)))))
|
||||
|
||||
(register-handler :protocol-initialized
|
||||
(fn [db [_ identity]]
|
||||
|
|
Loading…
Reference in New Issue