Hide jump-to behind a feature flag (#20069)

This commit is contained in:
Parvesh Monu 2024-05-27 15:07:28 +05:30 committed by GitHub
parent 777b2bb8da
commit bcd8f3ad16
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
28 changed files with 184 additions and 98 deletions

View File

@ -38,3 +38,4 @@ SHOW_NOT_IMPLEMENTED_FEATURES=1
DELETE_MESSAGE_FOR_ME_UNDO_TIME_LIMIT=10000 DELETE_MESSAGE_FOR_ME_UNDO_TIME_LIMIT=10000
DELETE_MESSAGE_UNDO_TIME_LIMIT=10000 DELETE_MESSAGE_UNDO_TIME_LIMIT=10000
ENABLE_ALERT_BANNER=0 ENABLE_ALERT_BANNER=0
ENABLE_JUMP_TO=1

View File

@ -148,12 +148,11 @@
(when-let [chat-id (:current-chat-id db)] (when-let [chat-id (:current-chat-id db)]
(chat.state/reset-visible-item) (chat.state/reset-visible-item)
(rf/merge cofx (rf/merge cofx
(merge {:db (-> db
{:db (-> db (dissoc :current-chat-id)
(dissoc :current-chat-id) (assoc-in [:chat/inputs chat-id :focused?] false))
(assoc-in [:chat/inputs chat-id :focused?] false)) :effects.async-storage/set {:chat-id nil
:effects.async-storage/set {:chat-id nil :key-uid nil}}
:key-uid nil}})
(link-preview/reset-all) (link-preview/reset-all)
(delete-for-me/sync-all) (delete-for-me/sync-all)
(delete-message/send-all) (delete-message/send-all)
@ -215,8 +214,9 @@
[cofx chat-id animation] [cofx chat-id animation]
(rf/merge (rf/merge
cofx cofx
(navigation/pop-to-root :shell-stack) {:dispatch-later {:ms 500
(navigate-to-chat chat-id animation))) :dispatch [:chat/navigate-to-chat chat-id animation]}}
(navigation/pop-to-root :shell-stack)))
(rf/defn handle-clear-history-response (rf/defn handle-clear-history-response
{:events [:chat/history-cleared]} {:events [:chat/history-cleared]}

View File

@ -12,6 +12,7 @@
[status-im.common.home.actions.view :as actions] [status-im.common.home.actions.view :as actions]
[status-im.constants :as constants] [status-im.constants :as constants]
[status-im.contexts.chat.group-details.style :as style] [status-im.contexts.chat.group-details.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]))
@ -179,8 +180,9 @@
:admin? admin?} :admin? admin?}
:render-fn contact-item-render :render-fn contact-item-render
:separator [rn/view {:style {:height 4}}]}] :separator [rn/view {:style {:height 4}}]}]
[quo/floating-shell-button (when (ff/enabled? ::ff/shell.jump-to)
{:jump-to {:on-press #(rf/dispatch [:shell/navigate-to-jump-to]) [quo/floating-shell-button
:customization-color profile-color {:jump-to {:on-press #(rf/dispatch [:shell/navigate-to-jump-to])
:label (i18n/label :t/jump-to)}} :customization-color profile-color
style/floating-shell-button]])) :label (i18n/label :t/jump-to)}}
style/floating-shell-button])]))

View File

@ -4,6 +4,7 @@
[react-native.core :as rn] [react-native.core :as rn]
[react-native.reanimated :as reanimated] [react-native.reanimated :as reanimated]
[status-im.contexts.chat.messenger.composer.style :as style] [status-im.contexts.chat.messenger.composer.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]
[utils.worklets.chat.messenger.composer :as worklets])) [utils.worklets.chat.messenger.composer :as worklets]))
@ -30,11 +31,12 @@
[reanimated/view [reanimated/view
{:style (style/shell-button jump-to-button-position jump-to-button-opacity)} {:style (style/shell-button jump-to-button-position jump-to-button-opacity)}
[quo/floating-shell-button [quo/floating-shell-button
{:jump-to (when (ff/enabled? ::ff/shell.jump-to)
{:on-press #(rf/dispatch [:shell/navigate-to-jump-to]) {:jump-to
:customization-color customization-color {:on-press #(rf/dispatch [:shell/navigate-to-jump-to])
:label (i18n/label :t/jump-to) :customization-color customization-color
:style {:align-self :center}}} :label (i18n/label :t/jump-to)
:style {:align-self :center}}})
{}]] {}]]
[quo/floating-shell-button [quo/floating-shell-button
{:scroll-to-bottom {:on-press #(rf/dispatch [:chat.ui/scroll-to-bottom])}} {:scroll-to-bottom {:on-press #(rf/dispatch [:chat.ui/scroll-to-bottom])}}

View File

@ -5,6 +5,7 @@
[status-im.constants :as constants] [status-im.constants :as constants]
[status-im.contexts.chat.messenger.messages.contact-requests.bottom-drawer.style :as style] [status-im.contexts.chat.messenger.messages.contact-requests.bottom-drawer.style :as style]
[status-im.contexts.shell.jump-to.constants :as jump-to.constants] [status-im.contexts.shell.jump-to.constants :as jump-to.constants]
[status-im.feature-flags :as ff]
[utils.i18n :as i18n] [utils.i18n :as i18n]
[utils.re-frame :as rf])) [utils.re-frame :as rf]))
@ -49,10 +50,11 @@
contact-request-pending? contact-request-pending?
(i18n/label :t/contact-request-chat-pending))}] (i18n/label :t/contact-request-chat-pending))}]
[quo/floating-shell-button (when (ff/enabled? ::ff/shell.jump-to)
{:jump-to [quo/floating-shell-button
{:on-press #(rf/dispatch [:shell/navigate-to-jump-to]) {:jump-to
:customization-color customization-color {:on-press #(rf/dispatch [:shell/navigate-to-jump-to])
:label (i18n/label :t/jump-to)}} :customization-color customization-color
{:position :absolute :label (i18n/label :t/jump-to)}}
:top (- jump-to.constants/floating-shell-button-height)}]])) {:position :absolute
:top (- jump-to.constants/floating-shell-button-height)}])]))

