From a2ac2a4f74db879e7386039a8a79554a5ae04c63 Mon Sep 17 00:00:00 2001 From: Ulises M Date: Tue, 21 Jan 2025 16:50:21 -0600 Subject: [PATCH] Add maps to pass params --- .../contexts/profile/edit/accent_colour/events.cljs | 7 +++++-- .../contexts/profile/edit/accent_colour/events_test.cljs | 5 ++++- src/status_im/contexts/profile/edit/header/events.cljs | 8 ++++---- .../contexts/profile/edit/header/events_test.cljs | 4 ++-- 4 files changed, 15 insertions(+), 9 deletions(-) diff --git a/src/status_im/contexts/profile/edit/accent_colour/events.cljs b/src/status_im/contexts/profile/edit/accent_colour/events.cljs index 3bc263384ba..ef7b5197a6b 100644 --- a/src/status_im/contexts/profile/edit/accent_colour/events.cljs +++ b/src/status_im/contexts/profile/edit/accent_colour/events.cljs @@ -4,7 +4,7 @@ [utils.re-frame :as rf])) (rf/reg-event-fx :profile/edit-accent-colour-success - (fn [_ [customization-color navigate-back? show-toast?]] + (fn [_ [{:keys [customization-color navigate-back? show-toast?]}]] {:fx [[:dispatch [:profile/save-local-accent-color customization-color]] (when navigate-back? [:dispatch [:navigate-back]]) @@ -29,7 +29,10 @@ [{:method "wakuext_setCustomizationColor" :params [{:customizationColor color :keyUid key-uid}] - :on-success [:profile/edit-accent-colour-success color navigate-back? show-toast?] + :on-success [:profile/edit-accent-colour-success + {:customization-color color + :navigate-back? navigate-back? + :show-toast? show-toast?}] :on-error #(log/error "failed to edit accent color." {:error %})}]]]})) (rf/reg-event-fx :profile/edit-accent-colour edit-accent-colour) diff --git a/src/status_im/contexts/profile/edit/accent_colour/events_test.cljs b/src/status_im/contexts/profile/edit/accent_colour/events_test.cljs index 0c9f2788180..0c042442556 100644 --- a/src/status_im/contexts/profile/edit/accent_colour/events_test.cljs +++ b/src/status_im/contexts/profile/edit/accent_colour/events_test.cljs @@ -11,7 +11,10 @@ [{:method "wakuext_setCustomizationColor" :params [{:customizationColor new-color :keyUid key-uid}] - :on-success [:profile/edit-accent-colour-success new-color true true] + :on-success [:profile/edit-accent-colour-success + {:customization-color new-color + :navigate-back? true + :show-toast? true}] :on-error fn?}]]]}] (is (match? expected (sut/edit-accent-colour cofx [{:color new-color}]))))) diff --git a/src/status_im/contexts/profile/edit/header/events.cljs b/src/status_im/contexts/profile/edit/header/events.cljs index 5e6a724cc59..5082d416b39 100644 --- a/src/status_im/contexts/profile/edit/header/events.cljs +++ b/src/status_im/contexts/profile/edit/header/events.cljs @@ -11,7 +11,7 @@ (update db :profile/profile dissoc :images))})) (rf/reg-event-fx :profile/edit-profile-picture-success - (fn [{db :db} [show-toast? images]] + (fn [{db :db} [{:keys [show-toast?]} images]] (let [has-picture? (-> db :profile/profile :images count pos?)] {:fx [[:dispatch [:profile/update-local-picture (reverse images)]] (when show-toast? @@ -34,12 +34,12 @@ {:fx [[:json-rpc/call [{:method "multiaccounts_storeIdentityImage" :params [key-uid path 0 0 crop-width crop-height] - :on-success [:profile/edit-profile-picture-success show-toast?]}]]]})) + :on-success [:profile/edit-profile-picture-success {:show-toast? show-toast?}]}]]]})) (rf/reg-event-fx :profile/edit-picture edit-profile-picture) (rf/reg-event-fx :profile/delete-profile-picture-success - (fn [_ [show-toast?]] + (fn [_ [{:keys [show-toast?]}]] {:fx [[:dispatch [:profile/update-local-picture nil]] (when show-toast? [:dispatch @@ -56,6 +56,6 @@ {:fx [[:json-rpc/call [{:method "multiaccounts_deleteIdentityImage" :params [key-uid] - :on-success [:profile/delete-profile-picture-success show-toast?]}]]]})) + :on-success [:profile/delete-profile-picture-success {:show-toast? show-toast?}]}]]]})) (rf/reg-event-fx :profile/delete-picture delete-profile-picture) diff --git a/src/status_im/contexts/profile/edit/header/events_test.cljs b/src/status_im/contexts/profile/edit/header/events_test.cljs index 3555887c761..e250542dc7f 100644 --- a/src/status_im/contexts/profile/edit/header/events_test.cljs +++ b/src/status_im/contexts/profile/edit/header/events_test.cljs @@ -12,7 +12,7 @@ [{:method "multiaccounts_storeIdentityImage" :params [key-uid picture 0 0 profile-picture-picker/crop-size profile-picture-picker/crop-size] - :on-success [:profile/edit-profile-picture-success true]}]]]}] + :on-success [:profile/edit-profile-picture-success {:show-toast? true}]}]]]}] (is (match? expected (sut/edit-profile-picture cofx [{:picture picture}]))))) @@ -22,6 +22,6 @@ expected {:fx [[:json-rpc/call [{:method "multiaccounts_deleteIdentityImage" :params [key-uid] - :on-success [:profile/delete-profile-picture-success true]}]]]}] + :on-success [:profile/delete-profile-picture-success {:show-toast? true}]}]]]}] (is (match? expected (sut/delete-profile-picture cofx [{}])))))