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

This commit is contained in:
Jamie Caprani 2024-01-25 21:13:33 +00:00 committed by GitHub
parent ad7a95ed3d
commit d8e0d1c36b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 30 additions and 160 deletions

View File

@ -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})

View File

@ -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]
@ -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)
#(rf/dispatch [:open-modal :wallet-bridge])
#(js/alert "feature disabled in config file"))}])
[quo/tabs
{:style style/tabs
:size 32

View File

@ -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]))
@ -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
@ -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)}
[quo/link-card (assoc item :container-style link-card-container-style)])])]))
(def view (quo.theme/with-theme view-internal))

View File

@ -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]
@ -12,6 +11,6 @@
(defn view
[]
[rn/flat-list
{:data temp/collectible-activities
{:data nil
:style {:flex 1}
:render-fn activity-item}])

View File

@ -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]
@ -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
@ -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}

View File

@ -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]
@ -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

View File

@ -1,124 +0,0 @@
(ns status-im.contexts.wallet.temp
(:require [clojure.string :as string]
[quo.foundations.resources :as quo.resources]
[status-im.common.resources :as resources]
[status-im.contexts.wallet.item-types :as types]))
(def ens-local-suggestion-saved-address-mock
{:type types/saved-address
:name "Pedro"
:ens "pedro.eth"
:address "0x4732894732894738294783294723894723984"
:customization-color :purple
:networks [{:network-name :ethereum
:short-name "eth"}
{:network-name :optimism
:short-name "opt"}]})
(def ens-local-suggestion-mock
{:type types/address
:ens "pedro.eth"
:address "0x4732894732894738294783294723894723984"
:networks [{:network-name :ethereum
:short-name "eth"}
{:network-name :optimism
:short-name "opt"}]})
(def address-local-suggestion-saved-contact-address-mock
{:type types/saved-contact-address
:customization-color :blue
:accounts [{:name "New House"
:address "0x62cf6E0Ba4C4530735616e1Ee7ff5FbCB726fBd2"
:emoji "🍔"
:customization-color :blue}]
:contact-props {:full-name "Mark Libot"
:profile-picture (resources/get-mock-image :user-picture-male4)
:customization-color :purple}})
(def address-local-suggestion-saved-address-mock
{:type types/saved-address
:name "Peter Lamborginski"
:address "0x12FaBc34De56Ef78A9B0Cd12Ef3456AbC7D8E9F0"
:customization-color :magenta
:networks [{:network-name :ethereum
:short-name "eth"}
{:network-name :optimism
:short-name "opt"}]})
(def address-local-suggestion-mock
{:type types/address
:address "0x1233cD34De56Ef78A9B0Cd12Ef3456AbC7123dee"
:networks [{:network-name :ethereum
:short-name "eth"}
{:network-name :optimism
:short-name "opt"}]})
(defn find-matching-addresses
[substring]
(let [all-addresses [address-local-suggestion-saved-address-mock
address-local-suggestion-mock]]
(vec (filter #(string/starts-with? (:address %) substring) all-addresses))))
(def collectible-activities
[{:transaction :receive
:timestamp "Today 22:20"
:status :finalised
:counter 1
:first-tag {:size 24
:type :collectible
:collectible (resources/mock-images :collectible)
:collectible-name "Collectible"
:collectible-number "123"}
:second-tag-prefix :t/from
:second-tag {:size 24
:type :default
:full-name "Aretha Gosling"
:profile-picture (resources/mock-images :user-picture-female2)}
:third-tag-prefix :t/to
:third-tag {:size 24
:type :account
:account-name "Piggy bank"
:emoji "🐷"}
:fourth-tag-prefix :t/via
:fourth-tag {:size 24
:type :network
:network-logo (quo.resources/get-network :ethereum)
:network-name "Mainnet"}}
{:transaction :mint
:timestamp "Yesterday"
:status :finalised
:counter 1
:first-tag {:size 24
:type :collectible
:collectible (resources/mock-images :collectible)
:collectible-name "Collectible"
:collectible-number "123"}
:second-tag-prefix :t/at
:second-tag
{:size 24
:type :address
:address
"0x04fcf40c526b09ff9fb22f4a5dbd08490ef9b64af700870f8a0ba2133f4251d5607ed83cd9047b8c2796576bc83fa0de23a13a4dced07654b8ff137fe744047917"}
:third-tag-prefix :t/on
:third-tag {:size 24
:type :network
:network-logo (quo.resources/get-network :ethereum)
:network-name "Mainnet"}}])
(def collectible-about
{:cards [{:title "BAYC"
:icon :social/link
:address "boredapeyachtclub"
:customization-color :social/link
:on-press #(js/alert "pressed")}
{:title "Twitter"
:icon :social/twitter
:address "@BoredApeYC"
:customization-color :social/twitter
:on-press #(js/alert "pressed")}
{:title "Opensea"
:icon :social/opensea
:address "Bored Ape Yacht Club"
:customization-color :social/opensea
:on-press #(js/alert "pressed")}]})