View File

@ -5,9 +5,11 @@
[react-native.reanimated :as reanimated] [react-native.reanimated :as reanimated]
[status-im.contexts.chat.messenger.messages.constants :as messages.constants])) [status-im.contexts.chat.messenger.messages.constants :as messages.constants]))
(def keyboard-avoiding-container (defn keyboard-avoiding-container
{:flex 1 [theme]
:z-index 2}) {:flex 1
:background-color (colors/theme-colors colors/white colors/neutral-95 theme)
:z-index 2})
(defn background-container (defn background-container
[background-color background-opacity top-margin] [background-color background-opacity top-margin]

View File

@ -20,6 +20,7 @@
[status-im.contexts.chat.messenger.messages.list.state :as state] [status-im.contexts.chat.messenger.messages.list.state :as state]
[status-im.contexts.chat.messenger.messages.list.style :as style] [status-im.contexts.chat.messenger.messages.list.style :as style]
[status-im.contexts.shell.jump-to.constants :as jump-to.constants] [status-im.contexts.shell.jump-to.constants :as jump-to.constants]
[status-im.feature-flags :as ff]
[utils.i18n :as i18n] [utils.i18n :as i18n]
[utils.re-frame :as rf] [utils.re-frame :as rf]
[utils.worklets.chat.messenger.messages :as worklets])) [utils.worklets.chat.messenger.messages :as worklets]))
@ -106,7 +107,9 @@
(let [images (rf/sub [:chats/sending-image]) (let [images (rf/sub [:chats/sending-image])
height (if able-to-send-message? height (if able-to-send-message?
(+ composer.constants/composer-default-height (+ composer.constants/composer-default-height
jump-to.constants/floating-shell-button-height (if (ff/enabled? ::ff/shell.jump-to)
jump-to.constants/floating-shell-button-height
0)
(if (seq images) composer.constants/images-container-height 0) (if (seq images) composer.constants/images-container-height 0)
(:bottom insets)) (:bottom insets))
(- 70 (:bottom insets)))] (- 70 (:bottom insets)))]

View File

@ -1,30 +1,34 @@
(ns status-im.contexts.chat.messenger.messages.view (ns status-im.contexts.chat.messenger.messages.view
(:require (:require
[quo.theme :as quo.theme]
[react-native.core :as rn] [react-native.core :as rn]
[react-native.platform :as platform] [react-native.platform :as platform]
[react-native.reanimated :as reanimated] [react-native.reanimated :as reanimated]
[react-native.safe-area :as safe-area] [react-native.safe-area :as safe-area]
[reagent.core :as reagent]
[status-im.contexts.chat.messenger.composer.view :as composer.view] [status-im.contexts.chat.messenger.composer.view :as composer.view]
[status-im.contexts.chat.messenger.messages.list.style :as style] [status-im.contexts.chat.messenger.messages.list.style :as style]
[status-im.contexts.chat.messenger.messages.list.view :as list.view] [status-im.contexts.chat.messenger.messages.list.view :as list.view]
[status-im.contexts.chat.messenger.messages.navigation.view :as messages.navigation] [status-im.contexts.chat.messenger.messages.navigation.view :as messages.navigation]
[status-im.contexts.chat.messenger.placeholder.view :as placeholder.view] [status-im.contexts.chat.messenger.placeholder.view :as placeholder.view]
[status-im.feature-flags :as ff]
[utils.re-frame :as rf])) [utils.re-frame :as rf]))
(defn- chat-screen (defn- chat-screen
[{:keys [insets] :as props}] [{:keys [insets] :as props}]
(let [alert-banners-top-margin (rf/sub [:alert-banners/top-margin]) (let [theme (quo.theme/use-theme)
alert-banners-top-margin (rf/sub [:alert-banners/top-margin])
chat-exist? (rf/sub [:chats/current-chat-exist?])] chat-exist? (rf/sub [:chats/current-chat-exist?])]
(when chat-exist? (when chat-exist?
[rn/keyboard-avoiding-view [rn/keyboard-avoiding-view
{:style style/keyboard-avoiding-container {:style (style/keyboard-avoiding-container theme)
:keyboard-vertical-offset (- (if platform/ios? alert-banners-top-margin 0) (:bottom insets))} :keyboard-vertical-offset (- (if platform/ios? alert-banners-top-margin 0) (:bottom insets))}
[list.view/messages-list-content props] [list.view/messages-list-content props]
[messages.navigation/view props] [messages.navigation/view props]
[composer.view/composer props]]))) [composer.view/composer props]])))
(defn lazy-chat-screen (defn lazy-chat-screen
[chat-screen-layout-calculations-complete?] [chat-screen-layout-calculations-complete? *screen-loaded?*]
(let [screen-loaded? (rf/sub [:shell/chat-screen-loaded?]) (let [screen-loaded? (rf/sub [:shell/chat-screen-loaded?])
distance-from-list-top (reanimated/use-shared-value 0) distance-from-list-top (reanimated/use-shared-value 0)
chat-list-scroll-y (reanimated/use-shared-value 0) chat-list-scroll-y (reanimated/use-shared-value 0)
@ -36,16 +40,21 @@
:chat-list-scroll-y chat-list-scroll-y :chat-list-scroll-y chat-list-scroll-y
:chat-screen-layout-calculations-complete? :chat-screen-layout-calculations-complete?
chat-screen-layout-calculations-complete?}] chat-screen-layout-calculations-complete?}]
(when-not screen-loaded? (when *screen-loaded?*
(rn/use-mount #(reset! *screen-loaded?* true)))
(when-not (if *screen-loaded?* @*screen-loaded?* screen-loaded?)
(reanimated/set-shared-value chat-screen-layout-calculations-complete? false) (reanimated/set-shared-value chat-screen-layout-calculations-complete? false)
(reanimated/set-shared-value distance-from-list-top 0) (reanimated/set-shared-value distance-from-list-top 0)
(reanimated/set-shared-value chat-list-scroll-y 0)) (reanimated/set-shared-value chat-list-scroll-y 0))
(when screen-loaded? (when (if *screen-loaded?* @*screen-loaded?* screen-loaded?)
[chat-screen props]))) [chat-screen props])))
(defn chat (defn chat
[] []
(let [chat-screen-layout-calculations-complete? (reanimated/use-shared-value false)] (let [chat-screen-layout-calculations-complete? (reanimated/use-shared-value false)
jump-to-enabled? (ff/enabled? ::ff/shell.jump-to)
*screen-loaded?* (when-not jump-to-enabled?
(reagent/atom false))]
[:<> [:<>
[lazy-chat-screen chat-screen-layout-calculations-complete?] [lazy-chat-screen chat-screen-layout-calculations-complete? *screen-loaded?*]
[placeholder.view/view chat-screen-layout-calculations-complete?]])) [placeholder.view/view chat-screen-layout-calculations-complete?]]))

View File

@ -7,6 +7,7 @@
[status-im.common.contact-list.view :as contact-list] [status-im.common.contact-list.view :as contact-list]
[status-im.common.home.actions.view :as home.actions] [status-im.common.home.actions.view :as home.actions]
[status-im.contexts.communities.actions.channel-view-details.style :as style] [status-im.contexts.communities.actions.channel-view-details.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]))
@ -69,11 +70,12 @@
(rn/use-mount (fn [] (rn/use-mount (fn []
(rf/dispatch [:pin-message/load-pin-messages chat-id]))) (rf/dispatch [:pin-message/load-pin-messages chat-id])))
[:<> [:<>
[quo/floating-shell-button (when (ff/enabled? ::ff/shell.jump-to)
{:jump-to {:on-press #(rf/dispatch [:shell/navigate-to-jump-to]) [quo/floating-shell-button
:customization-color color {:jump-to {:on-press #(rf/dispatch [:shell/navigate-to-jump-to])
:label (i18n/label :t/jump-to)}} :customization-color color
style/floating-shell-button] :label (i18n/label :t/jump-to)}}
style/floating-shell-button])
[quo/gradient-cover {:customization-color color :opacity 0.4}] [quo/gradient-cover {:customization-color color :opacity 0.4}]
[quo/page-nav [quo/page-nav
{:background :blur {:background :blur

View File

@ -10,6 +10,7 @@
[status-im.common.scroll-page.view :as scroll-page] [status-im.common.scroll-page.view :as scroll-page]
[status-im.contexts.communities.actions.community-options.view :as options] [status-im.contexts.communities.actions.community-options.view :as options]
[status-im.contexts.communities.discover.style :as style] [status-im.contexts.communities.discover.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]))
@ -238,8 +239,9 @@
colors/neutral-95 colors/neutral-95
theme))} theme))}
[discover-screen-content featured-communities theme] [discover-screen-content featured-communities theme]
[quo/floating-shell-button (when (ff/enabled? ::ff/shell.jump-to)
{:jump-to {:on-press #(rf/dispatch [:shell/navigate-to-jump-to]) [quo/floating-shell-button
:customization-color customization-color {:jump-to {:on-press #(rf/dispatch [:shell/navigate-to-jump-to])
:label (i18n/label :t/jump-to)}} :customization-color customization-color
style/floating-shell-button]])) :label (i18n/label :t/jump-to)}}
style/floating-shell-button])]))

