Skip to content

Commit

Permalink
more celanup
Browse files Browse the repository at this point in the history
  • Loading branch information
briansztamfater committed Dec 6, 2023
1 parent 3ff4f14 commit e42d22e
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 56 deletions.
2 changes: 1 addition & 1 deletion src/status_im/currency/core.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@
(rf/merge cofx
(multiaccounts.update/multiaccount-update
:currency
"USD"
currency
{})
(prices/update-prices)))
15 changes: 2 additions & 13 deletions src/status_im/ui/screens/advanced_settings/views.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@
transactions-management-enabled?
wakuv2-flag
current-fleet
webview-debug
test-networks-enabled?]}]
webview-debug]}]
(keep
identity
[{:size :small
Expand Down Expand Up @@ -101,15 +100,6 @@
[:profile.settings/change-webview-debug (not webview-debug)])
:accessory :switch
:active webview-debug}
{:size :small
:title "Test Networks Enabled"
:accessibility-label :test-networks-enabled
:container-margin-bottom 8
:on-press
#(re-frame/dispatch
[:profile.settings/change-test-networks-enabled (not test-networks-enabled?)])
:accessory :switch
:active test-networks-enabled?}
{:size :small
:title (i18n/label :t/waku-bloom-filter-mode)
:accessibility-label :waku-bloom-filter-mode-settings-switch
Expand Down Expand Up @@ -155,7 +145,6 @@
:dev-mode? false
:wakuv2-flag wakuv2-flag
:waku-bloom-filter-mode waku-bloom-filter-mode
:webview-debug webview-debug
:test-networks-enabled? test-networks-enabled?})
:webview-debug webview-debug})
:key-fn (fn [_ i] (str i))
:render-fn render-item}]))
64 changes: 32 additions & 32 deletions src/status_im/wallet/core.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -1074,38 +1074,38 @@

;;TODO: this could be replaced by a single API call on status-go side
(re-frame/reg-fx :wallet-legacy/initialize-wallet
(fn [[network-id _network callback]]
(-> (js/Promise.all
(clj->js
[(js/Promise.
(fn [resolve-fn reject]
(json-rpc/call {:method "accounts_getAccounts"
:on-success resolve-fn
:on-error reject})))
(js/Promise.
(fn [resolve-fn _]
(json-rpc/call {:method "wallet_getTokens"
:params [(int network-id)]
:on-success resolve-fn
:on-error (fn [_]
(resolve-fn nil))})))
(js/Promise.
(fn [resolve-fn reject]
(json-rpc/call {:method "wallet_getCustomTokens"
:on-success resolve-fn
:on-error reject})))
(js/Promise.
(fn [resolve-fn reject]
(json-rpc/call {:method "wallet_getSavedAddresses"
:on-success resolve-fn
:on-error reject})))]))
(.then (fn [[accounts _ tokens custom-tokens favourites]]
(callback accounts
(normalize-tokens network-id tokens)
(mapv #(update % :symbol keyword) custom-tokens)
(filter :favourite favourites))))
(.catch (fn [_]
(log/error "Failed to initialize wallet"))))))
(fn [[network-id _network callback]]
(-> (js/Promise.all
(clj->js
[(js/Promise.
(fn [resolve-fn reject]
(json-rpc/call {:method "accounts_getAccounts"
:on-success resolve-fn
:on-error reject})))
(js/Promise.
(fn [resolve-fn _]
(json-rpc/call {:method "wallet_getTokens"
:params [(int network-id)]
:on-success resolve-fn
:on-error (fn [_]
(resolve-fn nil))})))
(js/Promise.
(fn [resolve-fn reject]
(json-rpc/call {:method "wallet_getCustomTokens"
:on-success resolve-fn
:on-error reject})))
(js/Promise.
(fn [resolve-fn reject]
(json-rpc/call {:method "wallet_getSavedAddresses"
:on-success resolve-fn
:on-error reject})))]))
(.then (fn [[accounts _ tokens custom-tokens favourites]]
(callback accounts
(normalize-tokens network-id tokens)
(mapv #(update % :symbol keyword) custom-tokens)
(filter :favourite favourites))))
(.catch (fn [_]
(log/error "Failed to initialize wallet"))))))

(defn rpc->accounts
[accounts]
Expand Down
2 changes: 1 addition & 1 deletion src/status_im2/config.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@

(def default-multiaccount
{:preview-privacy? blank-preview?
:wallet-legacy/visible-tokens {:mainnet #{:SNT :ETH :DAI}}
:wallet-legacy/visible-tokens {:mainnet #{:SNT}}
:currency :usd
:appearance 0
:profile-pictures-show-to 2
Expand Down
1 change: 0 additions & 1 deletion src/status_im2/contexts/communities/discover/view.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,6 @@

(defn- internal-discover-view
[params]
(rf/dispatch [:fetch-contract-communities])
[:f> f-view-internal params])

(def view (quo.theme/with-theme internal-discover-view))
5 changes: 0 additions & 5 deletions src/status_im2/contexts/profile/settings/events.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
:on-success #(log/debug "sent contact update")}]}))

(rf/defn profile-update
{:events [:profile.settings/profile-update]}
[{:keys [db] :as cofx}
setting setting-value
{:keys [dont-sync? on-success] :or {on-success #()}}]
Expand Down Expand Up @@ -57,10 +56,6 @@
{:profile.settings/webview-debug-changed value}
(profile-update :webview-debug (boolean value) {})))

(rf/reg-event-fx :profile.settings/change-test-networks-enabled
(fn [_ [value]]
{:fx [[:dispatch [:profile.settings/profile-update :test-networks-enabled? (boolean value) {}]]]}))

(rf/defn change-preview-privacy-flag
{:events [:profile.settings/change-preview-privacy]}
[{:keys [db] :as cofx} private?]
Expand Down
6 changes: 3 additions & 3 deletions src/status_im2/contexts/wallet/home/view.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@

(defn view
[]
#_(rf/dispatch [:wallet/request-collectibles
{:start-at-index 0
:new-request? true}])
(rf/dispatch [:wallet/request-collectibles
{:start-at-index 0
:new-request? true}])
(let [top (safe-area/get-top)
selected-tab (reagent/atom (:id (first tabs-data)))]
(fn []
Expand Down

0 comments on commit e42d22e

Please sign in to comment.