Compare commits

...
Author SHA1 Message Date
Ulises M c757835ca3 WIP 2024-09-13 18:32:05 -06:00
Ulises M 88b7439c48 Unshadow cljs.core/name 2024-09-13 17:57:38 -06:00
4 changed files with 17 additions and 14 deletions
+1 -1
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"
+12 -10
View File
@@ -58,9 +58,9 @@
(defn- create-new-chat
[chat-id {:keys [db now]}]
(let [name (get-in db [:contacts/contacts chat-id :name])]
(let [chat-name (get-in db [:contacts/contacts chat-id :name] "")]
{:chat-id chat-id
:name (or name "")
:name chat-name
:chat-type constants/one-to-one-chat-type
:group-chat false
:timestamp now
@@ -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)
@@ -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)))
@@ -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