View File

@ -12,7 +12,9 @@
status-im.contexts.communities.actions.community-options.events status-im.contexts.communities.actions.community-options.events
status-im.contexts.communities.actions.leave.events status-im.contexts.communities.actions.leave.events
[status-im.contexts.communities.utils :as utils] [status-im.contexts.communities.utils :as utils]
[status-im.feature-flags :as ff]
[status-im.navigation.events :as navigation] [status-im.navigation.events :as navigation]
[status-im.navigation.transitions :as transitions]
[taoensso.timbre :as log] [taoensso.timbre :as log]
[utils.re-frame :as rf])) [utils.re-frame :as rf]))
@ -370,7 +372,10 @@
:update-last-opened-at? true}]]) :update-last-opened-at? true}]])
(if pop-to-root? (if pop-to-root?
[:dispatch [:chat/pop-to-root-and-navigate-to-chat chat-id]] [:dispatch [:chat/pop-to-root-and-navigate-to-chat chat-id]]
[:dispatch [:chat/navigate-to-chat chat-id]])]} [:dispatch
[:chat/navigate-to-chat chat-id
(when-not (ff/enabled? ::ff/shell.jump-to)
transitions/stack-slide-transition)]])]}
(when-not (get-in db [:chats chat-id :community-id]) (when-not (get-in db [:chats chat-id :community-id])
{:db (assoc-in db [:chats chat-id :community-id] community-id)})))) {:db (assoc-in db [:chats chat-id :community-id] community-id)}))))

