2023-12-19 17:41:30 +00:00
|
|
|
(ns legacy.status-im.subs.stickers
|
2023-10-16 22:03:18 +00:00
|
|
|
(:require
|
|
|
|
[re-frame.core :as re-frame]
|
2023-12-19 19:59:07 +00:00
|
|
|
[status-im.constants :as constants]))
|
2022-09-21 14:03:06 +00:00
|
|
|
|
|
|
|
(re-frame/reg-sub
|
|
|
|
:stickers/installed-packs
|
|
|
|
:<- [:stickers/packs]
|
|
|
|
(fn [packs]
|
|
|
|
(filter #(= (:status %) constants/sticker-pack-status-installed) (vals packs))))
|
|
|
|
|
|
|
|
(re-frame/reg-sub
|
|
|
|
:stickers/all-packs
|
|
|
|
:<- [:stickers/packs]
|
|
|
|
(fn [packs]
|
|
|
|
(map (fn [{:keys [status] :as pack}]
|
|
|
|
(-> pack
|
|
|
|
(assoc :installed (= status constants/sticker-pack-status-installed))
|
|
|
|
(assoc :pending (= status constants/sticker-pack-status-pending))
|
|
|
|
(assoc :owned (= status constants/sticker-pack-status-owned))))
|
|
|
|
(vals packs))))
|
|
|
|
|
|
|
|
(re-frame/reg-sub
|
|
|
|
:stickers/get-current-pack
|
|
|
|
:<- [:get-screen-params]
|
|
|
|
:<- [:stickers/all-packs]
|
|
|
|
(fn [[{:keys [id]} packs]]
|
2022-12-13 12:27:13 +00:00
|
|
|
(first (filter #(= (:id %) id) packs))))
|