From c757835ca395b3928243a862d6b4a86ad170e536 Mon Sep 17 00:00:00 2001 From: Ulises M Date: Fri, 13 Sep 2024 18:32:05 -0600 Subject: [PATCH] WIP --- src/status_im/common/signals/events.cljs | 2 +- src/status_im/contexts/chat/events.cljs | 18 ++++++++++-------- .../messenger/messages/transport/events.cljs | 4 ++-- .../push_notifications/local/events.cljs | 3 ++- 4 files changed, 15 insertions(+), 12 deletions(-) diff --git a/src/status_im/common/signals/events.cljs b/src/status_im/common/signals/events.cljs index faab98945a..b59fd04a56 100644 --- a/src/status_im/common/signals/events.cljs +++ b/src/status_im/common/signals/events.cljs @@ -68,7 +68,7 @@ "discovery.summary" (summary cofx (transforms/js->clj event-js)) - "local-notifications" + "local-notifications" ;; WIP: when it's edited, The signal is not received, but the message is (local-notifications/process cofx (transforms/js->clj event-js)) "community.found" diff --git a/src/status_im/contexts/chat/events.cljs b/src/status_im/contexts/chat/events.cljs index b3a5ee7e35..b128ba63d1 100644 --- a/src/status_im/contexts/chat/events.cljs +++ b/src/status_im/contexts/chat/events.cljs @@ -81,21 +81,23 @@ (defn ensure-chats [{:keys [db] :as cofx} [chats]] - (let [{:keys [view-id current-chat-id]} db - {:keys [all-chats chats-home-list removed-chats]} + (let [{:keys [view-id current-chat-id]} + db + + {:keys [all-chats chats-home-list removed-chats] :as x} (reduce (fn [acc {:keys [chat-id community-id active muted] :as chat}] - (if (not (or active muted)) + (if-not (or active muted) (update acc :removed-chats conj chat-id) (cond-> acc - (and (not community-id) active) - (update :chats-home-list conj chat-id) - :always - (assoc-in [:all-chats chat-id] chat)))) + (and (not community-id) active) (update :chats-home-list conj chat-id) + :always (assoc-in [:all-chats chat-id] chat)))) {:all-chats {} :chats-home-list #{} :removed-chats #{}} - (map (map-chats cofx) chats))] + (map (map-chats cofx) chats)) + + _ (def --x x)] {:db (-> db (update :chats merge all-chats) (update :chats-home-list set/union chats-home-list) diff --git a/src/status_im/contexts/chat/messenger/messages/transport/events.cljs b/src/status_im/contexts/chat/messenger/messages/transport/events.cljs index 3b59417737..74bf737227 100644 --- a/src/status_im/contexts/chat/messenger/messages/transport/events.cljs +++ b/src/status_im/contexts/chat/messenger/messages/transport/events.cljs @@ -62,9 +62,9 @@ ^js watch-only-accounts (.-watchOnlyAccounts response-js) sync-handler (when-not process-async process-response)] (cond - (seq chats) (do + (def --c chats) (js-delete response-js "chats") (rf/merge cofx (process-next response-js sync-handler) @@ -155,7 +155,7 @@ (seq removed-messages) (let [removed-messages-clj (types/js->clj removed-messages)] - (js-delete response-js "removedMessages") + (js-delete response-js "removedMessages") ;; TODO: check removed messages too (rf/merge cofx (process-next response-js sync-handler) (models.message/handle-removed-messages removed-messages-clj))) diff --git a/src/status_im/contexts/profile/push_notifications/local/events.cljs b/src/status_im/contexts/profile/push_notifications/local/events.cljs index 73990484da..e421044f32 100644 --- a/src/status_im/contexts/profile/push_notifications/local/events.cljs +++ b/src/status_im/contexts/profile/push_notifications/local/events.cljs @@ -35,9 +35,10 @@ (defn create-notification [cofx {:keys [bodyType] :as notification}] + (def --n notification) (assoc (case bodyType - "message" (when (show-message-pn? cofx notification) notification) + "message" (when true #_(show-message-pn? cofx notification) notification) "transaction" (notifications.wallet/create-transfer-notification cofx notification) nil) :body-type