View File

@ -18,6 +18,7 @@
[status-im.contexts.communities.actions.community-options.view :as options] [status-im.contexts.communities.actions.community-options.view :as options]
[status-im.contexts.communities.overview.style :as style] [status-im.contexts.communities.overview.style :as style]
[status-im.contexts.communities.utils :as communities.utils] [status-im.contexts.communities.utils :as communities.utils]
[status-im.feature-flags :as ff]
[utils.debounce :as debounce] [utils.debounce :as debounce]
[utils.i18n :as i18n] [utils.i18n :as i18n]
[utils.re-frame :as rf])) [utils.re-frame :as rf]))
@ -387,8 +388,9 @@
customization-color (rf/sub [:profile/customization-color])] customization-color (rf/sub [:profile/customization-color])]
[rn/view {:style style/community-overview-container} [rn/view {:style style/community-overview-container}
[community-card-page-view id] [community-card-page-view id]
[quo/floating-shell-button (when (ff/enabled? ::ff/shell.jump-to)
{:jump-to {:on-press #(rf/dispatch [:shell/navigate-to-jump-to]) [quo/floating-shell-button
:customization-color customization-color {:jump-to {:on-press #(rf/dispatch [:shell/navigate-to-jump-to])
:label (i18n/label :t/jump-to)}} :customization-color customization-color
style/floating-shell-button]])) :label (i18n/label :t/jump-to)}}
style/floating-shell-button])]))

View File

