diff --git a/src/status_im/data_store/settings.cljs b/src/status_im/data_store/settings.cljs index 5f6bdc2deb..20ae9d6f63 100644 --- a/src/status_im/data_store/settings.cljs +++ b/src/status_im/data_store/settings.cljs @@ -39,6 +39,7 @@ (update :wallet/visible-tokens rpc->visible-tokens) (update :pinned-mailservers rpc->pinned-mailservers) (update :stickers/packs-installed rpc->stickers-packs) + (update :stickers/packs-pending set) (update :custom-bootnodes rpc->custom-bootnodes) (update :custom-bootnodes-enabled? rpc->custom-bootnodes) (update :currency keyword))) diff --git a/src/status_im/events.cljs b/src/status_im/events.cljs index 17d7ed0eaf..1597432c33 100644 --- a/src/status_im/events.cljs +++ b/src/status_im/events.cljs @@ -1369,7 +1369,7 @@ (stickers/pending-pack cofx id))) (handlers/register-handler-fx - :stickers/pending-timout + :stickers/pending-timeout (fn [cofx _] (stickers/pending-timeout cofx))) diff --git a/src/status_im/stickers/core.cljs b/src/status_im/stickers/core.cljs index b1b0368688..c66e3c085e 100644 --- a/src/status_im/stickers/core.cljs +++ b/src/status_im/stickers/core.cljs @@ -21,9 +21,9 @@ (re-frame/dispatch [:stickers/load-pack url id price])))) (re-frame/reg-fx - :stickers/set-pending-timout-fx + :stickers/set-pending-timeout-fx (fn [] - (utils/set-timeout #(re-frame/dispatch [:stickers/pending-timout]) + (utils/set-timeout #(re-frame/dispatch [:stickers/pending-timeout]) 10000))) (defn eth-call-pack-data @@ -86,11 +86,15 @@ (re-frame/dispatch [:stickers/pack-owned pack-id]))}))})))}))) (fx/defn init-stickers-packs - [{:keys [db]}] - (let [sticker-packs (get-in db [:multiaccount :stickers/packs-installed])] - {:db (assoc db - :stickers/packs-installed sticker-packs - :stickers/packs sticker-packs)})) + [{:keys [db] :as cofx}] + (let [sticker-packs (get-in db [:multiaccount :stickers/packs-installed]) + pending-packs (get-in db [:multiaccount :stickers/packs-pending] #{})] + (cond-> {:db (assoc db + :stickers/packs-installed sticker-packs + :stickers/packs sticker-packs + :stickers/packs-pending pending-packs)} + (not-empty pending-packs) + (assoc :stickers/set-pending-timeout-fx nil)))) (fx/defn install-stickers-pack [{{:keys [multiaccount] :as db} :db :as cofx} id] @@ -160,26 +164,36 @@ :on-result [:stickers/pending-pack pack-id]}))) (fx/defn pending-pack - [{:keys [db] :as cofx} id] + [{{:keys [multiaccount] :as db} :db :as cofx} id] (let [contract (contracts/get-address db :status/sticker-pack) - address (ethereum/default-address db)] + address (ethereum/default-address db) + pending (get multiaccount :stickers/packs-pending #{})] (when contract (fx/merge cofx {:db (update db :stickers/packs-pending conj id) :stickers/owned-packs-fx [contract address]} + (multiaccounts.update/multiaccount-update + :stickers/packs-pending + (conj pending id) + {}) #(when (zero? (count (:stickers/packs-pending db))) - {:stickers/set-pending-timout-fx nil}))))) + {:stickers/set-pending-timeout-fx nil}))))) (fx/defn pending-timeout - [{{:stickers/keys [packs-pending packs-owned] :as db} :db}] + [{{:stickers/keys [packs-pending packs-owned] :as db} :db :as cofx}] (let [packs-diff (clojure.set/difference packs-pending packs-owned) contract (contracts/get-address db :status/sticker-pack) address (ethereum/default-address db)] (when contract - (merge {:db (assoc db :stickers/packs-pending packs-diff)} - (when-not (zero? (count packs-diff)) - {:stickers/owned-packs-fx [contract address] - :stickers/set-pending-timout-fx nil}))))) + (fx/merge cofx + (merge {:db (assoc db :stickers/packs-pending packs-diff)} + (when-not (zero? (count packs-diff)) + {:stickers/owned-packs-fx [contract address] + :stickers/set-pending-timeout-fx nil})) + (multiaccounts.update/multiaccount-update + :stickers/packs-pending + packs-diff + {}))))) (fx/defn pack-owned [{db :db} id] {:db (update db :stickers/packs-owned conj id)}) diff --git a/src/status_im/ui/screens/db.cljs b/src/status_im/ui/screens/db.cljs index 274501de47..62637427f8 100644 --- a/src/status_im/ui/screens/db.cljs +++ b/src/status_im/ui/screens/db.cljs @@ -51,7 +51,7 @@ :dimensions/window (dimensions/window) :registry {} :stickers/packs-owned #{} - :stickers/packs-pending #{} + :stickers/packs-pending #{} :hardwallet {:nfc-enabled? false :pin {:original [] :confirmation [] diff --git a/status-go-version.json b/status-go-version.json index 3e07464dfb..743569d3c8 100644 --- a/status-go-version.json +++ b/status-go-version.json @@ -2,7 +2,7 @@ "_comment": "DO NOT EDIT THIS FILE BY HAND. USE 'scripts/update-status-go.sh ' instead", "owner": "status-im", "repo": "status-go", - "version": "v0.43.1", - "commit-sha1": "0b6ad662b519ce0bc0f0c1c65f8c5eb77ddb2904", - "src-sha256": "1rn11ig98pb6y5gp5w9vzh41grsampd8bz09zdqz2rzfdic1b66i" + "version": "v0.44.2", + "commit-sha1": "fdcefb8dc298b334be601ad7e330f14bdb066fc5", + "src-sha256": "19shkxqqwdz218d436fkbfcp8n257r55mnbr467kdm2ac973pnv1" }