Feature/clean metro logs remove old wallet UI (#18165)

This commit is contained in:
flexsurfer 2023-12-13 16:11:30 +01:00 committed by GitHub
parent cc4a732f60
commit 0eb424bb74
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 40 additions and 57 deletions

View File

@ -69,10 +69,10 @@
(rf/defn new-wallet-event (rf/defn new-wallet-event
[cofx {:keys [type blockNumber accounts] :as 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 "event-type" type
"blockNumber" blockNumber "blockNumber" blockNumber
"accounts" accounts) "accounts" accounts)
(case type (case type
"new-transfers" (new-transfers cofx blockNumber accounts) "new-transfers" (new-transfers cofx blockNumber accounts)
"recent-history-fetching" (recent-history-fetching-started cofx accounts) "recent-history-fetching" (recent-history-fetching-started cofx accounts)
@ -85,4 +85,4 @@
"wallet-get-collectibles-details-done" {:fx [[:dispatch "wallet-get-collectibles-details-done" {:fx [[:dispatch
[:wallet/get-collectible-details-done [:wallet/get-collectible-details-done
event]]]} event]]]}
(log/warn ::unknown-wallet-event :type type :event event))) (log/debug ::unknown-wallet-event :type type :event event)))

View File

@ -1153,26 +1153,18 @@
#(async-storage/set-item! :invalid-ens-name-seen true))))) #(async-storage/set-item! :invalid-ens-name-seen true)))))
nil) nil)
(re-frame/reg-fx
::enable-local-notifications
(fn []
(native-module/start-local-notifications)))
(rf/defn initialize-wallet (rf/defn initialize-wallet
{:events [:wallet-legacy/initialize-wallet]} {:events [:wallet-legacy/initialize-wallet]}
[{:keys [db] :as cofx} accounts tokens custom-tokens [{:keys [db] :as cofx} accounts tokens custom-tokens
favourites scan-all-tokens? new-account?] favourites scan-all-tokens? new-account?]
(rf/merge (rf/merge
cofx cofx
{:db (assoc db {:db (assoc db
:profile/wallet-accounts :profile/wallet-accounts
(rpc->accounts accounts)) (rpc->accounts accounts))
;; NOTE: Local notifications should be enabled only after wallet was started :dispatch-n [(when (or (not (utils.mobile-sync/syncing-allowed? cofx))
::enable-local-notifications nil (chain/binance-chain? db))
:dispatch-n [(when (or (not (utils.mobile-sync/syncing-allowed? cofx)) [:transaction/get-fetched-transfers])]}
(chain/binance-chain? db))
[:transaction/get-fetched-transfers])]
:dispatch [:wallet/get-accounts-success accounts]}
(check-invalid-ens) (check-invalid-ens)
(initialize-tokens tokens custom-tokens) (initialize-tokens tokens custom-tokens)
(initialize-favourites favourites) (initialize-favourites favourites)

View File

@ -9,3 +9,7 @@
;;"node.login" signal will be triggered as a callback ;;"node.login" signal will be triggered as a callback
(native-module/login-account (native-module/login-account
(assoc (profile.config/login) :keyUid key-uid :password hashed-password)))) (assoc (profile.config/login) :keyUid key-uid :password hashed-password))))
(rf/reg-fx :effects.profile/enable-local-notifications
(fn []
(native-module/start-local-notifications)))

View File

