diff --git a/.env.e2e b/.env.e2e index 768448fa2a..4afb230f31 100644 --- a/.env.e2e +++ b/.env.e2e @@ -38,3 +38,4 @@ SHOW_NOT_IMPLEMENTED_FEATURES=1 DELETE_MESSAGE_FOR_ME_UNDO_TIME_LIMIT=10000 DELETE_MESSAGE_UNDO_TIME_LIMIT=10000 ENABLE_ALERT_BANNER=0 +ENABLE_JUMP_TO=1 diff --git a/src/status_im/contexts/chat/events.cljs b/src/status_im/contexts/chat/events.cljs index 6d88adbc4c..f1f444aaef 100644 --- a/src/status_im/contexts/chat/events.cljs +++ b/src/status_im/contexts/chat/events.cljs @@ -148,12 +148,11 @@ (when-let [chat-id (:current-chat-id db)] (chat.state/reset-visible-item) (rf/merge cofx - (merge - {:db (-> db - (dissoc :current-chat-id) - (assoc-in [:chat/inputs chat-id :focused?] false)) - :effects.async-storage/set {:chat-id nil - :key-uid nil}}) + {:db (-> db + (dissoc :current-chat-id) + (assoc-in [:chat/inputs chat-id :focused?] false)) + :effects.async-storage/set {:chat-id nil + :key-uid nil}} (link-preview/reset-all) (delete-for-me/sync-all) (delete-message/send-all) @@ -215,8 +214,9 @@ [cofx chat-id animation] (rf/merge cofx - (navigation/pop-to-root :shell-stack) - (navigate-to-chat chat-id animation))) + {:dispatch-later {:ms 500 + :dispatch [:chat/navigate-to-chat chat-id animation]}} + (navigation/pop-to-root :shell-stack))) (rf/defn handle-clear-history-response {:events [:chat/history-cleared]} diff --git a/src/status_im/contexts/chat/group_details/view.cljs b/src/status_im/contexts/chat/group_details/view.cljs index b1ad4a00c7..ea3a6f3624 100644 --- a/src/status_im/contexts/chat/group_details/view.cljs +++ b/src/status_im/contexts/chat/group_details/view.cljs @@ -12,6 +12,7 @@ [status-im.common.home.actions.view :as actions] [status-im.constants :as constants] [status-im.contexts.chat.group-details.style :as style] + [status-im.feature-flags :as ff] [utils.i18n :as i18n] [utils.re-frame :as rf])) @@ -179,8 +180,9 @@ :admin? admin?} :render-fn contact-item-render :separator [rn/view {:style {:height 4}}]}] - [quo/floating-shell-button - {:jump-to {:on-press #(rf/dispatch [:shell/navigate-to-jump-to]) - :customization-color profile-color - :label (i18n/label :t/jump-to)}} - style/floating-shell-button]])) + (when (ff/enabled? ::ff/shell.jump-to) + [quo/floating-shell-button + {:jump-to {:on-press #(rf/dispatch [:shell/navigate-to-jump-to]) + :customization-color profile-color + :label (i18n/label :t/jump-to)}} + style/floating-shell-button])])) diff --git a/src/status_im/contexts/chat/messenger/composer/sub_view.cljs b/src/status_im/contexts/chat/messenger/composer/sub_view.cljs index daeb8c1bb9..43295f6cad 100644 --- a/src/status_im/contexts/chat/messenger/composer/sub_view.cljs +++ b/src/status_im/contexts/chat/messenger/composer/sub_view.cljs @@ -4,6 +4,7 @@ [react-native.core :as rn] [react-native.reanimated :as reanimated] [status-im.contexts.chat.messenger.composer.style :as style] + [status-im.feature-flags :as ff] [utils.i18n :as i18n] [utils.re-frame :as rf] [utils.worklets.chat.messenger.composer :as worklets])) @@ -30,11 +31,12 @@ [reanimated/view {:style (style/shell-button jump-to-button-position jump-to-button-opacity)} [quo/floating-shell-button - {:jump-to - {:on-press #(rf/dispatch [:shell/navigate-to-jump-to]) - :customization-color customization-color - :label (i18n/label :t/jump-to) - :style {:align-self :center}}} + (when (ff/enabled? ::ff/shell.jump-to) + {:jump-to + {:on-press #(rf/dispatch [:shell/navigate-to-jump-to]) + :customization-color customization-color + :label (i18n/label :t/jump-to) + :style {:align-self :center}}}) {}]] [quo/floating-shell-button {:scroll-to-bottom {:on-press #(rf/dispatch [:chat.ui/scroll-to-bottom])}} diff --git a/src/status_im/contexts/chat/messenger/messages/contact_requests/bottom_drawer/view.cljs b/src/status_im/contexts/chat/messenger/messages/contact_requests/bottom_drawer/view.cljs index 8beace5904..8f4d5f7d95 100644 --- a/src/status_im/contexts/chat/messenger/messages/contact_requests/bottom_drawer/view.cljs +++ b/src/status_im/contexts/chat/messenger/messages/contact_requests/bottom_drawer/view.cljs @@ -5,6 +5,7 @@ [status-im.constants :as constants] [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.feature-flags :as ff] [utils.i18n :as i18n] [utils.re-frame :as rf])) @@ -49,10 +50,11 @@ contact-request-pending? (i18n/label :t/contact-request-chat-pending))}] - [quo/floating-shell-button - {:jump-to - {:on-press #(rf/dispatch [:shell/navigate-to-jump-to]) - :customization-color customization-color - :label (i18n/label :t/jump-to)}} - {:position :absolute - :top (- jump-to.constants/floating-shell-button-height)}]])) + (when (ff/enabled? ::ff/shell.jump-to) + [quo/floating-shell-button + {:jump-to + {:on-press #(rf/dispatch [:shell/navigate-to-jump-to]) + :customization-color customization-color + :label (i18n/label :t/jump-to)}} + {:position :absolute + :top (- jump-to.constants/floating-shell-button-height)}])])) diff --git a/src/status_im/contexts/chat/messenger/messages/list/style.cljs b/src/status_im/contexts/chat/messenger/messages/list/style.cljs index 0d3ede0f1b..df12e1f799 100644 --- a/src/status_im/contexts/chat/messenger/messages/list/style.cljs +++ b/src/status_im/contexts/chat/messenger/messages/list/style.cljs @@ -5,9 +5,11 @@ [react-native.reanimated :as reanimated] [status-im.contexts.chat.messenger.messages.constants :as messages.constants])) -(def keyboard-avoiding-container - {:flex 1 - :z-index 2}) +(defn keyboard-avoiding-container + [theme] + {:flex 1 + :background-color (colors/theme-colors colors/white colors/neutral-95 theme) + :z-index 2}) (defn background-container [background-color background-opacity top-margin] diff --git a/src/status_im/contexts/chat/messenger/messages/list/view.cljs b/src/status_im/contexts/chat/messenger/messages/list/view.cljs index ac250d2c37..c0f0905ff4 100644 --- a/src/status_im/contexts/chat/messenger/messages/list/view.cljs +++ b/src/status_im/contexts/chat/messenger/messages/list/view.cljs @@ -20,6 +20,7 @@ [status-im.contexts.chat.messenger.messages.list.state :as state] [status-im.contexts.chat.messenger.messages.list.style :as style] [status-im.contexts.shell.jump-to.constants :as jump-to.constants] + [status-im.feature-flags :as ff] [utils.i18n :as i18n] [utils.re-frame :as rf] [utils.worklets.chat.messenger.messages :as worklets])) @@ -106,7 +107,9 @@ (let [images (rf/sub [:chats/sending-image]) height (if able-to-send-message? (+ 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) (:bottom insets)) (- 70 (:bottom insets)))] diff --git a/src/status_im/contexts/chat/messenger/messages/view.cljs b/src/status_im/contexts/chat/messenger/messages/view.cljs index 98f7457fcb..bdd31c592a 100644 --- a/src/status_im/contexts/chat/messenger/messages/view.cljs +++ b/src/status_im/contexts/chat/messenger/messages/view.cljs @@ -1,30 +1,34 @@ (ns status-im.contexts.chat.messenger.messages.view (:require + [quo.theme :as quo.theme] [react-native.core :as rn] [react-native.platform :as platform] [react-native.reanimated :as reanimated] [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.messages.list.style :as style] [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.placeholder.view :as placeholder.view] + [status-im.feature-flags :as ff] [utils.re-frame :as rf])) (defn- chat-screen [{: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?])] (when chat-exist? [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))} [list.view/messages-list-content props] [messages.navigation/view props] [composer.view/composer props]]))) (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?]) distance-from-list-top (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-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 distance-from-list-top 0) (reanimated/set-shared-value chat-list-scroll-y 0)) - (when screen-loaded? + (when (if *screen-loaded?* @*screen-loaded?* screen-loaded?) [chat-screen props]))) (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?]])) diff --git a/src/status_im/contexts/communities/actions/channel_view_details/view.cljs b/src/status_im/contexts/communities/actions/channel_view_details/view.cljs index 1cb3a79deb..23ace086f8 100644 --- a/src/status_im/contexts/communities/actions/channel_view_details/view.cljs +++ b/src/status_im/contexts/communities/actions/channel_view_details/view.cljs @@ -7,6 +7,7 @@ [status-im.common.contact-list.view :as contact-list] [status-im.common.home.actions.view :as home.actions] [status-im.contexts.communities.actions.channel-view-details.style :as style] + [status-im.feature-flags :as ff] [utils.i18n :as i18n] [utils.re-frame :as rf])) @@ -69,11 +70,12 @@ (rn/use-mount (fn [] (rf/dispatch [:pin-message/load-pin-messages chat-id]))) [:<> - [quo/floating-shell-button - {:jump-to {:on-press #(rf/dispatch [:shell/navigate-to-jump-to]) - :customization-color color - :label (i18n/label :t/jump-to)}} - style/floating-shell-button] + (when (ff/enabled? ::ff/shell.jump-to) + [quo/floating-shell-button + {:jump-to {:on-press #(rf/dispatch [:shell/navigate-to-jump-to]) + :customization-color color + :label (i18n/label :t/jump-to)}} + style/floating-shell-button]) [quo/gradient-cover {:customization-color color :opacity 0.4}] [quo/page-nav {:background :blur diff --git a/src/status_im/contexts/communities/discover/view.cljs b/src/status_im/contexts/communities/discover/view.cljs index 1b74bb7362..6b92ac815b 100644 --- a/src/status_im/contexts/communities/discover/view.cljs +++ b/src/status_im/contexts/communities/discover/view.cljs @@ -10,6 +10,7 @@ [status-im.common.scroll-page.view :as scroll-page] [status-im.contexts.communities.actions.community-options.view :as options] [status-im.contexts.communities.discover.style :as style] + [status-im.feature-flags :as ff] [utils.i18n :as i18n] [utils.re-frame :as rf])) @@ -238,8 +239,9 @@ colors/neutral-95 theme))} [discover-screen-content featured-communities theme] - [quo/floating-shell-button - {:jump-to {:on-press #(rf/dispatch [:shell/navigate-to-jump-to]) - :customization-color customization-color - :label (i18n/label :t/jump-to)}} - style/floating-shell-button]])) + (when (ff/enabled? ::ff/shell.jump-to) + [quo/floating-shell-button + {:jump-to {:on-press #(rf/dispatch [:shell/navigate-to-jump-to]) + :customization-color customization-color + :label (i18n/label :t/jump-to)}} + style/floating-shell-button])])) diff --git a/src/status_im/contexts/communities/events.cljs b/src/status_im/contexts/communities/events.cljs index 40cbc19be7..83fe2b414b 100644 --- a/src/status_im/contexts/communities/events.cljs +++ b/src/status_im/contexts/communities/events.cljs @@ -12,7 +12,9 @@ status-im.contexts.communities.actions.community-options.events status-im.contexts.communities.actions.leave.events [status-im.contexts.communities.utils :as utils] + [status-im.feature-flags :as ff] [status-im.navigation.events :as navigation] + [status-im.navigation.transitions :as transitions] [taoensso.timbre :as log] [utils.re-frame :as rf])) @@ -370,7 +372,10 @@ :update-last-opened-at? true}]]) (if pop-to-root? [: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]) {:db (assoc-in db [:chats chat-id :community-id] community-id)})))) diff --git a/src/status_im/contexts/communities/overview/view.cljs b/src/status_im/contexts/communities/overview/view.cljs index 65cba68945..a32bd37b97 100644 --- a/src/status_im/contexts/communities/overview/view.cljs +++ b/src/status_im/contexts/communities/overview/view.cljs @@ -18,6 +18,7 @@ [status-im.contexts.communities.actions.community-options.view :as options] [status-im.contexts.communities.overview.style :as style] [status-im.contexts.communities.utils :as communities.utils] + [status-im.feature-flags :as ff] [utils.debounce :as debounce] [utils.i18n :as i18n] [utils.re-frame :as rf])) @@ -387,8 +388,9 @@ customization-color (rf/sub [:profile/customization-color])] [rn/view {:style style/community-overview-container} [community-card-page-view id] - [quo/floating-shell-button - {:jump-to {:on-press #(rf/dispatch [:shell/navigate-to-jump-to]) - :customization-color customization-color - :label (i18n/label :t/jump-to)}} - style/floating-shell-button]])) + (when (ff/enabled? ::ff/shell.jump-to) + [quo/floating-shell-button + {:jump-to {:on-press #(rf/dispatch [:shell/navigate-to-jump-to]) + :customization-color customization-color + :label (i18n/label :t/jump-to)}} + style/floating-shell-button])])) diff --git a/src/status_im/contexts/onboarding/enable_notifications/view.cljs b/src/status_im/contexts/onboarding/enable_notifications/view.cljs index f6a1eba34f..f383f028cb 100644 --- a/src/status_im/contexts/onboarding/enable_notifications/view.cljs +++ b/src/status_im/contexts/onboarding/enable_notifications/view.cljs @@ -6,6 +6,7 @@ [react-native.safe-area :as safe-area] [status-im.common.resources :as resources] [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] [taoensso.timbre :as log] [utils.i18n :as i18n] @@ -26,7 +27,10 @@ [rn/view {:style (style/buttons insets)} [quo/button {: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 [:request-permissions {:permissions [:post-notifications] @@ -43,7 +47,10 @@ (i18n/label :t/intro-wizard-title6)] [quo/button {: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 [:screen/onboarding.welcome :screen/onboarding.enable-notifications]])) diff --git a/src/status_im/contexts/profile/contact/view.cljs b/src/status_im/contexts/profile/contact/view.cljs index b777a3b658..8af77bc8fc 100644 --- a/src/status_im/contexts/profile/contact/view.cljs +++ b/src/status_im/contexts/profile/contact/view.cljs @@ -7,6 +7,7 @@ [status-im.contexts.profile.contact.actions.view :as actions] [status-im.contexts.profile.contact.header.view :as contact-header] [status-im.contexts.shell.jump-to.constants :as jump-to.constants] + [status-im.feature-flags :as ff] [utils.debounce :as debounce] [utils.i18n :as i18n] [utils.re-frame :as rf])) @@ -40,10 +41,11 @@ :on-press on-show-actions :accessibility-label :contact-actions}]}} [contact-header/view {:scroll-y scroll-y}]] - [quo/floating-shell-button - {:jump-to - {:on-press on-jump-to - :customization-color profile-customization-color - :label (i18n/label :t/jump-to)}} - {:position :absolute - :bottom jump-to.constants/floating-shell-button-height}]])) + (when (ff/enabled? ::ff/shell.jump-to) + [quo/floating-shell-button + {:jump-to + {:on-press on-jump-to + :customization-color profile-customization-color + :label (i18n/label :t/jump-to)}} + {:position :absolute + :bottom jump-to.constants/floating-shell-button-height}])])) diff --git a/src/status_im/contexts/profile/settings/view.cljs b/src/status_im/contexts/profile/settings/view.cljs index 73a2126b9d..387e9030f7 100644 --- a/src/status_im/contexts/profile/settings/view.cljs +++ b/src/status_im/contexts/profile/settings/view.cljs @@ -87,9 +87,10 @@ :on-scroll on-scroll :bounces false :over-scroll-mode :never}] - [quo/floating-shell-button - {:jump-to - {:on-press #(rf/dispatch [:shell/navigate-to-jump-to]) - :customization-color customization-color - :label (i18n/label :t/jump-to)}} - (style/floating-shell-button-style insets)]])) + (when (ff/enabled? ::ff/shell.jump-to) + [quo/floating-shell-button + {:jump-to + {:on-press #(rf/dispatch [:shell/navigate-to-jump-to]) + :customization-color customization-color + :label (i18n/label :t/jump-to)}} + (style/floating-shell-button-style insets)])])) diff --git a/src/status_im/contexts/shell/jump_to/components/bottom_tabs/view.cljs b/src/status_im/contexts/shell/jump_to/components/bottom_tabs/view.cljs index 64e2110468..4dcd250e2c 100644 --- a/src/status_im/contexts/shell/jump_to/components/bottom_tabs/view.cljs +++ b/src/status_im/contexts/shell/jump_to/components/bottom_tabs/view.cljs @@ -12,6 +12,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.feature-flags :as ff] [utils.re-frame :as rf])) (defn blur-overlay-params @@ -44,7 +45,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 (ff/enabled? ::ff/shell.jump-to) + (rf/sub [:shell/shell-pass-through?])) shared-values @state/shared-values-atom communities-double-tab-gesture (-> (gesture/gesture-tap) (gesture/number-of-taps 2) @@ -58,7 +60,9 @@ (rf/dispatch [:messages-home/select-tab :tab/recent])))) bottom-tabs-blur-overlay-style (style/bottom-tabs-blur-overlay (:bottom-tabs-height 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?) [quo.theme/provider :dark [reanimated/view diff --git a/src/status_im/contexts/shell/jump_to/constants.cljs b/src/status_im/contexts/shell/jump_to/constants.cljs index c7bdfa5957..acac57c2db 100644 --- a/src/status_im/contexts/shell/jump_to/constants.cljs +++ b/src/status_im/contexts/shell/jump_to/constants.cljs @@ -4,6 +4,8 @@ (def ^:const switcher-card-size 160) (def ^:const floating-shell-button-height 44) +(def ^:const default-selected-stack :communities-stack) + ;; Bottom tabs (def ^:const bottom-tabs-container-height-android 57) (def ^:const bottom-tabs-container-height-ios 82) diff --git a/src/status_im/contexts/shell/jump_to/events.cljs b/src/status_im/contexts/shell/jump_to/events.cljs index a5241047c8..f979aa359b 100644 --- a/src/status_im/contexts/shell/jump_to/events.cljs +++ b/src/status_im/contexts/shell/jump_to/events.cljs @@ -6,6 +6,7 @@ [status-im.contexts.shell.jump-to.constants :as shell.constants] status-im.contexts.shell.jump-to.effects [status-im.contexts.shell.jump-to.utils :as shell.utils] + [status-im.feature-flags :as ff] [status-im.navigation.state :as navigation.state] [utils.re-frame :as rf])) @@ -147,7 +148,7 @@ (:current-chat-id db)) (conj [:chat/close]))}) {: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 {:events [:shell/navigate-back]} @@ -171,7 +172,11 @@ shell.constants/close-screen-with-slide-to-right-animation))} (when (and current-chat-id 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 {:events [:shell/floating-screen-opened]} diff --git a/src/status_im/contexts/shell/jump_to/shared_values.cljs b/src/status_im/contexts/shell/jump_to/shared_values.cljs index 2a3495d515..7172515028 100644 --- a/src/status_im/contexts/shell/jump_to/shared_values.cljs +++ b/src/status_im/contexts/shell/jump_to/shared_values.cljs @@ -6,6 +6,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.feature-flags :as ff] [utils.worklets.shell :as worklets.shell])) (defn calculate-home-stack-position @@ -109,8 +110,11 @@ switcher-card-top-position (+ (safe-area/get-top) 120) shared-values {:selected-stack-id (reanimated/use-shared-value - (name (or @state/selected-stack-id :communities-stack))) - :home-stack-state (reanimated/use-shared-value @state/home-stack-state)}] + (name (or @state/selected-stack-id shell.constants/default-selected-stack))) + :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 ;; Means On login and on UI reloading (like changing theme) ;; So we are also resetting bottom tabs here (disabling loading of unselected tabs), diff --git a/src/status_im/contexts/shell/jump_to/utils.cljs b/src/status_im/contexts/shell/jump_to/utils.cljs index a6482be390..2acb5e0661 100644 --- a/src/status_im/contexts/shell/jump_to/utils.cljs +++ b/src/status_im/contexts/shell/jump_to/utils.cljs @@ -7,6 +7,7 @@ [react-native.safe-area :as safe-area] [status-im.contexts.shell.jump-to.constants :as shell.constants] [status-im.contexts.shell.jump-to.state :as state] + [status-im.feature-flags :as ff] [utils.re-frame :as rf])) ;;;; Helper Functions @@ -118,7 +119,8 @@ ;;; Navigation (defn shell-navigation? [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 [] diff --git a/src/status_im/contexts/shell/jump_to/view.cljs b/src/status_im/contexts/shell/jump_to/view.cljs index 3b7d4a5e55..04faeb2959 100644 --- a/src/status_im/contexts/shell/jump_to/view.cljs +++ b/src/status_im/contexts/shell/jump_to/view.cljs @@ -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.shared-values :as shared-values] [status-im.contexts.shell.jump-to.utils :as utils] + [status-im.feature-flags :as ff] [status-im.navigation.state :as navigation.state] [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))) + (seq (utils/open-floating-screens)) + (> (count (navigation.state/get-navigation-state)) 1)) (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) @@ -32,7 +34,7 @@ :bottom (utils/bottom-tabs-container-height)} (:home-stack-opacity shared-values)]))) -(defn f-shell-stack +(defn shell-stack [] (let [alert-banners-top-margin (rf/sub [:alert-banners/top-margin]) shared-values (shared-values/calculate-and-set-shared-values @@ -42,12 +44,11 @@ (rn/hw-back-add-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> home-stack/f-home-stack] - [floating-button shared-values] - [floating-screens/view]])) - -(defn shell-stack - [] - [:f> f-shell-stack]) + (when (ff/enabled? ::ff/shell.jump-to) + [:<> + [floating-button shared-values] + [floating-screens/view]])])) diff --git a/src/status_im/contexts/wallet/account/view.cljs b/src/status_im/contexts/wallet/account/view.cljs index 9650be655e..d06ff2e211 100644 --- a/src/status_im/contexts/wallet/account/view.cljs +++ b/src/status_im/contexts/wallet/account/view.cljs @@ -68,9 +68,10 @@ :scrollable? true :scroll-on-press? true}] [tabs/view {:selected-tab @selected-tab}] - [quo/floating-shell-button - {:jump-to - {:on-press #(rf/dispatch [:shell/navigate-to-jump-to]) - :customization-color customization-color - :label (i18n/label :t/jump-to)}} - style/shell-button]])))) + (when (ff/enabled? ::ff/shell.jump-to) + [quo/floating-shell-button + {:jump-to + {:on-press #(rf/dispatch [:shell/navigate-to-jump-to]) + :customization-color customization-color + :label (i18n/label :t/jump-to)}} + style/shell-button])])))) diff --git a/src/status_im/feature_flags.cljs b/src/status_im/feature_flags.cljs index ff01788138..d5642e42c4 100644 --- a/src/status_im/feature_flags.cljs +++ b/src/status_im/feature_flags.cljs @@ -16,6 +16,7 @@ :FLAG_WALLET_SETTINGS_KEYPAIRS_AND_ACCOUNTS_ENABLED) ::settings.network-settings (enabled-in-env? :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-manage-tokens (enabled-in-env? :FLAG_ASSETS_MODAL_MANAGE_TOKENS) ::wallet.bridge-token (enabled-in-env? :FLAG_BRIDGE_TOKEN_ENABLED) diff --git a/src/status_im/navigation/effects.cljs b/src/status_im/navigation/effects.cljs index d427504c34..6abdc5fac3 100644 --- a/src/status_im/navigation/effects.cljs +++ b/src/status_im/navigation/effects.cljs @@ -86,8 +86,9 @@ ;;;; Navigate to (defn- navigate - [[component theme]] - (let [{:keys [options]} (get views/screens component)] + [[component theme animations]] + (let [{:keys [options]} (get views/screens component) + options (if (map? animations) (assoc options :animations animations) options)] (dismiss-all-modals) (navigation/push (name @state/root-id) diff --git a/src/status_im/navigation/screens.cljs b/src/status_im/navigation/screens.cljs index 3438d62216..dd9cc8d479 100644 --- a/src/status_im/navigation/screens.cljs +++ b/src/status_im/navigation/screens.cljs @@ -129,8 +129,8 @@ :component shell-qr-reader/view} {:name :chat - :options {:insets {:top? true} - :popGesture false} + :options {:popGesture false + :animations transitions/stack-transition-from-bottom} :component chat/chat} {:name :start-a-new-chat @@ -212,6 +212,7 @@ :component communities.discover/view} {:name :community-overview + :options {:animations transitions/stack-transition-from-bottom} :component communities.overview/view} {:name :settings diff --git a/src/status_im/navigation/state.cljs b/src/status_im/navigation/state.cljs index 191a07ceb4..e80bbc79df 100644 --- a/src/status_im/navigation/state.cljs +++ b/src/status_im/navigation/state.cljs @@ -19,8 +19,10 @@ (defn navigation-state-push [component] - (swap! navigation-state conj component) - (update-view-id)) + (when-let [view-id (:id (last (get-navigation-state)))] + (when-not (= view-id (:id component)) + (swap! navigation-state conj component) + (update-view-id)))) (defn navigation-state-pop [] diff --git a/src/status_im/navigation/transitions.cljs b/src/status_im/navigation/transitions.cljs index 5caf24015c..af79ce4194 100644 --- a/src/status_im/navigation/transitions.cljs +++ b/src/status_im/navigation/transitions.cljs @@ -3,6 +3,7 @@ [react-native.core :as rn] [status-im.constants :as constants])) +;;;; Modal Transitions (def sign-in-modal-animations {:showModal {:translationY {:from (:height (rn/get-window)) :to 0 @@ -38,3 +39,20 @@ :dismissModal {:translationX {:from 0 :to (:width (rn/get-window)) :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}}}}) diff --git a/src/status_im/subs/shell.cljs b/src/status_im/subs/shell.cljs index f4e526c305..33c6dc861c 100644 --- a/src/status_im/subs/shell.cljs +++ b/src/status_im/subs/shell.cljs @@ -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.feature-flags :as ff] [utils.datetime :as datetime] [utils.i18n :as i18n])) @@ -268,4 +269,5 @@ :shell/chat-screen-loaded? :<- [:shell/loaded-screens] (fn [screens] - (get screens shell.constants/chat-screen))) + (or (not (ff/enabled? ::ff/shell.jump-to)) + (get screens shell.constants/chat-screen))))