[#10119] Android app UI is slow after backgorund
Signed-off-by: Andrey Shovkoplyas <motor4ik@gmail.com>
This commit is contained in:
parent
696ebbf67e
commit
5f2b29ee52
|
@ -60,19 +60,9 @@
|
||||||
(multiaccounts.update/multiaccount-update :photo-path photo-path {:dont-sync? true}))))
|
(multiaccounts.update/multiaccount-update :photo-path photo-path {:dont-sync? true}))))
|
||||||
|
|
||||||
(fx/defn ensure-contact
|
(fx/defn ensure-contact
|
||||||
[{:keys [db] :as cofx}
|
[{:keys [db]}
|
||||||
{:keys [public-key] :as contact}]
|
{:keys [public-key] :as contact}]
|
||||||
(let [new? (get-in db [:contacts/contacts public-key])
|
{:db (update-in db [:contacts/contacts public-key] merge contact)})
|
||||||
us? (= public-key (multiaccounts.model/current-public-key cofx))]
|
|
||||||
(fx/merge cofx
|
|
||||||
{:db (-> db
|
|
||||||
(update-in [:contacts/contacts public-key] merge contact))}
|
|
||||||
|
|
||||||
(cond
|
|
||||||
us?
|
|
||||||
(handle-update-from-contact-request contact)
|
|
||||||
new?
|
|
||||||
(transport.filters/load-contact contact)))))
|
|
||||||
|
|
||||||
(fx/defn upsert-contact
|
(fx/defn upsert-contact
|
||||||
[{:keys [db] :as cofx}
|
[{:keys [db] :as cofx}
|
||||||
|
|
|
@ -15,10 +15,10 @@
|
||||||
[status-im.ethereum.core :as ethereum]
|
[status-im.ethereum.core :as ethereum]
|
||||||
[status-im.native-module.core :as status]
|
[status-im.native-module.core :as status]
|
||||||
[status-im.ens.core :as ens]
|
[status-im.ens.core :as ens]
|
||||||
[cljs-bean.core :as clj-bean]
|
|
||||||
[status-im.utils.fx :as fx]
|
[status-im.utils.fx :as fx]
|
||||||
[taoensso.timbre :as log]
|
[taoensso.timbre :as log]
|
||||||
[status-im.ethereum.json-rpc :as json-rpc]))
|
[status-im.ethereum.json-rpc :as json-rpc]
|
||||||
|
[status-im.utils.types :as types]))
|
||||||
|
|
||||||
(defn- js-obj->seq [obj]
|
(defn- js-obj->seq [obj]
|
||||||
;; Sometimes the filter will return a single object instead of a collection
|
;; Sometimes the filter will return a single object instead of a collection
|
||||||
|
@ -42,30 +42,31 @@
|
||||||
(let [chats (.-chats response-js)
|
(let [chats (.-chats response-js)
|
||||||
contacts (.-contacts response-js)
|
contacts (.-contacts response-js)
|
||||||
installations (.-installations response-js)
|
installations (.-installations response-js)
|
||||||
raw-messages (.-rawMessages response-js)
|
|
||||||
messages (.-messages response-js)]
|
messages (.-messages response-js)]
|
||||||
(cond
|
(cond
|
||||||
(seq installations)
|
(seq installations)
|
||||||
(let [installation (.pop installations)]
|
(let [installation (.pop installations)]
|
||||||
(fx/merge cofx
|
(fx/merge cofx
|
||||||
{:dispatch-later [{:ms 20 :dispatch [::process response-js]}]}
|
{:utils/dispatch-later [{:ms 20 :dispatch [::process response-js]}]}
|
||||||
(models.pairing/handle-installation (clj-bean/->clj installation))))
|
(models.pairing/handle-installation (types/js->clj installation))))
|
||||||
|
|
||||||
(seq contacts)
|
(seq contacts)
|
||||||
(let [contact (.pop contacts)]
|
(let [contact (.pop contacts)]
|
||||||
(fx/merge cofx
|
(fx/merge cofx
|
||||||
{:dispatch-later [{:ms 20 :dispatch [::process response-js]}]}
|
{:utils/dispatch-later [{:ms 20 :dispatch [::process response-js]}]}
|
||||||
(handle-contact (-> contact (clj-bean/->clj) (data-store.contacts/<-rpc)))))
|
(handle-contact (-> contact (types/js->clj) (data-store.contacts/<-rpc)))))
|
||||||
|
|
||||||
(seq chats)
|
(seq chats)
|
||||||
(let [chat (.pop chats)]
|
(let [chat (.pop chats)]
|
||||||
(fx/merge cofx
|
(fx/merge cofx
|
||||||
{:dispatch-later [{:ms 20 :dispatch [::process response-js]}]}
|
{:utils/dispatch-later [{:ms 20 :dispatch [::process response-js]}]}
|
||||||
(handle-chat (-> chat (clj-bean/->clj) (data-store.chats/<-rpc)))))
|
(handle-chat (-> chat (types/js->clj) (data-store.chats/<-rpc)))))
|
||||||
|
|
||||||
(seq messages)
|
(seq messages)
|
||||||
(let [message (.pop messages)]
|
(let [message (.pop messages)]
|
||||||
(fx/merge cofx
|
(fx/merge cofx
|
||||||
{:dispatch-later [{:ms 20 :dispatch [::process response-js]}]}
|
{:utils/dispatch-later [{:ms 20 :dispatch [::process response-js]}]}
|
||||||
(handle-message (-> message (clj-bean/->clj) (data-store.messages/<-rpc))))))))
|
(handle-message (-> message (types/js->clj) (data-store.messages/<-rpc))))))))
|
||||||
|
|
||||||
(handlers/register-handler-fx
|
(handlers/register-handler-fx
|
||||||
::process
|
::process
|
||||||
|
|
|
@ -1,11 +1,9 @@
|
||||||
(ns status-im.ui.components.large-toolbar.view
|
(ns status-im.ui.components.large-toolbar.view
|
||||||
(:require [reagent.core :as reagent]
|
(:require [reagent.core :as reagent]
|
||||||
[cljs-bean.core :refer [->clj ->js]]
|
|
||||||
[status-im.ui.components.list.views :as list.views]
|
[status-im.ui.components.list.views :as list.views]
|
||||||
[status-im.ui.components.react :as react]
|
[status-im.ui.components.react :as react]
|
||||||
[status-im.ui.components.toolbar.view :as toolbar]
|
[status-im.ui.components.toolbar.view :as toolbar]
|
||||||
[status-im.ui.components.large-toolbar.styles :as styles]
|
[status-im.ui.components.large-toolbar.styles :as styles]
|
||||||
[status-im.utils.platform :as platform]
|
|
||||||
[status-im.ui.components.animation :as animation])
|
[status-im.ui.components.animation :as animation])
|
||||||
(:require-macros [status-im.utils.views :as views]))
|
(:require-macros [status-im.utils.views :as views]))
|
||||||
|
|
||||||
|
|
|
@ -1,19 +1,22 @@
|
||||||
(ns status-im.utils.types
|
(ns status-im.utils.types
|
||||||
(:require
|
(:refer-clojure :exclude [js->clj])
|
||||||
[cljs-bean.core :as clj-bean]))
|
(:require [cljs-bean.core :as clj-bean]))
|
||||||
|
|
||||||
(defn to-string [s]
|
(defn to-string [s]
|
||||||
(if (keyword? s)
|
(if (keyword? s)
|
||||||
(name s)
|
(name s)
|
||||||
s))
|
s))
|
||||||
|
|
||||||
|
(defn js->clj [data]
|
||||||
|
(cljs.core/js->clj data :keywordize-keys true))
|
||||||
|
|
||||||
(defn clj->json [data]
|
(defn clj->json [data]
|
||||||
(.stringify js/JSON (clj-bean/->js data)))
|
(.stringify js/JSON (clj-bean/->js data)))
|
||||||
|
|
||||||
(defn json->clj [json]
|
(defn json->clj [json]
|
||||||
(when-not (= json "undefined")
|
(when-not (= json "undefined")
|
||||||
(try
|
(try
|
||||||
(js->clj (.parse js/JSON json) :keywordize-keys true)
|
(js->clj (.parse js/JSON json))
|
||||||
(catch js/Error _ (when (string? json) json)))))
|
(catch js/Error _ (when (string? json) json)))))
|
||||||
|
|
||||||
(def serialize clj->json)
|
(def serialize clj->json)
|
||||||
|
|
Loading…
Reference in New Issue