@ -112,31 +112,29 @@
current-network-config (get networks current-network) current-network-config (get networks current-network)
network-id (str (get-in networks network-id (str (get-in networks
[current-network :config :NetworkId]))] [current-network :config :NetworkId]))]
(rf/merge cofx (rf/merge
(cond-> {:json-rpc/call [{:method "wakuext_startMessenger" cofx
:on-success #(re-frame/dispatch [:messenger-started %]) (cond-> {:json-rpc/call [{:method "wakuext_startMessenger"
:on-error #(log/error "failed to start messenger")}] :on-success #(re-frame/dispatch
:wallet-legacy/initialize-transactions-management-enabled nil [:messenger-started %])
:wallet-legacy/initialize-wallet :on-error #(log/error
[network-id "failed to start messenger")}]
current-network-config :check-eip1559-activation {:network-id network-id}
(fn [accounts tokens custom-tokens favourites] :effects.profile/enable-local-notifications nil
(re-frame/dispatch [:wallet-legacy/initialize-wallet :dispatch-n [[:wallet/get-accounts]]}
accounts tokens custom-tokens favourites]))] (not (:universal-links/handling db))
:check-eip1559-activation {:network-id network-id}} (assoc :effects.chat/open-last-chat (get-in db [:profile/profile :key-uid]))
(not (:universal-links/handling db)) notifications-enabled?
(assoc :effects.chat/open-last-chat (get-in db [:profile/profile :key-uid])) (assoc :effects/push-notifications-enable nil))
notifications-enabled? (contacts/initialize-contacts)
(assoc :effects/push-notifications-enable nil)) (browser/initialize-browser)
(contacts/initialize-contacts) (mobile-network/on-network-status-change)
(browser/initialize-browser) (group-chats/get-group-chat-invitations)
(mobile-network/on-network-status-change) (profile.settings.events/get-profile-picture)
(group-chats/get-group-chat-invitations) (profile.settings.events/change-preview-privacy)
(profile.settings.events/get-profile-picture) (link-preview/request-link-preview-whitelist)
(profile.settings.events/change-preview-privacy) (visibility-status-updates-store/fetch-visibility-status-updates-rpc)
(link-preview/request-link-preview-whitelist) (switcher-cards-store/fetch-switcher-cards-rpc))))
(visibility-status-updates-store/fetch-visibility-status-updates-rpc)
(switcher-cards-store/fetch-switcher-cards-rpc))))
(rf/defn messenger-started (rf/defn messenger-started
{:events [:messenger-started]} {:events [:messenger-started]}

View File

@ -8,8 +8,7 @@
(def mock-data (def mock-data
[{:id 1 [{:id 1
:type types/item :type types/item
:data {:on-press (println "pressed") :data {:image (resources/get-mock-image :diamond)
:image (resources/get-mock-image :diamond)
:image-size 21 :image-size 21
:right-icon :i/world :right-icon :i/world
:title "Trip to Bahamas"}} :title "Trip to Bahamas"}}

View File

@ -33,10 +33,6 @@
(assoc :test-ID stack-id (assoc :test-ID stack-id
:icon icon :icon icon
:icon-color-anim icon-color :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) :on-press #(animation/bottom-tab-on-press stack-id true)
:accessibility-label (str (name stack-id) "-tab") :accessibility-label (str (name stack-id) "-tab")
:customization-color customization-color))])) :customization-color customization-color))]))

View File

@ -3,7 +3,6 @@
[quo.theme :as quo.theme] [quo.theme :as quo.theme]
[react-native.reanimated :as reanimated] [react-native.reanimated :as reanimated]
[status-im.ui.screens.browser.stack :as browser.stack] [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.chat.home.view :as chat]
[status-im2.contexts.communities.home.view :as communities] [status-im2.contexts.communities.home.view :as communities]
[status-im2.contexts.shell.jump-to.components.home-stack.style :as style] [status-im2.contexts.shell.jump-to.components.home-stack.style :as style]
@ -32,10 +31,7 @@
(case stack-id (case stack-id
:communities-stack [:f> communities/view] :communities-stack [:f> communities/view]
:chats-stack [:f> chat/view] :chats-stack [:f> chat/view]
;NOTE temporary while we support old wallet :wallet-stack [wallet-new/view]
:wallet-stack (if @state/load-new-wallet?
[wallet-new/view]
[wallet.accounts/accounts-overview-old])
:browser-stack [browser.stack/browser-stack] :browser-stack [browser.stack/browser-stack]
[:<>])]) [:<>])])

View File

@ -17,5 +17,3 @@
(def load-chats-stack? (reagent/atom false)) (def load-chats-stack? (reagent/atom false))
(def load-wallet-stack? (reagent/atom false)) (def load-wallet-stack? (reagent/atom false))
(def load-browser-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))