@ -6,6 +6,7 @@
[react-native.safe-area :as safe-area] [react-native.safe-area :as safe-area]
[status-im.common.resources :as resources] [status-im.common.resources :as resources]
[status-im.contexts.onboarding.enable-notifications.style :as style] [status-im.contexts.onboarding.enable-notifications.style :as style]
[status-im.contexts.shell.jump-to.constants :as shell.constants]
[status-im.contexts.shell.jump-to.utils :as shell.utils] [status-im.contexts.shell.jump-to.utils :as shell.utils]
[taoensso.timbre :as log] [taoensso.timbre :as log]
[utils.i18n :as i18n] [utils.i18n :as i18n]
@ -26,7 +27,10 @@
[rn/view {:style (style/buttons insets)} [rn/view {:style (style/buttons insets)}
[quo/button [quo/button
{:on-press (fn [] {:on-press (fn []
(shell.utils/change-selected-stack-id :communities-stack true nil) (shell.utils/change-selected-stack-id
shell.constants/default-selected-stack
true
nil)
(rf/dispatch (rf/dispatch
[:request-permissions [:request-permissions
{:permissions [:post-notifications] {:permissions [:post-notifications]
@ -43,7 +47,10 @@
(i18n/label :t/intro-wizard-title6)] (i18n/label :t/intro-wizard-title6)]
[quo/button [quo/button
{:on-press (fn [] {:on-press (fn []
(shell.utils/change-selected-stack-id :communities-stack true nil) (shell.utils/change-selected-stack-id
shell.constants/default-selected-stack
true
nil)
(rf/dispatch [:navigate-to-within-stack (rf/dispatch [:navigate-to-within-stack
[:screen/onboarding.welcome [:screen/onboarding.welcome
:screen/onboarding.enable-notifications]])) :screen/onboarding.enable-notifications]]))

View File

@ -7,6 +7,7 @@
[status-im.contexts.profile.contact.actions.view :as actions] [status-im.contexts.profile.contact.actions.view :as actions]
[status-im.contexts.profile.contact.header.view :as contact-header] [status-im.contexts.profile.contact.header.view :as contact-header]
[status-im.contexts.shell.jump-to.constants :as jump-to.constants] [status-im.contexts.shell.jump-to.constants :as jump-to.constants]
[status-im.feature-flags :as ff]
[utils.debounce :as debounce] [utils.debounce :as debounce]
[utils.i18n :as i18n] [utils.i18n :as i18n]
[utils.re-frame :as rf])) [utils.re-frame :as rf]))
@ -40,10 +41,11 @@
:on-press on-show-actions :on-press on-show-actions
:accessibility-label :contact-actions}]}} :accessibility-label :contact-actions}]}}
[contact-header/view {:scroll-y scroll-y}]] [contact-header/view {:scroll-y scroll-y}]]
[quo/floating-shell-button (when (ff/enabled? ::ff/shell.jump-to)
{:jump-to [quo/floating-shell-button
{:on-press on-jump-to {:jump-to
:customization-color profile-customization-color {:on-press on-jump-to
:label (i18n/label :t/jump-to)}} :customization-color profile-customization-color
{:position :absolute :label (i18n/label :t/jump-to)}}
:bottom jump-to.constants/floating-shell-button-height}]])) {:position :absolute
:bottom jump-to.constants/floating-shell-button-height}])]))

View File

@ -87,9 +87,10 @@
:on-scroll on-scroll :on-scroll on-scroll
:bounces false :bounces false
:over-scroll-mode :never}] :over-scroll-mode :never}]
[quo/floating-shell-button (when (ff/enabled? ::ff/shell.jump-to)
{:jump-to [quo/floating-shell-button
{:on-press #(rf/dispatch [:shell/navigate-to-jump-to]) {:jump-to
:customization-color customization-color {:on-press #(rf/dispatch [:shell/navigate-to-jump-to])
:label (i18n/label :t/jump-to)}} :customization-color customization-color
(style/floating-shell-button-style insets)]])) :label (i18n/label :t/jump-to)}}
(style/floating-shell-button-style insets)])]))

View File

