Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
Parveshdhull committed May 21, 2024
1 parent 34cf65b commit 01fb254
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 15 deletions.
2 changes: 2 additions & 0 deletions src/status_im/config.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -141,3 +141,5 @@
;; 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")))

(def jump-to-enabled? (enabled? (get-config :ENABLE_JUMP_TO "0")))
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
[status-im.contexts.shell.jump-to.constants :as shell.constants]
[status-im.contexts.shell.jump-to.state :as state]
[status-im.contexts.shell.jump-to.utils :as utils]
[status-im.config :as config]
[utils.re-frame :as rf]))

(defn blur-overlay-params
Expand Down Expand Up @@ -43,7 +44,8 @@
(defn f-bottom-tabs
[]
(let [notifications-data (rf/sub [:shell/bottom-tabs-notifications-data])
pass-through? (rf/sub [:shell/shell-pass-through?])
pass-through? (and config/jump-to-enabled?
(rf/sub [:shell/shell-pass-through?]))
shared-values @state/shared-values-atom
communities-double-tab-gesture (-> (gesture/gesture-tap)
(gesture/number-of-taps 2)
Expand Down
4 changes: 3 additions & 1 deletion src/status_im/contexts/shell/jump_to/utils.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
(:require
[react-native.async-storage :as async-storage]
[react-native.core :as rn]
[status-im.config :as config]
[react-native.platform :as platform]
[react-native.reanimated :as reanimated]
[react-native.safe-area :as safe-area]
Expand Down Expand Up @@ -118,7 +119,8 @@
;;; Navigation
(defn shell-navigation?
[view-id]
(some #{view-id} shell.constants/floating-screens))
(and config/config/jump-to-enabled?
(some #{view-id} shell.constants/floating-screens)))

(defn calculate-view-id
[]
Expand Down
23 changes: 13 additions & 10 deletions src/status_im/contexts/shell/jump_to/view.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
(:require
[quo.core :as quo]
[react-native.core :as rn]
[status-im.config :as config]
[status-im.contexts.shell.jump-to.animation :as animation]
[status-im.contexts.shell.jump-to.components.bottom-tabs.view :as bottom-tabs]
[status-im.contexts.shell.jump-to.components.floating-screens.view :as floating-screens]
Expand All @@ -13,14 +14,14 @@
[utils.i18n :as i18n]
[utils.re-frame :as rf]))

(defn navigate-back-handler
(defn- navigate-back-handler
[]
(when (or (seq @navigation.state/modals)
(seq (utils/open-floating-screens)))
(rf/dispatch [:navigate-back])
true))

(defn floating-button
(defn- floating-button
[shared-values]
(let [current-screen-id (rf/sub [:view-id])]
(when-not (= current-screen-id :settings)
Expand All @@ -32,7 +33,14 @@
:bottom (utils/bottom-tabs-container-height)}
(:home-stack-opacity shared-values)])))

(defn f-shell-stack
(defn- jump-to-components
[]
[:<>
[jump-to-screen/view]
[floating-button shared-values]
[floating-screens/view]])

(defn shell-stack
[]
(let [alert-banners-top-margin (rf/sub [:alert-banners/top-margin])
shared-values (shared-values/calculate-and-set-shared-values
Expand All @@ -42,12 +50,7 @@
(rn/hw-back-add-listener navigate-back-handler)
#(rn/hw-back-remove-listener navigate-back-handler)))
[:<>
[jump-to-screen/view]
[:f> bottom-tabs/f-bottom-tabs]
[:f> home-stack/f-home-stack]
[floating-button shared-values]
[floating-screens/view]]))

(defn shell-stack
[]
[:f> f-shell-stack])
(when config/jump-to-enabled?
[jump-to-components]])))
3 changes: 1 addition & 2 deletions src/status_im/navigation/screens.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,7 @@
:component shell-qr-reader/view}

{:name :chat
:options {:insets {:top? true}
:popGesture false}
:options {:popGesture false}
:component chat/chat}

{:name :start-a-new-chat
Expand Down
4 changes: 3 additions & 1 deletion src/status_im/subs/shell.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
[status-im.common.resources :as resources]
[status-im.constants :as constants]
[status-im.contexts.shell.jump-to.constants :as shell.constants]
[status-im.config :as config]
[utils.datetime :as datetime]
[utils.i18n :as i18n]))

Expand Down Expand Up @@ -268,4 +269,5 @@
:shell/chat-screen-loaded?
:<- [:shell/loaded-screens]
(fn [screens]
(get screens shell.constants/chat-screen)))
(or (not config/jump-to-enabled?)
(get screens shell.constants/chat-screen))))

0 comments on commit 01fb254

Please sign in to comment.