Skip to content

Commit

Permalink
fix alert banner issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Parveshdhull committed Apr 24, 2024
1 parent 782d038 commit 0f8d63b
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 5 deletions.
1 change: 1 addition & 0 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,4 @@ TEST_STATEOFUS=1
FAST_CREATE_COMMUNITY_ENABLED=1
TEST_NETWORKS_ENABLED=1
SHOW_NOT_IMPLEMENTED_FEATURES=0
ENABLE_ALERT_BANNER=0
1 change: 1 addition & 0 deletions .env.e2e
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,4 @@ TEST_NETWORKS_ENABLED=1
SHOW_NOT_IMPLEMENTED_FEATURES=1
DELETE_MESSAGE_FOR_ME_UNDO_TIME_LIMIT=10000
DELETE_MESSAGE_UNDO_TIME_LIMIT=10000
ENABLE_ALERT_BANNER=1
1 change: 1 addition & 0 deletions .env.jenkins
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,4 @@ LOCAL_PAIRING_ENABLED=1
FAST_CREATE_COMMUNITY_ENABLED=1
TEST_NETWORKS_ENABLED=1
SHOW_NOT_IMPLEMENTED_FEATURES=1
ENABLE_ALERT_BANNER=1
1 change: 1 addition & 0 deletions .env.nightly
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,4 @@ DATABASE_MANAGEMENT_ENABLED=1
DELETE_MESSAGE_ENABLED=1
FAST_CREATE_COMMUNITY_ENABLED=0
TEST_NETWORKS_ENABLED=0
ENABLE_ALERT_BANNER=1
4 changes: 4 additions & 0 deletions src/status_im/config.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -133,3 +133,7 @@
(def community-accounts-selection-enabled? true)
(def fetch-messages-enabled? (enabled? (get-config :FETCH_MESSAGES_ENABLED "1")))
(def test-networks-enabled? (enabled? (get-config :TEST_NETWORKS_ENABLED "0")))

;; Alert banners are disabled for debug builds because alert banners overlay
;; interfere with react-native debug tools, such as inspector and Perf monitor
(def enable-alert-banner? (enabled? (get-config :ENABLE_ALERT_BANNER "0")))
3 changes: 2 additions & 1 deletion src/status_im/contexts/profile/login/events.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,8 @@
(rf/reg-event-fx
:profile/show-testnet-mode-banner-if-enabled
(fn [{:keys [db]}]
(when (get-in db [:profile/profile :test-networks-enabled?])
(when (and (get-in db [:profile/profile :test-networks-enabled?])
config/enable-alert-banner?)
{:fx [[:dispatch
[:alert-banners/add
{:type :alert
Expand Down
5 changes: 3 additions & 2 deletions src/status_im/contexts/shell/jump_to/shared_values.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,9 @@
shell.constants/switcher-card-size)}))

(defn calculate-and-set-shared-values
[]
(let [{:keys [width] :as dimensions} (utils/dimensions)
[alert-banners-top-margin]
(let [{:keys [width height] :as dimensions} (utils/dimensions)
dimensions (assoc dimensions :height (- height alert-banners-top-margin))
switcher-card-left-position (/ (- width (* 2 shell.constants/switcher-card-size)) 3)
switcher-card-top-position (+ (safe-area/get-top) 120)
shared-values
Expand Down
4 changes: 3 additions & 1 deletion src/status_im/contexts/shell/jump_to/view.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@

(defn f-shell-stack
[]
(let [shared-values (shared-values/calculate-and-set-shared-values)]
(let [alert-banners-top-margin (rf/sub [:alert-banners/top-margin])
shared-values (shared-values/calculate-and-set-shared-values
alert-banners-top-margin)]
(rn/use-mount
(fn []
(rn/hw-back-add-listener navigate-back-handler)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@
keypairs (rf/sub [:wallet/keypairs])
selected-keypair-uid (rf/sub [:wallet/selected-keypair-uid])
placeholder (i18n/label :t/default-account-placeholder)
alert-banners-top-margin (rf/sub [:alert-banners/top-margin])
derivation-path (utils/get-derivation-path
number-of-accounts)
keypair (some #(when (= (:key-uid %) selected-keypair-uid)
Expand Down Expand Up @@ -109,7 +110,7 @@
(rn/use-unmount #(rf/dispatch [:wallet/clear-new-keypair]))
[floating-button-page/view
{:gradient-cover? true
:footer-container-padding 0
:footer-container-padding alert-banners-top-margin
:header-container-style {:padding-top top}
:customization-color @account-color
:header [quo/page-nav
Expand Down

0 comments on commit 0f8d63b

Please sign in to comment.