@ -12,6 +12,7 @@
[status-im.contexts.shell.jump-to.constants :as shell.constants] [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.state :as state]
[status-im.contexts.shell.jump-to.utils :as utils] [status-im.contexts.shell.jump-to.utils :as utils]
[status-im.feature-flags :as ff]
[utils.re-frame :as rf])) [utils.re-frame :as rf]))
(defn blur-overlay-params (defn blur-overlay-params
@ -44,7 +45,8 @@
(defn f-bottom-tabs (defn f-bottom-tabs
[] []
(let [notifications-data (rf/sub [:shell/bottom-tabs-notifications-data]) (let [notifications-data (rf/sub [:shell/bottom-tabs-notifications-data])
pass-through? (rf/sub [:shell/shell-pass-through?]) pass-through? (and (ff/enabled? ::ff/shell.jump-to)
(rf/sub [:shell/shell-pass-through?]))
shared-values @state/shared-values-atom shared-values @state/shared-values-atom
communities-double-tab-gesture (-> (gesture/gesture-tap) communities-double-tab-gesture (-> (gesture/gesture-tap)
(gesture/number-of-taps 2) (gesture/number-of-taps 2)
@ -58,7 +60,9 @@
(rf/dispatch [:messages-home/select-tab :tab/recent])))) (rf/dispatch [:messages-home/select-tab :tab/recent]))))
bottom-tabs-blur-overlay-style (style/bottom-tabs-blur-overlay (:bottom-tabs-height bottom-tabs-blur-overlay-style (style/bottom-tabs-blur-overlay (:bottom-tabs-height
shared-values))] shared-values))]
(utils/load-stack @state/selected-stack-id) (utils/load-stack (if (ff/enabled? ::ff/shell.jump-to)
@state/selected-stack-id
shell.constants/default-selected-stack))
(reanimated/set-shared-value (:pass-through? shared-values) pass-through?) (reanimated/set-shared-value (:pass-through? shared-values) pass-through?)
[quo.theme/provider :dark [quo.theme/provider :dark
[reanimated/view [reanimated/view

View File

@ -4,6 +4,8 @@
(def ^:const switcher-card-size 160) (def ^:const switcher-card-size 160)
(def ^:const floating-shell-button-height 44) (def ^:const floating-shell-button-height 44)
(def ^:const default-selected-stack :communities-stack)
;; Bottom tabs ;; Bottom tabs
(def ^:const bottom-tabs-container-height-android 57) (def ^:const bottom-tabs-container-height-android 57)
(def ^:const bottom-tabs-container-height-ios 82) (def ^:const bottom-tabs-container-height-ios 82)

View File

@ -6,6 +6,7 @@
[status-im.contexts.shell.jump-to.constants :as shell.constants] [status-im.contexts.shell.jump-to.constants :as shell.constants]
status-im.contexts.shell.jump-to.effects status-im.contexts.shell.jump-to.effects
[status-im.contexts.shell.jump-to.utils :as shell.utils] [status-im.contexts.shell.jump-to.utils :as shell.utils]
[status-im.feature-flags :as ff]
[status-im.navigation.state :as navigation.state] [status-im.navigation.state :as navigation.state]
[utils.re-frame :as rf])) [utils.re-frame :as rf]))
@ -147,7 +148,7 @@
(:current-chat-id db)) (:current-chat-id db))
(conj [:chat/close]))}) (conj [:chat/close]))})
{:db (assoc db :view-id go-to-view-id) {:db (assoc db :view-id go-to-view-id)
:navigate-to [go-to-view-id (:theme db)]})) :navigate-to [go-to-view-id (:theme db) animation]}))
(rf/defn shell-navigate-back (rf/defn shell-navigate-back
{:events [:shell/navigate-back]} {:events [:shell/navigate-back]}
@ -171,7 +172,11 @@
shell.constants/close-screen-with-slide-to-right-animation))} shell.constants/close-screen-with-slide-to-right-animation))}
(when (and current-chat-id community-id) (when (and current-chat-id community-id)
{:dispatch [:shell/add-switcher-card shell.constants/community-screen community-id]})) {:dispatch [:shell/add-switcher-card shell.constants/community-screen community-id]}))
{:navigate-back nil}))) (merge
{:navigate-back nil}
(when (and (not (ff/enabled? ::ff/shell.jump-to))
(= current-view-id :chat))
{:dispatch [:chat/close]})))))
(rf/defn floating-screen-opened (rf/defn floating-screen-opened
{:events [:shell/floating-screen-opened]} {:events [:shell/floating-screen-opened]}

View File

@ -6,6 +6,7 @@
[status-im.contexts.shell.jump-to.constants :as shell.constants] [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.state :as state]
[status-im.contexts.shell.jump-to.utils :as utils] [status-im.contexts.shell.jump-to.utils :as utils]
[status-im.feature-flags :as ff]
[utils.worklets.shell :as worklets.shell])) [utils.worklets.shell :as worklets.shell]))
(defn calculate-home-stack-position (defn calculate-home-stack-position
@ -109,8 +110,11 @@
switcher-card-top-position (+ (safe-area/get-top) 120) switcher-card-top-position (+ (safe-area/get-top) 120)
shared-values shared-values
{:selected-stack-id (reanimated/use-shared-value {:selected-stack-id (reanimated/use-shared-value
(name (or @state/selected-stack-id :communities-stack))) (name (or @state/selected-stack-id shell.constants/default-selected-stack)))
:home-stack-state (reanimated/use-shared-value @state/home-stack-state)}] :home-stack-state (reanimated/use-shared-value
(if (ff/enabled? ::ff/shell.jump-to)
@state/home-stack-state
shell.constants/open-without-animation))}]
;; Whenever shell stack is created, calculate shared values function is called ;; Whenever shell stack is created, calculate shared values function is called
;; Means On login and on UI reloading (like changing theme) ;; Means On login and on UI reloading (like changing theme)
;; So we are also resetting bottom tabs here (disabling loading of unselected tabs), ;; So we are also resetting bottom tabs here (disabling loading of unselected tabs),

View File

@ -7,6 +7,7 @@
[react-native.safe-area :as safe-area] [react-native.safe-area :as safe-area]
[status-im.contexts.shell.jump-to.constants :as shell.constants] [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.state :as state]
[status-im.feature-flags :as ff]
[utils.re-frame :as rf])) [utils.re-frame :as rf]))
;;;; Helper Functions ;;;; Helper Functions
@ -118,7 +119,8 @@
;;; Navigation ;;; Navigation
(defn shell-navigation? (defn shell-navigation?
[view-id] [view-id]
(some #{view-id} shell.constants/floating-screens)) (and (ff/enabled? ::ff/shell.jump-to)
(some #{view-id} shell.constants/floating-screens)))
(defn calculate-view-id (defn calculate-view-id
[] []

View File

@ -9,18 +9,20 @@
[status-im.contexts.shell.jump-to.components.jump-to-screen.view :as jump-to-screen] [status-im.contexts.shell.jump-to.components.jump-to-screen.view :as jump-to-screen]
[status-im.contexts.shell.jump-to.shared-values :as shared-values] [status-im.contexts.shell.jump-to.shared-values :as shared-values]
[status-im.contexts.shell.jump-to.utils :as utils] [status-im.contexts.shell.jump-to.utils :as utils]
[status-im.feature-flags :as ff]
[status-im.navigation.state :as navigation.state] [status-im.navigation.state :as navigation.state]
[utils.i18n :as i18n] [utils.i18n :as i18n]
[utils.re-frame :as rf])) [utils.re-frame :as rf]))
(defn navigate-back-handler (defn- navigate-back-handler
[] []
(when (or (seq @navigation.state/modals) (when (or (seq @navigation.state/modals)
(seq (utils/open-floating-screens))) (seq (utils/open-floating-screens))
(> (count (navigation.state/get-navigation-state)) 1))
(rf/dispatch [:navigate-back]) (rf/dispatch [:navigate-back])
true)) true))
(defn floating-button (defn- floating-button
[shared-values] [shared-values]
(let [current-screen-id (rf/sub [:view-id])] (let [current-screen-id (rf/sub [:view-id])]
(when-not (= current-screen-id :settings) (when-not (= current-screen-id :settings)
@ -32,7 +34,7 @@
:bottom (utils/bottom-tabs-container-height)} :bottom (utils/bottom-tabs-container-height)}
(:home-stack-opacity shared-values)]))) (:home-stack-opacity shared-values)])))
(defn f-shell-stack (defn shell-stack
[] []
(let [alert-banners-top-margin (rf/sub [:alert-banners/top-margin]) (let [alert-banners-top-margin (rf/sub [:alert-banners/top-margin])
shared-values (shared-values/calculate-and-set-shared-values shared-values (shared-values/calculate-and-set-shared-values
@ -42,12 +44,11 @@
(rn/hw-back-add-listener navigate-back-handler) (rn/hw-back-add-listener navigate-back-handler)
#(rn/hw-back-remove-listener navigate-back-handler))) #(rn/hw-back-remove-listener navigate-back-handler)))
[:<> [:<>
[jump-to-screen/view] (when (ff/enabled? ::ff/shell.jump-to)
[jump-to-screen/view])
[:f> bottom-tabs/f-bottom-tabs] [:f> bottom-tabs/f-bottom-tabs]
[:f> home-stack/f-home-stack] [:f> home-stack/f-home-stack]
[floating-button shared-values] (when (ff/enabled? ::ff/shell.jump-to)
[floating-screens/view]])) [:<>
[floating-button shared-values]
(defn shell-stack [floating-screens/view]])]))
[]
[:f> f-shell-stack])

View File

@ -68,9 +68,10 @@
:scrollable? true :scrollable? true
:scroll-on-press? true}] :scroll-on-press? true}]
[tabs/view {:selected-tab @selected-tab}] [tabs/view {:selected-tab @selected-tab}]
[quo/floating-shell-button (when (ff/enabled? ::ff/shell.jump-to)
{:jump-to [quo/floating-shell-button
{:on-press #(rf/dispatch [:shell/navigate-to-jump-to]) {:jump-to
:customization-color customization-color {:on-press #(rf/dispatch [:shell/navigate-to-jump-to])
:label (i18n/label :t/jump-to)}} :customization-color customization-color
style/shell-button]])))) :label (i18n/label :t/jump-to)}}
style/shell-button])]))))

View File

@ -16,6 +16,7 @@
:FLAG_WALLET_SETTINGS_KEYPAIRS_AND_ACCOUNTS_ENABLED) :FLAG_WALLET_SETTINGS_KEYPAIRS_AND_ACCOUNTS_ENABLED)
::settings.network-settings (enabled-in-env? ::settings.network-settings (enabled-in-env?
:FLAG_WALLET_SETTINGS_NETWORK_SETTINGS_ENABLED) :FLAG_WALLET_SETTINGS_NETWORK_SETTINGS_ENABLED)
::shell.jump-to (enabled-in-env? :ENABLE_JUMP_TO)
::wallet.assets-modal-hide (enabled-in-env? :FLAG_ASSETS_MODAL_HIDE) ::wallet.assets-modal-hide (enabled-in-env? :FLAG_ASSETS_MODAL_HIDE)
::wallet.assets-modal-manage-tokens (enabled-in-env? :FLAG_ASSETS_MODAL_MANAGE_TOKENS) ::wallet.assets-modal-manage-tokens (enabled-in-env? :FLAG_ASSETS_MODAL_MANAGE_TOKENS)
::wallet.bridge-token (enabled-in-env? :FLAG_BRIDGE_TOKEN_ENABLED) ::wallet.bridge-token (enabled-in-env? :FLAG_BRIDGE_TOKEN_ENABLED)

View File

@ -86,8 +86,9 @@
;;;; Navigate to ;;;; Navigate to
(defn- navigate (defn- navigate
[[component theme]] [[component theme animations]]
(let [{:keys [options]} (get views/screens component)] (let [{:keys [options]} (get views/screens component)
options (if (map? animations) (assoc options :animations animations) options)]
(dismiss-all-modals) (dismiss-all-modals)
(navigation/push (navigation/push
(name @state/root-id) (name @state/root-id)

View File

@ -129,8 +129,8 @@
:component shell-qr-reader/view} :component shell-qr-reader/view}
{:name :chat {:name :chat
:options {:insets {:top? true} :options {:popGesture false
:popGesture false} :animations transitions/stack-transition-from-bottom}
:component chat/chat} :component chat/chat}
{:name :start-a-new-chat {:name :start-a-new-chat
@ -212,6 +212,7 @@
:component communities.discover/view} :component communities.discover/view}
{:name :community-overview {:name :community-overview
:options {:animations transitions/stack-transition-from-bottom}
:component communities.overview/view} :component communities.overview/view}
{:name :settings {:name :settings

View File

@ -19,8 +19,10 @@
(defn navigation-state-push (defn navigation-state-push
[component] [component]
(swap! navigation-state conj component) (when-let [view-id (:id (last (get-navigation-state)))]
(update-view-id)) (when-not (= view-id (:id component))
(swap! navigation-state conj component)
(update-view-id))))
(defn navigation-state-pop (defn navigation-state-pop
[] []

View File

@ -3,6 +3,7 @@
[react-native.core :as rn] [react-native.core :as rn]
[status-im.constants :as constants])) [status-im.constants :as constants]))
;;;; Modal Transitions
(def sign-in-modal-animations (def sign-in-modal-animations
{:showModal {:translationY {:from (:height (rn/get-window)) {:showModal {:translationY {:from (:height (rn/get-window))
:to 0 :to 0
@ -38,3 +39,20 @@
:dismissModal {:translationX {:from 0 :dismissModal {:translationX {:from 0
:to (:width (rn/get-window)) :to (:width (rn/get-window))
:duration constants/onboarding-modal-animation-duration}}}) :duration constants/onboarding-modal-animation-duration}}})
;;;; Stack Transitions
(def stack-slide-transition
{:push {:content {:translationX {:from (:width (rn/get-window))
:to 0
:duration 200}}}
:pop {:content {:translationX {:from 0
:to (:width (rn/get-window))
:duration 200}}}})
(def stack-transition-from-bottom
{:push {:content {:translationY {:from (:height (rn/get-window))
:to 0
:duration 200}}}
:pop {:content {:translationY {:from 0
:to (:height (rn/get-window))
:duration 200}}}})

View File

@ -4,6 +4,7 @@
[status-im.common.resources :as resources] [status-im.common.resources :as resources]
[status-im.constants :as constants] [status-im.constants :as constants]
[status-im.contexts.shell.jump-to.constants :as shell.constants] [status-im.contexts.shell.jump-to.constants :as shell.constants]
[status-im.feature-flags :as ff]
[utils.datetime :as datetime] [utils.datetime :as datetime]
[utils.i18n :as i18n])) [utils.i18n :as i18n]))
@ -268,4 +269,5 @@
:shell/chat-screen-loaded? :shell/chat-screen-loaded?
:<- [:shell/loaded-screens] :<- [:shell/loaded-screens]
(fn [screens] (fn [screens]
(get screens shell.constants/chat-screen))) (or (not (ff/enabled? ::ff/shell.jump-to))
(get screens shell.constants/chat-screen))))