mirror of
https://github.com/status-im/status-mobile.git
synced 2025-01-27 00:49:39 +00:00
feat!: add saved addresses to wallet settings (#20475)
This commit is contained in:
parent
4bd7abaace
commit
b005eb8181
@ -31,7 +31,7 @@
|
|||||||
(defn- checkbox-border-unchecked-color
|
(defn- checkbox-border-unchecked-color
|
||||||
[theme]
|
[theme]
|
||||||
{:normal (colors/theme-colors colors/neutral-30 colors/neutral-70 theme)
|
{:normal (colors/theme-colors colors/neutral-30 colors/neutral-70 theme)
|
||||||
:blur (colors/theme-colors colors/neutral-80-opa-20 colors/white-opa-40 theme)})
|
:blur (colors/theme-colors colors/neutral-80-opa-20 colors/white-opa-20 theme)})
|
||||||
|
|
||||||
(defn- filled-checkbox-background-color
|
(defn- filled-checkbox-background-color
|
||||||
[theme]
|
[theme]
|
||||||
|
@ -39,6 +39,12 @@
|
|||||||
(def avatar-container-rounded
|
(def avatar-container-rounded
|
||||||
(assoc avatar-container-common :border-radius 16))
|
(assoc avatar-container-common :border-radius 16))
|
||||||
|
|
||||||
|
(def big-avatar-container-rounded
|
||||||
|
(assoc avatar-container-common
|
||||||
|
:width 84
|
||||||
|
:height 84
|
||||||
|
:border-radius 42))
|
||||||
|
|
||||||
(def community-logo-image
|
(def community-logo-image
|
||||||
{:width 64
|
{:width 64
|
||||||
:height 64
|
:height 64
|
||||||
|
@ -13,8 +13,9 @@
|
|||||||
:as props}]
|
:as props}]
|
||||||
[rn/view {:style style/avatar-overlay}
|
[rn/view {:style style/avatar-overlay}
|
||||||
[rn/view
|
[rn/view
|
||||||
{:style (if (= avatar-type :wallet-account)
|
{:style (case avatar-type
|
||||||
style/avatar-container-rounded
|
:wallet-account style/avatar-container-rounded
|
||||||
|
:saved-address style/big-avatar-container-rounded
|
||||||
style/avatar-container-circular)}
|
style/avatar-container-circular)}
|
||||||
(case avatar-type
|
(case avatar-type
|
||||||
:profile
|
:profile
|
||||||
@ -37,7 +38,7 @@
|
|||||||
[channel-avatar/view (assoc props :locked? nil :size :size-64)]
|
[channel-avatar/view (assoc props :locked? nil :size :size-64)]
|
||||||
|
|
||||||
:saved-address
|
:saved-address
|
||||||
[wallet-avatar/wallet-user-avatar (assoc props :size :size-64)]
|
[wallet-avatar/wallet-user-avatar (assoc props :size :size-80)]
|
||||||
|
|
||||||
nil)]])
|
nil)]])
|
||||||
|
|
||||||
|
@ -27,4 +27,5 @@
|
|||||||
{:color colors/white-opa-40})
|
{:color colors/white-opa-40})
|
||||||
|
|
||||||
(def saved-address-item
|
(def saved-address-item
|
||||||
{:margin-top 4})
|
{:margin-top 4
|
||||||
|
:background-color colors/white-opa-5})
|
||||||
|
@ -49,6 +49,7 @@
|
|||||||
:multiline? true
|
:multiline? true
|
||||||
:on-clear clear-input
|
:on-clear clear-input
|
||||||
:return-key-type :done
|
:return-key-type :done
|
||||||
|
:auto-focus true
|
||||||
:clearable? (not empty-input?)
|
:clearable? (not empty-input?)
|
||||||
:on-change-text on-change-text
|
:on-change-text on-change-text
|
||||||
:button (when empty-input?
|
:button (when empty-input?
|
||||||
@ -83,7 +84,7 @@
|
|||||||
[quo/info-message
|
[quo/info-message
|
||||||
{:accessibility-label :error-message
|
{:accessibility-label :error-message
|
||||||
:size :default
|
:size :default
|
||||||
:icon :i/info
|
:icon :i/alert
|
||||||
:type :error
|
:type :error
|
||||||
:style style/info-message}
|
:style style/info-message}
|
||||||
error-msg])))
|
error-msg])))
|
||||||
@ -91,8 +92,7 @@
|
|||||||
(defn- existing-saved-address
|
(defn- existing-saved-address
|
||||||
[{:keys [address]}]
|
[{:keys [address]}]
|
||||||
(let [{:keys [name customization-color chain-short-names ens ens?]}
|
(let [{:keys [name customization-color chain-short-names ens ens?]}
|
||||||
(rf/sub [:wallet/saved-address-by-address
|
(rf/sub [:wallet/saved-address-by-address address])]
|
||||||
address])]
|
|
||||||
[rn/view {:style style/existing-saved-address-container}
|
[rn/view {:style style/existing-saved-address-container}
|
||||||
[quo/text
|
[quo/text
|
||||||
{:size :paragraph-1
|
{:size :paragraph-1
|
||||||
|
@ -93,20 +93,19 @@
|
|||||||
:subtitle-type :default
|
:subtitle-type :default
|
||||||
:label :none
|
:label :none
|
||||||
:blur? true
|
:blur? true
|
||||||
:icon-right? (not ens?)
|
:right-icon (when-not ens? :i/advanced)
|
||||||
:right-icon :i/advanced
|
|
||||||
:card? true
|
:card? true
|
||||||
:title (i18n/label :t/address)
|
:title (i18n/label :t/address)
|
||||||
:subtitle ens
|
:subtitle ens
|
||||||
:custom-subtitle address-text
|
:custom-subtitle address-text
|
||||||
:on-press open-network-preferences
|
:on-press (when-not ens? open-network-preferences)
|
||||||
:container-style style/data-item}
|
:container-style style/data-item}
|
||||||
ens?
|
ens?
|
||||||
(dissoc :custom-subtitle))
|
(dissoc :custom-subtitle))
|
||||||
[ens ens? open-network-preferences address-text])]
|
[ens ens? open-network-preferences address-text])]
|
||||||
[quo/overlay {:type :shell}
|
[quo/overlay {:type :shell}
|
||||||
[floating-button-page/view
|
[floating-button-page/view
|
||||||
{:footer-container-padding 0
|
{:footer-container-padding (if edit? (+ (safe-area/get-bottom) 12) 0)
|
||||||
:header [quo/page-nav
|
:header [quo/page-nav
|
||||||
{:type :no-title
|
{:type :no-title
|
||||||
:background :blur
|
:background :blur
|
||||||
@ -133,7 +132,7 @@
|
|||||||
:container-style style/avatar}]
|
:container-style style/avatar}]
|
||||||
[quo/title-input
|
[quo/title-input
|
||||||
{:blur? true
|
{:blur? true
|
||||||
:auto-focus true
|
:auto-focus (not edit?)
|
||||||
:max-length 24
|
:max-length 24
|
||||||
:size :heading-1
|
:size :heading-1
|
||||||
:placeholder placeholder
|
:placeholder placeholder
|
||||||
|
@ -73,27 +73,34 @@
|
|||||||
|
|
||||||
(defn- filtered-list
|
(defn- filtered-list
|
||||||
[{:keys [search-text]}]
|
[{:keys [search-text]}]
|
||||||
[rn/flat-list
|
(let [search-result (rf/sub [:wallet/filtered-saved-addresses search-text])]
|
||||||
{:key-fn :address
|
(if (empty? search-result)
|
||||||
:data (rf/sub [:wallet/filtered-saved-addresses search-text])
|
[empty-result]
|
||||||
:render-fn saved-address
|
[rn/flat-list
|
||||||
:shows-vertical-scroll-indicator false
|
{:key-fn :address
|
||||||
:keyboard-should-persist-taps :always
|
:data search-result
|
||||||
:content-container-style {:flex-grow 1}
|
:render-fn saved-address
|
||||||
:empty-component [empty-result]}])
|
:shows-vertical-scroll-indicator false
|
||||||
|
:keyboard-should-persist-taps :always
|
||||||
|
:content-container-style {:flex-grow 1}
|
||||||
|
:bounces false
|
||||||
|
:over-scroll-mode :never}])))
|
||||||
|
|
||||||
(defn- unfiltered-list
|
(defn- unfiltered-list
|
||||||
[{:keys [grouped-saved-addresses]}]
|
[{:keys [grouped-saved-addresses]}]
|
||||||
[rn/section-list
|
(if (empty? grouped-saved-addresses)
|
||||||
{:key-fn :title
|
[empty-list]
|
||||||
:shows-vertical-scroll-indicator false
|
[rn/section-list
|
||||||
:sticky-section-headers-enabled false
|
{:key-fn :title
|
||||||
:keyboard-should-persist-taps :always
|
:shows-vertical-scroll-indicator false
|
||||||
:render-section-header-fn header
|
:sticky-section-headers-enabled false
|
||||||
:sections grouped-saved-addresses
|
:keyboard-should-persist-taps :always
|
||||||
:render-fn saved-address
|
:render-section-header-fn header
|
||||||
:content-container-style {:flex-grow 1}
|
:sections grouped-saved-addresses
|
||||||
:empty-component [empty-list]}])
|
:render-fn saved-address
|
||||||
|
:bounces false
|
||||||
|
:over-scroll-mode :never
|
||||||
|
:content-container-style {:flex-grow 1}}]))
|
||||||
|
|
||||||
(defn- navigate-back
|
(defn- navigate-back
|
||||||
[]
|
[]
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
(:require [quo.core :as quo]
|
(:require [quo.core :as quo]
|
||||||
[react-native.safe-area :as safe-area]
|
[react-native.safe-area :as safe-area]
|
||||||
[status-im.contexts.settings.wallet.wallet-options.style :as style]
|
[status-im.contexts.settings.wallet.wallet-options.style :as style]
|
||||||
[status-im.feature-flags :as ff]
|
|
||||||
[utils.i18n :as i18n]
|
[utils.i18n :as i18n]
|
||||||
[utils.re-frame :as rf]))
|
[utils.re-frame :as rf]))
|
||||||
|
|
||||||
@ -20,11 +19,10 @@
|
|||||||
:blur? true
|
:blur? true
|
||||||
:on-press open-keypairs-and-accounts-settings-modal
|
:on-press open-keypairs-and-accounts-settings-modal
|
||||||
:action :arrow}
|
:action :arrow}
|
||||||
(when (ff/enabled? ::ff/settings.saved-addresses)
|
{:title (i18n/label :t/saved-addresses)
|
||||||
{:title (i18n/label :t/saved-addresses)
|
:blur? true
|
||||||
:blur? true
|
:on-press open-saved-addresses-settings-modal
|
||||||
:on-press open-saved-addresses-settings-modal
|
:action :arrow}])
|
||||||
:action :arrow})])
|
|
||||||
|
|
||||||
(defn basic-settings
|
(defn basic-settings
|
||||||
[]
|
[]
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
(let [{:keys [on-result]} (rf/sub [:get-screen-params])]
|
(let [{:keys [on-result]} (rf/sub [:get-screen-params])]
|
||||||
[scan-qr-code/view
|
[scan-qr-code/view
|
||||||
{:title (i18n/label :t/scan-qr)
|
{:title (i18n/label :t/scan-qr)
|
||||||
:subtitle (i18n/label :t/scan-an-account-qr-code)
|
:subtitle (i18n/label :t/scan-an-address-qr-code)
|
||||||
:error-message (i18n/label :t/oops-this-qr-does-not-contain-an-address)
|
:error-message (i18n/label :t/oops-this-qr-does-not-contain-an-address)
|
||||||
:validate-fn #(contains-supported-address? %)
|
:validate-fn #(contains-supported-address? %)
|
||||||
:on-success-scan (fn [result]
|
:on-success-scan (fn [result]
|
||||||
|
@ -220,7 +220,7 @@
|
|||||||
|
|
||||||
(defn make-network-item
|
(defn make-network-item
|
||||||
"This function generates props for quo/category component item"
|
"This function generates props for quo/category component item"
|
||||||
[{:keys [network-name color on-change networks state label-props type]}]
|
[{:keys [network-name color on-change networks state label-props type blur?]}]
|
||||||
(cond-> {:title (string/capitalize (name network-name))
|
(cond-> {:title (string/capitalize (name network-name))
|
||||||
:image :icon-avatar
|
:image :icon-avatar
|
||||||
:image-props {:icon (resources/get-network network-name)
|
:image-props {:icon (resources/get-network network-name)
|
||||||
@ -230,6 +230,7 @@
|
|||||||
(if (= :default state)
|
(if (= :default state)
|
||||||
:filled-checkbox
|
:filled-checkbox
|
||||||
:checkbox))
|
:checkbox))
|
||||||
|
:blur? blur?
|
||||||
:customization-color color
|
:customization-color color
|
||||||
:checked? (contains? networks network-name)
|
:checked? (contains? networks network-name)
|
||||||
:on-change on-change}}
|
:on-change on-change}}
|
||||||
|
@ -90,10 +90,7 @@
|
|||||||
:address address
|
:address address
|
||||||
:blur? blur?
|
:blur? blur?
|
||||||
:format :long}])
|
:format :long}])
|
||||||
:container-style (merge style/data-item
|
:container-style style/data-item}])
|
||||||
{:background-color (colors/theme-colors colors/neutral-2_5
|
|
||||||
colors/neutral-90
|
|
||||||
theme)})}])
|
|
||||||
[quo/category
|
[quo/category
|
||||||
{:list-type :settings
|
{:list-type :settings
|
||||||
:blur? blur?
|
:blur? blur?
|
||||||
@ -106,6 +103,7 @@
|
|||||||
:normal-checkbox? receiver?
|
:normal-checkbox? receiver?
|
||||||
:networks (get-current-preferences-names)
|
:networks (get-current-preferences-names)
|
||||||
:type :checkbox
|
:type :checkbox
|
||||||
|
:blur? blur?
|
||||||
:on-change (fn []
|
:on-change (fn []
|
||||||
(toggle-network (:network-name
|
(toggle-network (:network-name
|
||||||
network))
|
network))
|
||||||
@ -137,6 +135,7 @@
|
|||||||
:normal-checkbox? receiver?
|
:normal-checkbox? receiver?
|
||||||
:networks (get-current-preferences-names)
|
:networks (get-current-preferences-names)
|
||||||
:type :checkbox
|
:type :checkbox
|
||||||
|
:blur? blur?
|
||||||
:on-change (fn []
|
:on-change (fn []
|
||||||
(toggle-network (:network-name
|
(toggle-network (:network-name
|
||||||
network))
|
network))
|
||||||
|
@ -11,8 +11,6 @@
|
|||||||
|
|
||||||
(def ^:private initial-flags
|
(def ^:private initial-flags
|
||||||
{::community.edit-account-selection (enabled-in-env? :FLAG_EDIT_ACCOUNT_SELECTION_ENABLED)
|
{::community.edit-account-selection (enabled-in-env? :FLAG_EDIT_ACCOUNT_SELECTION_ENABLED)
|
||||||
::settings.saved-addresses (enabled-in-env?
|
|
||||||
:FLAG_WALLET_SETTINGS_SAVED_ADDRESSES_ENABLED)
|
|
||||||
::settings.import-all-keypairs (enabled-in-env?
|
::settings.import-all-keypairs (enabled-in-env?
|
||||||
:FLAG_WALLET_SETTINGS_IMPORT_ALL_KEYPAIRS)
|
:FLAG_WALLET_SETTINGS_IMPORT_ALL_KEYPAIRS)
|
||||||
::shell.jump-to (enabled-in-env? :ENABLE_JUMP_TO)
|
::shell.jump-to (enabled-in-env? :ENABLE_JUMP_TO)
|
||||||
|
@ -54,7 +54,7 @@
|
|||||||
:wallet/saved-address-by-address
|
:wallet/saved-address-by-address
|
||||||
:<- [:wallet/saved-addresses-by-network-mode]
|
:<- [:wallet/saved-addresses-by-network-mode]
|
||||||
(fn [saved-addresses [_ address]]
|
(fn [saved-addresses [_ address]]
|
||||||
(get saved-addresses address)))
|
(get saved-addresses (string/lower-case address))))
|
||||||
|
|
||||||
(rf/reg-sub
|
(rf/reg-sub
|
||||||
:wallet/filtered-saved-addresses
|
:wallet/filtered-saved-addresses
|
||||||
@ -65,7 +65,7 @@
|
|||||||
(sort-by :name)
|
(sort-by :name)
|
||||||
(filter
|
(filter
|
||||||
(fn [{:keys [name address ens chain-short-names]}]
|
(fn [{:keys [name address ens chain-short-names]}]
|
||||||
(let [lowercase-query (string/lower-case query)]
|
(let [lowercase-query (string/lower-case (string/trim query))]
|
||||||
(or
|
(or
|
||||||
(string/includes? (string/lower-case name) lowercase-query)
|
(string/includes? (string/lower-case name) lowercase-query)
|
||||||
(string/includes? address lowercase-query)
|
(string/includes? address lowercase-query)
|
||||||
|
@ -2475,7 +2475,7 @@
|
|||||||
"make-one-it-is-easy-we-promise": "Make one, it’s easy, we promise!",
|
"make-one-it-is-easy-we-promise": "Make one, it’s easy, we promise!",
|
||||||
"saved-addresses": "Saved addresses",
|
"saved-addresses": "Saved addresses",
|
||||||
"no-saved-addresses": "No saved addresses",
|
"no-saved-addresses": "No saved addresses",
|
||||||
"you-like-to-type-43-characters": "You like to type 43 characters?",
|
"you-like-to-type-43-characters": "Do you like to type 43 characters?",
|
||||||
"no-other-accounts": "No other accounts",
|
"no-other-accounts": "No other accounts",
|
||||||
"here-is-a-cat-in-a-box-instead": "Here’s a cat in a box instead",
|
"here-is-a-cat-in-a-box-instead": "Here’s a cat in a box instead",
|
||||||
"accounts-count": "{{count}} accounts",
|
"accounts-count": "{{count}} accounts",
|
||||||
@ -2506,6 +2506,7 @@
|
|||||||
"select-another-account": "Select another account",
|
"select-another-account": "Select another account",
|
||||||
"oops-this-qr-does-not-contain-an-address": "Oops! This QR does not contain an address",
|
"oops-this-qr-does-not-contain-an-address": "Oops! This QR does not contain an address",
|
||||||
"scan-an-account-qr-code": "Scan an account QR code",
|
"scan-an-account-qr-code": "Scan an account QR code",
|
||||||
|
"scan-an-address-qr-code": "Scan an address QR code",
|
||||||
"buy-assets": "Buy assets",
|
"buy-assets": "Buy assets",
|
||||||
"one-time": "One time",
|
"one-time": "One time",
|
||||||
"recurrent": "Recurrent",
|
"recurrent": "Recurrent",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user