sync activity center
Signed-off-by: Michele Balistreri <michele@bitgamma.com>
This commit is contained in:
parent
816f15f976
commit
46c023920c
|
@ -28,7 +28,10 @@
|
|||
:chat-type constants/one-to-one-chat-type
|
||||
:chat-name name
|
||||
:public? false
|
||||
:group-chat false)))
|
||||
:group-chat false)
|
||||
|
||||
:else
|
||||
chat))
|
||||
|
||||
(defn <-rpc [item]
|
||||
(-> item
|
||||
|
|
|
@ -6,15 +6,28 @@
|
|||
[status-im.data-store.activities :as data-store.activities]))
|
||||
|
||||
(fx/defn handle-activities [{:keys [db]} activities]
|
||||
(let [{:keys [unread-count notifications]}
|
||||
(reduce (fn [acc {:keys [read dismissed accepted] :as notification}]
|
||||
(as-> acc a
|
||||
(if read
|
||||
(update a :unread-count dec)
|
||||
(update a :unread-count inc))
|
||||
|
||||
(if (or dismissed accepted)
|
||||
(update a :notifications (fn [items] (remove #(= (:id notification) (:id %)) items)))
|
||||
(update a :notifications conj notification))))
|
||||
{:unread-count (get db :activity.center/notifications-count 0)
|
||||
:notifications (get-in db [:activity.center/notifications :notifications])}
|
||||
activities)]
|
||||
{:db (-> db
|
||||
(update-in [:activity.center/notifications :notifications] #(concat activities %))
|
||||
(update :activity.center/notifications-count + (count activities)))
|
||||
(assoc-in [:activity.center/notifications :notifications] notifications)
|
||||
(assoc :activity.center/notifications-count (max 0 unread-count)))
|
||||
:dispatch (cond
|
||||
(= (:view-id db) :notifications-center)
|
||||
[:mark-all-activity-center-notifications-as-read]
|
||||
|
||||
(= (:view-id db) :chat)
|
||||
[:accept-all-activity-center-notifications-from-chat (:current-chat-id db)])})
|
||||
[:accept-all-activity-center-notifications-from-chat (:current-chat-id db)])}))
|
||||
|
||||
(fx/defn get-activity-center-notifications-count
|
||||
{:events [:get-activity-center-notifications-count]}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
"_comment": "Instead use: scripts/update-status-go.sh <rev>",
|
||||
"owner": "status-im",
|
||||
"repo": "status-go",
|
||||
"version": "v0.91.12",
|
||||
"commit-sha1": "f60cf5cd47c9f50f1bfb8e01aa5f49802d5220c5",
|
||||
"src-sha256": "10dwxrav77v7xvbzy9camacdflsvpyjnwry638jhgrd4i32x745f"
|
||||
"version": "v0.91.14",
|
||||
"commit-sha1": "0867458f16dc8ddb5a25113083c82fde3b27f148",
|
||||
"src-sha256": "0l1slzs96glycylsy8cdi20qzabdhwd3j78fwvn4aknxddyyy8fr"
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue