From a0721a8bcd7ebb0e6f3cd08bc09227b069ec27e5 Mon Sep 17 00:00:00 2001 From: andrey Date: Wed, 13 Dec 2023 12:41:27 +0100 Subject: [PATCH 1/5] remove old wallet ui, clean metro logs --- src/status_im/ethereum/subscriptions.cljs | 4 ++-- src/status_im2/contexts/profile/login/events.cljs | 7 ------- .../contexts/quo_preview/settings/reorder_item.cljs | 3 +-- .../shell/jump_to/components/bottom_tabs/view.cljs | 4 ---- .../contexts/shell/jump_to/components/home_stack/view.cljs | 5 +---- src/status_im2/contexts/shell/jump_to/state.cljs | 2 -- 6 files changed, 4 insertions(+), 21 deletions(-) diff --git a/src/status_im/ethereum/subscriptions.cljs b/src/status_im/ethereum/subscriptions.cljs index 1dbb7dd498e..d4a124d40f0 100644 --- a/src/status_im/ethereum/subscriptions.cljs +++ b/src/status_im/ethereum/subscriptions.cljs @@ -69,7 +69,7 @@ (rf/defn new-wallet-event [cofx {:keys [type blockNumber accounts] :as event}] - (log/info "[wallet-subs] new-wallet-event" + (log/debug "[wallet-subs] new-wallet-event" "event-type" type "blockNumber" blockNumber "accounts" accounts) @@ -85,4 +85,4 @@ "wallet-get-collectibles-details-done" {:fx [[:dispatch [:wallet/get-collectible-details-done event]]]} - (log/warn ::unknown-wallet-event :type type :event event))) + (log/debug ::unknown-wallet-event :type type :event event))) diff --git a/src/status_im2/contexts/profile/login/events.cljs b/src/status_im2/contexts/profile/login/events.cljs index 46b106e5495..38ed0a0c151 100644 --- a/src/status_im2/contexts/profile/login/events.cljs +++ b/src/status_im2/contexts/profile/login/events.cljs @@ -116,13 +116,6 @@ (cond-> {:json-rpc/call [{:method "wakuext_startMessenger" :on-success #(re-frame/dispatch [:messenger-started %]) :on-error #(log/error "failed to start messenger")}] - :wallet-legacy/initialize-transactions-management-enabled nil - :wallet-legacy/initialize-wallet - [network-id - current-network-config - (fn [accounts tokens custom-tokens favourites] - (re-frame/dispatch [:wallet-legacy/initialize-wallet - accounts tokens custom-tokens favourites]))] :check-eip1559-activation {:network-id network-id}} (not (:universal-links/handling db)) (assoc :effects.chat/open-last-chat (get-in db [:profile/profile :key-uid])) diff --git a/src/status_im2/contexts/quo_preview/settings/reorder_item.cljs b/src/status_im2/contexts/quo_preview/settings/reorder_item.cljs index 1385f22a464..ffcb7ac0af5 100644 --- a/src/status_im2/contexts/quo_preview/settings/reorder_item.cljs +++ b/src/status_im2/contexts/quo_preview/settings/reorder_item.cljs @@ -8,8 +8,7 @@ (def mock-data [{:id 1 :type types/item - :data {:on-press (println "pressed") - :image (resources/get-mock-image :diamond) + :data {:image (resources/get-mock-image :diamond) :image-size 21 :right-icon :i/world :title "Trip to Bahamas"}} diff --git a/src/status_im2/contexts/shell/jump_to/components/bottom_tabs/view.cljs b/src/status_im2/contexts/shell/jump_to/components/bottom_tabs/view.cljs index bd70ca3e029..44ceff3215c 100644 --- a/src/status_im2/contexts/shell/jump_to/components/bottom_tabs/view.cljs +++ b/src/status_im2/contexts/shell/jump_to/components/bottom_tabs/view.cljs @@ -33,10 +33,6 @@ (assoc :test-ID stack-id :icon icon :icon-color-anim icon-color - ;NOTE temporary use of on long press while we support old wallet - :on-long-press #(when (= stack-id :wallet-stack) - (swap! state/load-new-wallet? not) - (animation/bottom-tab-on-press stack-id true)) :on-press #(animation/bottom-tab-on-press stack-id true) :accessibility-label (str (name stack-id) "-tab") :customization-color customization-color))])) diff --git a/src/status_im2/contexts/shell/jump_to/components/home_stack/view.cljs b/src/status_im2/contexts/shell/jump_to/components/home_stack/view.cljs index 59f0c6f2448..af3f7e962db 100644 --- a/src/status_im2/contexts/shell/jump_to/components/home_stack/view.cljs +++ b/src/status_im2/contexts/shell/jump_to/components/home_stack/view.cljs @@ -32,10 +32,7 @@ (case stack-id :communities-stack [:f> communities/view] :chats-stack [:f> chat/view] - ;NOTE temporary while we support old wallet - :wallet-stack (if @state/load-new-wallet? - [wallet-new/view] - [wallet.accounts/accounts-overview-old]) + :wallet-stack [wallet-new/view] :browser-stack [browser.stack/browser-stack] [:<>])]) diff --git a/src/status_im2/contexts/shell/jump_to/state.cljs b/src/status_im2/contexts/shell/jump_to/state.cljs index 42b7f2dbdbd..2a6775c963d 100644 --- a/src/status_im2/contexts/shell/jump_to/state.cljs +++ b/src/status_im2/contexts/shell/jump_to/state.cljs @@ -17,5 +17,3 @@ (def load-chats-stack? (reagent/atom false)) (def load-wallet-stack? (reagent/atom false)) (def load-browser-stack? (reagent/atom false)) -;NOTE temporary while we support old wallet -(def load-new-wallet? (reagent/atom true)) From 823ede8ae6c92846915dabf1e3b49b7f5d334b2d Mon Sep 17 00:00:00 2001 From: andrey Date: Wed, 13 Dec 2023 12:47:01 +0100 Subject: [PATCH 2/5] lint and move enable-local-notifications --- src/status_im/ethereum/subscriptions.cljs | 6 +-- src/status_im/wallet/core.cljs | 21 ++++------ .../contexts/profile/login/effects.cljs | 4 ++ .../contexts/profile/login/events.cljs | 40 ++++++++++--------- .../jump_to/components/home_stack/view.cljs | 1 - 5 files changed, 36 insertions(+), 36 deletions(-) diff --git a/src/status_im/ethereum/subscriptions.cljs b/src/status_im/ethereum/subscriptions.cljs index d4a124d40f0..a7a5bccc421 100644 --- a/src/status_im/ethereum/subscriptions.cljs +++ b/src/status_im/ethereum/subscriptions.cljs @@ -70,9 +70,9 @@ (rf/defn new-wallet-event [cofx {:keys [type blockNumber accounts] :as event}] (log/debug "[wallet-subs] new-wallet-event" - "event-type" type - "blockNumber" blockNumber - "accounts" accounts) + "event-type" type + "blockNumber" blockNumber + "accounts" accounts) (case type "new-transfers" (new-transfers cofx blockNumber accounts) "recent-history-fetching" (recent-history-fetching-started cofx accounts) diff --git a/src/status_im/wallet/core.cljs b/src/status_im/wallet/core.cljs index 5844fe978f7..d60f10b513f 100644 --- a/src/status_im/wallet/core.cljs +++ b/src/status_im/wallet/core.cljs @@ -1153,26 +1153,19 @@ #(async-storage/set-item! :invalid-ens-name-seen true))))) nil) -(re-frame/reg-fx - ::enable-local-notifications - (fn [] - (native-module/start-local-notifications))) - (rf/defn initialize-wallet {:events [:wallet-legacy/initialize-wallet]} [{:keys [db] :as cofx} accounts tokens custom-tokens favourites scan-all-tokens? new-account?] (rf/merge cofx - {:db (assoc db - :profile/wallet-accounts - (rpc->accounts accounts)) - ;; NOTE: Local notifications should be enabled only after wallet was started - ::enable-local-notifications nil - :dispatch-n [(when (or (not (utils.mobile-sync/syncing-allowed? cofx)) - (chain/binance-chain? db)) - [:transaction/get-fetched-transfers])] - :dispatch [:wallet/get-accounts-success accounts]} + {:db (assoc db + :profile/wallet-accounts + (rpc->accounts accounts)) + :dispatch-n [(when (or (not (utils.mobile-sync/syncing-allowed? cofx)) + (chain/binance-chain? db)) + [:transaction/get-fetched-transfers])] + :dispatch [:wallet/get-accounts-success accounts]} (check-invalid-ens) (initialize-tokens tokens custom-tokens) (initialize-favourites favourites) diff --git a/src/status_im2/contexts/profile/login/effects.cljs b/src/status_im2/contexts/profile/login/effects.cljs index 2f211dfbe7d..d99fb11cf9a 100644 --- a/src/status_im2/contexts/profile/login/effects.cljs +++ b/src/status_im2/contexts/profile/login/effects.cljs @@ -9,3 +9,7 @@ ;;"node.login" signal will be triggered as a callback (native-module/login-account (assoc (profile.config/login) :keyUid key-uid :password hashed-password)))) + +(rf/reg-fx :effects.profile/enable-local-notifications + (fn [] + (native-module/start-local-notifications))) diff --git a/src/status_im2/contexts/profile/login/events.cljs b/src/status_im2/contexts/profile/login/events.cljs index 38ed0a0c151..e62798f766a 100644 --- a/src/status_im2/contexts/profile/login/events.cljs +++ b/src/status_im2/contexts/profile/login/events.cljs @@ -112,24 +112,28 @@ current-network-config (get networks current-network) network-id (str (get-in networks [current-network :config :NetworkId]))] - (rf/merge cofx - (cond-> {:json-rpc/call [{:method "wakuext_startMessenger" - :on-success #(re-frame/dispatch [:messenger-started %]) - :on-error #(log/error "failed to start messenger")}] - :check-eip1559-activation {:network-id network-id}} - (not (:universal-links/handling db)) - (assoc :effects.chat/open-last-chat (get-in db [:profile/profile :key-uid])) - notifications-enabled? - (assoc :effects/push-notifications-enable nil)) - (contacts/initialize-contacts) - (browser/initialize-browser) - (mobile-network/on-network-status-change) - (group-chats/get-group-chat-invitations) - (profile.settings.events/get-profile-picture) - (profile.settings.events/change-preview-privacy) - (link-preview/request-link-preview-whitelist) - (visibility-status-updates-store/fetch-visibility-status-updates-rpc) - (switcher-cards-store/fetch-switcher-cards-rpc)))) + (rf/merge + cofx + (cond-> {:json-rpc/call [{:method "wakuext_startMessenger" + :on-success #(re-frame/dispatch + [:messenger-started %]) + :on-error #(log/error + "failed to start messenger")}] + :check-eip1559-activation {:network-id network-id} + :effects.profile/enable-local-notifications nil} + (not (:universal-links/handling db)) + (assoc :effects.chat/open-last-chat (get-in db [:profile/profile :key-uid])) + notifications-enabled? + (assoc :effects/push-notifications-enable nil)) + (contacts/initialize-contacts) + (browser/initialize-browser) + (mobile-network/on-network-status-change) + (group-chats/get-group-chat-invitations) + (profile.settings.events/get-profile-picture) + (profile.settings.events/change-preview-privacy) + (link-preview/request-link-preview-whitelist) + (visibility-status-updates-store/fetch-visibility-status-updates-rpc) + (switcher-cards-store/fetch-switcher-cards-rpc)))) (rf/defn messenger-started {:events [:messenger-started]} diff --git a/src/status_im2/contexts/shell/jump_to/components/home_stack/view.cljs b/src/status_im2/contexts/shell/jump_to/components/home_stack/view.cljs index af3f7e962db..8548e53a7d6 100644 --- a/src/status_im2/contexts/shell/jump_to/components/home_stack/view.cljs +++ b/src/status_im2/contexts/shell/jump_to/components/home_stack/view.cljs @@ -3,7 +3,6 @@ [quo.theme :as quo.theme] [react-native.reanimated :as reanimated] [status-im.ui.screens.browser.stack :as browser.stack] - [status-im.ui.screens.wallet.accounts.views :as wallet.accounts] [status-im2.contexts.chat.home.view :as chat] [status-im2.contexts.communities.home.view :as communities] [status-im2.contexts.shell.jump-to.components.home-stack.style :as style] From 630a1084e6276d800565597b8ea1140b4dea16c1 Mon Sep 17 00:00:00 2001 From: andrey Date: Wed, 13 Dec 2023 13:38:36 +0100 Subject: [PATCH 3/5] :wallet/get-accounts --- src/status_im/wallet/core.cljs | 3 +-- src/status_im2/contexts/profile/login/events.cljs | 1 + 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/status_im/wallet/core.cljs b/src/status_im/wallet/core.cljs index d60f10b513f..9cb535b4634 100644 --- a/src/status_im/wallet/core.cljs +++ b/src/status_im/wallet/core.cljs @@ -1164,8 +1164,7 @@ (rpc->accounts accounts)) :dispatch-n [(when (or (not (utils.mobile-sync/syncing-allowed? cofx)) (chain/binance-chain? db)) - [:transaction/get-fetched-transfers])] - :dispatch [:wallet/get-accounts-success accounts]} + [:transaction/get-fetched-transfers])]} (check-invalid-ens) (initialize-tokens tokens custom-tokens) (initialize-favourites favourites) diff --git a/src/status_im2/contexts/profile/login/events.cljs b/src/status_im2/contexts/profile/login/events.cljs index e62798f766a..0f46ccbb6c9 100644 --- a/src/status_im2/contexts/profile/login/events.cljs +++ b/src/status_im2/contexts/profile/login/events.cljs @@ -120,6 +120,7 @@ :on-error #(log/error "failed to start messenger")}] :check-eip1559-activation {:network-id network-id} + :wallet/get-accounts nil :effects.profile/enable-local-notifications nil} (not (:universal-links/handling db)) (assoc :effects.chat/open-last-chat (get-in db [:profile/profile :key-uid])) From 2e4816fc0d4d7244c6a3ea313d2a6b63609f8851 Mon Sep 17 00:00:00 2001 From: andrey Date: Wed, 13 Dec 2023 13:51:17 +0100 Subject: [PATCH 4/5] dispatch :wallet/get-accounts --- src/status_im2/contexts/profile/login/events.cljs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/status_im2/contexts/profile/login/events.cljs b/src/status_im2/contexts/profile/login/events.cljs index 0f46ccbb6c9..9a0d82d1029 100644 --- a/src/status_im2/contexts/profile/login/events.cljs +++ b/src/status_im2/contexts/profile/login/events.cljs @@ -120,8 +120,8 @@ :on-error #(log/error "failed to start messenger")}] :check-eip1559-activation {:network-id network-id} - :wallet/get-accounts nil - :effects.profile/enable-local-notifications nil} + :effects.profile/enable-local-notifications nil + :dispatch-n [:wallet/get-accounts]} (not (:universal-links/handling db)) (assoc :effects.chat/open-last-chat (get-in db [:profile/profile :key-uid])) notifications-enabled? From 9dc78d7e1b6a649ae6e4e0e415ac208a4cf879e4 Mon Sep 17 00:00:00 2001 From: andrey Date: Wed, 13 Dec 2023 13:52:00 +0100 Subject: [PATCH 5/5] dispatch :wallet/get-accounts --- src/status_im2/contexts/profile/login/events.cljs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/status_im2/contexts/profile/login/events.cljs b/src/status_im2/contexts/profile/login/events.cljs index 9a0d82d1029..a33ff0ed980 100644 --- a/src/status_im2/contexts/profile/login/events.cljs +++ b/src/status_im2/contexts/profile/login/events.cljs @@ -121,7 +121,7 @@ "failed to start messenger")}] :check-eip1559-activation {:network-id network-id} :effects.profile/enable-local-notifications nil - :dispatch-n [:wallet/get-accounts]} + :dispatch-n [[:wallet/get-accounts]]} (not (:universal-links/handling db)) (assoc :effects.chat/open-last-chat (get-in db [:profile/profile :key-uid])) notifications-enabled?