[#19926] feat: allow for disabling testnet mode by pressing the banner (#20935)

This commit is contained in:
Mohsen 2024-08-19 15:30:03 +03:30 committed by GitHub
parent 5a9279b232
commit eecd1d50e4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 24 additions and 6 deletions

View File

@ -19,8 +19,10 @@
:text-color (colors/resolve-color :danger theme)}})
(defn- banner
[{:keys [text type second-banner? colors-map]}]
[rn/view (when second-banner? {:style style/second-banner-wrapper})
[{:keys [text type second-banner? colors-map on-press]}]
[rn/pressable
{:on-press #(when on-press (on-press))
:style (when second-banner? style/second-banner-wrapper)}
[hole-view/hole-view
{:style (style/hole-view (get-in colors-map [type :background-color]))
:holes (if second-banner?

View File

@ -126,7 +126,8 @@
[reanimated/view
{:style (reanimated/apply-animations-to-style
{:opacity bg-opacity}
{:flex 1 :background-color colors/neutral-100-opa-70})}]]
{:flex 1
:background-color (if shell? colors/neutral-100-opa-60 colors/neutral-100-opa-70)})}]]
;; sheet
[gesture/gesture-detector {:gesture sheet-gesture}
[reanimated/view
@ -138,7 +139,7 @@
[quo/blur
{:style style/shell-bg
:blur-radius (or blur-radius 20)
:blur-amount 32
:blur-amount 15
:blur-type :transparent
:overlay-color :transparent}]])
(when selected-item

View File

@ -252,4 +252,5 @@
{:fx [[:dispatch
[:alert-banners/add
{:type :alert
:text (i18n/label :t/testnet-mode-enabled)}]]]})))
:text (i18n/label :t/testnet-mode-enabled)
:on-press #(rf/dispatch [:wallet/show-disable-testnet-mode-confirmation])}]]]})))

View File

@ -2,7 +2,9 @@
(:require
[clojure.string :as string]
[native-module.core :as native-module]
[react-native.platform :as platform]
[status-im.contexts.settings.wallet.data-store :as data-store]
[status-im.contexts.settings.wallet.network-settings.testnet-mode.view :as testnet]
[taoensso.timbre :as log]
[utils.i18n :as i18n]
[utils.re-frame :as rf]
@ -292,3 +294,15 @@
(rf/reg-event-fx :wallet/make-partially-operable-accounts-fully-operable
make-partially-operable-accounts-fully-operable)
(rf/reg-event-fx :wallet/show-disable-testnet-mode-confirmation
(fn [{:keys [db]} _]
(let [theme (:theme db)
blur? (and (not platform/android?) (= theme :dark))]
{:fx [[:dispatch
[:show-bottom-sheet
{:content (fn [] [testnet/view
{:enable? false
:blur? blur?}])
:shell? blur?
:theme (when-not platform/android? theme)}]]]})))