Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: remove mock data from wallet and feature flag incomplete features #18569

Merged
merged 2 commits into from
Jan 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/status_im/config.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -162,3 +162,7 @@

(def community-accounts-selection-enabled? false)
(def fetch-messages-enabled? (enabled? (get-config :FETCH_MESSAGES_ENABLED "1")))

(def wallet-feature-flags
{:edit-default-keypair false
:bridge-token false})
Comment on lines +165 to +168
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

5 changes: 4 additions & 1 deletion src/status_im/contexts/wallet/account/view.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
[quo.core :as quo]
[react-native.core :as rn]
[reagent.core :as reagent]
[status-im.config :as config]
[status-im.contexts.wallet.account.style :as style]
[status-im.contexts.wallet.account.tabs.view :as tabs]
[status-im.contexts.wallet.common.account-switcher.view :as account-switcher]
Expand Down Expand Up @@ -52,7 +53,9 @@
:receive-action #(rf/dispatch [:open-modal :wallet-share-address {:status :receive}])
:buy-action #(rf/dispatch [:show-bottom-sheet
{:content buy-drawer}])
:bridge-action #(rf/dispatch [:open-modal :wallet-bridge])}])
:bridge-action (if (:bridge-token config/wallet-feature-flags)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To improve readability, maybe would be nice to have some function like feature-enabled? that receives the feature key, located in a utils file. WDYT?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, I agree! There was discussion in another pr - #18530 (comment)
where we will put some effort into how we want to work with feature flags.
For now I will leave it this way but in an upcoming pr/issue will refactor this

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome 😃

#(rf/dispatch [:open-modal :wallet-bridge])
#(js/alert "feature disabled in config file"))}])
[quo/tabs
{:style style/tabs
:size 32
Expand Down
19 changes: 10 additions & 9 deletions src/status_im/contexts/wallet/collectible/tabs/about/view.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
[quo.theme]
[react-native.core :as rn]
[status-im.contexts.wallet.collectible.tabs.about.style :as style]
[status-im.contexts.wallet.temp :as temp]
[utils.i18n :as i18n]
[utils.re-frame :as rf]))

Expand All @@ -14,7 +13,8 @@
(let [window-width (rf/sub [:dimensions/window-width])
item-width (- (/ window-width 2) link-card-space)
{:keys [collectible-data]} (rf/sub [:wallet/last-collectible-details])
link-card-container-style (style/link-card item-width)]
link-card-container-style (style/link-card item-width)
collectible-about {:cards []}]
[:<>
[rn/view {:style style/title}
[quo/text
Expand All @@ -25,12 +25,13 @@
[quo/text
{:size :paragraph-2}
(:description collectible-data)]]
[quo/section-label
{:container-style style/section-label
:section (i18n/label :t/on-the-web)}]
[rn/view {:style style/link-cards-container}
(for [item (:cards temp/collectible-about)]
^{:key (:title item)}
[quo/link-card (assoc item :container-style link-card-container-style)])]]))
(when (count collectible-about)
[quo/section-label
{:container-style style/section-label
:section (i18n/label :t/on-the-web)}]
[rn/view {:style style/link-cards-container}
(for [item (:cards collectible-about)]
^{:key (:title item)}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a blocker: I know this is not from your PR. I have a feeling that using the name of the collectable as the key is not a good idea as it may have the same names.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any suggestions?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe id?

[quo/link-card (assoc item :container-style link-card-container-style)])])]))

(def view (quo.theme/with-theme view-internal))
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
(ns status-im.contexts.wallet.collectible.tabs.activity.view
(:require [quo.core :as quo]
[react-native.core :as rn]
[status-im.contexts.wallet.temp :as temp]))
[react-native.core :as rn]))

(defn activity-item
[item]
Expand All @@ -12,6 +11,6 @@
(defn view
[]
[rn/flat-list
{:data temp/collectible-activities
{:data nil
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe add a TODO here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah sure, I'll create the issues for the code removed so the data structure is easy to track 👍

:style {:flex 1}
:render-fn activity-item}])
7 changes: 5 additions & 2 deletions src/status_im/contexts/wallet/create_account/view.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
[reagent.core :as reagent]
[status-im.common.emoji-picker.utils :as emoji-picker.utils]
[status-im.common.standard-authentication.core :as standard-auth]
[status-im.config :as config]
[status-im.constants :as constants]
[status-im.contexts.wallet.common.utils :as utils]
[status-im.contexts.wallet.create-account.style :as style]
Expand All @@ -31,7 +32,9 @@
:size :xxs
:customization-color account-color}
:action :button
:action-props {:on-press #(rf/dispatch [:navigate-to :wallet-select-keypair])
:action-props {:on-press (if (:edit-default-keypair config/wallet-feature-flags)
#(rf/dispatch [:navigate-to :wallet-select-keypair])
#(js/alert "feature disabled in config file"))
:button-text (i18n/label :t/edit)
:alignment :flex-start}
:description :text
Expand All @@ -40,7 +43,7 @@
:image :icon
:image-props :i/derivated-path
:action :button
:action-props {:on-press #(js/alert "Button pressed!")
:action-props {:on-press #(js/alert "Coming soon!")
:button-text (i18n/label :t/edit)
:icon-left :i/placeholder
:alignment :flex-start}
Expand Down
26 changes: 5 additions & 21 deletions src/status_im/contexts/wallet/events.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
[status-im.contexts.wallet.data-store :as data-store]
[status-im.contexts.wallet.events.collectibles]
[status-im.contexts.wallet.item-types :as item-types]
[status-im.contexts.wallet.temp :as temp]
[taoensso.timbre :as log]
[utils.ethereum.chain :as chain]
[utils.ethereum.eip.eip55 :as eip55]
Expand Down Expand Up @@ -242,30 +241,15 @@


(rf/reg-event-fx :wallet/fetch-address-suggestions
(fn [{:keys [db]} [address]]
(fn [{:keys [db]} [_address]]
{:db (assoc db
:wallet/local-suggestions
(cond
(= address
(get-in
temp/address-local-suggestion-saved-contact-address-mock
[:accounts 0 :address]))
[temp/address-local-suggestion-saved-contact-address-mock]
(= address
(get temp/address-local-suggestion-saved-address-mock
:address))
[temp/address-local-suggestion-saved-address-mock]
:else (temp/find-matching-addresses address))
:wallet/valid-ens-or-address?
false)}))
:wallet/local-suggestions nil
:wallet/valid-ens-or-address? false)}))

(rf/reg-event-fx :wallet/ens-validation-success
(fn [{:keys [db]} [ens]]
(fn [{:keys [db]} [_ens]]
{:db (assoc db
:wallet/local-suggestions (if (= ens
(:ens temp/ens-local-suggestion-saved-address-mock))
[temp/ens-local-suggestion-saved-address-mock]
[temp/ens-local-suggestion-mock])
:wallet/local-suggestions nil
:wallet/valid-ens-or-address? true)}))

(rf/reg-event-fx :wallet/address-validation-success
Expand Down
124 changes: 0 additions & 124 deletions src/status_im/contexts/wallet/temp.cljs

This file was deleted.