Use new endpoint
This commit is contained in:
parent
c66c954df3
commit
29cebe5132
|
@ -18,9 +18,8 @@
|
||||||
clock-value
|
clock-value
|
||||||
"0x0000000000000000000000000000000000000000000000000000000000000000"))
|
"0x0000000000000000000000000000000000000000000000000000000000000000"))
|
||||||
|
|
||||||
(rf/defn update-chats-in-app-db
|
(rf/reg-event-fx :chats-list/load-success
|
||||||
{:events [:chats-list/load-success]}
|
(fn [{:keys [db]} [^js new-chats-js]]
|
||||||
[{:keys [db]} ^js new-chats-js]
|
|
||||||
(let [{:keys [all-chats chats-home-list]}
|
(let [{:keys [all-chats chats-home-list]}
|
||||||
(reduce (fn [acc ^js chat-js]
|
(reduce (fn [acc ^js chat-js]
|
||||||
(let [{:keys [chat-id profile-public-key timeline? community-id active] :as chat}
|
(let [{:keys [chat-id profile-public-key timeline? community-id active] :as chat}
|
||||||
|
@ -33,10 +32,10 @@
|
||||||
{:all-chats {}
|
{:all-chats {}
|
||||||
:chats-home-list #{}}
|
:chats-home-list #{}}
|
||||||
new-chats-js)]
|
new-chats-js)]
|
||||||
{:db (assoc db
|
{:db (-> db
|
||||||
:chats all-chats
|
(update :chats merge all-chats)
|
||||||
:chats-home-list chats-home-list
|
(update :chats-home-list into chats-home-list)
|
||||||
:chats/loading? false)}))
|
(assoc :chats/loading? false))})))
|
||||||
|
|
||||||
(rf/defn load-chat-success
|
(rf/defn load-chat-success
|
||||||
{:events [:chats-list/load-chat-success]}
|
{:events [:chats-list/load-chat-success]}
|
||||||
|
|
|
@ -134,9 +134,9 @@
|
||||||
unmarshal-members))
|
unmarshal-members))
|
||||||
|
|
||||||
(re-frame/reg-fx :fetch-chats-preview
|
(re-frame/reg-fx :fetch-chats-preview
|
||||||
(fn [{:keys [on-success]}]
|
(fn [{:keys [on-success chat-preview-type]}]
|
||||||
(json-rpc/call {:method "wakuext_chatsPreview"
|
(json-rpc/call {:method "wakuext_chatsPreview"
|
||||||
:params []
|
:params [chat-preview-type]
|
||||||
:js-response true
|
:js-response true
|
||||||
:on-success #(on-success ^js %)
|
:on-success #(on-success ^js %)
|
||||||
:on-error #(log/error "failed to fetch chats" 0 -1 %)})))
|
:on-error #(log/error "failed to fetch chats" 0 -1 %)})))
|
||||||
|
|
|
@ -76,6 +76,9 @@
|
||||||
(def ^:const timeline-chat-type 5)
|
(def ^:const timeline-chat-type 5)
|
||||||
(def ^:const community-chat-type 6)
|
(def ^:const community-chat-type 6)
|
||||||
|
|
||||||
|
(def ^:const chat-preview-type-community 0)
|
||||||
|
(def ^:const chat-preview-type-non-community 1)
|
||||||
|
|
||||||
(def ^:const contact-request-message-state-none 0)
|
(def ^:const contact-request-message-state-none 0)
|
||||||
(def ^:const contact-request-message-state-pending 1)
|
(def ^:const contact-request-message-state-pending 1)
|
||||||
(def ^:const contact-request-message-state-accepted 2)
|
(def ^:const contact-request-message-state-accepted 2)
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
[native-module.core :as native-module]
|
[native-module.core :as native-module]
|
||||||
[status-im.common.keychain.events :as keychain]
|
[status-im.common.keychain.events :as keychain]
|
||||||
[status-im.config :as config]
|
[status-im.config :as config]
|
||||||
|
[status-im.constants :as constants]
|
||||||
status-im.contexts.profile.login.effects
|
status-im.contexts.profile.login.effects
|
||||||
[status-im.contexts.profile.rpc :as profile.rpc]
|
[status-im.contexts.profile.rpc :as profile.rpc]
|
||||||
[taoensso.timbre :as log]
|
[taoensso.timbre :as log]
|
||||||
|
@ -131,10 +132,15 @@
|
||||||
(let [new-account? (get db :onboarding/new-account?)]
|
(let [new-account? (get db :onboarding/new-account?)]
|
||||||
{:db (assoc db :messenger/started? true)
|
{:db (assoc db :messenger/started? true)
|
||||||
:fx [[:fetch-chats-preview
|
:fx [[:fetch-chats-preview
|
||||||
{:on-success (fn [result]
|
{:chat-preview-type constants/chat-preview-type-non-community
|
||||||
|
:on-success (fn [result]
|
||||||
(rf/dispatch [:chats-list/load-success result])
|
(rf/dispatch [:chats-list/load-success result])
|
||||||
(rf/dispatch [:communities/get-user-requests-to-join])
|
|
||||||
(rf/dispatch [:profile.login/get-chats-callback]))}]
|
(rf/dispatch [:profile.login/get-chats-callback]))}]
|
||||||
|
[:fetch-chats-preview
|
||||||
|
{:chat-preview-type constants/chat-preview-type-community
|
||||||
|
:on-success (fn [result]
|
||||||
|
(rf/dispatch [:chats-list/load-success result])
|
||||||
|
(rf/dispatch [:communities/get-user-requests-to-join]))}]
|
||||||
(when (and (:syncing/fallback-flow? db) (:syncing/installation-id db))
|
(when (and (:syncing/fallback-flow? db) (:syncing/installation-id db))
|
||||||
[:dispatch [:pairing/finish-seed-phrase-fallback-syncing]])
|
[:dispatch [:pairing/finish-seed-phrase-fallback-syncing]])
|
||||||
(when-not new-account?
|
(when-not new-account?
|
||||||
|
|
Loading…
Reference in New Issue