This commit is contained in:
Ulises M 2024-09-13 18:32:05 -06:00
parent 88b7439c48
commit c757835ca3
No known key found for this signature in database
GPG Key ID: 5A15782EB758534E
4 changed files with 15 additions and 12 deletions

View File

@ -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"

View File

@ -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)

View File

@ -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)))

View File

@ -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