diff --git a/src/js/worklets/bottom_sheet.js b/src/js/worklets/bottom_sheet.js index 3fd3d6c481..a5761716ee 100644 --- a/src/js/worklets/bottom_sheet.js +++ b/src/js/worklets/bottom_sheet.js @@ -6,10 +6,10 @@ export function useTranslateY(initialTranslationY, bottomSheetDy, panY) { }) } -export function useBackgroundOpacity(translateY, backgroundHeight, windowHeight) { +export function useBackgroundOpacity(translateY, backgroundHeight, windowHeight, opacity) { return useDerivedValue(() => { - const opacity = ((translateY.value - windowHeight) / -backgroundHeight) * 0.5 + const calculatedOpacity = ((translateY.value - windowHeight) / -backgroundHeight) * opacity - return Math.max(Math.min(opacity, 0.5), 0) + return Math.max(Math.min(calculatedOpacity, opacity), 0) }) } diff --git a/src/react_native/gesture.cljs b/src/react_native/gesture.cljs index 233b6205b7..2811637fa6 100644 --- a/src/react_native/gesture.cljs +++ b/src/react_native/gesture.cljs @@ -6,7 +6,8 @@ Swipeable TouchableWithoutFeedback gestureHandlerRootHOC - FlatList)] + FlatList + ScrollView)] [react-native.flat-list :as rn-flat-list] [reagent.core :as reagent])) @@ -69,6 +70,9 @@ children)) (def gesture-flat-list (reagent/adapt-react-class FlatList)) + (defn flat-list [props] [gesture-flat-list (rn-flat-list/base-list-props props)]) + +(def scroll-view (reagent/adapt-react-class ScrollView)) diff --git a/src/react_native/reanimated.cljs b/src/react_native/reanimated.cljs index 9ddae70f75..ec882b2121 100644 --- a/src/react_native/reanimated.cljs +++ b/src/react_native/reanimated.cljs @@ -16,7 +16,8 @@ cancelAnimation SlideInUp SlideOutUp - LinearTransition)] + LinearTransition + runOnJS)] [reagent.core :as reagent] ["react-native-redash" :refer (withPause)] [react-native.flat-list :as rn-flat-list] @@ -64,6 +65,8 @@ (def with-pause withPause) (def cancel-animation cancelAnimation) +(def run-on-js runOnJS) + ;; Easings (def bezier (.-bezier ^js Easing)) diff --git a/src/status_im/add_new/core.cljs b/src/status_im/add_new/core.cljs index 983eb05689..384ba8b7dd 100644 --- a/src/status_im/add_new/core.cljs +++ b/src/status_im/add_new/core.cljs @@ -83,7 +83,7 @@ (if new-contact? (rf/merge cofx (contact/add-contact chat-key nickname ens-name) - (navigation/navigate-to-cofx :contacts-list {})) + (navigation/navigate-to :contacts-list {})) (chat/start-chat cofx chat-key ens-name)) {:utils/show-popup {:title (i18n/label :t/unable-to-read-this-code) :content (case validation-result diff --git a/src/status_im/bottom_sheet/events.cljs b/src/status_im/bottom_sheet/events.cljs new file mode 100644 index 0000000000..610a45e7ec --- /dev/null +++ b/src/status_im/bottom_sheet/events.cljs @@ -0,0 +1,30 @@ +(ns status-im.bottom-sheet.events + (:require [utils.re-frame :as rf])) + +(rf/defn show-bottom-sheet-old + [{:keys [db]} {:keys [view options]}] + {:dismiss-keyboard nil + :show-bottom-sheet-overlay-old nil + :db (assoc db + :bottom-sheet/show? true + :bottom-sheet/view view + :bottom-sheet/options options)}) + +(rf/defn show-bottom-sheet-event + {:events [:bottom-sheet/show-sheet-old]} + [cofx view options] + (show-bottom-sheet-old + cofx + {:view view + :options options})) + +(rf/defn hide-bottom-sheet-old + {:events [:bottom-sheet/hide-old]} + [{:keys [db]}] + {:db (assoc db :bottom-sheet/show? false) + :dismiss-bottom-sheet-overlay-old nil}) + +(rf/defn hide-bottom-sheet-navigation-overlay + {:events [:bottom-sheet/hide-old-navigation-overlay]} + [{}] + {:dismiss-bottom-sheet-overlay-old nil}) diff --git a/src/status_im2/common/bottom_sheet/sheets.cljs b/src/status_im/bottom_sheet/sheets.cljs similarity index 71% rename from src/status_im2/common/bottom_sheet/sheets.cljs rename to src/status_im/bottom_sheet/sheets.cljs index 38dc2415b7..37e0b784f6 100644 --- a/src/status_im2/common/bottom_sheet/sheets.cljs +++ b/src/status_im/bottom_sheet/sheets.cljs @@ -1,4 +1,4 @@ -(ns status-im2.common.bottom-sheet.sheets +(ns status-im.bottom-sheet.sheets (:require [utils.re-frame :as rf] [status-im.ui.screens.about-app.views :as about-app] [status-im.ui.screens.home.sheet.views :as home.sheet] @@ -6,16 +6,15 @@ [status-im.ui.screens.mobile-network-settings.view :as mobile-network-settings] [status-im.ui.screens.multiaccounts.key-storage.views :as key-storage] [status-im.ui.screens.multiaccounts.recover.views :as recover.views] - [status-im2.common.bottom-sheet.view :as bottom-sheet] - [status-im2.contexts.chat.menus.pinned-messages.view :as pinned-messages-menu] + [status-im.bottom-sheet.view :as bottom-sheet] [react-native.core :as rn])) (defn bottom-sheet [] (let [dismiss-bottom-sheet-callback (fn [] - (rf/dispatch [:bottom-sheet/hide]) + (rf/dispatch [:bottom-sheet/hide-old]) true) - {:keys [show? view options]} (rf/sub [:bottom-sheet]) + {:keys [show? view options]} (rf/sub [:bottom-sheet-old]) {:keys [content] :as opts} (cond-> {:visible? show?} @@ -31,12 +30,6 @@ (= view :add-new) (merge home.sheet/add-new) - (= view :new-chat-bottom-sheet) - (merge home.sheet/new-chat-bottom-sheet-comp) - - (= view :start-a-new-chat) - (merge home.sheet/start-a-new-chat) - (= view :keycard.login/more) (merge keycard/more-sheet) @@ -47,11 +40,8 @@ (merge recover.views/bottom-sheet) (= view :migrate-account-password) - (merge key-storage/migrate-account-password) + (merge key-storage/migrate-account-password))] - (= view :pinned-messages-list) - (merge {:content pinned-messages-menu/pinned-messages - :bottom-safe-area-spacing? false}))] [:f> (fn [] (rn/use-effect (fn [] diff --git a/src/status_im/bottom_sheet/styles.cljs b/src/status_im/bottom_sheet/styles.cljs new file mode 100644 index 0000000000..acc5650daf --- /dev/null +++ b/src/status_im/bottom_sheet/styles.cljs @@ -0,0 +1,56 @@ +(ns status-im.bottom-sheet.styles + (:require [quo2.foundations.colors :as colors])) + +(def border-radius 20) + +(defn handle + [override-theme] + {:position :absolute + :top 8 + :width 32 + :height 4 + :background-color (colors/theme-colors colors/neutral-100 colors/white override-theme) + :opacity 0.1 + :border-radius 100 + :align-self :center}) + +(def backdrop + {:position :absolute + :left 0 + :right 0 + :bottom 0 + :top 0 + :background-color colors/neutral-100}) + +(def container + {:position :absolute + :left 0 + :right 0 + :top 0 + :bottom 0 + :overflow :hidden}) + +(defn content-style + [insets bottom-safe-area-spacing?] + {:position :absolute + :left 0 + :right 0 + :top 0 + :padding-top border-radius + :padding-bottom (if bottom-safe-area-spacing? (:bottom insets) 0)}) + +(defn selected-background + [override-theme] + {:border-radius 12 + :padding-left 12 + :margin-horizontal 8 + :margin-bottom 10 + :height 48 + :background-color (colors/theme-colors colors/white colors/neutral-90 override-theme)}) + +(defn background + [override-theme] + {:background-color (colors/theme-colors colors/white colors/neutral-95 override-theme) + :flex 1 + :border-top-left-radius border-radius + :border-top-right-radius border-radius}) diff --git a/src/status_im/bottom_sheet/view.cljs b/src/status_im/bottom_sheet/view.cljs new file mode 100644 index 0000000000..d4fa7c542d --- /dev/null +++ b/src/status_im/bottom_sheet/view.cljs @@ -0,0 +1,240 @@ +(ns status-im.bottom-sheet.view + (:require [oops.core :refer [oget]] + [quo.react :as react] + [status-im.bottom-sheet.styles :as styles] + [re-frame.core :as re-frame] + [react-native.background-timer :as timer] + [react-native.core :as rn] + [react-native.gesture :as gesture] + [react-native.hooks :as hooks] + [react-native.platform :as platform] + [react-native.reanimated :as reanimated] + [react-native.safe-area :as safe-area] + [reagent.core :as reagent] + [utils.worklets.bottom-sheet :as worklets.bottom-sheet])) + +(def animation-delay 450) + +(defn with-animation + [value & [options callback]] + (reanimated/with-spring + value + (clj->js (merge {:mass 2 + :stiffness 500 + :damping 200}) + options) + callback)) + +(defn get-bottom-sheet-gesture + [pan-y translate-y bg-height bg-height-expanded + window-height keyboard-shown disable-drag? expandable? + show-bottom-sheet? expanded? close-bottom-sheet gesture-running?] + (-> (gesture/gesture-pan) + (gesture/on-start + (fn [_] + (reset! gesture-running? true) + (when (and keyboard-shown (not disable-drag?) show-bottom-sheet?) + (re-frame/dispatch [:dismiss-keyboard])))) + (gesture/on-update + (fn [evt] + (when (and (not disable-drag?) show-bottom-sheet?) + (let [max-pan-up (if (or @expanded? (not expandable?)) + 0 + (- (- bg-height-expanded bg-height))) + max-pan-down (if @expanded? + bg-height-expanded + bg-height)] + (reanimated/set-shared-value pan-y + (max + (min + (.-translationY evt) + max-pan-down) + max-pan-up)))))) + (gesture/on-end + (fn [_] + (reset! gesture-running? false) + (when (and (not disable-drag?) show-bottom-sheet?) + (let [end-pan-y (- window-height (.-value translate-y)) + expand-threshold (min (* bg-height 1.1) (+ bg-height 50)) + collapse-threshold (max (* bg-height-expanded 0.9) (- bg-height-expanded 50)) + should-close-bottom-sheet? (< end-pan-y (max (* bg-height 0.7) 50))] + (cond + should-close-bottom-sheet? + (close-bottom-sheet) + + (and (not @expanded?) (> end-pan-y expand-threshold)) + (reset! expanded? true) + + (and @expanded? (< end-pan-y collapse-threshold)) + (reset! expanded? false)))))))) + +(defn handle-comp + [window-width override-theme] + [rn/view + {:style {:width window-width + :position :absolute + :background-color :transparent + :top 0 + :height 20}} + [rn/view {:style (styles/handle override-theme)}]]) + +(defn bottom-sheet + [props children] + (let [{on-cancel :on-cancel + disable-drag? :disable-drag? + show-handle? :show-handle? + visible? :visible? + backdrop-dismiss? :backdrop-dismiss? + expandable? :expandable? + bottom-safe-area-spacing? :bottom-safe-area-spacing? + selected-item :selected-item + is-initially-expanded? :expanded? + override-theme :override-theme + :or {show-handle? true + backdrop-dismiss? true + expandable? false + bottom-safe-area-spacing? true + is-initially-expanded? false}} + props + content-height (reagent/atom nil) + show-bottom-sheet? (reagent/atom nil) + keyboard-was-shown? (reagent/atom false) + expanded? (reagent/atom is-initially-expanded?) + gesture-running? (reagent/atom false) + reset-atoms (fn [] + (reset! show-bottom-sheet? nil) + (reset! content-height nil) + (reset! expanded? false) + (reset! keyboard-was-shown? false) + (reset! gesture-running? false)) + close-bottom-sheet (fn [] + (reset! show-bottom-sheet? false) + (when (fn? on-cancel) (on-cancel)) + (timer/set-timeout + #(do + (re-frame/dispatch [:bottom-sheet/hide-old-navigation-overlay]) + (reset-atoms)) + animation-delay))] + [safe-area/consumer + (fn [insets] + [:f> + (fn [] + (let [{height :height + window-width :width} + (rn/use-window-dimensions) + window-height (if selected-item (- height 72) height) + {:keys [keyboard-shown]} (hooks/use-keyboard) + bg-height-expanded (- window-height (:top insets)) + bg-height (max (min @content-height bg-height-expanded) 109) + bottom-sheet-dy (reanimated/use-shared-value 0) + pan-y (reanimated/use-shared-value 0) + translate-y (worklets.bottom-sheet/use-translate-y window-height bottom-sheet-dy pan-y) + bg-opacity + (worklets.bottom-sheet/use-background-opacity translate-y bg-height window-height 0.7) + on-content-layout (fn [evt] + (let [height (oget evt "nativeEvent" "layout" "height")] + (reset! content-height height))) + on-expanded (fn [] + (reanimated/set-shared-value bottom-sheet-dy bg-height-expanded) + (reanimated/set-shared-value pan-y 0)) + on-collapsed (fn [] + (reanimated/set-shared-value bottom-sheet-dy bg-height) + (reanimated/set-shared-value pan-y 0)) + bottom-sheet-gesture (get-bottom-sheet-gesture + pan-y + translate-y + bg-height + bg-height-expanded + window-height + keyboard-shown + disable-drag? + expandable? + show-bottom-sheet? + expanded? + close-bottom-sheet + gesture-running?) + handle-comp [gesture/gesture-detector {:gesture bottom-sheet-gesture} + [handle-comp window-width override-theme]]] + + (react/effect! #(do + (cond + (and + (nil? @show-bottom-sheet?) + visible? + (some? @content-height) + (> @content-height 0)) + (reset! show-bottom-sheet? true) + + (and @show-bottom-sheet? (not visible?)) + (close-bottom-sheet))) + [@show-bottom-sheet? @content-height visible?]) + (react/effect! #(do + (when @show-bottom-sheet? + (cond + keyboard-shown + (do + (reset! keyboard-was-shown? true) + (reset! expanded? true)) + (and @keyboard-was-shown? (not keyboard-shown)) + (reset! expanded? false)))) + [@show-bottom-sheet? @keyboard-was-shown? keyboard-shown]) + (react/effect! #(do + (when-not @gesture-running? + (cond + @show-bottom-sheet? + (if @expanded? + (do + (reanimated/set-shared-value + bottom-sheet-dy + (with-animation (+ bg-height-expanded (.-value pan-y)))) + ;; Workaround for + ;; https://github.com/software-mansion/react-native-reanimated/issues/1758#issue-817145741 + ;; withTiming/withSpring callback not working + ;; on-expanded should be called as a callback of + ;; with-animation instead, once this issue has been resolved + (timer/set-timeout on-expanded animation-delay)) + (do + (reanimated/set-shared-value + bottom-sheet-dy + (with-animation (+ bg-height (.-value pan-y)))) + ;; Workaround for + ;; https://github.com/software-mansion/react-native-reanimated/issues/1758#issue-817145741 + ;; withTiming/withSpring callback not working + ;; on-collapsed should be called as a callback of + ;; with-animation instead, once this issue has been resolved + (timer/set-timeout on-collapsed animation-delay))) + + (= @show-bottom-sheet? false) + (reanimated/set-shared-value bottom-sheet-dy (with-animation 0))))) + [@show-bottom-sheet? @expanded? @gesture-running?]) + + [:<> + [rn/touchable-without-feedback {:on-press (when backdrop-dismiss? close-bottom-sheet)} + [reanimated/view + {:style (reanimated/apply-animations-to-style + {:opacity bg-opacity} + styles/backdrop)}]] + (cond->> [reanimated/view + {:style (reanimated/apply-animations-to-style + {:transform [{:translateY translate-y}]} + {:width window-width + :height window-height})} + [rn/view {:style styles/container} + (when selected-item + [rn/view {:style (styles/selected-background override-theme)} + [selected-item]]) + [rn/view {:style (styles/background override-theme)} + [rn/keyboard-avoiding-view + {:behaviour (if platform/ios? :padding :height) + :style {:flex 1}} + [rn/view + {:style (styles/content-style insets bottom-safe-area-spacing?) + :on-layout (when-not (and + (some? @content-height) + (> @content-height 0)) + on-content-layout)} + children]] + (when show-handle? + handle-comp)]]] + (not show-handle?) + (conj [gesture/gesture-detector {:gesture bottom-sheet-gesture}]))]))])])) diff --git a/src/status_im/browser/core.cljs b/src/status_im/browser/core.cljs index db9e023bc5..7e83828236 100644 --- a/src/status_im/browser/core.cljs +++ b/src/status_im/browser/core.cljs @@ -3,7 +3,7 @@ ["eth-phishing-detect" :as eth-phishing-detect] [clojure.string :as string] [re-frame.core :as re-frame] - [status-im2.common.bottom-sheet.events :as bottom-sheet] + [status-im.bottom-sheet.events :as bottom-sheet] [status-im.browser.eip3085 :as eip3085] [status-im.browser.eip3326 :as eip3326] [status-im.browser.permissions :as browser.permissions] @@ -572,7 +572,7 @@ [{:keys [db] :as cofx} address] (rf/merge cofx {:browser/clear-web-data nil} - (bottom-sheet/hide-bottom-sheet) + (bottom-sheet/hide-bottom-sheet-old) (browser.permissions/clear-dapps-permissions) (multiaccounts.update/multiaccount-update :dapps-address address {}) #(when (= (:view-id db) :browser) diff --git a/src/status_im/browser/eip3085.cljs b/src/status_im/browser/eip3085.cljs index f942a4f176..8a5b1aa6c0 100644 --- a/src/status_im/browser/eip3085.cljs +++ b/src/status_im/browser/eip3085.cljs @@ -28,7 +28,7 @@ :on-success #(re-frame/dispatch [:eip3085/send-success-call-to-bridge cofx id message-id]) :on-error #(log/error "failed to perform settings_saveSetting" %)}] - :dispatch [:bottom-sheet/hide]}) + :dispatch [:bottom-sheet/hide-old]}) (rf/defn deny-permission {:events [:eip3085.ui/dapp-permission-denied]} @@ -37,7 +37,7 @@ :messageId message-id :error {:code 4001 :message "User rejected the request."}} - :dispatch [:bottom-sheet/hide]}) + :dispatch [:bottom-sheet/hide-old]}) (rf/defn handle-add-ethereum-chain {:events [:eip3085/handle-add-ethereum-chain]} @@ -64,7 +64,7 @@ :id id :new-network network)] (if (network/chain-id-available? networks network) - {:dispatch [:bottom-sheet/show-sheet + {:dispatch [:bottom-sheet/show-sheet-old {:content (fn [] [sheet/permissions-panel dapp-name message-id params])}]} (send-success-call-to-bridge cofx id message-id))) diff --git a/src/status_im/browser/eip3326.cljs b/src/status_im/browser/eip3326.cljs index 7688bee1af..40cbf26a5f 100644 --- a/src/status_im/browser/eip3326.cljs +++ b/src/status_im/browser/eip3326.cljs @@ -13,7 +13,7 @@ :messageId message-id :error {:code 4001 :message "User rejected the request."}} - :dispatch [:bottom-sheet/hide]}) + :dispatch [:bottom-sheet/hide-old]}) (rf/defn handle-switch-ethereum-chain {:events [:eip3326/handle-switch-ethereum-chain]} @@ -39,7 +39,7 @@ :target-network-id target-network-id :network-from network-from :network-to network-to)] - {:dispatch [:bottom-sheet/show-sheet + {:dispatch [:bottom-sheet/show-sheet-old {:content (fn [] [sheet/permissions-panel dapp-name message-id params])}]})) {:browser/send-to-bridge {:type constants/web3-send-async-callback diff --git a/src/status_im/communities/core.cljs b/src/status_im/communities/core.cljs index fc4437d698..b27c42fdc5 100644 --- a/src/status_im/communities/core.cljs +++ b/src/status_im/communities/core.cljs @@ -8,7 +8,7 @@ [status-im.async-storage.core :as async-storage] [status-im.ui.components.emoji-thumbnail.styles :as emoji-thumbnail-styles] [status-im.utils.universal-links.core :as universal-links] - [status-im2.common.bottom-sheet.events :as bottom-sheet] + [status-im.bottom-sheet.events :as bottom-sheet] [status-im2.common.toasts.events :as toasts] [status-im2.constants :as constants] [status-im2.contexts.activity-center.events :as activity-center] @@ -445,7 +445,7 @@ [cofx id] (rf/merge cofx (reset-community-id-input id) - (bottom-sheet/hide-bottom-sheet) + (bottom-sheet/hide-bottom-sheet-old) (navigation/open-modal :invite-people-community {:invite? true}))) (rf/defn share-community-pressed @@ -453,7 +453,7 @@ [cofx id] (rf/merge cofx (reset-community-id-input id) - (bottom-sheet/hide-bottom-sheet) + (bottom-sheet/hide-bottom-sheet-old) (navigation/open-modal :invite-people-community {}))) (rf/defn create-channel-pressed @@ -575,7 +575,7 @@ {:events [::member-banned]} [cofx response-js] (rf/merge cofx - (bottom-sheet/hide-bottom-sheet) + (bottom-sheet/hide-bottom-sheet-old) (handle-response response-js) (activity-center/notifications-fetch-unread-count))) @@ -596,7 +596,7 @@ {:events [::member-kicked]} [cofx response-js] (rf/merge cofx - (bottom-sheet/hide-bottom-sheet) + (bottom-sheet/hide-bottom-sheet-old) (handle-response response-js))) (rf/defn member-kick @@ -817,13 +817,13 @@ [cofx community-id] (rf/merge cofx (navigation/pop-to-root :shell-stack) - (navigation/navigate-to-cofx :community-overview community-id))) + (navigation/navigate-to :community-overview community-id))) (rf/defn member-role-updated {:events [:community.member/role-updated]} [cofx response-js] (rf/merge cofx - (bottom-sheet/hide-bottom-sheet) + (bottom-sheet/hide-bottom-sheet-old) (handle-response response-js))) (rf/defn add-role-to-member diff --git a/src/status_im/contact/core.cljs b/src/status_im/contact/core.cljs index 4ba09f0d93..39c93c4099 100644 --- a/src/status_im/contact/core.cljs +++ b/src/status_im/contact/core.cljs @@ -9,4 +9,4 @@ {:db (assoc db :group/selected-contacts #{} :new-chat-name "")} - (navigation/navigate-to-cofx :contact-toggle-list nil))) + (navigation/navigate-to :contact-toggle-list nil))) diff --git a/src/status_im/ens/core.cljs b/src/status_im/ens/core.cljs index 4db54fc2dc..294ad70f9d 100644 --- a/src/status_im/ens/core.cljs +++ b/src/status_im/ens/core.cljs @@ -2,7 +2,7 @@ (:refer-clojure :exclude [name]) (:require [clojure.string :as string] [re-frame.core :as re-frame] - [status-im2.common.bottom-sheet.events :as bottom-sheet] + [status-im.bottom-sheet.events :as bottom-sheet] [status-im.ethereum.core :as ethereum] [status-im.ethereum.eip55 :as eip55] [status-im.ethereum.ens :as ens] @@ -121,7 +121,7 @@ (let [{:keys [state username custom-domain?]} (:ens/registration db)] (case state (:available :owned) - (navigation/navigate-to-cofx cofx :ens-checkout {}) + (navigation/navigate-to cofx :ens-checkout {}) :connected-with-different-key (re-frame/dispatch [::set-pub-key]) :connected @@ -261,7 +261,7 @@ [{:keys [db] :as cofx} _ {:keys [address]}] (rf/merge cofx {:db (assoc-in db [:ens/registration :address] address)} - (bottom-sheet/hide-bottom-sheet))) + (bottom-sheet/hide-bottom-sheet-old))) (rf/defn save-preferred-name {:events [::save-preferred-name]} @@ -311,14 +311,14 @@ ::resolve-pubkey [chain-id username #(re-frame/dispatch [::public-key-resolved username %])]} - (navigation/navigate-to-cofx :ens-name-details username)))) + (navigation/navigate-to :ens-name-details username)))) (rf/defn start-registration {:events [::add-username-pressed ::get-started-pressed]} [{:keys [db] :as cofx}] (rf/merge cofx (set-username-candidate (get-in db [:ens/registration :username] "")) - (navigation/navigate-to-cofx :ens-search {}))) + (navigation/navigate-to :ens-search {}))) (rf/defn remove-username {:events [::remove-username]} diff --git a/src/status_im/group_chats/core.cljs b/src/status_im/group_chats/core.cljs index 4c1413d8e6..a7c4b7c166 100644 --- a/src/status_im/group_chats/core.cljs +++ b/src/status_im/group_chats/core.cljs @@ -245,7 +245,7 @@ {:db (-> db (assoc :new-chat-name (get-in db [:chats chat-id :name])) (assoc :current-chat-id chat-id))} - (navigation/navigate-to-cofx :group-chat-profile nil))) + (navigation/navigate-to :group-chat-profile nil))) (rf/defn ui-leave-chat-pressed {:events [:group-chats.ui/leave-chat-pressed]} @@ -256,5 +256,5 @@ :content (i18n/label :t/leave-chat-confirmation) :confirm-button-text (i18n/label :t/leave) :on-accept #(do - (re-frame/dispatch [:bottom-sheet/hide]) + (re-frame/dispatch [:bottom-sheet/hide-old]) (re-frame/dispatch [:group-chats.ui/leave-chat-confirmed chat-id]))}})) diff --git a/src/status_im/keycard/backup_key.cljs b/src/status_im/keycard/backup_key.cljs index 6a66d6504d..71a47c3349 100644 --- a/src/status_im/keycard/backup_key.cljs +++ b/src/status_im/keycard/backup_key.cljs @@ -18,8 +18,8 @@ {:db (-> db (assoc-in [:keycard :creating-backup?] backup-type))} (when (:multiaccount db) - (navigation/navigate-to-cofx :my-profile nil)) - (navigation/navigate-to-cofx :seed-phrase nil))) + (navigation/navigate-to :my-profile nil)) + (navigation/navigate-to :seed-phrase nil))) (rf/defn recovery-card-pressed {:events [:keycard-settings.ui/recovery-card-pressed]} @@ -69,4 +69,4 @@ (update :multiaccounts/key-storage dissoc :seed-phrase)) :dismiss-keyboard nil} (common/listen-to-hardware-back-button) - (navigation/navigate-to-cofx :keycard-onboarding-intro nil))) + (navigation/navigate-to :keycard-onboarding-intro nil))) diff --git a/src/status_im/keycard/change_pin.cljs b/src/status_im/keycard/change_pin.cljs index 34cf9b0764..fac8f8a7ba 100644 --- a/src/status_im/keycard/change_pin.cljs +++ b/src/status_im/keycard/change_pin.cljs @@ -59,7 +59,7 @@ (common/clear-pin) (common/hide-connection-sheet) (if (get-in db [:keycard :pin :puk-restore?]) - (navigation/navigate-to-cofx :multiaccounts nil) + (navigation/navigate-to :multiaccounts nil) (navigation/set-stack-root :profile-stack [:my-profile :keycard-settings])))) (rf/defn change-pin @@ -150,7 +150,7 @@ :content (i18n/label :t/pin-changed)}} (common/hide-connection-sheet) (if puk-restore? - (navigation/navigate-to-cofx :multiaccounts nil) + (navigation/navigate-to :multiaccounts nil) (navigation/set-stack-root :profile-stack [:my-profile :keycard-settings])) (when (:multiaccounts/login db) (common/get-keys-from-keycard))))) @@ -211,5 +211,5 @@ :sign [] :error-label :t/pin-mismatch))} (when (zero? pin-retries) (common/frozen-keycard-popup)) - (navigation/navigate-to-cofx :enter-pin-settings nil)) + (navigation/navigate-to :enter-pin-settings nil)) (common/show-wrong-keycard-alert)))))) diff --git a/src/status_im/keycard/common.cljs b/src/status_im/keycard/common.cljs index e64d99cb5d..31aaaeef89 100644 --- a/src/status_im/keycard/common.cljs +++ b/src/status_im/keycard/common.cljs @@ -1,7 +1,7 @@ (ns status-im.keycard.common (:require [clojure.string :as string] [re-frame.core :as re-frame] - [status-im2.common.bottom-sheet.events :as bottom-sheet] + [status-im.bottom-sheet.events :as bottom-sheet] [status-im.ethereum.core :as ethereum] [utils.i18n :as i18n] [status-im.keycard.nfc :as nfc] @@ -195,8 +195,7 @@ connected?) (rf/merge cofx - {:dismiss-keyboard true} - (bottom-sheet/show-bottom-sheet + (bottom-sheet/show-bottom-sheet-old {:view {:transparent platform/ios? :show-handle? false :backdrop-dismiss? false @@ -231,7 +230,7 @@ {:db (assoc-in db [:keycard :card-read-in-progress?] false)} (restore-on-card-connected) (restore-on-card-read) - (bottom-sheet/hide-bottom-sheet))) + (bottom-sheet/hide-bottom-sheet-old))) (rf/defn hide-connection-sheet [cofx] @@ -309,7 +308,7 @@ [{:keys [db] :as cofx}] (rf/merge cofx {:db (assoc-in db [:keycard :pin :current] [])} - (navigation/navigate-to-cofx :enter-pin-settings nil))) + (navigation/navigate-to :enter-pin-settings nil))) (defn- tag-lost-exception? [code error] @@ -492,7 +491,7 @@ (if login? (rf/merge cofx (clear-on-card-read) - (navigation/navigate-to-cofx :not-keycard nil)) + (navigation/navigate-to :not-keycard nil)) (rf/merge cofx {:db (assoc-in db [:keycard :application-info-error] error)} diff --git a/src/status_im/keycard/core.cljs b/src/status_im/keycard/core.cljs index bcf77fb3dd..a259a0f9e5 100644 --- a/src/status_im/keycard/core.cljs +++ b/src/status_im/keycard/core.cljs @@ -40,7 +40,7 @@ {:enter-step :original :original [] :confirmation []}))} - (navigation/navigate-to-cofx :keycard-onboarding-pin nil))) + (navigation/navigate-to :keycard-onboarding-pin nil))) (rf/defn load-recovery-pin-screen [{:keys [db] :as cofx}] @@ -66,7 +66,7 @@ "instance-uid" instance-uid) (if (= flow :import) - (navigation/navigate-to-cofx cofx :keycard-recovery-no-key nil) + (navigation/navigate-to cofx :keycard-recovery-no-key nil) (if paired? (rf/merge cofx (common/listen-to-hardware-back-button) @@ -86,7 +86,7 @@ (assoc-in [:keycard :pin :on-verified] nil) (assoc-in [:keycard :setup-step] nil))} (common/clear-on-card-connected) - (navigation/navigate-to-cofx :keycard-settings nil))) + (navigation/navigate-to :keycard-settings nil))) (rf/defn password-option-pressed {:eevents [:keycard.ui/password-option-pressed]} @@ -272,7 +272,7 @@ (not on-verified-failure)) (when exporting? (navigation/navigate-back))) - ;(navigation/navigate-to-cofx :enter-pin-settings nil))) + ;(navigation/navigate-to :enter-pin-settings nil))) (when (zero? pin-retries) (common/frozen-keycard-popup)) (when on-verified-failure (fn [_] @@ -505,7 +505,7 @@ (when multiaccount (set-multiaccount-pairing multiaccount pairing paired-on)) (when (= flow :login) - (navigation/navigate-to-cofx :multiaccounts nil)) + (navigation/navigate-to :multiaccounts nil)) (when (= flow :recovery) (onboarding/proceed-with-generating-key)) (when (= flow :import) @@ -531,7 +531,7 @@ :keycard/pair)) (common/hide-connection-sheet) (when (= flow :import) - (navigation/navigate-to-cofx :keycard-recovery-pair nil)) + (navigation/navigate-to :keycard-recovery-pair nil)) (when (not= setup-step :enter-pair-code) (common/process-error code error)))))) @@ -579,7 +579,7 @@ (when (= card-state :pre-init) (if (= flow :import) - (navigation/navigate-to-cofx :keycard-recovery-no-key nil) + (navigation/navigate-to :keycard-recovery-no-key nil) (fn [cofx] (rf/merge cofx @@ -596,7 +596,7 @@ (when (= card-state :blank) (if (= flow :import) - (navigation/navigate-to-cofx :keycard-recovery-no-key nil) + (navigation/navigate-to :keycard-recovery-no-key nil) (show-no-keycard-applet-alert))) (when (and (= card-state :multiaccount) diff --git a/src/status_im/keycard/delete_key.cljs b/src/status_im/keycard/delete_key.cljs index 5058cd6177..3f3367e455 100644 --- a/src/status_im/keycard/delete_key.cljs +++ b/src/status_im/keycard/delete_key.cljs @@ -6,7 +6,7 @@ (rf/defn reset-card-pressed {:events [:keycard-settings.ui/reset-card-pressed]} [cofx] - (navigation/navigate-to-cofx cofx :reset-card nil)) + (navigation/navigate-to cofx :reset-card nil)) (rf/defn delete-card [{:keys [db] :as cofx}] @@ -20,7 +20,7 @@ (rf/defn navigate-to-reset-card-screen {:events [:keycard/navigate-to-reset-card-screen]} [cofx] - (navigation/navigate-to-cofx cofx :reset-card nil)) + (navigation/navigate-to cofx :reset-card nil)) (rf/defn reset-card-next-button-pressed {:events [:keycard-settings.ui/reset-card-next-button-pressed]} diff --git a/src/status_im/keycard/login.cljs b/src/status_im/keycard/login.cljs index fb552f0b84..13c65d20eb 100644 --- a/src/status_im/keycard/login.cljs +++ b/src/status_im/keycard/login.cljs @@ -1,5 +1,5 @@ (ns status-im.keycard.login - (:require [status-im2.common.bottom-sheet.events :as bottom-sheet] + (:require [status-im.bottom-sheet.events :as bottom-sheet] [status-im.ethereum.core :as ethereum] [status-im.keycard.common :as common] status-im.keycard.fx @@ -22,13 +22,13 @@ (rf/defn login-pin-more-icon-pressed {:events [:keycard.login.pin.ui/more-icon-pressed]} [cofx] - (bottom-sheet/show-bottom-sheet cofx {:view :keycard.login/more})) + (bottom-sheet/hide-bottom-sheet-old cofx)) (rf/defn login-create-key-pressed {:events [:keycard.login.ui/create-new-key-pressed]} [cofx] (rf/merge cofx - (bottom-sheet/hide-bottom-sheet) + (bottom-sheet/hide-bottom-sheet-old) (onboarding/start-onboarding-flow))) (rf/defn login-add-key-pressed @@ -48,7 +48,7 @@ (log/debug "[keycard] load-pair-card-pressed") (rf/merge cofx {:db (assoc-in db [:keycard :flow] :login)} - (navigation/navigate-to-cofx :keycard-recovery-pair nil))) + (navigation/navigate-to :keycard-recovery-pair nil))) (rf/defn reset-pin {:events [::reset-pin]} @@ -70,11 +70,11 @@ :status nil)) :hide-popover nil}) (when (:multiaccount db) - (navigation/navigate-to-cofx :my-profile nil)) + (navigation/navigate-to :my-profile nil)) (when-not (:multiaccounts/login db) (if (:popover/popover db) (navigation/navigate-replace :keycard-pin nil) - (navigation/navigate-to-cofx :keycard-pin nil))))) + (navigation/navigate-to :keycard-pin nil))))) (rf/defn dismiss-frozen-keycard-popover {:events [::frozen-keycard-popover-dismissed]} @@ -107,22 +107,22 @@ (empty? application-info) (rf/merge cofx (common/hide-connection-sheet) - (navigation/navigate-to-cofx :not-keycard nil)) + (navigation/navigate-to :not-keycard nil)) (empty? key-uid) (rf/merge cofx (common/hide-connection-sheet) - (navigation/navigate-to-cofx :keycard-blank nil)) + (navigation/navigate-to :keycard-blank nil)) multiaccount-mismatch? (rf/merge cofx (common/hide-connection-sheet) - (navigation/navigate-to-cofx :keycard-wrong nil)) + (navigation/navigate-to :keycard-wrong nil)) (not paired?) (rf/merge cofx (common/hide-connection-sheet) - (navigation/navigate-to-cofx :keycard-unpaired nil)) + (navigation/navigate-to :keycard-unpaired nil)) (and (zero? pin-retry-counter) (or (nil? puk-retry-counter) diff --git a/src/status_im/keycard/onboarding.cljs b/src/status_im/keycard/onboarding.cljs index 9a7b547c92..dcc7465753 100644 --- a/src/status_im/keycard/onboarding.cljs +++ b/src/status_im/keycard/onboarding.cljs @@ -36,7 +36,7 @@ (rf/merge cofx {:utils/show-popup {:title (i18n/label :t/error) :content (i18n/label :t/something-went-wrong)}} - (navigation/navigate-to-cofx :keycard-authentication-method nil)))))) + (navigation/navigate-to :keycard-authentication-method nil)))))) (rf/defn load-preparing-screen {:events [:keycard/load-preparing-screen]} @@ -120,7 +120,7 @@ [cofx] (rf/merge cofx (recovery-phrase-start-confirmation) - (navigation/navigate-to-cofx :keycard-onboarding-recovery-phrase-confirm-word1 nil))) + (navigation/navigate-to :keycard-onboarding-recovery-phrase-confirm-word1 nil))) (rf/defn recovery-phrase-next-word [{:keys [db]}] @@ -143,7 +143,7 @@ :on-verified :keycard/generate-and-load-key :current []}) (assoc-in [:keycard :setup-step] :loading-keys))} - (navigation/navigate-to-cofx :keycard-onboarding-pin nil)) + (navigation/navigate-to :keycard-onboarding-pin nil)) (load-finishing-screen cofx)))) (rf/defn recovery-phrase-confirm-word-next-pressed @@ -178,10 +178,10 @@ (rf/merge cofx {:keycard/check-nfc-enabled nil} (if (= flow :import) - (navigation/navigate-to-cofx :keycard-recovery-intro nil) + (navigation/navigate-to :keycard-recovery-intro nil) (do (common/listen-to-hardware-back-button) - (navigation/navigate-to-cofx :keycard-onboarding-intro nil)))))) + (navigation/navigate-to :keycard-onboarding-intro nil)))))) (rf/defn start-onboarding-flow {:events [:keycard/start-onboarding-flow]} @@ -190,7 +190,7 @@ {:db (assoc-in db [:keycard :flow] :create) :keycard/check-nfc-enabled nil} (common/listen-to-hardware-back-button) - (navigation/navigate-to-cofx :keycard-onboarding-intro nil))) + (navigation/navigate-to :keycard-onboarding-intro nil))) (rf/defn open-nfc-settings-pressed {:events [:keycard.onboarding.nfc-on/open-nfc-settings-pressed]} diff --git a/src/status_im/keycard/recovery.cljs b/src/status_im/keycard/recovery.cljs index 9c316df881..07b1d6c656 100644 --- a/src/status_im/keycard/recovery.cljs +++ b/src/status_im/keycard/recovery.cljs @@ -1,7 +1,7 @@ (ns status-im.keycard.recovery (:require [clojure.string :as string] [re-frame.core :as re-frame] - [status-im2.common.bottom-sheet.events :as bottom-sheet] + [status-im.bottom-sheet.events :as bottom-sheet] [status-im2.constants :as constants] [status-im.ethereum.core :as ethereum] [status-im.ethereum.eip55 :as eip55] @@ -54,16 +54,16 @@ (rf/merge cofx {:db (-> db (assoc-in [:keycard :setup-step] :pair)) - :dispatch [:bottom-sheet/hide]} + :dispatch [:bottom-sheet/hide-old]} (common/listen-to-hardware-back-button) - (navigation/navigate-to-cofx :keycard-recovery-pair nil))) + (navigation/navigate-to :keycard-recovery-pair nil))) (rf/defn keycard-storage-selected-for-recovery {:events [:recovery.ui/keycard-storage-selected]} [{:keys [db] :as cofx}] (rf/merge cofx {:db (assoc-in db [:keycard :flow] :recovery)} - (navigation/navigate-to-cofx :keycard-recovery-enter-mnemonic nil))) + (navigation/navigate-to :keycard-recovery-enter-mnemonic nil))) (rf/defn start-import-flow {:events [::recover-with-keycard-pressed]} @@ -74,13 +74,13 @@ (assoc-in [:keycard :flow] :import) (assoc :recovered-account? true)) :keycard/check-nfc-enabled nil} - (bottom-sheet/hide-bottom-sheet) - (navigation/navigate-to-cofx :keycard-recovery-intro nil))) + (bottom-sheet/hide-bottom-sheet-old) + (navigation/navigate-to :keycard-recovery-intro nil))) (rf/defn access-key-pressed {:events [:multiaccounts.recover.ui/recover-multiaccount-button-pressed]} [_] - {:dispatch [:bottom-sheet/show-sheet :recover-sheet]}) + {:dispatch [:bottom-sheet/show-sheet-old :recover-sheet]}) (rf/defn recovery-keycard-selected {:events [:recovery.ui/keycard-option-pressed]} @@ -89,7 +89,7 @@ {:db (assoc-in db [:keycard :flow] :recovery) :keycard/check-nfc-enabled nil} (common/listen-to-hardware-back-button) - (navigation/navigate-to-cofx :keycard-onboarding-intro nil))) + (navigation/navigate-to :keycard-onboarding-intro nil))) (rf/defn cancel-pressed {:events [::cancel-pressed]} @@ -126,10 +126,10 @@ :keycard dissoc :multiaccount-wallet-address :multiaccount-whisper-public-key)} - (navigation/navigate-to-cofx (if platform/android? - :notifications-settings - :welcome) - nil))) + (navigation/navigate-to (if platform/android? + :notifications-settings + :welcome) + nil))) (rf/defn intro-wizard {:events [:multiaccounts.create.ui/intro-wizard]} @@ -141,7 +141,7 @@ (dissoc :restored-account?))} (multiaccounts.create/prepare-intro-wizard) (if (pos? (count accs)) - (navigation/navigate-to-cofx :get-your-keys nil) + (navigation/navigate-to :get-your-keys nil) (navigation/set-stack-root :onboarding [:get-your-keys]))))) (rf/defn recovery-no-key diff --git a/src/status_im/keycard/unpair.cljs b/src/status_im/keycard/unpair.cljs index 29b1a2c2d3..f47f085ae1 100644 --- a/src/status_im/keycard/unpair.cljs +++ b/src/status_im/keycard/unpair.cljs @@ -87,7 +87,7 @@ :content (i18n/label :t/card-unpaired)}} (common/clear-on-card-connected) (remove-pairing-from-multiaccount nil) - (navigation/navigate-to-cofx :keycard-settings nil)))) + (navigation/navigate-to :keycard-settings nil)))) (rf/defn on-unpair-error {:events [:keycard.callback/on-unpair-error]} @@ -103,7 +103,7 @@ :utils/show-popup {:title "" :content (i18n/label :t/something-went-wrong)}} (common/clear-on-card-connected) - (navigation/navigate-to-cofx :keycard-settings nil))) + (navigation/navigate-to :keycard-settings nil))) (rf/defn remove-key-with-unpair {:events [:keycard/remove-key-with-unpair]} diff --git a/src/status_im/keycard/wallet.cljs b/src/status_im/keycard/wallet.cljs index 0fa85894f2..baaec18418 100644 --- a/src/status_im/keycard/wallet.cljs +++ b/src/status_im/keycard/wallet.cljs @@ -1,5 +1,5 @@ (ns status-im.keycard.wallet - (:require [status-im2.common.bottom-sheet.events :as bottom-sheet] + (:require [status-im.bottom-sheet.events :as bottom-sheet] [status-im2.constants :as constants] [status-im.ethereum.core :as ethereum] [status-im.ethereum.eip55 :as eip55] @@ -17,7 +17,7 @@ (assoc-in [:keycard :pin :enter-step] :export-key) (update-in [:keycard :pin] dissoc :export-key)) :dismiss-keyboard nil} - (bottom-sheet/show-bottom-sheet {:view {:content add-new.views/pin}}))) + (bottom-sheet/show-bottom-sheet-old {:view {:content add-new.views/pin}}))) (rf/defn verify-pin-with-delay [cofx] @@ -29,7 +29,7 @@ (rf/defn hide-pin-sheet {:events [:keycard/new-account-pin-sheet-hide]} [cofx] - (bottom-sheet/hide-bottom-sheet cofx)) + (bottom-sheet/hide-bottom-sheet-old cofx)) (rf/defn generate-new-keycard-account {:events [:wallet.accounts/generate-new-keycard-account]} diff --git a/src/status_im/mailserver/core.cljs b/src/status_im/mailserver/core.cljs index 231df5e764..3169fbdc1b 100644 --- a/src/status_im/mailserver/core.cljs +++ b/src/status_im/mailserver/core.cljs @@ -255,7 +255,7 @@ (set-input :id id) (set-input :url (str url)) (set-input :name (str name)) - (navigation/navigate-to-cofx :edit-mailserver nil)))) + (navigation/navigate-to :edit-mailserver nil)))) (defn mailserver->rpc [mailserver current-fleet] @@ -411,4 +411,4 @@ [{:keys [db] :as cofx}] (rf/merge cofx {:db (dissoc db :mailserver.edit/mailserver)} - (navigation/navigate-to-cofx :edit-mailserver nil))) + (navigation/navigate-to :edit-mailserver nil))) diff --git a/src/status_im/mobile_sync_settings/core.cljs b/src/status_im/mobile_sync_settings/core.cljs index 265b362f57..471924c4dd 100644 --- a/src/status_im/mobile_sync_settings/core.cljs +++ b/src/status_im/mobile_sync_settings/core.cljs @@ -1,5 +1,5 @@ (ns status-im.mobile-sync-settings.core - (:require [status-im2.common.bottom-sheet.events :as bottom-sheet] + (:require [status-im.bottom-sheet.events :as bottom-sheet] [status-im2.contexts.add-new-contact.events :as add-new-contact] [status-im.mailserver.core :as mailserver] [status-im.multiaccounts.model :as multiaccounts.model] @@ -33,7 +33,7 @@ (not remember-syncing-choice?) (not= :create-multiaccount (:view-id db))) - [(bottom-sheet/show-bottom-sheet + [(bottom-sheet/show-bottom-sheet-old {:view :mobile-network}) (sheet-defaults)] @@ -42,13 +42,13 @@ ;; no reason to restart wallet. (and logged-in? initialized?) [(mailserver/process-next-messages-request) - (bottom-sheet/hide-bottom-sheet) + (bottom-sheet/hide-bottom-sheet-old) (wallet/restart-wallet-service nil) (add-new-contact/set-new-identity-reconnected)] logged-in? [(mailserver/process-next-messages-request) - (bottom-sheet/hide-bottom-sheet)])))) + (bottom-sheet/hide-bottom-sheet-old)])))) (defn apply-settings ([sync?] (apply-settings sync? :default)) @@ -115,12 +115,10 @@ [cofx] (rf/merge cofx - (bottom-sheet/hide-bottom-sheet) - (navigation/navigate-to-cofx :mobile-network-settings nil))) + (bottom-sheet/hide-bottom-sheet-old) + (navigation/navigate-to :mobile-network-settings nil))) (rf/defn mobile-network-show-offline-sheet {:events [:mobile-network/show-offline-sheet]} [cofx] - (bottom-sheet/show-bottom-sheet - cofx - {:view :mobile-network-offline})) + (bottom-sheet/hide-bottom-sheet-old cofx)) diff --git a/src/status_im/multiaccounts/core.cljs b/src/status_im/multiaccounts/core.cljs index fff23e2143..8929768064 100644 --- a/src/status_im/multiaccounts/core.cljs +++ b/src/status_im/multiaccounts/core.cljs @@ -2,7 +2,7 @@ (:require [clojure.string :as string] [quo.platform :as platform] [re-frame.core :as re-frame] - [status-im2.common.bottom-sheet.events :as bottom-sheet] + [status-im.bottom-sheet.events :as bottom-sheet] [status-im.multiaccounts.update.core :as multiaccounts.update] [status-im.native-module.core :as native-module] [utils.re-frame :as rf] @@ -147,12 +147,12 @@ [:dark :light colors/neutral-100] [:light :dark colors/white])] (theme/set-theme theme) - (re-frame/dispatch [:change-root-status-bar-style + (re-frame/dispatch [:change-shell-status-bar-style (if (shell.animation/home-stack-open?) status-bar-theme :light)]) (when reload-ui? (hot-reload/reload) (when-not (= view-id :shell-stack) - (re-frame/dispatch [:change-root-nav-bar-color nav-bar-color])))))) + (re-frame/dispatch [:change-shell-nav-bar-color nav-bar-color])))))) (rf/defn switch-appearance {:events [:multiaccounts.ui/appearance-switched]} @@ -198,7 +198,7 @@ :params [key-uid (clean-path path) ax ay bx by] ;; NOTE: In case of an error we can show a toast error :on-success #(re-frame/dispatch [::update-local-picture %])}]} - (bottom-sheet/hide-bottom-sheet)))) + (bottom-sheet/hide-bottom-sheet-old)))) (rf/defn save-profile-picture-from-url {:events [::save-profile-picture-from-url]} @@ -209,7 +209,7 @@ :params [key-uid url] :on-error #(log/error "::save-profile-picture-from-url error" %) :on-success #(re-frame/dispatch [::update-local-picture %])}]} - (bottom-sheet/hide-bottom-sheet)))) + (bottom-sheet/hide-bottom-sheet-old)))) (comment (re-frame/dispatch @@ -227,7 +227,7 @@ ;; with a toast error :on-success #(log/info "[multiaccount] Delete profile image" %)}]} (multiaccounts.update/optimistic :images nil) - (bottom-sheet/hide-bottom-sheet)))) + (bottom-sheet/hide-bottom-sheet-old)))) (rf/defn get-profile-picture [cofx] diff --git a/src/status_im/multiaccounts/create/core.cljs b/src/status_im/multiaccounts/create/core.cljs index 1c7c54dce9..cd326c1a54 100644 --- a/src/status_im/multiaccounts/create/core.cljs +++ b/src/status_im/multiaccounts/create/core.cljs @@ -94,16 +94,16 @@ (rf/defn multiaccount-generate-and-derive-addresses-success {:events [:multiaccount-generate-and-derive-addresses-success]} [{:keys [db]} result] - {:db (update db - :intro-wizard - (fn [data] - (-> data - (dissoc :processing?) - (assoc :multiaccounts result - :selected-storage-type :default - :selected-id (-> result first :id) - :step :choose-key)))) - :navigate-to-fx :choose-name}) + {:db (update db + :intro-wizard + (fn [data] + (-> data + (dissoc :processing?) + (assoc :multiaccounts result + :selected-storage-type :default + :selected-id (-> result first :id) + :step :choose-key)))) + :navigate-to :choose-name}) (rf/defn generate-and-derive-addresses {:events [:generate-and-derive-addresses]} diff --git a/src/status_im/multiaccounts/key_storage/core.cljs b/src/status_im/multiaccounts/key_storage/core.cljs index 305e35c657..c567c1fa78 100644 --- a/src/status_im/multiaccounts/key_storage/core.cljs +++ b/src/status_im/multiaccounts/key_storage/core.cljs @@ -1,7 +1,7 @@ (ns status-im.multiaccounts.key-storage.core (:require [clojure.string :as string] [re-frame.core :as re-frame] - [status-im2.common.bottom-sheet.events :as bottom-sheet] + [status-im.bottom-sheet.events :as bottom-sheet] [status-im.ethereum.core :as ethereum] [status-im.ethereum.mnemonic :as mnemonic] [utils.i18n :as i18n] @@ -22,7 +22,7 @@ "This event can be dispatched before login and from profile and needs to redirect accordingly" {:events [::key-and-storage-management-pressed]} [cofx] - (navigation/navigate-to-cofx + (navigation/navigate-to cofx (if (multiaccounts.model/logged-in? cofx) :actions-logged-in @@ -60,7 +60,7 @@ (rf/merge cofx {:db (assoc db :recovered-account? true)} - (navigation/navigate-to-cofx :seed-phrase nil))) + (navigation/navigate-to :seed-phrase nil))) (rf/defn seed-phrase-input-changed {:events [::seed-phrase-input-changed]} @@ -85,7 +85,7 @@ (let [backup? (get-in db [:keycard :creating-backup?])] (if backup? (keycard.backup/start-keycard-backup cofx) - (navigation/navigate-to-cofx cofx :storage nil)))) + (navigation/navigate-to cofx :storage nil)))) (defn validate-seed-against-key-uid "Check if the key-uid was generated with the given seed-phrase" @@ -173,7 +173,7 @@ We don't need to take the exact steps, just set the required state and redirect " (rf/defn import-multiaccount [{:keys [db] :as cofx}] - {:dispatch [:bottom-sheet/hide] + {:dispatch [:bottom-sheet/hide-old] ::multiaccounts.recover/import-multiaccount {:passphrase (get-in db [:multiaccounts/key-storage :seed-phrase]) :password nil @@ -183,7 +183,7 @@ We don't need to take the exact steps, just set the required state and redirect {:events [::delete-multiaccount-and-init-keycard-onboarding]} [{:keys [db] :as cofx}] (rf/merge - {:dispatch [:bottom-sheet/hide] + {:dispatch [:bottom-sheet/hide-old] :db (assoc-in db [:multiaccounts/key-storage :reset-db-checked?] true)} (import-multiaccount))) @@ -192,7 +192,7 @@ We don't need to take the exact steps, just set the required state and redirect [{:keys [db] :as cofx}] (if (get-in db [:multiaccounts/key-storage :reset-db-checked?]) (popover/show-popover cofx {:view :transfer-multiaccount-to-keycard-warning}) - (bottom-sheet/show-bottom-sheet cofx {:view :migrate-account-password}))) + (bottom-sheet/hide-bottom-sheet-old cofx))) (rf/defn skip-password-pressed {:events [::skip-password-pressed]} @@ -248,14 +248,14 @@ We don't need to take the exact steps, just set the required state and redirect (dissoc :multiaccounts/key-storage))} (popover/hide-popover) (common/listen-to-hardware-back-button) - (navigation/navigate-to-cofx :keycard-onboarding-intro nil))) + (navigation/navigate-to :keycard-onboarding-intro nil))) (rf/defn goto-multiaccounts-screen {:events [::hide-popover-and-goto-multiaccounts-screen]} [cofx _] (rf/merge cofx (popover/hide-popover) - (navigation/navigate-to-cofx :multiaccounts nil))) + (navigation/navigate-to :multiaccounts nil))) (rf/defn confirm-logout-and-goto-key-storage {:events [::confirm-logout-and-goto-key-storage]} diff --git a/src/status_im/multiaccounts/login/core.cljs b/src/status_im/multiaccounts/login/core.cljs index d71ff11a04..e092810634 100644 --- a/src/status_im/multiaccounts/login/core.cljs +++ b/src/status_im/multiaccounts/login/core.cljs @@ -621,12 +621,12 @@ (if password (rf/merge cofx - {:db (update-in db - [:multiaccounts/login] - assoc - :password password - :save-password? true) - :init-root-fx :progress} + {:db (update-in db + [:multiaccounts/login] + assoc + :password password + :save-password? true) + :set-root :progress} login) (rf/merge cofx @@ -636,10 +636,10 @@ (assoc-in [:keycard :pin :status] nil) (assoc-in [:keycard :pin :login] []))}) #(if keycard-account? - {:init-root-fx :multiaccounts-keycard} - {:init-root-fx :profiles}) + {:set-root :multiaccounts-keycard} + {:set-root :profiles}) #(when goto-key-storage? - (navigation/navigate-to-cofx % :actions-not-logged-in nil)))))) + (navigation/navigate-to % :actions-not-logged-in nil)))))) (rf/defn get-credentials [{:keys [db] :as cofx} key-uid] @@ -725,7 +725,7 @@ (rf/defn welcome-lets-go {:events [:welcome-lets-go]} [_] - {:init-root-fx :shell-stack}) + {:set-root :shell-stack}) (rf/defn multiaccount-selected {:events [:multiaccounts.login.ui/multiaccount-selected]} @@ -738,7 +738,7 @@ cofx (merge {:db (update db :keycard dissoc :application-info)} - (when keycard-multiaccount? {:navigate-to-fx :keycard-login-pin})) + (when keycard-multiaccount? {:navigate-to :keycard-login-pin})) (open-login (select-keys multiaccount [:key-uid :name :public-key :identicon :images]))))) (rf/defn hide-keycard-banner diff --git a/src/status_im/multiaccounts/logout/core.cljs b/src/status_im/multiaccounts/logout/core.cljs index abdc7612f2..5f153e873a 100644 --- a/src/status_im/multiaccounts/logout/core.cljs +++ b/src/status_im/multiaccounts/logout/core.cljs @@ -14,7 +14,7 @@ [{:keys [db] :as cofx} {:keys [auth-method logout?]}] (let [key-uid (get-in db [:multiaccount :key-uid])] (rf/merge cofx - {:init-root-fx :progress + {:set-root :progress :chat.ui/clear-inputs nil :chat.ui/clear-inputs-old nil :shell/reset-bottom-tabs nil diff --git a/src/status_im/multiaccounts/recover/core.cljs b/src/status_im/multiaccounts/recover/core.cljs index 09584676ed..9628164d51 100644 --- a/src/status_im/multiaccounts/recover/core.cljs +++ b/src/status_im/multiaccounts/recover/core.cljs @@ -1,7 +1,7 @@ (ns status-im.multiaccounts.recover.core (:require [clojure.string :as string] [re-frame.core :as re-frame] - [status-im2.common.bottom-sheet.events :as bottom-sheet] + [status-im.bottom-sheet.events :as bottom-sheet] [status-im2.constants :as constants] [status-im.ethereum.core :as ethereum] [status-im.ethereum.mnemonic :as mnemonic] @@ -142,7 +142,7 @@ :step :recovery-success)} (when (existing-account? multiaccounts key-uid) (show-existing-multiaccount-alert key-uid)) - (navigation/navigate-to-cofx :recover-multiaccount-success nil)))) + (navigation/navigate-to :recover-multiaccount-success nil)))) (rf/defn enter-phrase-pressed {:events [::enter-phrase-pressed]} @@ -159,8 +159,8 @@ :forward-action :multiaccounts.recover/enter-phrase-next-pressed} :recovered-account? true) (update :keycard dissoc :flow))} - (bottom-sheet/hide-bottom-sheet) - (navigation/navigate-to-cofx :recover-multiaccount-enter-phrase nil))) + (bottom-sheet/hide-bottom-sheet-old) + (navigation/navigate-to :recover-multiaccount-enter-phrase nil))) (rf/defn proceed-to-import-mnemonic {:events [:multiaccounts.recover/phrase-validated]} @@ -234,7 +234,7 @@ {:dispatch [:recovery.ui/keycard-option-pressed]} (rf/merge cofx {:db (update db :intro-wizard assoc :step :create-code)} - (navigation/navigate-to-cofx :create-password nil))))) + (navigation/navigate-to :create-password nil))))) (rf/defn re-encrypt-pressed {:events [:multiaccounts.recover/re-encrypt-pressed]} @@ -246,7 +246,7 @@ :step :select-key-storage :selected-storage-type :default)} (if (nfc/nfc-supported?) - (navigation/navigate-to-cofx :select-key-storage nil) + (navigation/navigate-to :select-key-storage nil) (select-storage-next-pressed)))) (rf/defn confirm-password-next-button-pressed diff --git a/src/status_im/network/core.cljs b/src/status_im/network/core.cljs index 3408d40ffd..b6c496e742 100644 --- a/src/status_im/network/core.cljs +++ b/src/status_im/network/core.cljs @@ -202,4 +202,4 @@ (rf/defn open-network-details {:events [::network-entry-pressed]} [cofx network] - (navigation/navigate-to-cofx cofx :network-details {:networks/selected-network network})) + (navigation/navigate-to cofx :network-details {:networks/selected-network network})) diff --git a/src/status_im/pairing/core.cljs b/src/status_im/pairing/core.cljs index 0c2583766b..4459839a12 100644 --- a/src/status_im/pairing/core.cljs +++ b/src/status_im/pairing/core.cljs @@ -73,7 +73,7 @@ [{:keys [db] :as cofx}] (rf/merge cofx {:db (assoc-in db [:pairing/prompt-user-pop-up] false)} - (navigation/navigate-to-cofx :installations nil))) + (navigation/navigate-to :installations nil))) (rf/defn prompt-user-on-new-installation [{:keys [db]}] diff --git a/src/status_im/qr_scanner/core.cljs b/src/status_im/qr_scanner/core.cljs index 124e9d28ed..89520a3b3c 100644 --- a/src/status_im/qr_scanner/core.cljs +++ b/src/status_im/qr_scanner/core.cljs @@ -66,7 +66,7 @@ (and public-key own) (rf/merge cofx {:pop-to-root-fx :shell-stack} - (navigation/navigate-to-cofx :my-profile nil)) + (navigation/navigate-to :my-profile nil)) (and public-key (not own)) (rf/merge cofx diff --git a/src/status_im/signing/gas.cljs b/src/status_im/signing/gas.cljs index 0178d0937d..14f236a759 100644 --- a/src/status_im/signing/gas.cljs +++ b/src/status_im/signing/gas.cljs @@ -1,7 +1,7 @@ (ns status-im.signing.gas (:require [clojure.string :as string] [re-frame.core :as re-frame] - [status-im2.common.bottom-sheet.events :as bottom-sheet] + [status-im.bottom-sheet.events :as bottom-sheet] [status-im.ethereum.core :as ethereum] [utils.i18n :as i18n] [status-im.popover.core :as popover] @@ -277,7 +277,7 @@ max-priority-fee})] (rf/merge cofx {:db (assoc db :signing/edit-fee edit-fee)} - (bottom-sheet/show-bottom-sheet {:view sheet-opts})))) + (bottom-sheet/show-bottom-sheet-old {:view sheet-opts})))) (rf/defn submit-fee {:events [:signing.edit-fee.ui/submit]} @@ -300,14 +300,14 @@ :maxFeePerGas (money/->wei :gwei (:value-number maxFeePerGas)) :maxPriorityFeePerGas (money/->wei :gwei (:value-number maxPriorityFeePerGas)))} - (bottom-sheet/hide-bottom-sheet))))) + (bottom-sheet/hide-bottom-sheet-old))))) (rf/defn submit-nonce {:events [:signing.nonce/submit]} [{db :db :as cofx} nonce] (rf/merge cofx {:db (assoc-in db [:signing/tx :nonce] (if (string/blank? nonce) nil nonce))} - (bottom-sheet/hide-bottom-sheet))) + (bottom-sheet/hide-bottom-sheet-old))) (re-frame/reg-fx :signing/update-gas-price diff --git a/src/status_im/ui/components/connectivity/view.cljs b/src/status_im/ui/components/connectivity/view.cljs index a16dc4769f..3ab30bfb32 100644 --- a/src/status_im/ui/components/connectivity/view.cljs +++ b/src/status_im/ui/components/connectivity/view.cljs @@ -80,7 +80,7 @@ (defn hide-sheet-and-dispatch [event] - (re-frame/dispatch [:bottom-sheet/hide]) + (re-frame/dispatch [:bottom-sheet/hide-old]) (re-frame/dispatch event)) (defview connectivity-sheet @@ -187,6 +187,6 @@ [quo/button {:type :icon :accessibility-label (str "conn-button-" (name icon)) - :on-press #(re-frame/dispatch [:bottom-sheet/show-sheet + :on-press #(re-frame/dispatch [:bottom-sheet/show-sheet-old {:content connectivity-sheet}]) :theme (if (= (:peers state) :offline) :negative :secondary)} icon]))) diff --git a/src/status_im/ui/components/invite/views.cljs b/src/status_im/ui/components/invite/views.cljs index d1c1143566..058f5cf392 100644 --- a/src/status_im/ui/components/invite/views.cljs +++ b/src/status_im/ui/components/invite/views.cljs @@ -19,7 +19,7 @@ :icon :main-icons/share :accessibility-label accessibility-label :on-press (fn [] - (re-frame/dispatch [:bottom-sheet/hide]) + (re-frame/dispatch [:bottom-sheet/hide-old]) (js/setTimeout #(re-frame/dispatch [::invite.events/share-link nil]) 250))}]) diff --git a/src/status_im/ui/components/topbar.cljs b/src/status_im/ui/components/topbar.cljs index 46b334c3ea..c21d81a29d 100644 --- a/src/status_im/ui/components/topbar.cljs +++ b/src/status_im/ui/components/topbar.cljs @@ -9,7 +9,7 @@ [modal? {:keys [on-press label icon]}] (cond-> {:icon (if modal? :i/close :i/arrow-left) :accessibility-label :back-button - :on-press #(re-frame/dispatch [:navigate-back :bottom-sheet/hide])} + :on-press #(re-frame/dispatch [:navigate-back :bottom-sheet/hide-old])} on-press (assoc :on-press on-press) diff --git a/src/status_im/ui/screens/browser/empty_tab/views.cljs b/src/status_im/ui/screens/browser/empty_tab/views.cljs index ca7ba2828d..9f01a67008 100644 --- a/src/status_im/ui/screens/browser/empty_tab/views.cljs +++ b/src/status_im/ui/screens/browser/empty_tab/views.cljs @@ -18,7 +18,7 @@ (defn hide-sheet-and-dispatch [event] - (re-frame/dispatch [:bottom-sheet/hide]) + (re-frame/dispatch [:bottom-sheet/hide-old]) (js/setTimeout #(re-frame/dispatch event) 200)) (defn list-item @@ -30,7 +30,7 @@ :on-press #(re-frame/dispatch [:browser.ui/open-url url]) :on-long-press (fn [] (re-frame/dispatch - [:bottom-sheet/show-sheet + [:bottom-sheet/show-sheet-old {:content (fn [] [react/view {:flex 1} [quo/list-item @@ -109,7 +109,7 @@ [quo/button {:accessibility-label :select-account :type :scale - :on-press #(re-frame/dispatch [:bottom-sheet/show-sheet + :on-press #(re-frame/dispatch [:bottom-sheet/show-sheet-old {:content (accounts/accounts-list accounts dapps-account)}])} [react/view (styles/dapps-account color) diff --git a/src/status_im/ui/screens/browser/options/views.cljs b/src/status_im/ui/screens/browser/options/views.cljs index d0f8ae9789..2fe9d5b0c9 100644 --- a/src/status_im/ui/screens/browser/options/views.cljs +++ b/src/status_im/ui/screens/browser/options/views.cljs @@ -15,7 +15,7 @@ (defn hide-sheet-and-dispatch [event] - (re-frame/dispatch [:bottom-sheet/hide]) + (re-frame/dispatch [:bottom-sheet/hide-old]) (re-frame/dispatch event)) (defn wallet-connection @@ -81,7 +81,7 @@ :accessibility-label :share :icon :main-icons/share :on-press (fn [] - (re-frame/dispatch-sync [:bottom-sheet/hide]) + (re-frame/dispatch-sync [:bottom-sheet/hide-old]) (js/setTimeout #(browser/share-link url) 200))}] @@ -103,7 +103,7 @@ :accessibility-label :connected-account :chevron true :on-press #(hide-sheet-and-dispatch - [:bottom-sheet/show-sheet + [:bottom-sheet/show-sheet-old {:content (wallet-connection (http/url-host url) account)}])}] [quo/list-item {:theme :accent diff --git a/src/status_im/ui/screens/browser/stack.cljs b/src/status_im/ui/screens/browser/stack.cljs index 207d3c5c18..136a3d0a51 100644 --- a/src/status_im/ui/screens/browser/stack.cljs +++ b/src/status_im/ui/screens/browser/stack.cljs @@ -2,13 +2,18 @@ (:require [utils.re-frame :as rf] [status-im.ui.screens.browser.empty-tab.views :as empty-tab] [status-im.ui.screens.browser.views :as browser] - [status-im.ui.screens.browser.tabs.views :as tabs])) + [status-im.ui.screens.browser.tabs.views :as tabs] + [react-native.safe-area :as safe-area] + [react-native.core :as rn])) (defn browser-stack [] (let [screen-id (rf/sub [:browser/screen-id])] - (case screen-id - :empty-tab [empty-tab/empty-tab] - :browser [browser/browser] - :browser-tabs [tabs/tabs] - [empty-tab/empty-tab]))) + [safe-area/consumer + (fn [{:keys [top]}] + [rn/view {:padding-top top :flex 1} + (case screen-id + :empty-tab [empty-tab/empty-tab] + :browser [browser/browser] + :browser-tabs [tabs/tabs] + [empty-tab/empty-tab])])])) diff --git a/src/status_im/ui/screens/browser/views.cljs b/src/status_im/ui/screens/browser/views.cljs index 6418cfed82..a1c7921c38 100644 --- a/src/status_im/ui/screens/browser/views.cljs +++ b/src/status_im/ui/screens/browser/views.cljs @@ -93,7 +93,7 @@ [icons/icon :main-icons/arrow-right {:color colors/black}]] [react/touchable-highlight {:accessibility-label :select-account - :on-press #(re-frame/dispatch [:bottom-sheet/show-sheet + :on-press #(re-frame/dispatch [:bottom-sheet/show-sheet-old {:content (accounts/accounts-list accounts dapps-account)}])} [chat-icon/custom-icon-view-list (:name dapps-account) (:color dapps-account) 32]] @@ -112,7 +112,7 @@ [icons/icon :main-icons/qr {:color colors/black}]] [react/touchable-highlight {:on-press #(re-frame/dispatch - [:bottom-sheet/show-sheet + [:bottom-sheet/show-sheet-old {:content (options/browser-options url dapps-account @@ -143,7 +143,7 @@ {:permissions (map resources-to-permissions-map resources) :on-allowed #(.answerPermissionRequest ^js webview-ref true resources) :on-denied #(.answerPermissionRequest ^js webview-ref false)}) - (re-frame/dispatch [:bottom-sheet/hide]))} + (re-frame/dispatch [:bottom-sheet/hide-old]))} (i18n/label :t/allow)]] [react/view styles/blocked-access-button-wrapper [quo/button @@ -151,7 +151,7 @@ :style styles/blocked-access-button :on-press (fn [] (.answerPermissionRequest ^js webview-ref false) - (re-frame/dispatch [:bottom-sheet/hide]))} + (re-frame/dispatch [:bottom-sheet/hide-old]))} (i18n/label :t/deny)]]]]) (views/defview block-resources-panel @@ -166,7 +166,7 @@ (defn request-resources-access-for-page [resources url webview-ref] (re-frame/dispatch - [:bottom-sheet/show-sheet + [:bottom-sheet/show-sheet-old {:content (fn [] [request-resources-panel resources url webview-ref]) :show-handle? false :backdrop-dismiss? false @@ -176,7 +176,7 @@ (defn block-resources-access-and-notify-user [url] (.answerPermissionRequest ^js @webview-ref/webview-ref false) - (re-frame/dispatch [:bottom-sheet/show-sheet + (re-frame/dispatch [:bottom-sheet/show-sheet-old {:content (fn [] [block-resources-panel url])}])) ;; should-component-update is called only when component's props are changed, diff --git a/src/status_im/ui/screens/chat/sheets.cljs b/src/status_im/ui/screens/chat/sheets.cljs index 7adc1bd7dd..8fbbd4a942 100644 --- a/src/status_im/ui/screens/chat/sheets.cljs +++ b/src/status_im/ui/screens/chat/sheets.cljs @@ -11,7 +11,7 @@ (defn hide-sheet-and-dispatch [event] - (re-frame/dispatch [:bottom-sheet/hide]) + (re-frame/dispatch [:bottom-sheet/hide-old]) (re-frame/dispatch event)) (defn one-to-one-chat-accents @@ -53,7 +53,7 @@ :accessibility-label :share-chat-button :icon :main-icons/share :on-press (fn [] - (re-frame/dispatch [:bottom-sheet/hide]) + (re-frame/dispatch [:bottom-sheet/hide-old]) ;; https://github.com/facebook/react-native/pull/26839 (js/setTimeout #(list-selection/open-share {:message message}) diff --git a/src/status_im/ui/screens/communities/channel_details.cljs b/src/status_im/ui/screens/communities/channel_details.cljs index e8ac885dd6..fe8e288104 100644 --- a/src/status_im/ui/screens/communities/channel_details.cljs +++ b/src/status_im/ui/screens/communities/channel_details.cljs @@ -1,7 +1,6 @@ (ns status-im.ui.screens.communities.channel-details (:require [clojure.string :as string] [quo.core :as quo] - [re-frame.core :as re-frame] [status-im.communities.core :as communities] [utils.i18n :as i18n] [status-im.ui.components.profile-header.view :as profile-header] @@ -64,5 +63,4 @@ :accessory :text :accessory-text (count pinned-messages) :chevron true - :on-press #(re-frame/dispatch [:bottom-sheet/show-sheet :pinned-messages-list - chat-id])}]])])))) + :on-press #(rf/dispatch [:pin-message/show-pins-bottom-sheet chat-id])}]])])))) diff --git a/src/status_im/ui/screens/communities/community.cljs b/src/status_im/ui/screens/communities/community.cljs index 131beaa055..5b6a298d73 100644 --- a/src/status_im/ui/screens/communities/community.cljs +++ b/src/status_im/ui/screens/communities/community.cljs @@ -3,8 +3,7 @@ [utils.i18n :as i18n] [quo.core :as quo] [quo.design-system.colors :as colors] - [quo2.components.community.style :as styles] ;; TODO reimplement with quo2 library and new - ;; designs + [quo2.components.community.style :as styles] [quo2.components.navigation.floating-shell-button :as floating-shell-button] [react-native.core :as rn] [status-im.communities.core :as communities] @@ -69,7 +68,7 @@ (defn hide-sheet-and-dispatch [event] - (rf/dispatch [:bottom-sheet/hide]) + (rf/dispatch [:bottom-sheet/hide-old]) (rf/dispatch event)) (defn community-plus-actions @@ -173,7 +172,7 @@ (rf/dispatch [:dismiss-keyboard]) (rf/dispatch [:chat/navigate-to-chat chat-id]) (rf/dispatch [:search/home-filter-changed nil])) - :on-long-press #(rf/dispatch [:bottom-sheet/show-sheet + :on-long-press #(rf/dispatch [:bottom-sheet/show-sheet-old {:content (fn [] [sheets/actions home-item])}])}]) @@ -292,7 +291,7 @@ (when (or admin joined) [{:icon :main-icons/more :accessibility-label :community-menu-button - :on-press #(rf/dispatch [:bottom-sheet/show-sheet + :on-press #(rf/dispatch [:bottom-sheet/show-sheet-old {:content (fn [] [community-actions community])}])}])}] (if joined @@ -300,7 +299,7 @@ [community-channel-preview-list id chats]) (when admin [components.plus-button/plus-button-old - {:on-press #(rf/dispatch [:bottom-sheet/show-sheet + {:on-press #(rf/dispatch [:bottom-sheet/show-sheet-old {:content (fn [] [community-plus-actions community])}]) :accessibility-label :new-chat-button}]) diff --git a/src/status_im/ui/screens/communities/create.cljs b/src/status_im/ui/screens/communities/create.cljs index b5a559aac5..f8b0ce1b13 100644 --- a/src/status_im/ui/screens/communities/create.cljs +++ b/src/status_im/ui/screens/communities/create.cljs @@ -63,7 +63,7 @@ :icon :main-icons/camera :title (i18n/label :t/community-image-take) :on-press #(do - (rf/dispatch [:bottom-sheet/hide]) + (rf/dispatch [:bottom-sheet/hide-old]) (take-pic))}] [quo/list-item {:accessibility-label :pick-photo @@ -71,7 +71,7 @@ :theme :accent :title (i18n/label :t/community-image-pick) :on-press #(do - (rf/dispatch [:bottom-sheet/hide]) + (rf/dispatch [:bottom-sheet/hide-old]) (pick-pic))}] (when (and has-picture (not editing?)) [quo/list-item @@ -80,7 +80,7 @@ :theme :accent :title (i18n/label :t/community-image-remove) :on-press #(do - (rf/dispatch [:bottom-sheet/hide]) + (rf/dispatch [:bottom-sheet/hide-old]) (rf/dispatch [::communities/remove-field :image]))}])])) (defn photo-picker @@ -92,7 +92,7 @@ [rn/touchable-opacity {:on-press (fn [] (rn/dismiss-keyboard!) - (rf/dispatch [:bottom-sheet/show-sheet + (rf/dispatch [:bottom-sheet/show-sheet-old {:content (bottom-sheet (boolean image) editing?)}]))} [rn/view {:style {:width 128 diff --git a/src/status_im/ui/screens/communities/members.cljs b/src/status_im/ui/screens/communities/members.cljs index 6e9af61ea4..9d37d7897d 100644 --- a/src/status_im/ui/screens/communities/members.cljs +++ b/src/status_im/ui/screens/communities/members.cljs @@ -14,7 +14,7 @@ (defn hide-sheet-and-dispatch [event] - (rf/dispatch [:bottom-sheet/hide]) + (rf/dispatch [:bottom-sheet/hide-old]) (rf/dispatch event)) (defn member-sheet @@ -72,7 +72,7 @@ :accessory (when (not= public-key my-public-key) [quo/button {:on-press - #(rf/dispatch [:bottom-sheet/show-sheet + #(rf/dispatch [:bottom-sheet/show-sheet-old {:content (fn [] [member-sheet primary-name member community-id can-kick-users? can-manage-users? admin?])}]) diff --git a/src/status_im/ui/screens/communities/views.cljs b/src/status_im/ui/screens/communities/views.cljs index 33cfe7612a..6bc6612e35 100644 --- a/src/status_im/ui/screens/communities/views.cljs +++ b/src/status_im/ui/screens/communities/views.cljs @@ -17,7 +17,7 @@ (defn hide-sheet-and-dispatch [event] - (rf/dispatch [:bottom-sheet/hide]) + (rf/dispatch [:bottom-sheet/hide-old]) (rf/dispatch event)) (defn community-unviewed-count @@ -49,7 +49,7 @@ (rf/dispatch [:communities/load-category-states id]) (rf/dispatch [:dismiss-keyboard]) (rf/dispatch [:navigate-to :community-overview id])) - :on-long-press #(rf/dispatch [:bottom-sheet/show-sheet + :on-long-press #(rf/dispatch [:bottom-sheet/show-sheet-old {:content (fn [] [community/community-actions community])}])} [:<> @@ -150,7 +150,7 @@ [{:icon :main-icons/more :accessibility-label :chat-menu-button :on-press - #(rf/dispatch [:bottom-sheet/show-sheet + #(rf/dispatch [:bottom-sheet/show-sheet-old {:content (fn [] [communities-actions]) :height 256}])}]}] diff --git a/src/status_im/ui/screens/ens/views.cljs b/src/status_im/ui/screens/ens/views.cljs index d9c262d2ec..9d027c8679 100644 --- a/src/status_im/ui/screens/ens/views.cljs +++ b/src/status_im/ui/screens/ens/views.cljs @@ -292,7 +292,7 @@ :title (:name account) :subtitle (utils/get-shortened-checksum-address (:address account)) :chevron true - :on-press #(re-frame/dispatch [:bottom-sheet/show-sheet + :on-press #(re-frame/dispatch [:bottom-sheet/show-sheet-old {:content (fn [] [sheets/accounts-list :from ::ens/change-address])}])}])) @@ -681,7 +681,7 @@ [react/view {:style {:flex 1 :margin-top 8}} (for [name names] (let [action #(do (re-frame/dispatch [::ens/save-preferred-name name]) - (re-frame/dispatch [:bottom-sheet/hide])) + (re-frame/dispatch [:bottom-sheet/hide-old])) stateofus-username (stateofus/username name) s (or stateofus-username name)] ^{:key name} @@ -755,7 +755,7 @@ [profile.components/settings-item {:label-kw :ens-primary-username :value preferred-name - :action-fn #(re-frame/dispatch [:bottom-sheet/show-sheet + :action-fn #(re-frame/dispatch [:bottom-sheet/show-sheet-old {:content (fn [] (name-list names preferred-name))}])}]])]]]) diff --git a/src/status_im/ui/screens/home/sheet/views.cljs b/src/status_im/ui/screens/home/sheet/views.cljs index 26bce72c0e..1dabc05997 100644 --- a/src/status_im/ui/screens/home/sheet/views.cljs +++ b/src/status_im/ui/screens/home/sheet/views.cljs @@ -1,19 +1,16 @@ (ns status-im.ui.screens.home.sheet.views (:require [quo.core :as quo] - [quo2.foundations.colors :as colors] [utils.re-frame :as rf] [utils.i18n :as i18n] [status-im.qr-scanner.core :as qr-scanner] [status-im.ui.components.invite.views :as invite] [status-im.ui.components.react :as rn] - [status-im.ui2.screens.chat.components.new-chat.view :as new-chat-aio] [status-im2.config :as config] - [quo2.core :as quo2] [status-im.ui.screens.home.sheet.styles :as style])) (defn- hide-sheet-and-dispatch [event] - (rf/dispatch [:bottom-sheet/hide]) + (rf/dispatch [:bottom-sheet/hide-old]) (rf/dispatch event)) (defn add-new-view @@ -60,48 +57,6 @@ [invite/list-item {:accessibility-label :chats-menu-invite-friends-button}]]) -(defn new-chat-bottom-sheet - [] - [rn/view - [quo2/menu-item - {:type :transparent - :title (i18n/label :t/new-chat) - :icon-bg-color :transparent - :container-padding-vertical 12 - :title-column-style {:margin-left 2} - :style-props {:border-bottom-width 1 - :border-bottom-color (colors/theme-colors colors/neutral-10 - colors/neutral-90)} - :icon-color (colors/theme-colors colors/neutral-50 colors/neutral-40) - :accessibility-label :start-a-new-chat - :icon :i/new-message - :on-press (fn [] - (rf/dispatch [:group-chat/clear-contacts]) - (hide-sheet-and-dispatch [:bottom-sheet/show-sheet - :start-a-new-chat {}]))}] - [quo2/menu-item - {:type :transparent - :title (i18n/label :t/add-a-contact) - :icon-bg-color :transparent - :icon-container-style {:padding-horizontal 0} - :container-padding-horizontal {:padding-horizontal 4} - :style-props {:margin-top 18 - :margin-bottom 9} - :container-padding-vertical 12 - :title-column-style {:margin-left 2} - :icon-color (colors/theme-colors colors/neutral-50 colors/neutral-40) - :accessibility-label :add-a-contact - :subtitle (i18n/label :t/enter-a-chat-key) - :subtitle-color colors/neutral-50 - :icon :i/add-user - :on-press #(hide-sheet-and-dispatch [:open-modal :new-contact])}]]) - -(def new-chat-bottom-sheet-comp - {:content new-chat-bottom-sheet}) - ;; Deprecated (def add-new {:content add-new-view}) - -(def start-a-new-chat - {:content new-chat-aio/contact-selection-list}) diff --git a/src/status_im/ui/screens/home/views.cljs b/src/status_im/ui/screens/home/views.cljs index b692a98e4b..dc194b2839 100644 --- a/src/status_im/ui/screens/home/views.cljs +++ b/src/status_im/ui/screens/home/views.cljs @@ -154,7 +154,7 @@ (re-frame/dispatch [:dismiss-keyboard]) (re-frame/dispatch [:chat/navigate-to-chat chat-id]) (re-frame/dispatch [:search/home-filter-changed nil])) - :on-long-press #(re-frame/dispatch [:bottom-sheet/show-sheet + :on-long-press #(re-frame/dispatch [:bottom-sheet/show-sheet-old {:content (fn [] [sheets/actions home-item])}])}] [communities.views/community-home-list-item home-item])) @@ -169,7 +169,7 @@ (re-frame/dispatch [:dismiss-keyboard]) (re-frame/dispatch [:chat/navigate-to-chat chat-id]) (re-frame/dispatch [:search/home-filter-changed nil])) - :on-long-press #(re-frame/dispatch [:bottom-sheet/show-sheet + :on-long-press #(re-frame/dispatch [:bottom-sheet/show-sheet-old {:content (fn [] [sheets/actions home-item])}])}] [communities.views/community-home-list-item home-item])) @@ -261,7 +261,7 @@ {:on-press (when-not logging-in? (fn [] (re-frame/dispatch [:group-chat/clear-contacts]) - (re-frame/dispatch [:bottom-sheet/show-sheet :start-a-new-chat {}]))) + (re-frame/dispatch [:bottom-sheet/show-sheet-old :start-a-new-chat {}]))) :loading logging-in? :accessibility-label :new-chat-button}])) @@ -272,7 +272,7 @@ {:on-press (when-not logging-in? (fn [] (re-frame/dispatch [:group-chat/clear-contacts]) - (re-frame/dispatch [:bottom-sheet/show-sheet :start-a-new-chat {}]))) + (re-frame/dispatch [:bottom-sheet/show-sheet-old :start-a-new-chat {}]))) :loading logging-in? :accessibility-label :new-chat-button}])) diff --git a/src/status_im/ui/screens/keycard/views.cljs b/src/status_im/ui/screens/keycard/views.cljs index f282fcd9fe..4196c25f50 100644 --- a/src/status_im/ui/screens/keycard/views.cljs +++ b/src/status_im/ui/screens/keycard/views.cljs @@ -4,7 +4,7 @@ [quo.design-system.colors :as colors] [re-frame.core :as re-frame] [reagent.core :as reagent] - [status-im2.common.bottom-sheet.events :as bottom-sheet] + [status-im.bottom-sheet.events :as bottom-sheet] [status-im2.constants :as constants] [utils.i18n :as i18n] [status-im.keycard.login :as keycard.login] @@ -447,8 +447,8 @@ [{:keys [db] :as cofx}] (rf/merge cofx (multiaccounts.create/prepare-intro-wizard) - (bottom-sheet/hide-bottom-sheet) - (navigation/navigate-to-cofx :get-your-keys nil))) + (bottom-sheet/hide-bottom-sheet-old) + (navigation/navigate-to :get-your-keys nil))) (defn- more-sheet-content [] diff --git a/src/status_im/ui/screens/mobile_network_settings/sheets.cljs b/src/status_im/ui/screens/mobile_network_settings/sheets.cljs index 57cd487133..8f401812a5 100644 --- a/src/status_im/ui/screens/mobile_network_settings/sheets.cljs +++ b/src/status_im/ui/screens/mobile_network_settings/sheets.cljs @@ -63,7 +63,7 @@ (defn hide-sheet-and-dispatch [event] - (re-frame/dispatch [:bottom-sheet/hide]) + (re-frame/dispatch [:bottom-sheet/hide-old]) (re-frame/dispatch event)) (views/defview settings-sheet diff --git a/src/status_im/ui/screens/mobile_network_settings/view.cljs b/src/status_im/ui/screens/mobile_network_settings/view.cljs index 10134b1ec6..bd7209a78a 100644 --- a/src/status_im/ui/screens/mobile_network_settings/view.cljs +++ b/src/status_im/ui/screens/mobile_network_settings/view.cljs @@ -10,7 +10,7 @@ (defn hide-sheet-and-dispatch [event] - (re-frame/dispatch [:bottom-sheet/hide]) + (re-frame/dispatch [:bottom-sheet/hide-old]) (re-frame/dispatch event)) (defn settings-separator diff --git a/src/status_im/ui/screens/multiaccounts/recover/views.cljs b/src/status_im/ui/screens/multiaccounts/recover/views.cljs index c57306217e..c9f6bd8d71 100644 --- a/src/status_im/ui/screens/multiaccounts/recover/views.cljs +++ b/src/status_im/ui/screens/multiaccounts/recover/views.cljs @@ -16,7 +16,7 @@ (defn hide-sheet-and-dispatch [event] - (re-frame/dispatch [:bottom-sheet/hide]) + (re-frame/dispatch [:bottom-sheet/hide-old]) (re-frame/dispatch event)) (defview custom-seed-phrase diff --git a/src/status_im/ui/screens/multiaccounts/sheets.cljs b/src/status_im/ui/screens/multiaccounts/sheets.cljs index 3963b508ee..ba87a1d384 100644 --- a/src/status_im/ui/screens/multiaccounts/sheets.cljs +++ b/src/status_im/ui/screens/multiaccounts/sheets.cljs @@ -5,7 +5,7 @@ (defn- hide-sheet-and-dispatch [event] - (re-frame/dispatch [:bottom-sheet/hide]) + (re-frame/dispatch [:bottom-sheet/hide-old]) (re-frame/dispatch event)) (defn actions-sheet diff --git a/src/status_im/ui/screens/multiaccounts/views.cljs b/src/status_im/ui/screens/multiaccounts/views.cljs index abb0c7156a..c463eae28e 100644 --- a/src/status_im/ui/screens/multiaccounts/views.cljs +++ b/src/status_im/ui/screens/multiaccounts/views.cljs @@ -41,7 +41,7 @@ (defn topbar-button [] - (re-frame/dispatch [:bottom-sheet/show-sheet + (re-frame/dispatch [:bottom-sheet/show-sheet-old {:content sheets/actions-sheet}])) (defview multiaccounts [] diff --git a/src/status_im/ui/screens/onboarding/keys/views.cljs b/src/status_im/ui/screens/onboarding/keys/views.cljs index b8ddad4b5e..8656f8d913 100644 --- a/src/status_im/ui/screens/onboarding/keys/views.cljs +++ b/src/status_im/ui/screens/onboarding/keys/views.cljs @@ -103,7 +103,7 @@ (i18n/label :t/generate-a-key)]] [react/view {:padding-vertical 8} [quo/button - {:on-press #(re-frame/dispatch [:bottom-sheet/show-sheet :recover-sheet]) + {:on-press #(re-frame/dispatch [:bottom-sheet/show-sheet-old :recover-sheet]) :type :secondary} (i18n/label :t/access-existing-keys)]] [react/text {:style (assoc (styles/wizard-text) :margin-top 20 :margin-bottom 16)} diff --git a/src/status_im/ui/screens/onboarding/views.cljs b/src/status_im/ui/screens/onboarding/views.cljs index 2dfb676d7d..7cef26adc1 100644 --- a/src/status_im/ui/screens/onboarding/views.cljs +++ b/src/status_im/ui/screens/onboarding/views.cljs @@ -10,7 +10,7 @@ (defn learn-more [title content] [react/text - {:on-press #(re-frame/dispatch [:bottom-sheet/show-sheet :learn-more + {:on-press #(re-frame/dispatch [:bottom-sheet/show-sheet-old :learn-more {:title (i18n/label title) :content (i18n/label content)}]) :style (merge (styles/wizard-text) {:color colors/blue}) diff --git a/src/status_im/ui/screens/profile/contact/views.cljs b/src/status_im/ui/screens/profile/contact/views.cljs index 6e62477cee..ceb3e274b2 100644 --- a/src/status_im/ui/screens/profile/contact/views.cljs +++ b/src/status_im/ui/screens/profile/contact/views.cljs @@ -67,7 +67,7 @@ :accessory :text :accessory-text pin-count :disabled (zero? pin-count) - :on-press #(re-frame/dispatch [:bottom-sheet/show-sheet :pinned-messages-list public-key]) + :on-press #(rf/dispatch [:pin-message/show-pins-bottom-sheet public-key]) :chevron true}]) (defn nickname-settings diff --git a/src/status_im/ui/screens/profile/group_chat/views.cljs b/src/status_im/ui/screens/profile/group_chat/views.cljs index 246841fe89..2fe62e8b97 100644 --- a/src/status_im/ui/screens/profile/group_chat/views.cljs +++ b/src/status_im/ui/screens/profile/group_chat/views.cljs @@ -71,7 +71,7 @@ (not= public-key current-user-identity)) {:accessory [quo/button {:on-press #(re-frame/dispatch - [:bottom-sheet/show-sheet + [:bottom-sheet/show-sheet-old {:content (fn [] [member-sheet chat-id member admin?])}]) :type :icon @@ -105,7 +105,7 @@ (defn hide-sheet-and-dispatch [event] - (re-frame/dispatch [:bottom-sheet/hide]) + (re-frame/dispatch [:bottom-sheet/hide-old]) (debounce/dispatch-and-chill event 2000)) (defn invitation-sheet @@ -142,7 +142,7 @@ {:title (multiaccounts/displayed-name contact) :icon [chat-icon/contact-icon-contacts-tab (multiaccounts/displayed-photo contact)] - :on-press #(re-frame/dispatch [:bottom-sheet/show-sheet + :on-press #(re-frame/dispatch [:bottom-sheet/show-sheet-old {:content (fn [] [invitation-sheet invitation contact])}])}])) @@ -214,8 +214,7 @@ :accessory :text :accessory-text (count pinned-messages) :chevron true - :on-press #(re-frame/dispatch [:bottom-sheet/show-sheet :pinned-messages-list - chat-id])}] + :on-press #(re-frame/dispatch [:pin-message/show-pins-bottom-sheet chat-id])}] (when member? [quo/list-item {:theme :negative diff --git a/src/status_im/ui/screens/profile/user/edit_picture.cljs b/src/status_im/ui/screens/profile/user/edit_picture.cljs index 6a781a927f..e90b56f28b 100644 --- a/src/status_im/ui/screens/profile/user/edit_picture.cljs +++ b/src/status_im/ui/screens/profile/user/edit_picture.cljs @@ -15,14 +15,14 @@ (defn pick-pic [] - (re-frame/dispatch [:bottom-sheet/hide]) + (re-frame/dispatch [:bottom-sheet/hide-old]) (react/show-image-picker #(re-frame/dispatch [::multiaccounts/save-profile-picture (.-path ^js %) 0 0 crop-size crop-size]) crop-opts)) (defn take-pic [] - (re-frame/dispatch [:bottom-sheet/hide]) + (re-frame/dispatch [:bottom-sheet/hide-old]) (react/show-image-picker-camera #(re-frame/dispatch [::multiaccounts/save-profile-picture (.-path ^js %) 0 0 crop-size crop-size]) crop-opts)) diff --git a/src/status_im/ui/screens/profile/user/views.cljs b/src/status_im/ui/screens/profile/user/views.cljs index 06e724bcea..ba0c588ef9 100644 --- a/src/status_im/ui/screens/profile/user/views.cljs +++ b/src/status_im/ui/screens/profile/user/views.cljs @@ -210,7 +210,7 @@ :use-insets true :extended-header (profile-header/extended-header {:on-press on-share - :on-edit #(re-frame/dispatch [:bottom-sheet/show-sheet + :on-edit #(re-frame/dispatch [:bottom-sheet/show-sheet-old {:content (edit/bottom-sheet has-picture)}]) :title (multiaccounts/displayed-name account) diff --git a/src/status_im/ui/screens/screens.cljs b/src/status_im/ui/screens/screens.cljs index 43381b50f3..c81f1f8280 100644 --- a/src/status_im/ui/screens/screens.cljs +++ b/src/status_im/ui/screens/screens.cljs @@ -113,25 +113,29 @@ ;Multiaccounts {:name :multiaccounts - :insets {:bottom true} - :options {:topBar {:title {:text (i18n/label :t/your-keys)} + :options {:insets {:bottom? true + :top? true} + :topBar {:title {:text (i18n/label :t/your-keys)} :rightButtons (right-button-options :multiaccounts :more)}} :right-handler multiaccounts/topbar-button :component multiaccounts/multiaccounts} ;Login {:name :login - :insets {:bottom true} - :options {:topBar {:rightButtons (right-button-options :login :more)}} + :options {:insets {:bottom? true + :top? true} + :topBar {:rightButtons (right-button-options :login :more)}} :right-handler login/topbar-button :component login/login} {:name :progress + :options {:insets {:top? true}} :component progress/progress} ;[Onboarding] {:name :get-your-keys - :insets {:bottom true} + :options {:insets {:bottom? true + :top? true}} :component onboarding.keys/get-your-keys} ;[Onboarding] @@ -139,377 +143,435 @@ :options {:topBar {:visible false} :popGesture false :hardwareBackButton {:dismissModalOnPress false - :popStackOnPress false}} - :insets {:bottom true} + :popStackOnPress false} + :insets {:bottom? true + :top? true}} :component onboarding.keys/choose-a-chat-name} ;[Onboarding] {:name :select-key-storage - :insets {:bottom true} :options {:popGesture false :hardwareBackButton {:dismissModalOnPress false - :popStackOnPress false}} + :popStackOnPress false} + :insets {:bottom? true + :top? true}} :component onboarding.storage/select-key-storage} ;[Onboarding] Create Password {:name :create-password :options {:popGesture false :hardwareBackButton {:dismissModalOnPress false - :popStackOnPress false}} - :insets {:bottom true} + :popStackOnPress false} + :insets {:bottom? true + :top? true}} :component onboarding.password/screen} ;[Onboarding] Welcome {:name :welcome :options {:popGesture false :hardwareBackButton {:dismissModalOnPress false - :popStackOnPress false}} - :insets {:bottom true} + :popStackOnPress false} + :insets {:bottom? true + :top? true}} :component onboarding.welcome/welcome} ;[Onboarding] Notification {:name :onboarding-notification :options {:popGesture false :hardwareBackButton {:dismissModalOnPress false - :popStackOnPress false}} - :insets {:bottom true} + :popStackOnPress false} + :insets {:bottom? true + :top? true}} :component onboarding.notifications/notifications-onboarding} ;[Onboarding] Recovery {:name :recover-multiaccount-enter-phrase - :insets {:bottom true} + :options {:insets {:top? true :bottom? true}} :component onboarding.phrase/enter-phrase} {:name :recover-multiaccount-success :options {:popGesture false :hardwareBackButton {:dismissModalOnPress false - :popStackOnPress false}} - :insets {:bottom true} + :popStackOnPress false} + :insets {:bottom? true + :top? true}} :component onboarding.phrase/wizard-recovery-success} ;;CHAT + {:name :start-a-new-chat + :options {:sheet? true :insets {:top? true}} + :component new-chat-aio/contact-selection-list} {:name :group-chat-profile ;;TODO animated-header - :options {:topBar {:visible false}} + :options {:insets {:top? true}} :component group-details/group-details} {:name :group-chat-invite ;;TODO parameter in the event - :options {:topBar {:visible false}} + :options {:insets {:top? true}} :component profile.group-chat/group-chat-invite} {:name :stickers - :options {:topBar {:title {:text (i18n/label :t/sticker-market)}}} + :options {:insets {:top? true} + :topBar {:title {:text (i18n/label :t/sticker-market)}}} :component stickers/packs} {:name :stickers-pack + :options {:insets {:top? true}} :component stickers/pack} ;; Community {:name :community ;;TODO custom - :options {:topBar {:visible false}} + :options {:insets {:top? true}} :component community/community} {:name :community-management - :insets {:top false} ;;TODO animated-header :options {:topBar {:visible false}} :component community.profile/management-container} {:name :community-members ;;TODO custom subtitle - :options {:topBar {:visible false}} + :options {:insets {:top? true}} :component members/members-container} {:name :community-requests-to-join ;;TODO custom subtitle - :options {:topBar {:visible false}} + :options {:insets {:top? true}} :component requests-to-join/requests-to-join-container} {:name :create-community-channel - :insets {:bottom true} - :options {:topBar {:title {:text (i18n/label :t/create-channel-title)}}} + :options {:topBar {:title {:text (i18n/label :t/create-channel-title)}} + :insets {:bottom? true + :top? true}} :component create-channel/view} {:name :community-emoji-thumbnail-picker - :insets {:bottom true} - :options {:topBar {:title {:text (i18n/label :t/community-emoji-thumbnail-title)}}} + :options {:topBar {:title {:text (i18n/label :t/community-emoji-thumbnail-title)}} + :insets {:bottom? true + :top? true}} :component community-emoji-thumbnail-picker/view} {:name :create-community-category - :insets {:bottom true} - :options {:topBar {:title {:text (i18n/label :t/new-category)}}} + :options {:topBar {:title {:text (i18n/label :t/new-category)}} + :insets {:bottom? true + :top? true}} :component create-category/view} {:name :select-category - :insets {:bottom true} ;;TODO custom - :options {:topBar {:visible false}} + :options {:topBar {:visible false} + :insets {:bottom? true + :top? true}} :component select-category/view} {:name :community-reorder-categories - :insets {:top false} :options {:topBar {:visible false}} :component reorder-categories/view} {:name :community-channel-details - :insets {:top false} ;;TODO custom :options {:topBar {:visible false}} :component communities.channel-details/view} {:name :edit-community-channel - :options {:topBar {:title {:text (i18n/label :t/edit-channel-title)}}} - :insets {:bottom true} + :options {:topBar {:title {:text (i18n/label :t/edit-channel-title)}} + :insets {:bottom? true + :top? true}} :component edit-channel/view} {:name :contact-toggle-list ;;TODO custom subtitle - :options {:topBar {:visible false}} + :options {:insets {:top? true}} :component group-chat/contact-toggle-list} {:name :new-group - :options {:topBar {:visible false}} + :options {:insets {:top? true}} ;;TODO custom subtitle :component group-chat/new-group} {:name :communities ;;TODO custom - :options {:topBar {:visible false}} + :options {:insets {:top? true}} :component communities/communities} {:name :community-import - :options {:topBar {:title {:text (i18n/label :t/import-community-title)}}} + :options {:topBar {:title {:text (i18n/label :t/import-community-title)}} + :insets {:top? true}} :component communities.import/view} {:name :community-edit - :options {:topBar {:title {:text (i18n/label :t/community-edit-title)}}} + :options {:topBar {:title {:text (i18n/label :t/community-edit-title)}} + :insets {:top? true}} :component community.edit/edit} {:name :community-create - :options {:topBar {:title {:text (i18n/label :t/new-community-title)}}} + :options {:topBar {:title {:text (i18n/label :t/new-community-title)}} + :insets {:top? true}} :component communities.create/view} {:name :community-membership - :options {:topBar {:title {:text (i18n/label :t/membership-title)}}} + :options {:topBar {:title {:text (i18n/label :t/membership-title)}} + :insets {:top? true}} :component membership/membership} ;;WALLET {:name :wallet - :insets {:top false} :on-focus [:wallet/tab-opened] ;;TODO wallet redesign ;;:options {:statusBar {:backgroundColor quo2.colors/neutral-5}} :component wallet.accounts/accounts-overview-old} {:name :wallet-account ;;TODO dynamic titleaccounts-overview - :options {:topBar {:visible false}} + :options {:insets {:top? true}} :component wallet.account/account} {:name :add-new-account ;;TODO dynamic title - :options {:topBar {:visible false}} + :options {:insets {:top? true}} :component add-account/add-account} {:name :add-new-account-pin ;;TODO dynamic title - :options {:topBar {:visible false}} + :options {:insets {:top? true}} :component add-account/pin} {:name :account-settings ;;TODO dynamic title - :options {:topBar {:visible false}} + :options {:insets {:top? true}} :component account-settings/account-settings} {:name :wallet-transaction-details ;;TODO dynamic title - :options {:topBar {:visible false}} + :options {:insets {:top? true}} :component wallet-transactions/transaction-details} {:name :wallet-settings-assets ;;TODO dynamic title - :options {:topBar {:visible false}} + :options {:insets {:top? true}} :component wallet-settings/manage-assets} {:name :wallet-add-custom-token :on-focus [:wallet/wallet-add-custom-token] - :options {:topBar {:title {:text (i18n/label :t/add-custom-token)}}} + :options {:topBar {:title {:text (i18n/label :t/add-custom-token)}} + :insets {:top? true}} :component custom-tokens/add-custom-token} {:name :wallet-custom-token-details ;;TODO dynamic title - :options {:topBar {:visible false}} + :options {:insets {:top? true}} :component custom-tokens/custom-token-details} {:name :currency-settings - :options {:topBar {:title {:text (i18n/label :t/main-currency)}}} + :options {:topBar {:title {:text (i18n/label :t/main-currency)}} + :insets {:top? true}} :component currency-settings/currency-settings} {:name :manage-accounts - :options {:topBar {:title {:text (i18n/label :t/wallet-manage-accounts)}}} + :options {:topBar {:title {:text (i18n/label :t/wallet-manage-accounts)}} + :insets {:top? true}} :component accounts-manage/manage} {:name :token-swap ;;TODO dynamic title - :options {:topBar {:visible false}} + :options {:insets {:top? true}} :component wallet.swap/swap} {:name :token-swap-advanced-nonce - :options {:topBar {:title {:text (i18n/label :t/nonce)}}} + :options {:topBar {:title {:text (i18n/label :t/nonce)}} + :insets {:top? true}} :component wallet.swap/nonce-modal} {:name :token-swap-advanced-approve-token - :options {:topBar {:title {:text (i18n/label :t/approve-token)}}} + :options {:topBar {:title {:text (i18n/label :t/approve-token)}} + :insets {:top? true}} :component wallet.swap/approve-token-modal} {:name :token-swap-advanced-transaction-fee - :options {:topBar {:title {:text (i18n/label :t/transaction-fee)}}} + :options {:topBar {:title {:text (i18n/label :t/transaction-fee)}} + :insets {:top? true}} :component wallet.swap/transaction-fee-modal} {:name :token-swap-advanced-swap-details - :options {:topBar {:title {:text (i18n/label :t/swap-details)}}} + :options {:topBar {:title {:text (i18n/label :t/swap-details)}} + :insets {:top? true}} :component wallet.swap/swap-details-modal} {:name :swap-asset-selector ;;TODO dynamic title - :options {:topBar {:visible false}} + :options {:insets {:top? true}} :component wallet.swap/asset-selector} ;;PROFILE {:name :my-profile - :insets {:top false} :options {:topBar {:visible false}} :component profile.user/my-profile} {:name :contacts-list - :options {:topBar {:title {:text (i18n/label :t/contacts)}}} + :options {:topBar {:title {:text (i18n/label :t/contacts)}} + :insets {:top? true}} :component contacts-list/contacts-list} {:name :ens-main - :options {:topBar {:title {:text (i18n/label :t/ens-usernames)}}} + :options {:topBar {:title {:text (i18n/label :t/ens-usernames)}} + :insets {:top? true}} :component ens/main} {:name :ens-search - :options {:topBar {:title {:text (i18n/label :t/ens-your-username)}}} + :options {:topBar {:title {:text (i18n/label :t/ens-your-username)}} + :insets {:top? true}} :component ens/search} {:name :ens-checkout - :options {:topBar {:title {:text (i18n/label :t/ens-your-username)}}} + :options {:topBar {:title {:text (i18n/label :t/ens-your-username)}} + :insets {:top? true}} :component ens/checkout} {:name :ens-confirmation - :options {:topBar {:title {:text (i18n/label :t/ens-your-username)}}} + :options {:topBar {:title {:text (i18n/label :t/ens-your-username)}} + :insets {:top? true}} :component ens/confirmation} {:name :ens-terms - :options {:topBar {:title {:text (i18n/label :t/ens-terms-registration)}}} + :options {:topBar {:title {:text (i18n/label :t/ens-terms-registration)}} + :insets {:top? true}} :component ens/terms} {:name :ens-name-details ;;TODO dynamic title - :options {:topBar {:visible false}} + :options {:insets {:top? true}} :component ens/name-details} {:name :blocked-users-list - :options {:topBar {:title {:text (i18n/label :t/blocked-users)}}} + :options {:topBar {:title {:text (i18n/label :t/blocked-users)}} + :insets {:top? true}} :component contacts-list/blocked-users-list} {:name :wakuv2-settings ;;TODO dynamic title - :options {:topBar {:visible false}} + :options {:insets {:top? true}} :component wakuv2-settings/wakuv2-settings} {:name :edit-wakuv2-node ;;TODO dynamic title - :options {:topBar {:visible false}} + :options {:insets {:top? true}} :component edit-wakuv2-node/edit-node} {:name :bootnodes-settings ;;TODO dynamic title - :options {:topBar {:visible false}} + :options {:insets {:top? true}} :component bootnodes-settings/bootnodes-settings} {:name :installations - :options {:topBar {:title {:text (i18n/label :t/devices)}}} + :options {:topBar {:title {:text (i18n/label :t/devices)}} + :insets {:top? true}} :component pairing/installations} {:name :edit-bootnode ;;TODO dynamic title - :options {:topBar {:visible false}} + :options {:insets {:top? true}} :component edit-bootnode/edit-bootnode} {:name :offline-messaging-settings ;;TODO dynamic title - :options {:topBar {:visible false}} + :options {:insets {:top? true}} :component offline-messaging-settings/offline-messaging-settings} {:name :edit-mailserver ;;TODO dynamic title - :options {:topBar {:visible false}} + :options {:insets {:top? true}} :component edit-mailserver/edit-mailserver} {:name :dapps-permissions - :options {:topBar {:title {:text (i18n/label :t/dapps-permissions)}}} + :options {:topBar {:title {:text (i18n/label :t/dapps-permissions)}} + :insets {:top? true}} :component dapps-permissions/dapps-permissions} {:name :link-previews-settings - :options {:topBar {:title {:text (i18n/label :t/chat-link-previews)}}} + :options {:topBar {:title {:text (i18n/label :t/chat-link-previews)}} + :insets {:top? true}} :component link-previews-settings/link-previews-settings} {:name :privacy-and-security - :options {:topBar {:title {:text (i18n/label :t/privacy-and-security)}}} + :options {:topBar {:title {:text (i18n/label :t/privacy-and-security)}} + :insets {:top? true}} :component privacy-and-security/privacy-and-security} {:name :messages-from-contacts-only - :options {:topBar {:title {:text (i18n/label :t/accept-new-chats-from)}}} + :options {:topBar {:title {:text (i18n/label :t/accept-new-chats-from)}} + :insets {:top? true}} :component messages-from-contacts-only/messages-from-contacts-only} {:name :appearance - :options {:topBar {:title {:text (i18n/label :t/appearance)}}} + :options {:topBar {:title {:text (i18n/label :t/appearance)}} + :insets {:top? true}} :component appearance/appearance} {:name :privacy-and-security-profile-pic-show-to - :options {:topbar {:title {:text (i18n/label :t/show-profile-pictures-to)}}} + :options {:topbar {:title {:text (i18n/label :t/show-profile-pictures-to)}} + :insets {:top? true}} :component privacy-and-security/profile-pic-show-to} {:name :privacy-and-security-profile-pic - :options {:topBar {:title {:text (i18n/label :t/show-profile-pictures)}}} + :options {:topBar {:title {:text (i18n/label :t/show-profile-pictures)}} + :insets {:top? true}} :component privacy-and-security/profile-pic} {:name :notifications - :options {:topBar {:title {:text (i18n/label :t/notification-settings)}}} + :options {:topBar {:title {:text (i18n/label :t/notification-settings)}} + :insets {:top? true}} :component notifications-settings/notifications-settings} {:name :notifications-servers - :options {:topBar {:title {:text (i18n/label :t/notifications-servers)}}} + :options {:topBar {:title {:text (i18n/label :t/notifications-servers)}} + :insets {:top? true}} :component notifications-settings/notifications-servers} {:name :sync-settings - :options {:topBar {:title {:text (i18n/label :t/sync-settings)}}} + :options {:topBar {:title {:text (i18n/label :t/sync-settings)}} + :insets {:top? true}} :component sync-settings/sync-settings} {:name :advanced-settings - :options {:topBar {:title {:text (i18n/label :t/advanced)}}} + :options {:topBar {:title {:text (i18n/label :t/advanced)}} + :insets {:top? true}} :component advanced-settings/advanced-settings} {:name :help-center - :options {:topBar {:title {:text (i18n/label :t/need-help)}}} + :options {:topBar {:title {:text (i18n/label :t/need-help)}} + :insets {:top? true}} :component help-center/help-center} {:name :glossary - :options {:topBar {:title {:text (i18n/label :t/glossary)}}} + :options {:topBar {:title {:text (i18n/label :t/glossary)}} + :insets {:top? true}} :component glossary/glossary} {:name :about-app - :options {:topBar {:title {:text (i18n/label :t/about-app)}}} + :options {:topBar {:title {:text (i18n/label :t/about-app)}} + :insets {:top? true}} :component about-app/about-app} {:name :privacy-policy - :options {:topBar {:title {:text (i18n/label :t/privacy-policy)}}} + :options {:topBar {:title {:text (i18n/label :t/privacy-policy)}} + :insets {:top? true}} :component about-app/privacy-policy} {:name :terms-of-service - :options {:topBar {:title {:text (i18n/label :t/terms-of-service)}}} + :options {:topBar {:title {:text (i18n/label :t/terms-of-service)}} + :insets {:top? true}} :component about-app/tos} {:name :principles - :options {:topBar {:title {:text (i18n/label :t/principles)}}} + :options {:topBar {:title {:text (i18n/label :t/principles)}} + :insets {:top? true}} :component about-app/principles} {:name :force-accept-tos - :options {:topBar {:visible false}} + :options {:insets {:top? true}} :component terms-of-service/force-accept-tos} {:name :manage-dapps-permissions ;;TODO dynamic title - :options {:topBar {:visible false}} + :options {:insets {:top? true}} :component dapps-permissions/manage} {:name :network-settings ;;TODO accessories - :options {:topBar {:visible false}} + :options {:insets {:top? true}} :component network/network-settings} {:name :network-details - :options {:topBar {:title {:text (i18n/label :t/network-details)}}} + :options {:topBar {:title {:text (i18n/label :t/network-details)}} + :insets {:top? true}} :component network-details/network-details} {:name :network-info - :options {:topBar {:title {:text (i18n/label :t/network-info)}}} + :options {:topBar {:title {:text (i18n/label :t/network-info)}} + :insets {:top? true}} :component network-info/network-info} {:name :rpc-usage-info - :options {:topBar {:title {:text (i18n/label :t/rpc-usage-info)}}} + :options {:topBar {:title {:text (i18n/label :t/rpc-usage-info)}} + :insets {:top? true}} :component rpc-usage-info/usage-info} {:name :peers-stats - :options {:topBar {:title {:text (i18n/label :t/peers-stats)}}} + :options {:topBar {:title {:text (i18n/label :t/peers-stats)}} + :insets {:top? true}} :component peers-stats/peers-stats} {:name :edit-network - :options {:topBar {:title {:text (i18n/label :t/add-network)}}} + :options {:topBar {:title {:text (i18n/label :t/add-network)}} + :insets {:top? true}} :component edit-network/edit-network} {:name :log-level-settings - :options {:topBar {:title {:text (i18n/label :t/log-level-settings)}}} + :options {:topBar {:title {:text (i18n/label :t/log-level-settings)}} + :insets {:top? true}} :component log-level-settings/log-level-settings} {:name :fleet-settings - :options {:topBar {:title {:text (i18n/label :t/fleet-settings)}}} + :options {:topBar {:title {:text (i18n/label :t/fleet-settings)}} + :insets {:top? true}} :component fleet-settings/fleet-settings} {:name :mobile-network-settings - :options {:topBar {:title {:text (i18n/label :t/mobile-network-settings)}}} + :options {:topBar {:title {:text (i18n/label :t/mobile-network-settings)}} + :insets {:top? true}} :component mobile-network-settings/mobile-network-settings} {:name :backup-settings - :options {:topBar {:title {:text (i18n/label :t/backup-settings)}}} + :options {:topBar {:title {:text (i18n/label :t/backup-settings)}} + :insets {:top? true}} :component backup-settings/backup-settings} {:name :backup-seed ;;TODO dynamic navigation - :options {:topBar {:visible false}} + :options {:insets {:top? true}} :component profile.seed/backup-seed} {:name :reset-password - :options {:topBar {:title {:text (i18n/label :t/reset-password)}}} + :options {:topBar {:title {:text (i18n/label :t/reset-password)}} + :insets {:top? true}} :component reset-password/reset-password} {:name :delete-profile - :insets {:bottom true} + :insets {:bottom? true} :component delete-profile/delete-profile} {:name :default-sync-period-settings - :options {:topBar {:title {:text (i18n/label :t/default-sync-period)}}} + :options {:topBar {:title {:text (i18n/label :t/default-sync-period)}} + :insets {:top? true}} :component default-sync-period-settings/default-sync-period-settings} ;;MODALS @@ -518,70 +580,75 @@ {:name :new-chat :on-focus [:contacts/new-chat-focus] ;;TODO accessories - :options {:topBar {:visible false}} + :options {:insets {:top? true}} :component new-chat/new-chat} ;[Chat] New Public chat {:name :new-public-chat - :insets {:bottom true} - :options {:topBar {:title {:text (i18n/label :t/new-public-group-chat)}}} + :options {:topBar {:title {:text (i18n/label :t/new-public-group-chat)}} + :insets {:bottom? true + :top? true}} :component new-public-chat/new-public-chat} ;[Chat] Link preview settings {:name :link-preview-settings - :options {:topBar {:title {:text (i18n/label :t/chat-link-previews)}}} + :options {:topBar {:title {:text (i18n/label :t/chat-link-previews)}} + :insets {:top? true}} :component link-previews-settings/link-previews-settings} ;[Chat] Edit nickname {:name :nickname - :insets {:bottom true} ;;TODO dyn subtitle - :options {:topBar {:visible false}} + :options {:topBar {:visible false} + :insets {:bottom? true + :top? true}} :component contact/nickname-view} {:name :new-chat-aio :on-focus [:contacts/new-chat-focus] ;;TODO accessories - :options {:topBar {:visible false}} + :options {:insets {:top? true}} :component new-chat-aio/contact-selection-list} ;[Chat] New Public chat {:name :new-public-chat - :insets {:bottom true} - :options {:topBar {:title {:text (i18n/label :t/new-public-group-chat)}}} + :options {:topBar {:title {:text (i18n/label :t/new-public-group-chat)}} + :insets {:bottom? true + :top? true}} :component new-public-chat/new-public-chat} ;[Group chat] Add participants {:name :add-participants-toggle-list :on-focus [:group/add-participants-toggle-list] - :insets {:bottom true} ;;TODO dyn subtitle - :options {:topBar {:visible false}} + :options {:topBar {:visible false} + :insets {:bottom? true + :top? true}} :component group-chat/add-participants-toggle-list} ;[Communities] Invite people {:name :invite-people-community ;;TODO dyn title - :options {:topBar {:visible false}} - :component communities.invite/invite - :insets {:bottom true}} + :options {:insets {:bottom? true + :top? true}} + :component communities.invite/invite} ;[Wallet] Recipient {:name :recipient - :insets {:bottom true} ;;TODO accessories - :options {:topBar {:visible false}} + :options {:insets {:bottom? true + :top? true}} :component recipient/recipient} ;[Wallet] New favourite {:name :new-favourite - :insets {:bottom true} - :options {:topBar {:title {:text (i18n/label :t/new-favourite)}}} + :options {:topBar {:title {:text (i18n/label :t/new-favourite)}} + :insets {:bottom? true + :top? true}} :component recipient/new-favourite} ;QR Scanner {:name :qr-scanner - :insets {:top false :bottom false} ;;TODO custom topbar :options {:topBar {:visible false} :navigationBar {:backgroundColor colors/black-persist} @@ -595,8 +662,9 @@ :options {:topBar {:title {:text (i18n/label :t/notification-settings)}} :popGesture false :hardwareBackButton {:dismissModalOnPress false - :popStackOnPress false}} - :insets {:bottom true} + :popStackOnPress false} + :insets {:bottom? true + :top? true}} :component notifications-settings/notifications-settings} ;;TODO WHY MODAL? @@ -605,211 +673,218 @@ :options {:topBar {:title {:text (i18n/label :t/notification-settings)}} :popGesture false :hardwareBackButton {:dismissModalOnPress false - :popStackOnPress false}} - :insets {:bottom true} + :popStackOnPress false} + :insets {:bottom? true + :top? true}} :component notifications-settings/notifications-advanced-settings} ;[Wallet] Prepare Transaction {:name :prepare-send-transaction - :insets {:bottom true} :on-dissmiss [:wallet/cancel-transaction-command] :options {:topBar {:title {:text (i18n/label :t/send-transaction)}} :swipeToDismiss false - :hardwareBackButton {:dismissModalOnPress false}} + :hardwareBackButton {:dismissModalOnPress false} + :insets {:bottom? true + :top? true}} :component wallet.send/prepare-send-transaction} ;[Wallet] Request Transaction {:name :request-transaction - :insets {:bottom true} :on-dissmiss [:wallet/cancel-transaction-command] :options {:topBar {:title {:text (i18n/label :t/request-transaction)}} :swipeToDismiss false - :hardwareBackButton {:dismissModalOnPress false}} + :hardwareBackButton {:dismissModalOnPress false} + :insets {:bottom? true + :top? true}} :component wallet.send/request-transaction} ;[Wallet] Buy crypto {:name :buy-crypto - :insets {:bottom true} + :insets {:bottom? true} :component wallet.buy-crypto/container} ;[Wallet] Buy crypto website {:name :buy-crypto-website - :insets {:bottom true} ;;TODO subtitle - :options {:topBar {:visible false}} + :options {:insets {:bottom? true + :top? true}} :component wallet.buy-crypto/website} {:name :nft-details - :insets {:bottom true} ;;TODO dynamic title - :options {:topBar {:visible false}} + :options {:insets {:bottom? true + :top? true}} :component wallet.collectibles/nft-details-modal} ;[Browser] New bookmark {:name :new-bookmark - :insets {:bottom true} ;;TODO dynamic title - :options {:topBar {:visible false}} + :options {:insets {:bottom? true + :top? true}} :component bookmarks/new-bookmark} ;Profile {:name :profile - :insets {:bottom true} ;;TODO custom toolbar - :options {:topBar {:visible false}} + :options {:insets {:bottom? true + :top? true}} :component contact/profile} ;KEYCARD {:name :keycard-onboarding-intro - :insets {:bottom true} - :options {:topBar {:visible false} + :options {:insets {:bottom? true + :top? true} :popGesture false :hardwareBackButton {:dismissModalOnPress false :popStackOnPress false}} :component keycard.onboarding/intro} {:name :keycard-onboarding-puk-code - :insets {:bottom true} - :options {:topBar {:visible false} + :options {:insets {:bottom? true + :top? true} :popGesture false :hardwareBackButton {:dismissModalOnPress false :popStackOnPress false}} ;;TODO dynamic :component keycard.onboarding/puk-code} {:name :keycard-onboarding-pin - :insets {:bottom true} - :options {:topBar {:visible false} + :options {:insets {:bottom? true + :top? true} :popGesture false :hardwareBackButton {:dismissModalOnPress false :popStackOnPress false}} ;;TODO dynamic :component keycard.onboarding/pin} {:name :keycard-recovery-pair - :insets {:bottom true} :options {:topBar {:title {:text (i18n/label :t/step-i-of-n {:number 2 :step 1})}} + :insets {:bottom? true + :top? true} :popGesture false :hardwareBackButton {:dismissModalOnPress false :popStackOnPress false}} :component keycard.recovery/pair} {:name :seed-phrase - :insets {:bottom true} ;;TODO subtitle - :options {:topBar {:visible false}} + :options {:insets {:bottom? true + :top? true}} :component key-storage.views/seed-phrase} {:name :keycard-recovery-pin - :insets {:bottom true} ;;TODO dynamic - :options {:topBar {:visible false}} + :options {:insets {:bottom? true + :top? true}} :component keycard.recovery/pin} {:name :keycard-wrong - :insets {:bottom true} ;;TODO move to popover? - :options {:topBar {:visible false}} + :options {:insets {:bottom? true + :top? true}} :component keycard/wrong} {:name :not-keycard - :insets {:bottom true} - :options {:topBar {:visible false}} + :options {:insets {:bottom? true + :top? true}} ;;TODO move to popover? :component keycard/not-keycard} {:name :keycard-onboarding-recovery-phrase - :insets {:bottom true} - :options {:topBar {:visible false} + :options {:insets {:bottom? true + :top? true} :popGesture false :hardwareBackButton {:dismissModalOnPress false :popStackOnPress false}} :component keycard.onboarding/recovery-phrase} {:name :keycard-onboarding-recovery-phrase-confirm-word1 - :insets {:bottom true} - :options {:topBar {:visible false} + :options {:insets {:bottom? true + :top? true} :popGesture false :hardwareBackButton {:dismissModalOnPress false :popStackOnPress false}} :component keycard.onboarding/recovery-phrase-confirm-word} {:name :keycard-onboarding-recovery-phrase-confirm-word2 - :insets {:bottom true} - :options {:topBar {:visible false} + :options {:insets {:bottom? true + :top? true} :popGesture false :hardwareBackButton {:dismissModalOnPress false :popStackOnPress false}} :component keycard.onboarding/recovery-phrase-confirm-word} {:name :keycard-recovery-intro - :insets {:bottom true} + :insets {:bottom? true} :component keycard.recovery/intro} {:name :keycard-recovery-success - :insets {:bottom true} - :options {:topBar {:visible false} + :options {:insets {:bottom? true + :top? true} :popGesture false :hardwareBackButton {:dismissModalOnPress false :popStackOnPress false}} :component keycard.recovery/success} {:name :keycard-recovery-no-key - :insets {:bottom true} - :options {:topBar {:visible false} + :options {:insets {:bottom? true + :top? true} :popGesture false :hardwareBackButton {:dismissModalOnPress false :popStackOnPress false}} :component keycard.recovery/no-key} {:name :keycard-authentication-method - :insets {:bottom true} - :options {:topBar {:visible false}} + :options {:insets {:bottom? true + :top? true}} :component keycard.authentication/keycard-authentication-method} {:name :keycard-login-pin - :insets {:bottom true} - :options {:topBar {:visible false}} + :options {:insets {:bottom? true + :top? true}} :component keycard/login-pin} {:name :keycard-blank - :insets {:bottom true} - :options {:topBar {:visible false}} + :options {:insets {:bottom? true + :top? true}} :component keycard/blank} {:name :keycard-unpaired - :insets {:bottom true} - :options {:topBar {:visible false}} + :options {:insets {:bottom? true + :top? true}} :component keycard/unpaired} {:name :keycard-settings - :insets {:bottom true} - :options {:topBar {:title {:text (i18n/label :t/status-keycard)}}} + :options {:topBar {:title {:text (i18n/label :t/status-keycard)}} + :insets {:bottom? true + :top? true}} :component keycard.settings/keycard-settings} {:name :reset-card - :insets {:bottom true} - :options {:topBar {:title {:text (i18n/label :t/reset-card)}}} + :options {:topBar {:title {:text (i18n/label :t/reset-card)}} + :insets {:bottom? true + :top? true}} :component keycard.settings/reset-card} {:name :keycard-pin - :insets {:bottom true} ;;TODO dynamic title - :options {:topBar {:visible false}} + :options {:insets {:bottom? true + :top? true}} :component keycard.settings/reset-pin} {:name :enter-pin-settings - :insets {:bottom true} + :insets {:bottom? true} :component keycard.pin/enter-pin} {:name :change-pairing-code - :insets {:bottom true} + :insets {:bottom? true} :component keycard.pairing/change-pairing-code} ;;KEYSTORAGE {:name :actions-not-logged-in ;;TODO: topbar - :insets {:bottom true} - :options {:topBar {:visible false}} + :options {:insets {:bottom? true + :top? true}} ;;TODO move to popover? :component key-storage.views/actions-not-logged-in} {:name :actions-logged-in ;;TODO: topbar - :options {:topBar {:visible false}} - :insets {:bottom true} + :options {:insets {:bottom? true + :top? true}} ;;TODO move to popover? :component key-storage.views/actions-logged-in} {:name :storage ;;TODO: topbar - :options {:topBar {:visible false}} - :insets {:bottom true} + :options {:insets {:bottom? true + :top? true}} ;;TODO move to popover? :component key-storage.views/storage} {:name :show-all-connections - :insets {:bottom true} - :options {:topBar {:title {:text (i18n/label :all-connections)}}} + :options {:topBar {:title {:text (i18n/label :all-connections)}} + :insets {:bottom? true + :top? true}} :component manage-all-connections/views} ;; BUG REPORT {:name :bug-report - :options {:topBar {:visible false}} + :options {:insets {:top? true}} :component bug-report/bug-report}]) diff --git a/src/status_im/ui/screens/signing/sheets.cljs b/src/status_im/ui/screens/signing/sheets.cljs index 67f9849a00..179c75c1de 100644 --- a/src/status_im/ui/screens/signing/sheets.cljs +++ b/src/status_im/ui/screens/signing/sheets.cljs @@ -67,7 +67,7 @@ :margin-top 6} [quo/button {:type :secondary - :on-press #(re-frame/dispatch [:bottom-sheet/hide])} + :on-press #(re-frame/dispatch [:bottom-sheet/hide-old])} (i18n/label :t/cancel)] [quo/button {:type :secondary @@ -201,7 +201,7 @@ :accessibility-label :see-fee-suggestions ;;:on-press #_(re-frame/dispatch - [:bottom-sheet/show-sheet + [:bottom-sheet/show-sheet-old {:content (fn [] [fee-bottom-sheet-eip1559 fee-display-symbol]) :content-height 270}])} @@ -285,7 +285,7 @@ {:type :secondary :accessibility-label :set-custom-fee :on-press #(re-frame/dispatch - [:bottom-sheet/show-sheet + [:bottom-sheet/show-sheet-old {:content (fn [] [fee-bottom-sheet-eip1559-custom fee-display-symbol]) :content-height 270}])} diff --git a/src/status_im/ui/screens/signing/views.cljs b/src/status_im/ui/screens/signing/views.cljs index d0151e5e94..abe003fa91 100644 --- a/src/status_im/ui/screens/signing/views.cljs +++ b/src/status_im/ui/screens/signing/views.cljs @@ -470,7 +470,7 @@ {:size :small :title (i18n/label :t/advanced) :chevron true - :on-press #(re-frame/dispatch [:bottom-sheet/show-sheet {:content sheets/advanced}])}]]) + :on-press #(re-frame/dispatch [:bottom-sheet/show-sheet-old {:content sheets/advanced}])}]]) (views/defview sheet [{:keys [from contact amount token cancel?] :as tx}] diff --git a/src/status_im/ui/screens/wallet/account/views.cljs b/src/status_im/ui/screens/wallet/account/views.cljs index 806ddee987..f4ca18c827 100644 --- a/src/status_im/ui/screens/wallet/account/views.cljs +++ b/src/status_im/ui/screens/wallet/account/views.cljs @@ -316,7 +316,7 @@ {:title name :right-accessories [{:icon :main-icons/more - :on-press #(re-frame/dispatch [:bottom-sheet/show-sheet + :on-press #(re-frame/dispatch [:bottom-sheet/show-sheet-old {:content sheets/account-settings :content-height 60}])}]}] [react/animated-scroll-view diff --git a/src/status_im/ui/screens/wallet/accounts/sheets.cljs b/src/status_im/ui/screens/wallet/accounts/sheets.cljs index 691bfbe373..d744adbf59 100644 --- a/src/status_im/ui/screens/wallet/accounts/sheets.cljs +++ b/src/status_im/ui/screens/wallet/accounts/sheets.cljs @@ -6,7 +6,7 @@ (defn hide-sheet-and-dispatch [event] - (re-frame/dispatch [:bottom-sheet/hide]) + (re-frame/dispatch [:bottom-sheet/hide-old]) (re-frame/dispatch event)) (defn accounts-options diff --git a/src/status_im/ui/screens/wallet/accounts/views.cljs b/src/status_im/ui/screens/wallet/accounts/views.cljs index 8e188437a4..934bcdc501 100644 --- a/src/status_im/ui/screens/wallet/accounts/views.cljs +++ b/src/status_im/ui/screens/wallet/accounts/views.cljs @@ -17,7 +17,8 @@ [status-im.ui.screens.wallet.accounts.common :as common] [status-im.ui.screens.wallet.accounts.sheets :as sheets] [status-im.ui.screens.wallet.accounts.styles :as styles] - [status-im.ui.screens.wallet.buy-crypto.views :as buy-crypto]) + [status-im.ui.screens.wallet.buy-crypto.views :as buy-crypto] + [react-native.safe-area :as safe-area]) (:require-macros [status-im.utils.views :as views])) (views/defview account-card @@ -54,7 +55,7 @@ [react/touchable-highlight {:style styles/card-icon-more :on-press #(re-frame/dispatch - [:bottom-sheet/show-sheet + [:bottom-sheet/show-sheet-old {:content (fn [] [sheets/account-card-actions account type wallet]) :content-height 130}])} [icons/icon :main-icons/more {:color colors/white-persist}]]]]])) @@ -62,7 +63,7 @@ (defn add-card [card-width] [react/touchable-highlight - {:on-press #(re-frame/dispatch [:bottom-sheet/show-sheet + {:on-press #(re-frame/dispatch [:bottom-sheet/show-sheet-old {:content sheets/add-account :content-height 260}]) :accessibility-label "add-new-account"} @@ -290,7 +291,7 @@ [quo2.button/button {:type :grey :size 32 - :on-press #(re-frame/dispatch [:bottom-sheet/show-sheet + :on-press #(re-frame/dispatch [:bottom-sheet/show-sheet-old {:content sheets/add-account :content-height 260}])} "Add account"]]])))) @@ -301,33 +302,36 @@ ;mainnet? @(re-frame/subscribe [:mainnet?]) selected-account-atom (reagent/atom nil)] (fn [] - [react/view - {:style {:flex 1 - :background-color (quo2.colors/theme-colors quo2.colors/neutral-5 - quo2.colors/neutral-95)}} - [react/view {:padding-horizontal 20} - [react/view {:flex-direction :row :height 56 :align-items :center :justify-content :flex-end} - [quo2.button/button - {:icon true - :size 32 - :type :grey - :accessibility-label :accounts-qr-code - :on-press #(re-frame/dispatch - [::qr-scanner/scan-code - {:handler :wallet.send/qr-scanner-result}])} - :i/placeholder] - [react/view {:width 12}] - [quo2.button/button - {:icon true - :size 32 - :type :grey - :on-press #(re-frame/dispatch [:bottom-sheet/show-sheet - {:content (sheets/accounts-options mnemonic)}]) - :accessibility-label :accounts-more-options} - :i/placeholder]] - [total-value] - [accounts selected-account-atom]] - [account.views/account-new @selected-account-atom]]))) + [safe-area/consumer + (fn [{:keys [top]}] + [react/view + {:style {:flex 1 + :padding-top top + :background-color (quo2.colors/theme-colors quo2.colors/neutral-5 + quo2.colors/neutral-95)}} + [react/view {:padding-horizontal 20} + [react/view {:flex-direction :row :height 56 :align-items :center :justify-content :flex-end} + [quo2.button/button + {:icon true + :size 32 + :type :grey + :accessibility-label :accounts-qr-code + :on-press #(re-frame/dispatch + [::qr-scanner/scan-code + {:handler :wallet.send/qr-scanner-result}])} + :i/placeholder] + [react/view {:width 12}] + [quo2.button/button + {:icon true + :size 32 + :type :grey + :on-press #(re-frame/dispatch [:bottom-sheet/show-sheet-old + {:content (sheets/accounts-options mnemonic)}]) + :accessibility-label :accounts-more-options} + :i/placeholder]] + [total-value] + [accounts selected-account-atom]] + [account.views/account-new @selected-account-atom]])]))) (defn accounts-overview-old [] @@ -346,7 +350,7 @@ {:handler :wallet.send/qr-scanner-result}]) :icon :main-icons/qr :accessibility-label :accounts-qr-code} - {:on-press #(re-frame/dispatch [:bottom-sheet/show-sheet + {:on-press #(re-frame/dispatch [:bottom-sheet/show-sheet-old {:content (sheets/accounts-options mnemonic)}]) :icon :main-icons/more diff --git a/src/status_im/ui/screens/wallet/send/sheets.cljs b/src/status_im/ui/screens/wallet/send/sheets.cljs index b35d9766fb..a6a58029d4 100644 --- a/src/status_im/ui/screens/wallet/send/sheets.cljs +++ b/src/status_im/ui/screens/wallet/send/sheets.cljs @@ -39,8 +39,8 @@ (defn show-accounts-list [] - (re-frame/dispatch [:bottom-sheet/hide]) - (js/setTimeout #(re-frame/dispatch [:bottom-sheet/show-sheet + (re-frame/dispatch [:bottom-sheet/hide-old]) + (js/setTimeout #(re-frame/dispatch [:bottom-sheet/show-sheet-old {:content (fn [] [accounts-list :to :wallet.send/set-field]) :content-height 300}]) 400)) diff --git a/src/status_im/ui/screens/wallet/send/views.cljs b/src/status_im/ui/screens/wallet/send/views.cljs index 625386ea7a..ebea3b7a50 100644 --- a/src/status_im/ui/screens/wallet/send/views.cljs +++ b/src/status_im/ui/screens/wallet/send/views.cljs @@ -35,7 +35,7 @@ {:on-press (when-not request? #(do (re-frame/dispatch [:dismiss-keyboard]) - (re-frame/dispatch [:bottom-sheet/show-sheet + (re-frame/dispatch [:bottom-sheet/show-sheet-old {:content (fn [] [sheets/assets (:address from)]) :content-height 300}])))} [react/view @@ -70,7 +70,7 @@ :chevron true :on-press #(do (re-frame/dispatch [:dismiss-keyboard]) - (re-frame/dispatch [:bottom-sheet/show-sheet + (re-frame/dispatch [:bottom-sheet/show-sheet-old {:content (fn [] [sheets/accounts-list :from event]) :content-height 300}]))}]) diff --git a/src/status_im/ui/screens/wallet/settings/views.cljs b/src/status_im/ui/screens/wallet/settings/views.cljs index 870ea9f87d..d59a5ed1a9 100644 --- a/src/status_im/ui/screens/wallet/settings/views.cljs +++ b/src/status_im/ui/screens/wallet/settings/views.cljs @@ -23,7 +23,7 @@ (defn hide-sheet-and-dispatch [event] - (re-frame/dispatch [:bottom-sheet/hide]) + (re-frame/dispatch [:bottom-sheet/hide-old]) (re-frame/dispatch event)) (defn custom-token-actions-view @@ -65,7 +65,7 @@ :on-press #(re-frame/dispatch [:wallet.settings/toggle-visible-token (keyword symbol) (not checked?)]) :on-long-press #(re-frame/dispatch - [:bottom-sheet/show-sheet + [:bottom-sheet/show-sheet-old {:content (custom-token-actions-view token)}])}])})) (defn- render-token-wrapper diff --git a/src/status_im/ui2/screens/chat/components/new_chat/styles.cljs b/src/status_im/ui2/screens/chat/components/new_chat/styles.cljs index 8d435049cb..8d3352b42d 100644 --- a/src/status_im/ui2/screens/chat/components/new_chat/styles.cljs +++ b/src/status_im/ui2/screens/chat/components/new_chat/styles.cljs @@ -14,7 +14,8 @@ :margin-left 20 :margin-bottom 36 :justify-content :center - :align-items :center}) + :align-items :center + :margin-top 40}) (def chat-button {:position :absolute diff --git a/src/status_im/ui2/screens/chat/components/new_chat/view.cljs b/src/status_im/ui2/screens/chat/components/new_chat/view.cljs index b1b27c6987..a3ea31a152 100644 --- a/src/status_im/ui2/screens/chat/components/new_chat/view.cljs +++ b/src/status_im/ui2/screens/chat/components/new_chat/view.cljs @@ -14,11 +14,6 @@ [status-im.react-native.resources :as resources] [status-im2.common.contact-list-item.view :as contact-list-item])) -(defn- hide-sheet-and-dispatch - [event] - (rf/dispatch [:bottom-sheet/hide]) - (rf/dispatch event)) - (defn- no-contacts-view [] [rn/view @@ -45,7 +40,7 @@ (i18n/label :t/invite-friends)] [quo2/button {:type :grey - :on-press #(hide-sheet-and-dispatch [:open-modal :new-contact])} + :on-press #(rf/dispatch [:open-modal :new-contact])} (i18n/label :t/add-a-contact)]]) (defn contact-item-render @@ -69,18 +64,17 @@ (let [contacts (rf/sub [:contacts/sorted-and-grouped-by-first-letter]) selected-contacts-count (rf/sub [:selected-contacts-count]) selected-contacts (rf/sub [:group/selected-contacts]) - window-height (rf/sub [:dimensions/window-height]) one-contact-selected? (= selected-contacts-count 1) contacts-selected? (pos? selected-contacts-count) {:keys [primary-name public-key]} (when one-contact-selected? (rf/sub [:contacts/contact-by-identity (first selected-contacts)])) no-contacts? (empty? contacts)] - [rn/view {:style {:height (* window-height 0.9)}} + [:<> [quo2/button {:type :grey :icon true - :on-press #(rf/dispatch [:bottom-sheet/hide]) + :on-press #(rf/dispatch [:navigate-back]) :style style/contact-selection-close :override-background-color (quo2.colors/theme-colors quo2.colors/neutral-10 quo2.colors/neutral-90)} @@ -117,10 +111,8 @@ :accessibility-label :next-button :on-press (fn [] (if one-contact-selected? - (hide-sheet-and-dispatch [:chat.ui/start-chat - public-key]) - (hide-sheet-and-dispatch [:navigate-to - :new-group])))} + (rf/dispatch [:chat.ui/start-chat public-key]) + (rf/dispatch [:navigate-to :new-group])))} (if one-contact-selected? (i18n/label :t/chat-with {:selected-user primary-name}) (i18n/label :t/setup-group-chat))])]))]) diff --git a/src/status_im/ui2/screens/chat/messages/message.cljs b/src/status_im/ui2/screens/chat/messages/message.cljs index a93c8f9bea..abc2a6c675 100644 --- a/src/status_im/ui2/screens/chat/messages/message.cljs +++ b/src/status_im/ui2/screens/chat/messages/message.cljs @@ -154,7 +154,7 @@ {:on-press (fn [] (re-frame/dispatch - [:bottom-sheet/show-sheet + [:bottom-sheet/show-sheet-old {:content (sheets/options chat-id message-id) :content-height 200}]) (rn/dismiss-keyboard!))} diff --git a/src/status_im/ui2/screens/chat/pin_limit_popover/view.cljs b/src/status_im/ui2/screens/chat/pin_limit_popover/view.cljs index 98c8b93348..e17e827dd0 100644 --- a/src/status_im/ui2/screens/chat/pin_limit_popover/view.cljs +++ b/src/status_im/ui2/screens/chat/pin_limit_popover/view.cljs @@ -44,8 +44,7 @@ :active-opacity 1 :on-press (fn [] (rf/dispatch [:pin-message/hide-pin-limit-modal chat-id]) - (rf/dispatch [:bottom-sheet/show-sheet :pinned-messages-list - chat-id]) + (rf/dispatch [:pin-message/show-pins-bottom-sheet chat-id]) (rf/dispatch [:dismiss-keyboard])) :style style/view-pinned-messages} [quo/text {:size :paragraph-2 :weight :medium :color colors/white} diff --git a/src/status_im/utils/logging/core.cljs b/src/status_im/utils/logging/core.cljs index c2b73a5107..e3dc39106b 100644 --- a/src/status_im/utils/logging/core.cljs +++ b/src/status_im/utils/logging/core.cljs @@ -3,7 +3,7 @@ [goog.string :as gstring] [re-frame.core :as re-frame] [react-native.mail :as react-native-mail] - [status-im2.common.bottom-sheet.events :as bottom-sheet] + [status-im.bottom-sheet.events :as bottom-sheet] [utils.i18n :as i18n] [status-im.native-module.core :as status] [status-im.transport.utils :as transport.utils] @@ -206,7 +206,7 @@ {:db (assoc db :bug-report/description-error error)} (rf/merge cofx - (bottom-sheet/hide-bottom-sheet) + (bottom-sheet/hide-bottom-sheet-old) (send-logs :email)))) (re-frame/reg-fx @@ -234,5 +234,5 @@ (rf/merge cofx {:db (dissoc db :bug-report/details)} - (bottom-sheet/hide-bottom-sheet) + (bottom-sheet/hide-bottom-sheet-old) (submit-issue))) diff --git a/src/status_im/utils/universal_links/core.cljs b/src/status_im/utils/universal_links/core.cljs index 53c01bf570..c432edd9d5 100644 --- a/src/status_im/utils/universal_links/core.cljs +++ b/src/status_im/utils/universal_links/core.cljs @@ -72,18 +72,18 @@ (rf/defn handle-community-requests [cofx {:keys [community-id]}] (log/info "universal-links: handling community request " community-id) - (navigation/navigate-to-cofx cofx :community-requests-to-join {:community-id community-id})) + (navigation/navigate-to cofx :community-requests-to-join {:community-id community-id})) (rf/defn handle-community [cofx {:keys [community-id]}] (log/info "universal-links: handling community" community-id) - (navigation/navigate-to-cofx cofx :community {:community-id community-id})) + (navigation/navigate-to cofx :community {:community-id community-id})) (rf/defn handle-navigation-to-desktop-community-from-mobile {:events [:handle-navigation-to-desktop-community-from-mobile]} [{:keys [db]} cofx deserialized-key] - (navigation/navigate-to-cofx cofx :community {:community-id deserialized-key})) + (navigation/navigate-to cofx :community {:community-id deserialized-key})) (rf/defn handle-desktop-community @@ -111,7 +111,7 @@ (and public-key (new-chat.db/own-public-key? db public-key)) (rf/merge cofx {:pop-to-root-fx :shell-stack} - (navigation/navigate-to-cofx :my-profile nil)) + (navigation/navigate-to :my-profile nil)) public-key {:dispatch [:chat.ui/show-profile public-key ens-name]})) @@ -120,7 +120,7 @@ [cofx data] (rf/merge cofx (choose-recipient/parse-eip681-uri-and-resolve-ens data true) - (navigation/navigate-to-cofx :wallet nil))) + (navigation/navigate-to :wallet nil))) (defn existing-account? [{:keys [db]} address] @@ -133,9 +133,9 @@ (rf/defn handle-wallet-account [cofx {address :account}] (when-let [account (existing-account? cofx address)] - (navigation/navigate-to-cofx cofx - :wallet-account - account))) + (navigation/navigate-to cofx + :wallet-account + account))) (defn handle-not-found [full-url] diff --git a/src/status_im/wallet/accounts/core.cljs b/src/status_im/wallet/accounts/core.cljs index 83d66205ba..f7e8e5fd2e 100644 --- a/src/status_im/wallet/accounts/core.cljs +++ b/src/status_im/wallet/accounts/core.cljs @@ -37,7 +37,7 @@ {:name (str "Account " path-num)}))] (rf/merge cofx {:db (assoc db :add-account (assoc add-account :account account))} - (navigation/navigate-to-cofx :add-new-account nil)))) + (navigation/navigate-to :add-new-account nil)))) (rf/defn new-account-error {:events [::new-account-error]} diff --git a/src/status_im/wallet/choose_recipient/core.cljs b/src/status_im/wallet/choose_recipient/core.cljs index 2d2a37d6e2..5463b81a54 100644 --- a/src/status_im/wallet/choose_recipient/core.cljs +++ b/src/status_im/wallet/choose_recipient/core.cljs @@ -1,6 +1,6 @@ (ns status-im.wallet.choose-recipient.core (:require [re-frame.core :as re-frame] - [status-im2.common.bottom-sheet.events :as bottom-sheet] + [status-im.bottom-sheet.events :as bottom-sheet] [status-im.contact.db :as contact.db] [status-im.ethereum.core :as ethereum] [status-im.ethereum.eip681 :as eip681] @@ -111,7 +111,7 @@ {:events [:wallet.send/qr-scanner]} [{:keys [db] :as cofx} options] (rf/merge cofx - (bottom-sheet/hide-bottom-sheet) + (bottom-sheet/hide-bottom-sheet-old) (qr-scaner/scan-qr-code options))) (rf/defn parse-eip681-uri-and-resolve-ens diff --git a/src/status_im/wallet/core.cljs b/src/status_im/wallet/core.cljs index 7ced31337d..54ca7d8454 100644 --- a/src/status_im/wallet/core.cljs +++ b/src/status_im/wallet/core.cljs @@ -4,7 +4,7 @@ [clojure.string :as string] [re-frame.core :as re-frame] [status-im.async-storage.core :as async-storage] - [status-im2.common.bottom-sheet.events :as bottom-sheet] + [status-im.bottom-sheet.events :as bottom-sheet] [status-im.contact.db :as contact.db] [status-im.ethereum.core :as ethereum] [status-im.ethereum.eip55 :as eip55] @@ -87,7 +87,7 @@ (rf/defn open-transaction-details {:events [:wallet.ui/show-transaction-details]} [cofx hash address] - (navigation/navigate-to-cofx cofx :wallet-transaction-details {:hash hash :address address})) + (navigation/navigate-to cofx :wallet-transaction-details {:hash hash :address address})) (defn dups [seq] @@ -589,21 +589,21 @@ [{:keys [db] :as cofx} symbol] (rf/merge cofx {:db (assoc-in db [:wallet/prepare-transaction :symbol] symbol)} - (bottom-sheet/hide-bottom-sheet))) + (bottom-sheet/hide-bottom-sheet-old))) (rf/defn wallet-send-set-field {:events [:wallet.send/set-field]} [{:keys [db] :as cofx} field value] (rf/merge cofx {:db (assoc-in db [:wallet/prepare-transaction field] value)} - (bottom-sheet/hide-bottom-sheet))) + (bottom-sheet/hide-bottom-sheet-old))) (rf/defn wallet-request-set-field {:events [:wallet.request/set-field]} [{:keys [db] :as cofx} field value] (rf/merge cofx {:db (assoc-in db [:wallet/prepare-transaction field] value)} - (bottom-sheet/hide-bottom-sheet))) + (bottom-sheet/hide-bottom-sheet-old))) (rf/defn navigate-to-recipient-code {:events [:wallet.send/navigate-to-recipient-code]} @@ -611,7 +611,7 @@ (rf/merge cofx {:db (-> db (assoc :wallet/recipient {}))} - (bottom-sheet/hide-bottom-sheet) + (bottom-sheet/hide-bottom-sheet-old) (navigation/open-modal :recipient nil))) (rf/defn show-delete-account-confirmation diff --git a/src/status_im2/common/bottom_sheet/events.cljs b/src/status_im2/common/bottom_sheet/events.cljs deleted file mode 100644 index 8760f6da1d..0000000000 --- a/src/status_im2/common/bottom_sheet/events.cljs +++ /dev/null @@ -1,30 +0,0 @@ -(ns status-im2.common.bottom-sheet.events - (:require [utils.re-frame :as rf])) - -(rf/defn show-bottom-sheet - [{:keys [db]} {:keys [view options]}] - {:dispatch-n [[:dismiss-keyboard]] - :show-bottom-sheet-overlay nil - :db (assoc db - :bottom-sheet/show? true - :bottom-sheet/view view - :bottom-sheet/options options)}) - -(rf/defn show-bottom-sheet-event - {:events [:bottom-sheet/show-sheet]} - [cofx view options] - (show-bottom-sheet - cofx - {:view view - :options options})) - -(rf/defn hide-bottom-sheet - {:events [:bottom-sheet/hide]} - [{:keys [db]}] - {:db (assoc db :bottom-sheet/show? false) - :dismiss-bottom-sheet-overlay nil}) - -(rf/defn hide-bottom-sheet-navigation-overlay - {:events [:bottom-sheet/hide-navigation-overlay]} - [{}] - {:dismiss-bottom-sheet-overlay nil}) diff --git a/src/status_im2/common/bottom_sheet/styles.cljs b/src/status_im2/common/bottom_sheet/styles.cljs index ccda491270..8d10ac1a5f 100644 --- a/src/status_im2/common/bottom_sheet/styles.cljs +++ b/src/status_im2/common/bottom_sheet/styles.cljs @@ -1,56 +1,36 @@ (ns status-im2.common.bottom-sheet.styles (:require [quo2.foundations.colors :as colors])) -(def border-radius 20) - (defn handle [override-theme] - {:position :absolute - :top 8 - :width 32 + {:width 32 :height 4 :background-color (colors/theme-colors colors/neutral-100 colors/white override-theme) - :opacity 0.1 + :opacity 0.05 :border-radius 100 - :align-self :center}) + :align-self :center + :margin-vertical 8}) -(def backdrop - {:position :absolute - :left 0 - :right 0 - :bottom 0 - :top 0 - :background-color colors/neutral-100}) - -(def container - {:position :absolute - :left 0 - :right 0 - :top 0 - :bottom 0 - :overflow :hidden}) - -(defn content-style - [insets bottom-safe-area-spacing?] - {:position :absolute - :left 0 - :right 0 - :top 0 - :padding-top border-radius - :padding-bottom (if bottom-safe-area-spacing? (:bottom insets) 0)}) - -(defn selected-background - [override-theme] - {:border-radius 12 - :padding-left 12 - :margin-horizontal 8 - :margin-bottom 10 - :height 48 - :background-color (colors/theme-colors colors/white colors/neutral-90 override-theme)}) - -(defn background - [override-theme] - {:background-color (colors/theme-colors colors/white colors/neutral-95 override-theme) +(defn sheet + [{:keys [top bottom]} window-height override-theme] + {:position :absolute + :max-height (- window-height top 20) + :z-index 1 + :bottom 0 + :left 0 + :right 0 + :border-top-left-radius 20 + :border-top-right-radius 20 :flex 1 - :border-top-left-radius border-radius - :border-top-right-radius border-radius}) + :padding-bottom (max 20 bottom) + :background-color (colors/theme-colors colors/white colors/neutral-90 override-theme)}) + +(defn selected-item + [override-theme] + {:position :absolute + :bottom 10 + :left 0 + :right 0 + :border-radius 12 + :margin-horizontal 8 + :background-color (colors/theme-colors colors/white colors/neutral-90 override-theme)}) diff --git a/src/status_im2/common/bottom_sheet/view.cljs b/src/status_im2/common/bottom_sheet/view.cljs index 94197cbdb0..22e4f5909b 100644 --- a/src/status_im2/common/bottom_sheet/view.cljs +++ b/src/status_im2/common/bottom_sheet/view.cljs @@ -1,240 +1,82 @@ (ns status-im2.common.bottom-sheet.view - (:require [oops.core :refer [oget]] - [quo.react :as react] - [status-im2.common.bottom-sheet.styles :as styles] - [re-frame.core :as re-frame] - [react-native.background-timer :as timer] + (:require [utils.re-frame :as rf] [react-native.core :as rn] - [react-native.gesture :as gesture] - [react-native.hooks :as hooks] - [react-native.platform :as platform] + [quo2.foundations.colors :as colors] [react-native.reanimated :as reanimated] - [react-native.safe-area :as safe-area] - [reagent.core :as reagent] - [utils.worklets.bottom-sheet :as worklets.bottom-sheet])) + [status-im2.common.bottom-sheet.styles :as styles] + [react-native.gesture :as gesture] + [oops.core :as oops] + [react-native.hooks :as hooks])) -(def animation-delay 450) +(def duration 450) +(def timing-options #js {:duration duration}) -(defn with-animation - [value & [options callback]] - (reanimated/with-spring - value - (clj->js (merge {:mass 2 - :stiffness 500 - :damping 200}) - options) - callback)) +(defn hide + [translate-y bg-opacity window-height] + ;; it will be better to use animation callback, but it doesn't work + ;; so we have to use timeout, also we add 50ms for safety + (js/setTimeout #(rf/dispatch [:bottom-sheet-hidden]) (+ duration 50)) + (reanimated/set-shared-value translate-y + (reanimated/with-timing window-height timing-options)) + (reanimated/set-shared-value bg-opacity (reanimated/with-timing 0 timing-options))) -(defn get-bottom-sheet-gesture - [pan-y translate-y bg-height bg-height-expanded - window-height keyboard-shown disable-drag? expandable? - show-bottom-sheet? expanded? close-bottom-sheet gesture-running?] +(defn show + [translate-y bg-opacity] + (reanimated/set-shared-value translate-y (reanimated/with-timing 0 timing-options)) + (reanimated/set-shared-value bg-opacity (reanimated/with-timing 1 timing-options))) + +(def gesture-values (atom {})) + +(defn get-sheet-gesture + [translate-y bg-opacity window-height] (-> (gesture/gesture-pan) (gesture/on-start (fn [_] - (reset! gesture-running? true) - (when (and keyboard-shown (not disable-drag?) show-bottom-sheet?) - (re-frame/dispatch [:dismiss-keyboard])))) + (swap! gesture-values assoc :pan-y (reanimated/get-shared-value translate-y)))) (gesture/on-update (fn [evt] - (when (and (not disable-drag?) show-bottom-sheet?) - (let [max-pan-up (if (or @expanded? (not expandable?)) - 0 - (- (- bg-height-expanded bg-height))) - max-pan-down (if @expanded? - bg-height-expanded - bg-height)] - (reanimated/set-shared-value pan-y - (max - (min - (.-translationY evt) - max-pan-down) - max-pan-up)))))) + (let [tY (oops/oget evt "translationY")] + (swap! gesture-values assoc :dy (- tY (:pdy @gesture-values))) + (swap! gesture-values assoc :pdy tY) + (when (pos? tY) + (reanimated/set-shared-value + translate-y + (+ tY (:pan-y @gesture-values))))))) (gesture/on-end (fn [_] - (reset! gesture-running? false) - (when (and (not disable-drag?) show-bottom-sheet?) - (let [end-pan-y (- window-height (.-value translate-y)) - expand-threshold (min (* bg-height 1.1) (+ bg-height 50)) - collapse-threshold (max (* bg-height-expanded 0.9) (- bg-height-expanded 50)) - should-close-bottom-sheet? (< end-pan-y (max (* bg-height 0.7) 50))] - (cond - should-close-bottom-sheet? - (close-bottom-sheet) + (if (< (:dy @gesture-values) 0) + (show translate-y bg-opacity) + (hide translate-y bg-opacity window-height)))))) - (and (not @expanded?) (> end-pan-y expand-threshold)) - (reset! expanded? true) +(defn view + [{:keys [hide? insets]} {:keys [content override-theme selected-item]}] + (let [{window-height :height} (rn/use-window-dimensions) + bg-opacity (reanimated/use-shared-value 0) + translate-y (reanimated/use-shared-value window-height) + sheet-gesture (get-sheet-gesture translate-y bg-opacity window-height)] + (rn/use-effect #(if hide? (hide translate-y bg-opacity window-height) (show translate-y bg-opacity)) + [hide?]) + (hooks/use-back-handler #(do (rf/dispatch [:hide-bottom-sheet]) true)) + [rn/view {:flex 1} + ;; backdrop + [rn/touchable-without-feedback {:on-press #(rf/dispatch [:hide-bottom-sheet])} + [reanimated/view + {:style (reanimated/apply-animations-to-style + {:opacity bg-opacity} + {:flex 1 :background-color colors/neutral-100-opa-70})}]] + ;; sheet + [gesture/gesture-detector {:gesture sheet-gesture} + [reanimated/view + {:style (reanimated/apply-animations-to-style + {:transform [{:translateY translate-y}]} + (styles/sheet insets window-height override-theme))} - (and @expanded? (< end-pan-y collapse-threshold)) - (reset! expanded? false)))))))) + (when selected-item + [rn/view + [rn/view {:style (styles/selected-item override-theme)} + [selected-item]]]) -(defn handle-comp - [window-width override-theme] - [rn/view - {:style {:width window-width - :position :absolute - :background-color :transparent - :top 0 - :height 20}} - [rn/view {:style (styles/handle override-theme)}]]) - -(defn bottom-sheet - [props children] - (let [{on-cancel :on-cancel - disable-drag? :disable-drag? - show-handle? :show-handle? - visible? :visible? - backdrop-dismiss? :backdrop-dismiss? - expandable? :expandable? - bottom-safe-area-spacing? :bottom-safe-area-spacing? - selected-item :selected-item - is-initially-expanded? :expanded? - override-theme :override-theme - :or {show-handle? true - backdrop-dismiss? true - expandable? false - bottom-safe-area-spacing? true - is-initially-expanded? false}} - props - content-height (reagent/atom nil) - show-bottom-sheet? (reagent/atom nil) - keyboard-was-shown? (reagent/atom false) - expanded? (reagent/atom is-initially-expanded?) - gesture-running? (reagent/atom false) - reset-atoms (fn [] - (reset! show-bottom-sheet? nil) - (reset! content-height nil) - (reset! expanded? false) - (reset! keyboard-was-shown? false) - (reset! gesture-running? false)) - close-bottom-sheet (fn [] - (reset! show-bottom-sheet? false) - (when (fn? on-cancel) (on-cancel)) - (timer/set-timeout - #(do - (re-frame/dispatch [:bottom-sheet/hide-navigation-overlay]) - (reset-atoms)) - animation-delay))] - [safe-area/consumer - (fn [insets] - [:f> - (fn [] - (let [{height :height - window-width :width} - (rn/use-window-dimensions) - window-height (if selected-item (- height 72) height) - {:keys [keyboard-shown]} (hooks/use-keyboard) - bg-height-expanded (- window-height (:top insets)) - bg-height (max (min @content-height bg-height-expanded) 109) - bottom-sheet-dy (reanimated/use-shared-value 0) - pan-y (reanimated/use-shared-value 0) - translate-y (worklets.bottom-sheet/use-translate-y window-height bottom-sheet-dy pan-y) - bg-opacity - (worklets.bottom-sheet/use-background-opacity translate-y bg-height window-height) - on-content-layout (fn [evt] - (let [height (oget evt "nativeEvent" "layout" "height")] - (reset! content-height height))) - on-expanded (fn [] - (reanimated/set-shared-value bottom-sheet-dy bg-height-expanded) - (reanimated/set-shared-value pan-y 0)) - on-collapsed (fn [] - (reanimated/set-shared-value bottom-sheet-dy bg-height) - (reanimated/set-shared-value pan-y 0)) - bottom-sheet-gesture (get-bottom-sheet-gesture - pan-y - translate-y - bg-height - bg-height-expanded - window-height - keyboard-shown - disable-drag? - expandable? - show-bottom-sheet? - expanded? - close-bottom-sheet - gesture-running?) - handle-comp [gesture/gesture-detector {:gesture bottom-sheet-gesture} - [handle-comp window-width override-theme]]] - - (react/effect! #(do - (cond - (and - (nil? @show-bottom-sheet?) - visible? - (some? @content-height) - (> @content-height 0)) - (reset! show-bottom-sheet? true) - - (and @show-bottom-sheet? (not visible?)) - (close-bottom-sheet))) - [@show-bottom-sheet? @content-height visible?]) - (react/effect! #(do - (when @show-bottom-sheet? - (cond - keyboard-shown - (do - (reset! keyboard-was-shown? true) - (reset! expanded? true)) - (and @keyboard-was-shown? (not keyboard-shown)) - (reset! expanded? false)))) - [@show-bottom-sheet? @keyboard-was-shown? keyboard-shown]) - (react/effect! #(do - (when-not @gesture-running? - (cond - @show-bottom-sheet? - (if @expanded? - (do - (reanimated/set-shared-value - bottom-sheet-dy - (with-animation (+ bg-height-expanded (.-value pan-y)))) - ;; Workaround for - ;; https://github.com/software-mansion/react-native-reanimated/issues/1758#issue-817145741 - ;; withTiming/withSpring callback not working - ;; on-expanded should be called as a callback of - ;; with-animation instead, once this issue has been resolved - (timer/set-timeout on-expanded animation-delay)) - (do - (reanimated/set-shared-value - bottom-sheet-dy - (with-animation (+ bg-height (.-value pan-y)))) - ;; Workaround for - ;; https://github.com/software-mansion/react-native-reanimated/issues/1758#issue-817145741 - ;; withTiming/withSpring callback not working - ;; on-collapsed should be called as a callback of - ;; with-animation instead, once this issue has been resolved - (timer/set-timeout on-collapsed animation-delay))) - - (= @show-bottom-sheet? false) - (reanimated/set-shared-value bottom-sheet-dy (with-animation 0))))) - [@show-bottom-sheet? @expanded? @gesture-running?]) - - [:<> - [rn/touchable-without-feedback {:on-press (when backdrop-dismiss? close-bottom-sheet)} - [reanimated/view - {:style (reanimated/apply-animations-to-style - {:opacity bg-opacity} - styles/backdrop)}]] - (cond->> [reanimated/view - {:style (reanimated/apply-animations-to-style - {:transform [{:translateY translate-y}]} - {:width window-width - :height window-height})} - [rn/view {:style styles/container} - (when selected-item - [rn/view {:style (styles/selected-background override-theme)} - [selected-item]]) - [rn/view {:style (styles/background override-theme)} - [rn/keyboard-avoiding-view - {:behaviour (if platform/ios? :padding :height) - :style {:flex 1}} - [rn/view - {:style (styles/content-style insets bottom-safe-area-spacing?) - :on-layout (when-not (and - (some? @content-height) - (> @content-height 0)) - on-content-layout)} - children]] - (when show-handle? - handle-comp)]]] - (not show-handle?) - (conj [gesture/gesture-detector {:gesture bottom-sheet-gesture}]))]))])])) + ;; handle + [rn/view {:style (styles/handle override-theme)}] + ;; content + [content]]]])) diff --git a/src/status_im2/common/bottom_sheet_screen/view.cljs b/src/status_im2/common/bottom_sheet_screen/view.cljs index 363de5ede5..f7b16d508c 100644 --- a/src/status_im2/common/bottom_sheet_screen/view.cljs +++ b/src/status_im2/common/bottom_sheet_screen/view.cljs @@ -70,12 +70,14 @@ :padding-top padding-top}} (when-not skip-background? [reanimated/view {:style (style/background opacity)}]) - [gesture/gesture-detector - {:gesture (drag-gesture translate-y opacity scroll-enabled curr-scroll)} - [reanimated/view {:style (style/main-view translate-y)} + + [reanimated/view {:style (style/main-view translate-y)} + [gesture/gesture-detector + {:gesture (drag-gesture translate-y opacity scroll-enabled curr-scroll)} [rn/view {:style style/handle-container} - [rn/view {:style (style/handle)}]] - [content - {:close close - :scroll-enabled @scroll-enabled - :on-scroll #(on-scroll % curr-scroll)}]]]])))]) + [rn/view {:style (style/handle)}]]] + [content + {:insets insets + :close close + :scroll-enabled @scroll-enabled + :on-scroll #(on-scroll % curr-scroll)}]]])))]) diff --git a/src/status_im2/common/confirmation_drawer/view.cljs b/src/status_im2/common/confirmation_drawer/view.cljs index ea4bd15637..1798e3f2d5 100644 --- a/src/status_im2/common/confirmation_drawer/view.cljs +++ b/src/status_im2/common/confirmation_drawer/view.cljs @@ -61,7 +61,7 @@ [quo/button {:type :grey :style {:flex 0.48} ;;WUT? 0.48 , whats that ? - :on-press #(rf/dispatch [:bottom-sheet/hide])} + :on-press #(rf/dispatch [:hide-bottom-sheet])} (or close-button-text (i18n/label :t/close))] [quo/button {:type :danger diff --git a/src/status_im2/common/home/actions/view.cljs b/src/status_im2/common/home/actions/view.cljs index 2256f3af05..950a7ccaf2 100644 --- a/src/status_im2/common/home/actions/view.cljs +++ b/src/status_im2/common/home/actions/view.cljs @@ -23,7 +23,7 @@ (defn hide-sheet-and-dispatch [event] - (rf/dispatch [:bottom-sheet/hide]) + (rf/dispatch [:hide-bottom-sheet]) (rf/dispatch event)) (defn show-profile-action @@ -50,35 +50,35 @@ (defn clear-history-action [{:keys [chat-id] :as item}] (hide-sheet-and-dispatch - [:bottom-sheet/show-sheet + [:show-bottom-sheet {:content (fn [] - (confirmation-drawer/confirmation-drawer + [confirmation-drawer/confirmation-drawer {:title (i18n/label :t/clear-history?) :description (i18n/label :t/clear-history-confirmation-content) :context item :accessibility-label :clear-history-confirm :button-text (i18n/label :t/clear-history) - :on-press #(hide-sheet-and-dispatch [:chat.ui/clear-history chat-id])}))}])) + :on-press #(hide-sheet-and-dispatch [:chat.ui/clear-history chat-id])}])}])) (defn delete-chat-action [{:keys [chat-id] :as item}] (hide-sheet-and-dispatch - [:bottom-sheet/show-sheet + [:show-bottom-sheet {:content (fn [] - (confirmation-drawer/confirmation-drawer + [confirmation-drawer/confirmation-drawer {:title (i18n/label :t/delete-chat?) :description (i18n/label :t/delete-chat-confirmation) :context item :accessibility-label :delete-chat-confirm :button-text (i18n/label :t/delete-chat) - :on-press #(hide-sheet-and-dispatch [:chat.ui/remove-chat chat-id])}))}])) + :on-press #(hide-sheet-and-dispatch [:chat.ui/remove-chat chat-id])}])}])) (defn leave-group-action [item chat-id] (hide-sheet-and-dispatch - [:bottom-sheet/show-sheet + [:show-bottom-sheet {:content (fn [] - (confirmation-drawer/confirmation-drawer + [confirmation-drawer/confirmation-drawer {:title (i18n/label :t/leave-group?) :description (i18n/label :t/leave-chat-confirmation) :context item @@ -87,21 +87,21 @@ :on-press #(do (rf/dispatch [:navigate-back]) (hide-sheet-and-dispatch [:group-chats.ui/leave-chat-confirmed - chat-id]))}))}])) + chat-id]))}])}])) (defn block-user-action [{:keys [public-key] :as item}] (hide-sheet-and-dispatch - [:bottom-sheet/show-sheet + [:show-bottom-sheet {:content (fn [] - (confirmation-drawer/confirmation-drawer + [confirmation-drawer/confirmation-drawer {:title (i18n/label :t/block-user?) :description (i18n/label :t/block-contact-details) :context item :accessibility-label :block-user :button-text (i18n/label :t/block-user) :on-press #(hide-sheet-and-dispatch [:contact.ui/block-contact-confirmed - public-key])}))}])) + public-key])}])}])) (defn mute-chat-entry [chat-id] diff --git a/src/status_im2/common/home/view.cljs b/src/status_im2/common/home/view.cljs index 037635f145..56e4307897 100644 --- a/src/status_im2/common/home/view.cljs +++ b/src/status_im2/common/home/view.cljs @@ -76,7 +76,7 @@ (merge button-common-props {:icon false :accessibility-label :on-cellular-network - :on-press #(rf/dispatch [:bottom-sheet/show-sheet + :on-press #(rf/dispatch [:show-bottom-sheet {:content connectivity-sheet}])}) "🦄"]) (when (= network-type "none") @@ -84,7 +84,7 @@ (merge button-common-props {:icon false :accessibility-label :no-network-connection - :on-press #(rf/dispatch [:bottom-sheet/show-sheet + :on-press #(rf/dispatch [:show-bottom-sheet {:content connectivity-sheet}])}) "💀"]) (when search? diff --git a/src/status_im2/contexts/activity_center/notification/contact_verification/view.cljs b/src/status_im2/contexts/activity_center/notification/contact_verification/view.cljs index e15def6cae..d4861fbc59 100644 --- a/src/status_im2/contexts/activity_center/notification/contact_verification/view.cljs +++ b/src/status_im2/contexts/activity_center/notification/contact_verification/view.cljs @@ -76,20 +76,20 @@ (defn- decline-challenge [id] - (rf/dispatch [:bottom-sheet/hide]) + (rf/dispatch [:hide-bottom-sheet]) (rf/dispatch [:activity-center.contact-verification/decline id]) (rf/dispatch [:activity-center.notifications/mark-as-read id])) (defn- prepare-challenge-reply [props] - (rf/dispatch [:bottom-sheet/show-sheet + (rf/dispatch [:show-bottom-sheet {:content view :override-theme :dark} (assoc props :replying? true)])) (defn- send-challenge-reply [id reply] - (rf/dispatch [:bottom-sheet/hide]) + (rf/dispatch [:hide-bottom-sheet]) (rf/dispatch [:activity-center.contact-verification/reply id reply]) (rf/dispatch [:activity-center.notifications/mark-as-read id])) diff --git a/src/status_im2/contexts/activity_center/view.cljs b/src/status_im2/contexts/activity_center/view.cljs index 321497d6b8..bee39e37c4 100644 --- a/src/status_im2/contexts/activity_center/view.cljs +++ b/src/status_im2/contexts/activity_center/view.cljs @@ -50,7 +50,7 @@ ;; notifications to mark as read ;; https://github.com/status-im/status-mobile/issues/14983 (js/alert "No unread notifications to mark as read")) - (rf/dispatch [:bottom-sheet/hide]))}]]])) + (rf/dispatch [:hide-bottom-sheet]))}]]])) (defn empty-tab [] @@ -153,7 +153,7 @@ :size 32 :accessibility-label :activity-center-open-more :override-theme :dark - :on-press #(rf/dispatch [:bottom-sheet/show-sheet + :on-press #(rf/dispatch [:show-bottom-sheet {:content options-bottom-sheet-content :override-theme :dark}])} :i/options]] diff --git a/src/status_im2/contexts/chat/events.cljs b/src/status_im2/contexts/chat/events.cljs index 527c2e3202..2087a2e976 100644 --- a/src/status_im2/contexts/chat/events.cljs +++ b/src/status_im2/contexts/chat/events.cljs @@ -313,7 +313,7 @@ :content (i18n/label :t/clear-history-confirmation-content) :confirm-button-text (i18n/label :t/clear-history-action) :on-accept #(do - (rf/dispatch [:bottom-sheet/hide]) + (rf/dispatch [:hide-bottom-sheet]) (rf/dispatch [:chat.ui/clear-history chat-id false]))}}) (rf/defn show-remove-chat-confirmation @@ -324,7 +324,7 @@ :content (i18n/label :t/delete-chat-confirmation) :confirm-button-text (i18n/label :t/delete) :on-accept #(do - (rf/dispatch [:bottom-sheet/hide]) + (rf/dispatch [:hide-bottom-sheet]) (rf/dispatch [:chat.ui/remove-chat chat-id]))}}) (rf/defn navigate-to-user-pinned-messages diff --git a/src/status_im2/contexts/chat/group_details/style.cljs b/src/status_im2/contexts/chat/group_details/style.cljs index 55e4841898..a60208a76a 100644 --- a/src/status_im2/contexts/chat/group_details/style.cljs +++ b/src/status_im2/contexts/chat/group_details/style.cljs @@ -34,11 +34,10 @@ :margin-bottom 24}) (defn bottom-container - [safe-area] + [bottom] {:padding-horizontal 20 :padding-vertical 12 - :padding-bottom (+ 33 (:bottom safe-area)) - :width "100%" + :margin-bottom bottom :background-color (colors/theme-colors colors/white colors/neutral-95-opa-70) :flex-direction :row}) diff --git a/src/status_im2/contexts/chat/group_details/view.cljs b/src/status_im2/contexts/chat/group_details/view.cljs index 8a1414343e..8f13577317 100644 --- a/src/status_im2/contexts/chat/group_details/view.cljs +++ b/src/status_im2/contexts/chat/group_details/view.cljs @@ -1,6 +1,5 @@ (ns status-im2.contexts.chat.group-details.view (:require [utils.i18n :as i18n] - [quo.components.safe-area :as safe-area] [quo2.core :as quo] [quo2.foundations.colors :as colors] [react-native.core :as rn] @@ -31,7 +30,7 @@ :width 32 :style {:margin-right 20} :accessibility-label :options-button - :on-press #(rf/dispatch [:bottom-sheet/show-sheet + :on-press #(rf/dispatch [:show-bottom-sheet {:content (fn [] [actions/group-details-actions group])}])} [quo/icon :i/options {:color (colors/theme-colors colors/neutral-100 colors/white)}]])) @@ -92,52 +91,50 @@ :on-check on-toggle}}) item])))) -(defn add-members-sheet - [group admin?] - [:f> - (fn [] - (let [{window-height :height} (rn/use-window-dimensions) - safe-area (safe-area/use-safe-area) - selected-participants (rf/sub [:group-chat/selected-participants]) - deselected-members (rf/sub [:group-chat/deselected-members])] - [rn/view {:style {:height (- window-height (:top safe-area))}} - [rn/touchable-opacity - {:on-press #(rf/dispatch [:bottom-sheet/hide]) - :accessibility-label :close-manage-members - :style (style/close-icon)} - [quo/icon :i/close {:color (colors/theme-colors colors/neutral-100 colors/white)}]] - [quo/text - {:size :heading-1 - :weight :semi-bold - :style {:margin-left 20}} - (i18n/label (if admin? :t/manage-members :t/add-members))] - [rn/section-list - {:key-fn :title - :sticky-section-headers-enabled false - :sections (rf/sub [:contacts/grouped-by-first-letter]) - :render-section-header-fn contact-list/contacts-section-header - :content-container-style {:padding-bottom 20} - :render-data {:group group} - :render-fn add-member-contact-item-render}] - [rn/view {:style (style/bottom-container safe-area)} - [quo/button - {:style {:flex 1} - :accessibility-label :save - :on-press (fn [] - (rf/dispatch [:bottom-sheet/hide]) - (js/setTimeout (fn [] - (rf/dispatch - [:group-chats.ui/remove-members-pressed])) - 500) - (rf/dispatch [:group-chats.ui/add-members-pressed])) - :disabled (and (zero? (count selected-participants)) - (zero? (count deselected-members)))} - (i18n/label :t/save)]]]))]) +(defn add-manage-members + [] + (let [selected-participants (rf/sub [:group-chat/selected-participants]) + deselected-members (rf/sub [:group-chat/deselected-members]) + {:keys [admins] :as group} (rf/sub [:chats/current-chat]) + admin? (get admins (rf/sub [:multiaccount/public-key]))] + [rn/view {:flex 1 :margin-top 20} + [rn/touchable-opacity + {:on-press #(rf/dispatch [:navigate-back]) + :accessibility-label :close-manage-members + :style (style/close-icon)} + [quo/icon :i/close {:color (colors/theme-colors colors/neutral-100 colors/white)}]] + [quo/text + {:size :heading-1 + :weight :semi-bold + :style {:margin-left 20}} + (i18n/label (if admin? :t/manage-members :t/add-members))] + [rn/section-list + {:key-fn :title + :sticky-section-headers-enabled false + :sections (rf/sub [:contacts/grouped-by-first-letter]) + :render-section-header-fn contact-list/contacts-section-header + :content-container-style {:padding-bottom 20} + :render-data {:group group} + :render-fn add-member-contact-item-render}] + [rn/view {:style (style/bottom-container 30)} + [quo/button + {:style {:flex 1} + :accessibility-label :save + :on-press (fn [] + (rf/dispatch [:navigate-back]) + (js/setTimeout (fn [] + (rf/dispatch + [:group-chats.ui/remove-members-pressed])) + 500) + (rf/dispatch [:group-chats.ui/add-members-pressed])) + :disabled (and (zero? (count selected-participants)) + (zero? (count deselected-members)))} + (i18n/label :t/save)]]])) (defn contact-item-render [{:keys [public-key] :as item} _ _ extra-data] (let [current-pk (rf/sub [:multiaccount/public-key]) - show-profile-actions #(rf/dispatch [:bottom-sheet/show-sheet + show-profile-actions #(rf/dispatch [:show-bottom-sheet {:content (fn [] [actions/contact-actions item extra-data])}])] [contact-list-item/contact-list-item @@ -151,13 +148,11 @@ (defn group-details [] (let [{:keys [admins chat-id chat-name color public? - muted contacts] - :as group} (rf/sub - [:chats/current-chat]) - members (rf/sub [:contacts/group-members-sections]) - pinned-messages (rf/sub [:chats/pinned chat-id]) - current-pk (rf/sub [:multiaccount/public-key]) - admin? (get admins current-pk)] + muted contacts]} (rf/sub [:chats/current-chat]) + members (rf/sub [:contacts/group-members-sections]) + pinned-messages (rf/sub [:chats/pinned chat-id]) + current-pk (rf/sub [:multiaccount/public-key]) + admin? (get admins current-pk)] [rn/view {:style {:flex 1 :background-color (colors/theme-colors colors/white colors/neutral-95)}} @@ -185,7 +180,7 @@ :accessibility-label :pinned-messages :on-press (fn [] (rf/dispatch [:dismiss-keyboard]) - (rf/dispatch [:bottom-sheet/show-sheet :pinned-messages-list chat-id]))} + (rf/dispatch [:pin-message/show-pins-bottom-sheet chat-id]))} [rn/view {:style {:flex-direction :row :justify-content :space-between}} @@ -207,9 +202,7 @@ :on-press (fn [] (rf/dispatch [:group/clear-added-participants]) (rf/dispatch [:group/clear-removed-members]) - (rf/dispatch - [:bottom-sheet/show-sheet - {:content (fn [] [add-members-sheet group admin?])}]))} + (rf/dispatch [:open-modal :group-add-manage-members]))} [rn/view {:style {:flex-direction :row :justify-content :space-between}} diff --git a/src/status_im2/contexts/chat/home/chat_list_item/view.cljs b/src/status_im2/contexts/chat/home/chat_list_item/view.cljs index b817cc7069..a4bf72c286 100644 --- a/src/status_im2/contexts/chat/home/chat_list_item/view.cljs +++ b/src/status_im2/contexts/chat/home/chat_list_item/view.cljs @@ -128,7 +128,7 @@ [rn/touchable-opacity {:style (style/container) :on-press (open-chat chat-id) - :on-long-press #(rf/dispatch [:bottom-sheet/show-sheet + :on-long-press #(rf/dispatch [:show-bottom-sheet {:content (fn [] [actions/chat-actions item false])}])} [avatar-view {:contact contact diff --git a/src/status_im2/contexts/chat/home/view.cljs b/src/status_im2/contexts/chat/home/view.cljs index 693601788d..b7a12d9cbf 100644 --- a/src/status_im2/contexts/chat/home/view.cljs +++ b/src/status_im2/contexts/chat/home/view.cljs @@ -15,7 +15,8 @@ [quo2.foundations.colors :as colors] [react-native.blur :as blur] [status-im2.contexts.chat.home.style :as style] - [react-native.platform :as platform])) + [react-native.platform :as platform] + [status-im2.contexts.chat.sheets.view :as home.sheet])) (defn get-item-layout [_ index] @@ -61,7 +62,7 @@ (defn contact-item-render [{:keys [public-key] :as item}] (let [current-pk (rf/sub [:multiaccount/public-key]) - show-profile-actions #(rf/dispatch [:bottom-sheet/show-sheet + show-profile-actions #(rf/dispatch [:show-bottom-sheet {:content (fn [] [actions/contact-actions item])}])] [contact-list-item/contact-list-item (when (not= public-key current-pk) @@ -119,8 +120,8 @@ [common.home/top-nav] [common.home/title-column {:label (i18n/label :t/messages) - :handler #(rf/dispatch [:bottom-sheet/show-sheet :new-chat-bottom-sheet - {}]) + :handler #(rf/dispatch [:show-bottom-sheet + {:content home.sheet/new-chat-bottom-sheet}]) :accessibility-label :new-chat-button}] [quo/discover-card {:title (i18n/label :t/invite-friends-to-status) diff --git a/src/status_im2/contexts/chat/menus/pinned_messages/view.cljs b/src/status_im2/contexts/chat/menus/pinned_messages/view.cljs index 2e4ff02ba1..9613699fd6 100644 --- a/src/status_im2/contexts/chat/menus/pinned_messages/view.cljs +++ b/src/status_im2/contexts/chat/menus/pinned_messages/view.cljs @@ -7,7 +7,8 @@ [status-im2.contexts.chat.messages.content.view :as message] [status-im2.contexts.chat.menus.pinned-messages.style :as style] [utils.i18n :as i18n] - [utils.re-frame :as rf])) + [utils.re-frame :as rf] + [react-native.gesture :as gesture])) (def list-key-fn #(or (:message-id %) (:value %))) @@ -29,11 +30,9 @@ (fn [insets] [:f> (fn [] - (let [{window-height :height} (rn/use-window-dimensions) - bottom-inset (:bottom insets)] - [rn/scroll-view - {:style {:max-height (- window-height (:top insets))} - :accessibility-label :pinned-messages-menu} + (let [bottom-inset (:bottom insets)] + [gesture/scroll-view + {:accessibility-label :pinned-messages-menu} [:<> [quo/text {:size :heading-1 diff --git a/src/status_im2/contexts/chat/messages/composer/controls/style.cljs b/src/status_im2/contexts/chat/messages/composer/controls/style.cljs index 3b9a092b8d..d020eaa661 100644 --- a/src/status_im2/contexts/chat/messages/composer/controls/style.cljs +++ b/src/status_im2/contexts/chat/messages/composer/controls/style.cljs @@ -2,13 +2,13 @@ (:require [quo2.foundations.colors :as colors])) (defn controls - [insets] + [bottom-inset] {:padding-horizontal 20 :elevation 4 :z-index 3 :position :absolute :background-color (colors/theme-colors colors/white colors/neutral-90) - :padding-bottom (+ 12 (:bottom insets)) + :padding-bottom (+ 12 bottom-inset) :bottom 0 :left 0 :right 0}) @@ -19,11 +19,11 @@ :min-height 32}) (defn record-audio-container - [insets] + [bottom-inset] {:align-items :center :background-color :transparent :flex-direction :row :position :absolute :left 0 :right 0 - :bottom (- (:bottom insets) 7)}) + :bottom (- bottom-inset 7)}) diff --git a/src/status_im2/contexts/chat/messages/composer/controls/view.cljs b/src/status_im2/contexts/chat/messages/composer/controls/view.cljs index 8a3b705bed..fa160f9d0b 100644 --- a/src/status_im2/contexts/chat/messages/composer/controls/view.cljs +++ b/src/status_im2/contexts/chat/messages/composer/controls/view.cljs @@ -12,7 +12,6 @@ [status-im.ui2.screens.chat.composer.input :as input] [status-im2.common.alert.events :as alert] [react-native.permissions :as permissions] - [react-native.safe-area :as safe-area] [quo.react :as quo.react])) (defn send-button @@ -41,13 +40,12 @@ :size 32} :i/reaction]]) (defn image-button - [insets] + [] [quo/button {:on-press (fn [] (permissions/request-permissions {:permissions [:read-external-storage :write-external-storage] - :on-allowed #(rf/dispatch - [:open-modal :photo-selector {:insets insets}]) + :on-allowed #(rf/dispatch [:open-modal :photo-selector]) :on-denied (fn [] (background-timer/set-timeout #(utils-old/show-popup (i18n/label :t/error) @@ -60,72 +58,70 @@ :i/image]) (defn record-audio - [record-ref chat-id] - [safe-area/consumer - (fn [insets] - [rn/view - {:ref record-ref - :style (style/record-audio-container insets) - :pointer-events :box-none} - [quo/record-audio - {:record-audio-permission-granted @input/record-audio-permission-granted - :on-init (fn [init-fn] - (reset! input/record-audio-reset-fn init-fn) - (reset! input/recording-audio? - (some? (get @input/reviewing-audio-filepath chat-id))) - (when (seq (get @input/input-texts chat-id)) - (js/setTimeout #(quo.react/set-native-props - record-ref - #js {:right nil :left -1000})))) - :on-start-recording #(reset! input/recording-audio? true) - :audio-file (get @input/reviewing-audio-filepath chat-id) - :on-reviewing-audio (fn [audio-file] - (swap! input/reviewing-audio-filepath assoc - chat-id - audio-file) - (reset! input/reviewing-audio? true)) - :on-send (fn - [{:keys [file-path duration]}] - (rf/dispatch [:chat/send-audio file-path duration]) - (reset! input/recording-audio? false) - (reset! input/reviewing-audio? false) - (swap! input/reviewing-audio-filepath dissoc chat-id)) - :on-cancel (fn [] - (reset! input/recording-audio? false) - (reset! input/reviewing-audio? false) - (swap! input/reviewing-audio-filepath dissoc chat-id)) - :on-check-audio-permissions (fn [] - (permissions/permission-granted? - :record-audio - #(reset! input/record-audio-permission-granted %) - #(reset! input/record-audio-permission-granted false))) - :on-request-record-audio-permission (fn [] - (rf/dispatch - [:request-permissions - {:permissions [:record-audio] - :on-allowed - #(reset! input/record-audio-permission-granted true) - :on-denied - #(js/setTimeout - (fn [] - (alert/show-popup - (i18n/label :t/audio-recorder-error) - (i18n/label - :t/audio-recorder-permissions-error))) - 50)}]))}]])]) + [record-ref chat-id bottom-inset] + [rn/view + {:ref record-ref + :style (style/record-audio-container bottom-inset) + :pointer-events :box-none} + [quo/record-audio + {:record-audio-permission-granted @input/record-audio-permission-granted + :on-init (fn [init-fn] + (reset! input/record-audio-reset-fn init-fn) + (reset! input/recording-audio? + (some? (get @input/reviewing-audio-filepath chat-id))) + (when (seq (get @input/input-texts chat-id)) + (js/setTimeout #(quo.react/set-native-props + record-ref + #js {:right nil :left -1000})))) + :on-start-recording #(reset! input/recording-audio? true) + :audio-file (get @input/reviewing-audio-filepath chat-id) + :on-reviewing-audio (fn [audio-file] + (swap! input/reviewing-audio-filepath assoc + chat-id + audio-file) + (reset! input/reviewing-audio? true)) + :on-send (fn + [{:keys [file-path duration]}] + (rf/dispatch [:chat/send-audio file-path duration]) + (reset! input/recording-audio? false) + (reset! input/reviewing-audio? false) + (swap! input/reviewing-audio-filepath dissoc chat-id)) + :on-cancel (fn [] + (reset! input/recording-audio? false) + (reset! input/reviewing-audio? false) + (swap! input/reviewing-audio-filepath dissoc chat-id)) + :on-check-audio-permissions (fn [] + (permissions/permission-granted? + :record-audio + #(reset! input/record-audio-permission-granted %) + #(reset! input/record-audio-permission-granted false))) + :on-request-record-audio-permission (fn [] + (rf/dispatch + [:request-permissions + {:permissions [:record-audio] + :on-allowed + #(reset! input/record-audio-permission-granted true) + :on-denied + #(js/setTimeout + (fn [] + (alert/show-popup + (i18n/label :t/audio-recorder-error) + (i18n/label + :t/audio-recorder-permissions-error))) + 50)}]))}]]) (defn view - [send-ref record-ref params insets chat-id images edit on-send] - [rn/view {:style (style/controls insets)} + [send-ref record-ref params bottom-inset chat-id images edit on-send] + [rn/view {:style (style/controls bottom-inset)} [composer-images/images-list images] [rn/view {:style style/buttons-container} (when (and (not @input/recording-audio?) (nil? (get @input/reviewing-audio-filepath chat-id))) [:<> - [image-button insets] + [image-button] [rn/view {:width 12}] [reactions-button] [rn/view {:flex 1}] [send-button send-ref params on-send]])] (when (and (not edit) (not (seq images))) - [record-audio record-ref chat-id])]) + [record-audio record-ref chat-id bottom-inset])]) diff --git a/src/status_im2/contexts/chat/messages/composer/mentions/view.cljs b/src/status_im2/contexts/chat/messages/composer/mentions/view.cljs index 65c3dde5ce..1b1d6945bc 100644 --- a/src/status_im2/contexts/chat/messages/composer/mentions/view.cljs +++ b/src/status_im2/contexts/chat/messages/composer/mentions/view.cljs @@ -10,7 +10,7 @@ {:on-press #(rf/dispatch [:chat.ui/select-mention text-input-ref user])} user]) (defn mentions - [{:keys [refs suggestions max-y]} insets] + [{:keys [refs suggestions max-y]} bottom-inset] [:f> (fn [] (let [translate-y (reanimated/use-shared-value 0)] @@ -21,7 +21,7 @@ [reanimated/view {:style (reanimated/apply-animations-to-style {:transform [{:translateY translate-y}]} - {:bottom (or (:bottom insets) 0) + {:bottom (or bottom-inset 0) :position :absolute :left 0 :right 0 diff --git a/src/status_im2/contexts/chat/messages/composer/view.cljs b/src/status_im2/contexts/chat/messages/composer/view.cljs index f3c58cd153..6faa5bfe58 100644 --- a/src/status_im2/contexts/chat/messages/composer/view.cljs +++ b/src/status_im2/contexts/chat/messages/composer/view.cljs @@ -169,6 +169,7 @@ suggestions (rf/sub [:chat/mention-suggestions]) images (rf/sub [:chats/sending-image]) + bottom-inset (max 20 (:bottom insets)) {window-height :height} (rn/use-window-dimensions) {:keys [keyboard-shown keyboard-height]} (hooks/use-keyboard) translate-y (reanimated/use-shared-value 0) @@ -183,11 +184,11 @@ (- (if (> keyboard-height 0) keyboard-height 360) - (:bottom insets)) + bottom-inset) 46) min-y (+ 108 - (:bottom insets) + bottom-inset (if suggestions? (min (/ max-y 2) (+ 16 @@ -200,7 +201,7 @@ (when (seq images) 80)))) parent-height (reanimated/use-shared-value min-y) - max-parent-height (Math/abs (- max-y 110 (:bottom insets))) + max-parent-height (Math/abs (- max-y 110 bottom-inset)) params (prepare-params @@ -231,8 +232,8 @@ :sending-image (seq images) :refs refs}]]]] (if suggestions? - [mentions/mentions (select-keys params [:refs :suggestions :max-y]) insets] - [controls/view send-ref record-ref params insets chat-id images + [mentions/mentions (select-keys params [:refs :suggestions :max-y]) bottom-inset] + [controls/view send-ref record-ref params bottom-inset chat-id images edit #(clean-and-minimize params)]) ;;;;black background [reanimated/view diff --git a/src/status_im2/contexts/chat/messages/content/deleted/view.cljs b/src/status_im2/contexts/chat/messages/content/deleted/view.cljs index fff718cd3d..362a4c7c47 100644 --- a/src/status_im2/contexts/chat/messages/content/deleted/view.cljs +++ b/src/status_im2/contexts/chat/messages/content/deleted/view.cljs @@ -32,9 +32,8 @@ (when (and pinned deleted? message-pin-enabled) (fn [] (rf/dispatch [:dismiss-keyboard]) - (rf/dispatch [:bottom-sheet/show-sheet - {:content (drawers/reactions-and-actions message - context)}])))) + (rf/dispatch [:show-bottom-sheet + {:content (drawers/reactions-and-actions message context)}])))) (defn deleted-by-message [{:keys [deleted-by deleted-undoable-till timestamp-str deleted-for-me-undoable-till from]} diff --git a/src/status_im2/contexts/chat/messages/content/pin/view.cljs b/src/status_im2/contexts/chat/messages/content/pin/view.cljs index 3f38c02992..9494e5fe49 100644 --- a/src/status_im2/contexts/chat/messages/content/pin/view.cljs +++ b/src/status_im2/contexts/chat/messages/content/pin/view.cljs @@ -30,7 +30,7 @@ [rn/touchable-opacity {:on-press (fn [] (rf/dispatch [:dismiss-keyboard]) - (rf/dispatch [:bottom-sheet/show-sheet :pinned-messages-list chat-id])) + (rf/dispatch [:pin-message/show-pins-bottom-sheet chat-id])) :active-opacity 1 :style (merge {:flex-direction :row :margin-vertical 8} (old-style/message-wrapper message))} diff --git a/src/status_im2/contexts/chat/messages/content/reactions/view.cljs b/src/status_im2/contexts/chat/messages/content/reactions/view.cljs index d5c6193a8e..6e69265492 100644 --- a/src/status_im2/contexts/chat/messages/content/reactions/view.cljs +++ b/src/status_im2/contexts/chat/messages/content/reactions/view.cljs @@ -30,6 +30,6 @@ {:on-press (fn [] (rf/dispatch [:dismiss-keyboard]) (rf/dispatch - [:bottom-sheet/show-sheet + [:show-bottom-sheet {:content (fn [] [drawers/reactions {:chat-id chat-id :message-id message-id}])}]))}]]))) diff --git a/src/status_im2/contexts/chat/messages/content/view.cljs b/src/status_im2/contexts/chat/messages/content/view.cljs index a14c28e8b5..acb4595e9a 100644 --- a/src/status_im2/contexts/chat/messages/content/view.cljs +++ b/src/status_im2/contexts/chat/messages/content/view.cljs @@ -79,9 +79,8 @@ (defn on-long-press [message-data context] (rf/dispatch [:dismiss-keyboard]) - (rf/dispatch [:bottom-sheet/show-sheet - {:content (drawers/reactions-and-actions message-data - context)}])) + (rf/dispatch [:show-bottom-sheet + {:content (drawers/reactions-and-actions message-data context)}])) (defn user-message-content [] diff --git a/src/status_im2/contexts/chat/messages/drawers/view.cljs b/src/status_im2/contexts/chat/messages/drawers/view.cljs index 89c81f6a2a..53196416b0 100644 --- a/src/status_im2/contexts/chat/messages/drawers/view.cljs +++ b/src/status_im2/contexts/chat/messages/drawers/view.cljs @@ -66,7 +66,7 @@ [{:type :danger :on-press (fn [] (rf/dispatch - [:bottom-sheet/hide]) + [:hide-bottom-sheet]) (rf/dispatch [:chat.ui/delete-message-for-me message-data constants/delete-message-for-me-undo-time-limit-ms])) @@ -82,7 +82,7 @@ :else false) [{:type :danger :on-press (fn [] - (rf/dispatch [:bottom-sheet/hide]) + (rf/dispatch [:hide-bottom-sheet]) (rf/dispatch [:chat.ui/delete-message message-data constants/delete-message-undo-time-limit-ms])) :label (i18n/label :t/delete-for-everyone) @@ -132,7 +132,7 @@ (rf/dispatch [:models.reactions/send-emoji-reaction {:message-id message-id :emoji-id id}])) - (rf/dispatch [:bottom-sheet/hide]))}) + (rf/dispatch [:hide-bottom-sheet]))}) icon]])))])) (defn reactions-and-actions @@ -163,7 +163,7 @@ :accessibility-label (:label action) :icon (:icon action) :on-press (fn [] - (rf/dispatch [:bottom-sheet/hide]) + (rf/dispatch [:hide-bottom-sheet]) (when on-press (on-press)))}])) (when-not (empty? danger-actions) [quo/separator]) @@ -178,7 +178,7 @@ :accessibility-label (:label action) :icon (:icon action) :on-press (fn [] - (rf/dispatch [:bottom-sheet/hide]) + (rf/dispatch [:hide-bottom-sheet]) (when on-press (on-press)))}])) (when-not (empty? admin-actions) [quo/separator]) @@ -193,5 +193,5 @@ :accessibility-label (:label action) :icon (:icon action) :on-press (fn [] - (rf/dispatch [:bottom-sheet/hide]) + (rf/dispatch [:hide-bottom-sheet]) (when on-press (on-press)))}]))]]))) diff --git a/src/status_im2/contexts/chat/messages/pin/banner/view.cljs b/src/status_im2/contexts/chat/messages/pin/banner/view.cljs index 126143336a..bf116ed894 100644 --- a/src/status_im2/contexts/chat/messages/pin/banner/view.cljs +++ b/src/status_im2/contexts/chat/messages/pin/banner/view.cljs @@ -21,6 +21,6 @@ :pins-count pins-count :on-press (fn [] (rf/dispatch [:dismiss-keyboard]) - (rf/dispatch [:bottom-sheet/show-sheet :pinned-messages-list chat-id]))}])) + (rf/dispatch [:pin-message/show-pins-bottom-sheet chat-id]))}])) diff --git a/src/status_im2/contexts/chat/messages/pin/events.cljs b/src/status_im2/contexts/chat/messages/pin/events.cljs index 0bc4cbabeb..12ccd634fe 100644 --- a/src/status_im2/contexts/chat/messages/pin/events.cljs +++ b/src/status_im2/contexts/chat/messages/pin/events.cljs @@ -8,7 +8,9 @@ [status-im2.contexts.chat.messages.list.events :as message-list] [taoensso.timbre :as log] [utils.i18n :as i18n] - [utils.re-frame :as rf])) + [utils.re-frame :as rf] + [status-im2.contexts.chat.menus.pinned-messages.view :as pinned-messages-menu] + [status-im2.navigation.events :as navigation])) (rf/defn handle-failed-loading-pin-messages {:events [:pin-message/failed-loading-pin-messages]} @@ -118,3 +120,8 @@ {:icon :alert :icon-color colors/danger-50 :text (i18n/label :t/pin-limit-reached)})) + +(rf/defn show-pins-bottom-sheet + {:events [:pin-message/show-pins-bottom-sheet]} + [cofx chat-id] + (navigation/show-bottom-sheet cofx {:content (fn [] [pinned-messages-menu/pinned-messages chat-id])})) diff --git a/src/status_im2/contexts/chat/messages/view.cljs b/src/status_im2/contexts/chat/messages/view.cljs index 4edbde0960..2a28f0bfcf 100644 --- a/src/status_im2/contexts/chat/messages/view.cljs +++ b/src/status_im2/contexts/chat/messages/view.cljs @@ -73,7 +73,7 @@ (fn [insets] [rn/keyboard-avoiding-view {:style {:position :relative :flex 1} - :keyboardVerticalOffset (- (:bottom insets))} + :keyboardVerticalOffset (- (max 20 (:bottom insets)))} [page-nav] [pin.banner/banner chat-id] [messages.list/messages-list chat] diff --git a/src/status_im2/contexts/chat/photo_selector/view.cljs b/src/status_im2/contexts/chat/photo_selector/view.cljs index 1db54f254c..eab8c855fe 100644 --- a/src/status_im2/contexts/chat/photo_selector/view.cljs +++ b/src/status_im2/contexts/chat/photo_selector/view.cljs @@ -13,8 +13,8 @@ [status-im2.contexts.chat.photo-selector.style :as style] [status-im.utils.core :as utils] [quo.react] - [status-im2.common.bottom-sheet-screen.view :as bottom-sheet-screen] - [utils.re-frame :as rf])) + [utils.re-frame :as rf] + [react-native.safe-area :as safe-area])) (defn on-press-confirm-selection [selected] @@ -90,13 +90,13 @@ :on-press (fn [] ;; TODO: album-selector issue: ;; https://github.com/status-im/status-mobile/issues/15398 - (js/alert "currently disabled") - ;(if photos? - ; (do - ; (reset! temporary-selected @selected) - ; (rf/dispatch [:open-modal :album-selector {:insets insets}])) - ; (rf/dispatch [:navigate-back])) - )} + (js/alert "currently disabled"))} + ;(if photos? + ; (do + ; (reset! temporary-selected @selected) + ; (rf/dispatch [:open-modal :album-selector {:insets insets}])) + ; (rf/dispatch [:navigate-back])) + [quo/text {:weight :medium :ellipsize-mode :tail @@ -107,31 +107,29 @@ [quo/icon (if photos? :i/chevron-down :i/chevron-up) {:color (colors/theme-colors colors/neutral-100 colors/white)}]]])) - (defn photo-selector - [] - [:f> - (let [{:keys [insets]} (rf/sub [:get-screen-params]) - temporary-selected (reagent/atom [])] ; used when switching albums - (fn [] - (let [selected (reagent/atom []) ; currently selected - selected-images (rf/sub [:chats/sending-image]) ; already selected and dispatched - selected-album (or (rf/sub [:camera-roll/selected-album]) (i18n/label :t/recent))] - (rn/use-effect - (fn [] - (rf/dispatch [:chat.ui/camera-roll-get-photos 20 nil selected-album]) - (if (seq selected-images) - (reset! selected (vec (vals selected-images))) - (reset! selected @temporary-selected))) - [selected-album]) - [bottom-sheet-screen/view - (fn [{:keys [scroll-enabled on-scroll]}] + [{:keys [scroll-enabled on-scroll]}] + [safe-area/consumer + (fn [insets] + [:f> + (let [temporary-selected (reagent/atom [])] ; used when switching albums + (fn [] + (let [selected (reagent/atom []) ; currently selected + selected-images (rf/sub [:chats/sending-image]) ; already selected and dispatched + selected-album (or (rf/sub [:camera-roll/selected-album]) (i18n/label :t/recent))] + (rn/use-effect + (fn [] + (rf/dispatch [:chat.ui/camera-roll-get-photos 20 nil selected-album]) + (if (seq selected-images) + (reset! selected (vec (vals selected-images))) + (reset! selected @temporary-selected))) + [selected-album]) (let [window-width (:width (rn/get-window)) camera-roll-photos (rf/sub [:camera-roll/photos]) end-cursor (rf/sub [:camera-roll/end-cursor]) loading? (rf/sub [:camera-roll/loading-more]) has-next-page? (rf/sub [:camera-roll/has-next-page])] - [:<> + [rn/view {:flex 1} [rn/view {:style style/buttons-container} [album-title true selected-album selected temporary-selected insets] @@ -150,4 +148,4 @@ :on-end-reached #(rf/dispatch [:camera-roll/on-end-reached end-cursor selected-album loading? has-next-page?])}] - [bottom-gradient selected-images insets selected]]))])))]) + [bottom-gradient selected-images insets selected]]))))])]) diff --git a/src/status_im2/contexts/chat/sheets/view.cljs b/src/status_im2/contexts/chat/sheets/view.cljs new file mode 100644 index 0000000000..a5a0e4bda6 --- /dev/null +++ b/src/status_im2/contexts/chat/sheets/view.cljs @@ -0,0 +1,40 @@ +(ns status-im2.contexts.chat.sheets.view + (:require [quo2.core :as quo] + [utils.i18n :as i18n] + [quo2.foundations.colors :as colors] + [utils.re-frame :as rf])) + +(defn new-chat-bottom-sheet + [] + [:<> + [quo/menu-item + {:type :transparent + :title (i18n/label :t/new-chat) + :icon-bg-color :transparent + :container-padding-vertical 12 + :title-column-style {:margin-left 2} + :style-props {:border-bottom-width 1 + :border-bottom-color (colors/theme-colors colors/neutral-10 + colors/neutral-90)} + :icon-color (colors/theme-colors colors/neutral-50 colors/neutral-40) + :accessibility-label :start-a-new-chat + :icon :i/new-message + :on-press (fn [] + (rf/dispatch [:group-chat/clear-contacts]) + (rf/dispatch [:open-modal :start-a-new-chat]))}] + [quo/menu-item + {:type :transparent + :title (i18n/label :t/add-a-contact) + :icon-bg-color :transparent + :icon-container-style {:padding-horizontal 0} + :container-padding-horizontal {:padding-horizontal 4} + :style-props {:margin-top 18 + :margin-bottom 9} + :container-padding-vertical 12 + :title-column-style {:margin-left 2} + :icon-color (colors/theme-colors colors/neutral-50 colors/neutral-40) + :accessibility-label :add-a-contact + :subtitle (i18n/label :t/enter-a-chat-key) + :subtitle-color colors/neutral-50 + :icon :i/add-user + :on-press #(rf/dispatch [:open-modal :new-contact])}]]) diff --git a/src/status_im2/contexts/communities/discover/view.cljs b/src/status_im2/contexts/communities/discover/view.cljs index 74e2180ced..6c6344baa4 100644 --- a/src/status_im2/contexts/communities/discover/view.cljs +++ b/src/status_im2/contexts/communities/discover/view.cljs @@ -36,7 +36,7 @@ (rf/dispatch [:dismiss-keyboard]) (rf/dispatch [:navigate-to :community-overview (:id item)])) :on-long-press #(rf/dispatch - [:bottom-sheet/show-sheet + [:show-bottom-sheet {:content (fn [] [options/community-options-bottom-sheet (:id item)])}])}]))) @@ -149,7 +149,7 @@ (rf/dispatch [:communities/load-category-states (:id community)]) (rf/dispatch [:dismiss-keyboard]) (rf/dispatch [:navigate-to :community-overview (:id community)])) - :on-long-press #(rf/dispatch [:bottom-sheet/show-sheet + :on-long-press #(rf/dispatch [:show-bottom-sheet {:content (fn [] ;; TODO implement with quo2 [community/community-actions community])}])} diff --git a/src/status_im2/contexts/communities/home/view.cljs b/src/status_im2/contexts/communities/home/view.cljs index 4b9ede0792..33644ac169 100644 --- a/src/status_im2/contexts/communities/home/view.cljs +++ b/src/status_im2/contexts/communities/home/view.cljs @@ -20,7 +20,7 @@ {:style {:padding-horizontal 18} :on-press #(rf/dispatch [:navigate-to :community-overview id]) :on-long-press #(rf/dispatch - [:bottom-sheet/show-sheet + [:show-bottom-sheet {:content (fn [] [options/community-options-bottom-sheet id]) :selected-item (fn [] @@ -59,7 +59,7 @@ [common.home/top-nav] [common.home/title-column {:label (i18n/label :t/communities) - :handler #(rf/dispatch [:bottom-sheet/show-sheet :add-new {}]) + :handler #(rf/dispatch [:bottom-sheet/show-sheet-old :add-new {}]) :accessibility-label :new-chat-button}] [quo/discover-card {:on-press #(rf/dispatch [:navigate-to :discover-communities]) diff --git a/src/status_im2/contexts/communities/menus/community_options/view.cljs b/src/status_im2/contexts/communities/menus/community_options/view.cljs index 635077f091..1efc2206be 100644 --- a/src/status_im2/contexts/communities/menus/community_options/view.cljs +++ b/src/status_im2/contexts/communities/menus/community_options/view.cljs @@ -7,7 +7,7 @@ (defn hide-sheet-and-dispatch [event] - (rf/dispatch [:bottom-sheet/hide]) + (rf/dispatch [:hide-bottom-sheet]) (rf/dispatch event)) (defn view-members @@ -23,9 +23,8 @@ {:icon :i/bullet-list :right-icon :i/chevron-right :accessibility-label :view-community-rules - :on-press #(rf/dispatch [:bottom-sheet/show-sheet - {:content (constantly [see-rules/view id]) - :content-height 400}]) + :on-press #(rf/dispatch [:show-bottom-sheet + {:content (fn [] [see-rules/view id])}]) :label (i18n/label :t/view-community-rules)}) (defn view-token-gating @@ -86,9 +85,8 @@ :label (i18n/label :t/leave-community) :accessibility-label :leave-community :danger? true - :on-press #(rf/dispatch [:bottom-sheet/show-sheet - {:content (constantly [leave-menu/leave-sheet id]) - :content-height 400}])}) + :on-press #(rf/dispatch [:show-bottom-sheet + {:content (fn [] [leave-menu/leave-sheet id])}])}) (defn cancel-request-to-join [id request-id] @@ -96,10 +94,9 @@ :label (i18n/label :t/cancel-request-to-join) :accessibility-label :cancel-request-to-join :danger? true - :on-press #(rf/dispatch [:bottom-sheet/show-sheet - {:content (constantly [leave-menu/cancel-request-sheet id - request-id]) - :content-height 400}])}) + :on-press #(rf/dispatch [:show-bottom-sheet + {:content (fn [] [leave-menu/cancel-request-sheet id + request-id])}])}) (defn edit-community [id] @@ -107,7 +104,7 @@ :label (i18n/label :t/edit-community) :accessibility-label :edit-community :on-press #(rf/dispatch [:communities/open-edit-community id] - (rf/dispatch [:bottom-sheet/hide]))}) + (rf/dispatch [:hide-bottom-sheet]))}) (defn not-joined-options [id token-gated?] diff --git a/src/status_im2/contexts/communities/menus/leave/view.cljs b/src/status_im2/contexts/communities/menus/leave/view.cljs index 2e36669fcf..9329057cc9 100644 --- a/src/status_im2/contexts/communities/menus/leave/view.cljs +++ b/src/status_im2/contexts/communities/menus/leave/view.cljs @@ -8,7 +8,7 @@ (defn hide-sheet-and-dispatch [event] - (rf/dispatch [:bottom-sheet/hide]) + (rf/dispatch [:hide-bottom-sheet]) (rf/dispatch event)) (defn leave-sheet @@ -25,7 +25,7 @@ [rn/view {:style style/button-container} [quo/button - {:on-press #(rf/dispatch [:bottom-sheet/hide]) + {:on-press #(rf/dispatch [:hide-bottom-sheet]) :type :grey :style style/cancel-button} (i18n/label :t/cancel)] @@ -49,7 +49,7 @@ {:style style/button-container} [quo/button {:accessibility-label :cancel-button - :on-press #(rf/dispatch [:bottom-sheet/hide]) + :on-press #(rf/dispatch [:hide-bottom-sheet]) :type :grey :style style/cancel-button} (i18n/label :t/close)] diff --git a/src/status_im2/contexts/communities/menus/request_to_join/style.cljs b/src/status_im2/contexts/communities/menus/request_to_join/style.cljs index 812da95b93..bd71ecc908 100644 --- a/src/status_im2/contexts/communities/menus/request_to_join/style.cljs +++ b/src/status_im2/contexts/communities/menus/request_to_join/style.cljs @@ -2,9 +2,8 @@ (:require [quo2.foundations.colors :as colors])) (def page-container - {:margin-left 20 - :margin-right 20 - :margin-bottom 20}) + {:margin-horizontal 20 + :margin-bottom 20}) (def title-container {:flex-direction :row @@ -27,9 +26,9 @@ :margin-right 12}) (defn bottom-container - [safe-area-insets] - {:padding-top 32 - :padding-bottom (:bottom safe-area-insets) - :flex-direction :row - :align-items :center - :justify-content :space-evenly}) + [] + {:margin-horizontal 20 + :padding-top 32 + :flex-direction :row + :align-items :center + :justify-content :space-evenly}) diff --git a/src/status_im2/contexts/communities/menus/request_to_join/view.cljs b/src/status_im2/contexts/communities/menus/request_to_join/view.cljs index 9e488d729a..b7893bd78c 100644 --- a/src/status_im2/contexts/communities/menus/request_to_join/view.cljs +++ b/src/status_im2/contexts/communities/menus/request_to_join/view.cljs @@ -1,6 +1,5 @@ (ns status-im2.contexts.communities.menus.request-to-join.view (:require [react-native.core :as rn] - [react-native.safe-area :as safe-area] [status-im2.contexts.communities.menus.community-rules-list.view :as community-rules] [reagent.core :as reagent] [status-im2.contexts.communities.menus.request-to-join.style :as style] @@ -16,69 +15,66 @@ (i18n/label :t/request-to-join))) (defn request-to-join - [{:keys [permissions - name - id - images - can-join? - can-request-access? - requested-to-join-at]}] - (let [agreed-to-rules? (reagent/atom false) - pending? (rf/sub [:communities/my-pending-request-to-join id]) - ] - [safe-area/consumer - (fn [insets] - [:f> - (fn [] - (let [{window-height :height} (rn/use-window-dimensions) - is-open? (not= 3 (:access permissions))] - [rn/scroll-view {:style {:max-height (- window-height (:top insets))}} - [rn/view style/page-container - [rn/view - {:style style/title-container} - [quo/text - {:accessibility-label :communities-join-community - :weight :semi-bold - :size :heading-1} - (request-to-join-text is-open?)] - [rn/view - {:style style/request-icon} - [quo/icon :i/info]]] - [quo/context-tag - {:style - {:margin-right :auto - :margin-top 8}} - (:thumbnail images) name] - [quo/text - {:style {:margin-top 24} - :accessibility-label :communities-rules-title - :weight :semi-bold - :size :paragraph-1} - (i18n/label :t/community-rules)] - [community-rules/view community-rules/rules] - [quo/disclaimer - {:accessibility-label :rules-disclaimer-checkbox - :container-style {:margin-top 20} - :on-change #(swap! agreed-to-rules? not)} - (i18n/label :t/accept-community-rules)] - [rn/view {:style (style/bottom-container insets)} - [quo/button - {:accessibility-label :cancel - :on-press #(rf/dispatch [:bottom-sheet/hide]) - :type :grey - :style style/cancel-button} (i18n/label :t/cancel)] - [quo/button - {:accessibility-label :join-community-button - :on-press (fn [] - (if can-join? - (do - (rf/dispatch [:communities/join id]) - (rf/dispatch [:bottom-sheet/hide])) - (do (and can-request-access? - (not pending?) - (requests/can-request-access-again? - requested-to-join-at)) - (rf/dispatch [:communities/request-to-join id]) - (rf/dispatch [:bottom-sheet/hide])))) - :disabled (not @agreed-to-rules?) - :style {:flex 1}} (request-to-join-text is-open?)]]]]))])])) + [] + (let [agreed-to-rules? (reagent/atom false)] + (fn [] + (let [{:keys [permissions + name + id + images + can-join? + can-request-access? + requested-to-join-at]} (rf/sub [:get-screen-params]) + pending? (rf/sub [:communities/my-pending-request-to-join id]) + is-open? (not= 3 (:access permissions))] + [rn/view {:flex 1 :margin-top 40} + [rn/scroll-view {:style {:flex 1}} + [rn/view style/page-container + [rn/view + {:style style/title-container} + [quo/text + {:accessibility-label :communities-join-community + :weight :semi-bold + :size :heading-1} + (request-to-join-text is-open?)] + [rn/view + {:style style/request-icon} + [quo/icon :i/info]]] + [quo/context-tag + {:style + {:margin-right :auto + :margin-top 8}} + (:thumbnail images) name] + [quo/text + {:style {:margin-top 24} + :accessibility-label :communities-rules-title + :weight :semi-bold + :size :paragraph-1} + (i18n/label :t/community-rules)] + [community-rules/view community-rules/rules] + [quo/disclaimer + {:accessibility-label :rules-disclaimer-checkbox + :container-style {:margin-top 20} + :on-change #(swap! agreed-to-rules? not)} + (i18n/label :t/accept-community-rules)] + [rn/view {:style (style/bottom-container)} + [quo/button + {:accessibility-label :cancel + :on-press #(rf/dispatch [:navigate-back]) + :type :grey + :style style/cancel-button} (i18n/label :t/cancel)] + [quo/button + {:accessibility-label :join-community-button + :on-press (fn [] + (if can-join? + (do + (rf/dispatch [:communities/join id]) + (rf/dispatch [:navigate-back])) + (do (and can-request-access? + (not pending?) + (requests/can-request-access-again? + requested-to-join-at)) + (rf/dispatch [:communities/request-to-join id]) + (rf/dispatch [:navigate-back])))) + :disabled (not @agreed-to-rules?) + :style {:flex 1}} (request-to-join-text is-open?)]]]]])))) diff --git a/src/status_im2/contexts/communities/overview/view.cljs b/src/status_im2/contexts/communities/overview/view.cljs index e061dfc64e..b270d534e2 100644 --- a/src/status_im2/contexts/communities/overview/view.cljs +++ b/src/status_im2/contexts/communities/overview/view.cljs @@ -11,7 +11,6 @@ [status-im2.common.scroll-page.view :as scroll-page] [status-im2.contexts.communities.overview.style :as style] [status-im2.contexts.communities.menus.community-options.view :as options] - [status-im2.contexts.communities.menus.request-to-join.view :as join-menu] [quo2.components.navigation.floating-shell-button :as floating-shell-button] [status-im2.contexts.communities.overview.utils :as utils] [utils.re-frame :as rf])) @@ -47,11 +46,10 @@ (defn open-channel-token-gating-details [name token-gating emoji channel-color] (rf/dispatch - [:bottom-sheet/show-sheet + [:show-bottom-sheet {:content (fn [] - [channel-token-gating-details name token-gating emoji channel-color]) - :content-height 210}])) + [channel-token-gating-details name token-gating emoji channel-color])}])) (defn layout-y [event] @@ -137,12 +135,7 @@ [:<> (when-not (or joined pending? invite-only? unknown-access?) [quo/button - {:on-press #(rf/dispatch - [:bottom-sheet/show-sheet - {:content (fn [] [join-menu/request-to-join - community]) - :bottom-safe-area-spacing? false - :content-height 300}]) + {:on-press #(rf/dispatch [:open-modal :community-requests-to-join community]) :accessibility-label :show-request-to-join-screen-button :override-background-color community-color :style style/join-button @@ -252,9 +245,8 @@ :status status :tokens tokens :on-press #(rf/dispatch - [:bottom-sheet/show-sheet - {:content-height 210 - :content + [:show-bottom-sheet + {:content (fn [] [community-token-gating-details name @@ -299,10 +291,9 @@ :background-color (scroll-page/icon-color) :accessibility-label :community-options-for-community :on-press #(rf/dispatch - [:bottom-sheet/show-sheet + [:show-bottom-sheet {:content (fn [] - [options/community-options-bottom-sheet - id])}])}]) + [options/community-options-bottom-sheet id])}])}]) (defn pick-first-category-by-height [scroll-height first-channel-height categories-heights] diff --git a/src/status_im2/contexts/onboarding/create_profile/view.cljs b/src/status_im2/contexts/onboarding/create_profile/view.cljs index 18cd0c5d30..f8c47ccbca 100644 --- a/src/status_im2/contexts/onboarding/create_profile/view.cljs +++ b/src/status_im2/contexts/onboarding/create_profile/view.cljs @@ -106,12 +106,14 @@ [quo/profile-input {:customization-color @custom-color :placeholder (i18n/label :t/your-name) - :on-press #(rf/dispatch - [:bottom-sheet/show-sheet - {:override-theme :dark - :content - (fn [] - [method-menu/view on-change-profile-pic])}]) + :on-press (fn [] + (rf/dispatch [:dismiss-keyboard]) + (rf/dispatch + [:show-bottom-sheet + {:override-theme :dark + :content + (fn [] + [method-menu/view on-change-profile-pic])}])) :image-picker-props {:profile-picture @profile-pic :full-name @full-name} :title-input-props {:default-value @full-name diff --git a/src/status_im2/contexts/onboarding/new_to_status/view.cljs b/src/status_im2/contexts/onboarding/new_to_status/view.cljs index 408dce4166..6876d2594b 100644 --- a/src/status_im2/contexts/onboarding/new_to_status/view.cljs +++ b/src/status_im2/contexts/onboarding/new_to_status/view.cljs @@ -55,7 +55,7 @@ (defn new-to-status [] - [rn/view {:style style/full-screen} + [:<> [background/view true] [rn/view {:style style/content-container} [navigation-bar/navigation-bar {:on-press-info #(js/alert "Info pressed")}] diff --git a/src/status_im2/contexts/onboarding/profiles/view.cljs b/src/status_im2/contexts/onboarding/profiles/view.cljs index 604e9a932e..e2f41e397b 100644 --- a/src/status_im2/contexts/onboarding/profiles/view.cljs +++ b/src/status_im2/contexts/onboarding/profiles/view.cljs @@ -23,25 +23,20 @@ [quo/action-drawer [[{:icon :i/profile :label (i18n/label :t/create-new-profile) - :on-press #(do - (rf/dispatch [:bottom-sheet/hide]) - (rf/dispatch [:navigate-to :new-to-status])) + :on-press #(rf/dispatch [:navigate-to :new-to-status]) :accessibility-label :create-new-profile} {:icon :i/multi-profile :label (i18n/label :t/add-existing-status-profile) - :on-press #(do - (rf/dispatch [:bottom-sheet/hide]) - (rf/dispatch [:navigate-to :sign-in])) + :on-press #(rf/dispatch [:navigate-to :sign-in]) :accessibility-label :multi-profile}]]]) (defn show-new-account-options [] - (rf/dispatch [:bottom-sheet/show-sheet - {:content new-account-options}])) + (rf/dispatch [:show-bottom-sheet {:content new-account-options}])) (defn delete-profile-confirmation [key-uid context] - (confirmation-drawer/confirmation-drawer + [confirmation-drawer/confirmation-drawer {:title (i18n/label :remove-profile?) :description (i18n/label :remove-profile-confirm-message) :accessibility-label :remove-profile-confirm @@ -49,19 +44,18 @@ :button-text (i18n/label :t/remove) :close-button-text (i18n/label :t/cancel) :on-press #(do - (rf/dispatch [:bottom-sheet/hide]) + (rf/dispatch [:hide-bottom-sheet]) (status/delete-multiaccount key-uid (fn [result] (let [{:keys [error]} (types/json->clj result)] (rf/dispatch [:onboarding-2/on-delete-profile-success key-uid]) - (log/info "profile deleted: error" error)))))})) + (log/info "profile deleted: error" error)))))}]) (defn show-confirmation [key-uid context] - (rf/dispatch [:bottom-sheet/hide]) - (rf/dispatch [:bottom-sheet/show-sheet - {:content #(delete-profile-confirmation key-uid context)}])) + (rf/dispatch [:show-bottom-sheet + {:content (fn [] [delete-profile-confirmation key-uid context])}])) (defn profile-options [key-uid context] @@ -74,8 +68,8 @@ (defn show-profile-options [key-uid context] - (rf/dispatch [:bottom-sheet/show-sheet - {:content #(profile-options key-uid context)}])) + (rf/dispatch [:show-bottom-sheet + {:content (fn [] [profile-options key-uid context])}])) (defn profile-card [{:keys [name key-uid customization-color keycard-pairing last-index] :as multiaccount} index] diff --git a/src/status_im2/contexts/onboarding/select_photo/method_menu/view.cljs b/src/status_im2/contexts/onboarding/select_photo/method_menu/view.cljs index bcb3082d20..33ca70d334 100644 --- a/src/status_im2/contexts/onboarding/select_photo/method_menu/view.cljs +++ b/src/status_im2/contexts/onboarding/select_photo/method_menu/view.cljs @@ -44,14 +44,14 @@ (defn pick-pic [update-profile-pic-callback] - (rf/dispatch [:bottom-sheet/hide]) + (rf/dispatch [:hide-bottom-sheet]) (show-image-picker #(update-profile-pic-callback (.-path ^js %)) crop-opts)) (defn take-pic [update-profile-pic-callback] - (rf/dispatch [:bottom-sheet/hide]) + (rf/dispatch [:hide-bottom-sheet]) (show-image-picker-camera #(update-profile-pic-callback (.-path ^js %)) crop-opts)) diff --git a/src/status_im2/contexts/quo_preview/bottom_sheet/bottom_sheet.cljs b/src/status_im2/contexts/quo_preview/bottom_sheet/bottom_sheet.cljs index 840ee68e86..cf39f7ec73 100644 --- a/src/status_im2/contexts/quo_preview/bottom_sheet/bottom_sheet.cljs +++ b/src/status_im2/contexts/quo_preview/bottom_sheet/bottom_sheet.cljs @@ -26,7 +26,7 @@ [rn/view {:style {:justify-content :center :align-items :center}} - [button/button {:on-press #(do (re-frame/dispatch [:bottom-sheet/hide]))} "Close bottom sheet"] + [button/button {:on-press #(do (re-frame/dispatch [:hide-bottom-sheet]))} "Close bottom sheet"] [text/text {:style {:padding-top 20}} "Hello world!"]]) @@ -37,7 +37,7 @@ :expandable? true :disable-drag? false}) on-bottom-sheet-open (fn [] - (re-frame/dispatch [:bottom-sheet/show-sheet + (re-frame/dispatch [:show-bottom-sheet (merge {:content bottom-sheet-content} @state)]))] diff --git a/src/status_im2/contexts/quo_preview/drawers/action_drawers.cljs b/src/status_im2/contexts/quo_preview/drawers/action_drawers.cljs index 18852b3482..99866212c6 100644 --- a/src/status_im2/contexts/quo_preview/drawers/action_drawers.cljs +++ b/src/status_im2/contexts/quo_preview/drawers/action_drawers.cljs @@ -60,12 +60,11 @@ [preview/customizer state descriptor] [quo/button {:style {:margin-horizontal 40} - :on-press #(rf/dispatch [:bottom-sheet/show-sheet - {:content (constantly (render-action-sheet state)) - :content-height 300}])} + :on-press #(rf/dispatch [:show-bottom-sheet + {:content (fn [] [render-action-sheet state])}])} "See in bottom sheet"] [rn/view {:padding-vertical 60} - (render-action-sheet state)]]]))) + [render-action-sheet state]]]]))) (defn preview-action-drawers [] diff --git a/src/status_im2/contexts/shell/animation.cljs b/src/status_im2/contexts/shell/animation.cljs index 2d03a39b2c..7a5395e776 100644 --- a/src/status_im2/contexts/shell/animation.cljs +++ b/src/status_im2/contexts/shell/animation.cljs @@ -133,9 +133,9 @@ ;; Animations -(defn change-root-status-bar-style +(defn change-shell-status-bar-style [] - (rf/dispatch [:change-root-status-bar-style + (rf/dispatch [:change-shell-status-bar-style (if (or (colors/dark?) (not (home-stack-open?))) :light @@ -146,8 +146,8 @@ (let [home-stack-state-value (calculate-home-stack-state-value stack-id animate?)] (reanimated/set-shared-value (:selected-stack-id @shared-values-atom) (name stack-id)) (reanimated/set-shared-value (:home-stack-state @shared-values-atom) home-stack-state-value) - (js/setTimeout change-root-status-bar-style shell.constants/shell-animation-time) - (change-selected-stack-id stack-id true home-stack-state-value))) + (change-selected-stack-id stack-id true home-stack-state-value) + (js/setTimeout change-shell-status-bar-style shell.constants/shell-animation-time))) (defn change-tab [stack-id] @@ -172,5 +172,5 @@ home-stack-state-value (calculate-home-stack-state-value stack-id animate?)] (reanimated/set-shared-value (:animate-home-stack-left @shared-values-atom) true) (reanimated/set-shared-value (:home-stack-state @shared-values-atom) home-stack-state-value) - (change-root-status-bar-style) - (change-selected-stack-id stack-id true home-stack-state-value))) + (change-selected-stack-id stack-id true home-stack-state-value) + (change-shell-status-bar-style))) diff --git a/src/status_im2/contexts/shell/events.cljs b/src/status_im2/contexts/shell/events.cljs index 725bdb2880..d035c6b6b1 100644 --- a/src/status_im2/contexts/shell/events.cljs +++ b/src/status_im2/contexts/shell/events.cljs @@ -117,3 +117,13 @@ cofx {:shell/navigate-to-jump-to-fx nil} (navigation/pop-to-root :shell-stack))) + +(rf/defn change-shell-status-bar-style + {:events [:change-shell-status-bar-style]} + [_ style] + {:merge-options {:id "shell-stack" :options {:statusBar {:style style}}}}) + +(rf/defn change-shell-nav-bar-color + {:events [:change-shell-nav-bar-color]} + [_ color] + {:merge-options {:id "shell-stack" :options {:navigationBar {:backgroundColor color}}}}) diff --git a/src/status_im2/contexts/shell/view.cljs b/src/status_im2/contexts/shell/view.cljs index e18af5b679..155888be56 100644 --- a/src/status_im2/contexts/shell/view.cljs +++ b/src/status_im2/contexts/shell/view.cljs @@ -138,7 +138,6 @@ [:f> (fn [] (let [shared-values (animation/calculate-shared-values)] - (animation/change-root-status-bar-style) [rn/view {:style {:flex 1} :on-layout on-layout} diff --git a/src/status_im2/contexts/syncing/events.cljs b/src/status_im2/contexts/syncing/events.cljs index ec7e1617e9..8efa97966b 100644 --- a/src/status_im2/contexts/syncing/events.cljs +++ b/src/status_im2/contexts/syncing/events.cljs @@ -58,11 +58,10 @@ (let [valid-password? (>= (count entered-password) constants/min-password-length) show-sheet (fn [connection-string] (rf/dispatch - [:bottom-sheet/show-sheet - {:show-handle? false - :content (fn [] - [sheet/qr-code-view-with-connection-string - connection-string])}]))] + [:show-bottom-sheet + {:content (fn [] + [sheet/qr-code-view-with-connection-string + connection-string])}]))] (if valid-password? (let [sha3-pwd (status/sha3 (str (security/safe-unmask-data entered-password))) key-uid (get-in db [:multiaccount :key-uid]) @@ -76,4 +75,3 @@ config-map #(show-sheet %))) (show-sheet "")))) - diff --git a/src/status_im2/contexts/syncing/sheets/sync_device_notice/view.cljs b/src/status_im2/contexts/syncing/sheets/sync_device_notice/view.cljs index b4e712db67..e0a9c878f7 100644 --- a/src/status_im2/contexts/syncing/sheets/sync_device_notice/view.cljs +++ b/src/status_im2/contexts/syncing/sheets/sync_device_notice/view.cljs @@ -55,11 +55,8 @@ :size 40 :style styles/setup-syncing-button :before :i/face-id20 - :on-press (fn [] - (rf/dispatch [:bottom-sheet/hide]) - (rf/dispatch [:bottom-sheet/show-sheet - {:show-handle? true - :expanded? true - :content (fn [] - [enter-password/sheet])}]))} + :on-press #(rf/dispatch [:show-bottom-sheet + ;; this should be a modal screen + {:content (fn [] + [enter-password/sheet])}])} (i18n/label :t/setup-syncing)]]]) diff --git a/src/status_im2/contexts/syncing/view.cljs b/src/status_im2/contexts/syncing/view.cljs index bd0d976e4d..28d1267524 100644 --- a/src/status_im2/contexts/syncing/view.cljs +++ b/src/status_im2/contexts/syncing/view.cljs @@ -64,12 +64,10 @@ [quo/button {:size 32 :icon true - :on-press (fn [] - (rf/dispatch [:bottom-sheet/hide]) - (rf/dispatch [:bottom-sheet/show-sheet - {:show-handle? false - :content (fn [] - [sync-device-notice/sheet])}]))} + :on-press #(rf/dispatch [:show-bottom-sheet + {:show-handle? false + :content (fn [] + [sync-device-notice/sheet])}])} :i/add]] [rn/view {:style style/devices-container} [render-device diff --git a/src/status_im2/events.cljs b/src/status_im2/events.cljs index 43c2b83a9f..4e9e3c02d4 100644 --- a/src/status_im2/events.cljs +++ b/src/status_im2/events.cljs @@ -9,7 +9,7 @@ [status-im2.common.toasts.events] [status-im2.contexts.add-new-contact.events] status-im2.contexts.onboarding.events - [status-im2.common.bottom-sheet.events] + [status-im.bottom-sheet.events] [status-im2.navigation.events :as navigation] [status-im2.db :as db] [utils.re-frame :as rf] diff --git a/src/status_im2/navigation/core.cljs b/src/status_im2/navigation/core.cljs index e9754327c2..b51da3a469 100644 --- a/src/status_im2/navigation/core.cljs +++ b/src/status_im2/navigation/core.cljs @@ -1,34 +1,57 @@ (ns status-im2.navigation.core - (:require [quo2.foundations.colors :as colors] - [re-frame.core :as re-frame] + (:require [re-frame.core :as re-frame] [react-native.core :as rn] [react-native.gesture :as gesture] [react-native.navigation :as navigation] - [react-native.platform :as platform] [status-im.multiaccounts.login.core :as login-core] [status-im2.navigation.roots :as roots] [status-im2.navigation.state :as state] [status-im2.navigation.view :as views] [taoensso.timbre :as log] - [utils.re-frame :as rf])) + [status-im2.navigation.options :as options])) -;; REGISTER COMPONENT (LAZY) -(defn reg-comp - [key] - (log/debug "reg-comp" key) - (if-let [comp (get views/components (keyword key))] - (navigation/register-component key (fn [] (views/component comp)) nil) - (let [screen (views/screen key)] - (navigation/register-component key - (fn [] (gesture/gesture-handler-root-hoc screen)) - (fn [] screen))))) +(navigation/set-lazy-component-registrator + (fn [key] + (let [screen (views/screen key)] + (navigation/register-component key + (fn [] (gesture/gesture-handler-root-hoc screen)) + (fn [] screen))))) + +;; APP LAUNCHED +(navigation/reg-app-launched-listener + (fn [] + (navigation/set-default-options options/default-options) + (reset! state/curr-modal false) + (reset! state/dissmissing false) + (if (= @state/root-id :multiaccounts-stack) + (re-frame/dispatch-sync [:set-multiaccount-root]) + (when @state/root-id + (navigation/set-root (get (roots/roots) @state/root-id)) + (re-frame/dispatch [::login-core/check-last-chat]))) + (rn/hide-splash-screen))) + +(defn set-view-id + [view-id] + (when-let [{:keys [on-focus]} (get views/screens view-id)] + (re-frame/dispatch [:set-view-id view-id]) + (re-frame/dispatch [:screens/on-will-focus view-id]) + (when on-focus + (re-frame/dispatch on-focus)))) + +(navigation/reg-component-did-appear-listener + (fn [view-id] + (when (get views/screens view-id) + (set-view-id view-id) + (when-not @state/curr-modal + (reset! state/pushed-screen-id view-id))))) + +(defn dissmissModal + [] + (reset! state/dissmissing true) + (navigation/dismiss-modal (name (last @state/modals)))) (defn dismiss-all-modals [] - (log/debug "dissmiss-all-modals" - {:curr-modal @state/curr-modal - :modals @state/modals - :dissmissing @state/dissmissing}) (when @state/curr-modal (reset! state/curr-modal false) (reset! state/dissmissing true) @@ -36,53 +59,54 @@ (navigation/dismiss-modal (name modal))) (reset! state/modals []))) -(defn status-bar-options - [] - (if platform/android? - {:navigationBar {:backgroundColor (colors/theme-colors colors/white colors/neutral-100)} - :statusBar {:translucent true - :backgroundColor :transparent - :drawBehind true - :style (if (colors/dark?) :light :dark)}} - {:statusBar {:style (if (colors/dark?) :light :dark)}})) +;; ROOT +(re-frame/reg-fx + :set-root + (fn [root-id] + (let [root (get (roots/roots) root-id)] + (dismiss-all-modals) + (re-frame/dispatch [:multiaccounts.ui/switch-theme + (get roots/themes root-id) + root-id]) + (reset! state/root-id (or (get-in root [:root :stack :id]) root-id)) + (if root + (navigation/set-root root) + (println "root" root-id root))))) -;; PUSH SCREEN TO THE CURRENT STACK +;; NAVIGATE-TO (defn navigate [comp] - (log/debug "NAVIGATE" comp) (let [{:keys [options]} (get views/screens comp)] + (dismiss-all-modals) (navigation/push (name @state/root-id) {:component {:id comp :name comp - :options (merge (status-bar-options) + :options (merge (options/statusbar-and-navbar) + {:layout {:orientation :portrait}} options - (roots/merge-top-bar (roots/topbar-options) options))}}) - ;;if we push the screen from modal, we want to dismiss all modals - (dismiss-all-modals))) + (if (:topBar options) + (options/merge-top-bar (options/topbar-options) options) + {:topBar {:visible false}}))}}))) -;; OPEN MODAL -(defn update-modal-topbar-options - [options] - (log/debug "update-modal-topbar-options" options) - (merge options - ;; TODO fix colors and icons from quo2 later if needed - #_(roots/merge-top-bar {:elevation 0 - :noBorder true - :title {:color quo.colors/black} - :background {:color quo.colors/white} - :leftButtonColor quo.colors/black - :leftButtons {:id "dismiss-modal" - :icon (icons/icon-source :main-icons/close)}} - options))) +(re-frame/reg-fx :navigate-to navigate) +(re-frame/reg-fx :navigate-replace-fx + (fn [view-id] + (navigation/pop (name @state/root-id)) + (navigate view-id))) + +(re-frame/reg-fx :navigate-back + (fn [] + (if @state/curr-modal + (dissmissModal) + (navigation/pop (name @state/root-id))))) + +(re-frame/reg-fx :pop-to-root-fx navigation/pop-to-root) + +;; MODAL (defn open-modal [comp] - (log/debug "open-modal" - {:comp comp - :dissmissing @state/dissmissing - :curr-modal @state/curr-modal - :modals @state/modals}) (let [{:keys [options]} (get views/screens comp)] (if @state/dissmissing (reset! state/dissmissing comp) @@ -93,131 +117,90 @@ {:component {:name comp :id comp - :options (update-modal-topbar-options - (merge (roots/status-bar-options) - (roots/default-root) - options))}}))))) + :options (merge (options/statusbar-and-navbar) + (options/default-root) + options + (when (:sheet? options) + options/sheet-options))}}))))) (re-frame/reg-fx :open-modal-fx open-modal) -;; DISSMISS MODAL -(defn dissmissModal - [] - (log/debug "dissmissModal") - (reset! state/dissmissing true) - (navigation/dismiss-modal (name (last @state/modals)))) +(navigation/reg-button-pressed-listener + (fn [id] + (if (= "dismiss-modal" id) + (do + (when-let [event (get-in views/screens [(last @state/modals) :on-dissmiss])] + (re-frame/dispatch event)) + (dissmissModal)) + (when-let [handler (get-in views/screens [(keyword id) :right-handler])] + (handler))))) -(defn button-pressed-listener - [id] - (if (= "dismiss-modal" id) - (do - (when-let [event (get-in views/screens [(last @state/modals) :on-dissmiss])] - (re-frame/dispatch event)) - (dissmissModal)) - (when-let [handler (get-in views/screens [(keyword id) :right-handler])] - (handler)))) +(navigation/reg-modal-dismissed-listener + (fn [] + (if (> (count @state/modals) 1) + (let [new-modals (butlast @state/modals)] + (reset! state/modals (vec new-modals)) + (set-view-id (last new-modals))) + (do + (reset! state/modals []) + (reset! state/curr-modal false) + (set-view-id @state/pushed-screen-id))) -(defn set-view-id - [view-id] - (log/debug "set-view-id" view-id) - (when-let [{:keys [on-focus]} (get views/screens view-id)] - (re-frame/dispatch [:set-view-id view-id]) - (re-frame/dispatch [:screens/on-will-focus view-id]) - (when on-focus - (re-frame/dispatch on-focus)))) + (let [comp @state/dissmissing] + (reset! state/dissmissing false) + (when (keyword? comp) + (open-modal comp))))) -(defn modal-dismissed-listener - [] - (log/debug "modal-dismissed" - {:modals @state/modals - :curr-modal @state/curr-modal - :dissmissing @state/dissmissing}) - (if (> (count @state/modals) 1) - (let [new-modals (butlast @state/modals)] - (reset! state/modals (vec new-modals)) - (set-view-id (last new-modals))) - (do - (reset! state/modals []) - (reset! state/curr-modal false) - (set-view-id @state/pushed-screen-id))) +;; OVERLAY +(def dissmiss-overlay navigation/dissmiss-overlay) - (let [comp @state/dissmissing] - (reset! state/dissmissing false) - (when (keyword? comp) - (open-modal comp)))) +(defn show-overlay + ([comp] (show-overlay comp {})) + ([comp opts] + (dissmiss-overlay comp) + (navigation/show-overlay + {:component {:name comp + :id comp + :options (merge (options/statusbar) + {:layout {:componentBackgroundColor :transparent + :orientation :portrait} + :overlay {:interceptTouchOutside true}} + opts)}}))) -;; SCREEN DID APPEAR -(defn component-did-appear-listener - [view-id] - (log/debug "screen-appear-reg" view-id) - (when (get views/screens view-id) - (when (and (not= view-id :bottom-sheet) - (not= view-id :toasts) - (not= view-id :popover) - (not= view-id :visibility-status-popover)) - (set-view-id view-id) - (when-not @state/curr-modal - (reset! state/pushed-screen-id view-id))))) +;; toast +(navigation/register-component "toasts" (fn [] views/toasts) js/undefined) -;; SCREEN DID DISAPPEAR -(defn component-did-disappear-listener - [_] - #_(when-not (#{:popover :bottom-sheet :signing-sheet :visibility-status-popover :wallet-connect-sheet - :wallet-connect-success-sheet :wallet-connect-app-management-sheet} - view-id) - ;; TODO what to do ? - (doseq [[_ {:keys [ref value]}] @quo.text-input/text-input-refs] - (.setNativeProps ^js ref (clj->js {:text value}))) - (doseq [[^js text-input default-value] @react/text-input-refs] - (.setNativeProps text-input (clj->js {:text default-value}))))) +(re-frame/reg-fx :show-toasts + (fn [] + (show-overlay "toasts" + {:overlay {:interceptTouchOutside false} + :layout {:componentBackgroundColor :transparent}}))) +(re-frame/reg-fx :hide-toasts (fn [] (dissmiss-overlay "toasts"))) -;; APP LAUNCHED -(defn app-launched-listener - [] - (reset! state/curr-modal false) - (reset! state/dissmissing false) - (if (= @state/root-id :multiaccounts-stack) - (re-frame/dispatch-sync [::set-multiaccount-root]) - (when @state/root-id - (navigation/set-root (get (roots/roots) @state/root-id)) - (re-frame/dispatch [::login-core/check-last-chat]))) - (rn/hide-splash-screen)) +;; bottom sheet +(navigation/register-component "bottom-sheet" + (fn [] (gesture/gesture-handler-root-hoc views/bottom-sheet)) + (fn [] views/bottom-sheet)) -;; SET ROOT +(re-frame/reg-fx :show-bottom-sheet (fn [] (show-overlay "bottom-sheet"))) +(re-frame/reg-fx :hide-bottom-sheet (fn [] (dissmiss-overlay "bottom-sheet"))) + +;; MERGE OPTIONS (re-frame/reg-fx - :init-root-fx - (fn [new-root-id] - (let [root (get (roots/roots) new-root-id)] - (log/debug :init-root-fx new-root-id) - (dismiss-all-modals) - (re-frame/dispatch [:multiaccounts.ui/switch-theme - (get roots/themes new-root-id) - new-root-id]) - (reset! state/root-id (or (get-in root [:root :stack :id]) new-root-id)) - (navigation/set-root root)))) - -(rf/defn set-multiaccount-root - {:events [::set-multiaccount-root]} - [{:keys [db]}] - (log/debug :set-multiaccounts-root) - (let [key-uid (get-in db [:multiaccounts/login :key-uid]) - keycard-account? (boolean (get-in db - [:multiaccounts/multiaccounts - key-uid - :keycard-pairing]))] - {:init-root-fx (if keycard-account? :multiaccounts-keycard :multiaccounts)})) + :merge-options + (fn [{:keys [id options]}] + (navigation/merge-options id options))) +;; LEGACY (should be removed in status 2.0) (defn get-screen-component [comp] - (log/debug :get-screen-component comp) (let [{:keys [options]} (get views/screens comp)] {:component {:id comp :name comp - :options (merge (roots/status-bar-options) + :options (merge (options/statusbar-and-navbar) options - (roots/merge-top-bar (roots/topbar-options) options))}})) + (options/merge-top-bar (options/topbar-options) options))}})) -;; SET STACK ROOT (re-frame/reg-fx :set-stack-root-fx (fn [[stack comp]] @@ -233,50 +216,14 @@ (mapv get-screen-component comp) (get-screen-component comp)))))) -;; OVERLAY (Popover and bottom sheets) -(def dissmiss-overlay navigation/dissmiss-overlay) - -(defn show-overlay - ([comp] (show-overlay comp {})) - ([comp opts] - (dissmiss-overlay comp) - (navigation/show-overlay - {:component {:name comp - :id comp - :options (merge (cond-> (roots/status-bar-options) - (and platform/android? (not (colors/dark?))) - (assoc-in [:statusBar :backgroundColor] "#99999A")) - {:layout {:componentBackgroundColor (if platform/android? - colors/neutral-80-opa-20 ;; TODO - ;; adjust - ;; color - "transparent")} - :overlay {:interceptTouchOutside true}} - opts)}}))) - -;; POPOVER (re-frame/reg-fx :show-popover (fn [] (show-overlay "popover"))) (re-frame/reg-fx :hide-popover (fn [] (dissmiss-overlay "popover"))) - -;; TOAST -(re-frame/reg-fx :show-toasts - (fn [] - (show-overlay "toasts" - {:overlay {:interceptTouchOutside false} - :layout {:componentBackgroundColor :transparent}}))) -(re-frame/reg-fx :hide-toasts (fn [] (dissmiss-overlay "toasts"))) - -;; VISIBILITY STATUS POPOVER (re-frame/reg-fx :show-visibility-status-popover (fn [] (show-overlay "visibility-status-popover"))) (re-frame/reg-fx :hide-visibility-status-popover (fn [] (dissmiss-overlay "visibility-status-popover"))) - -;; BOTTOM SHEETS -(re-frame/reg-fx :show-bottom-sheet-overlay (fn [] (show-overlay "bottom-sheet"))) -(re-frame/reg-fx :dismiss-bottom-sheet-overlay (fn [] (dissmiss-overlay "bottom-sheet"))) - -;; WALLET CONNECT +(re-frame/reg-fx :show-bottom-sheet-overlay-old (fn [] (show-overlay "bottom-sheet-old"))) +(re-frame/reg-fx :dismiss-bottom-sheet-overlay-old (fn [] (dissmiss-overlay "bottom-sheet-old"))) (re-frame/reg-fx :show-wallet-connect-sheet (fn [] (show-overlay "wallet-connect-sheet"))) (re-frame/reg-fx :hide-wallet-connect-sheet (fn [] (dissmiss-overlay "wallet-connect-sheet"))) (re-frame/reg-fx :show-wallet-connect-success-sheet @@ -287,44 +234,27 @@ (fn [] (show-overlay "wallet-connect-app-management-sheet"))) (re-frame/reg-fx :hide-wallet-connect-app-management-sheet (fn [] (dissmiss-overlay "wallet-connect-app-management-sheet"))) - -;; SIGNING (re-frame/reg-fx :show-signing-sheet (fn [] (show-overlay "signing-sheet"))) (re-frame/reg-fx :hide-signing-sheet (fn [] (dissmiss-overlay "signing-sheet"))) - -;; Select account (re-frame/reg-fx :show-select-acc-sheet (fn [] (show-overlay "select-acc-sheet"))) (re-frame/reg-fx :hide-select-acc-sheet (fn [] (dissmiss-overlay "select-acc-sheet"))) (defonce _ - [(navigation/set-default-options {:layout {:orientation "portrait"}}) - (navigation/set-lazy-component-registrator reg-comp) - (navigation/reg-button-pressed-listener button-pressed-listener) - (navigation/reg-modal-dismissed-listener modal-dismissed-listener) - (navigation/reg-component-did-appear-listener component-did-appear-listener) - (navigation/reg-component-did-disappear-listener component-did-disappear-listener) - (navigation/reg-app-launched-listener app-launched-listener) - - (navigation/register-component + [(navigation/register-component "popover" (fn [] (gesture/gesture-handler-root-hoc views/popover-comp)) (fn [] views/popover-comp)) - (navigation/register-component - "toasts" - (fn [] views/toasts-comp) - js/undefined) - (navigation/register-component "visibility-status-popover" (fn [] (gesture/gesture-handler-root-hoc views/visibility-status-popover-comp)) (fn [] views/visibility-status-popover-comp)) (navigation/register-component - "bottom-sheet" - (fn [] (gesture/gesture-handler-root-hoc views/sheet-comp)) - (fn [] views/sheet-comp)) + "bottom-sheet-old" + (fn [] (gesture/gesture-handler-root-hoc views/sheet-comp-old)) + (fn [] views/sheet-comp-old)) (navigation/register-component "wallet-connect-sheet" @@ -350,43 +280,3 @@ "select-acc-sheet" (fn [] (gesture/gesture-handler-root-hoc views/select-acc-comp)) (fn [] views/select-acc-comp))]) - -;; NAVIGATION - -(re-frame/reg-fx - :navigate-to-fx - (fn [key] - (log/debug :navigate-to-fx key) - (navigate key))) - -(re-frame/reg-fx - :navigate-back-fx - (fn [] - (log/debug :navigate-back-fx) - (if @state/curr-modal - (dissmissModal) - (navigation/pop (name @state/root-id))))) - -(re-frame/reg-fx - :navigate-replace-fx - (fn [view-id] - (log/debug :navigate-replace-fx view-id) - (navigation/pop (name @state/root-id)) - (navigate view-id))) - -;; NAVIGATION 2 - -(re-frame/reg-fx - :change-root-status-bar-style-fx - (fn [style] - (navigation/merge-options "shell-stack" {:statusBar {:style style}}))) - -(re-frame/reg-fx - :change-root-nav-bar-color-fx - (fn [color] - (navigation/merge-options "shell-stack" {:navigationBar {:backgroundColor color}}))) - -(re-frame/reg-fx - :pop-to-root-fx - (fn [tab] - (navigation/pop-to-root tab))) diff --git a/src/status_im2/navigation/events.cljs b/src/status_im2/navigation/events.cljs index a6c5447df5..edd74ed7ee 100644 --- a/src/status_im2/navigation/events.cljs +++ b/src/status_im2/navigation/events.cljs @@ -10,33 +10,43 @@ (seq screen-params) (assoc-in [:navigation/screen-params view] screen-params))) -(rf/defn navigate-to-cofx - [{:keys [db] :as cofx} go-to-view-id screen-params] +(rf/defn navigate-to + {:events [:navigate-to]} + [{:keys [db]} go-to-view-id screen-params] (merge - {:db (-> (assoc db :view-id go-to-view-id) - (all-screens-params go-to-view-id screen-params)) - :navigate-to-fx go-to-view-id} + {:db (-> (assoc db :view-id go-to-view-id) + (all-screens-params go-to-view-id screen-params)) + :navigate-to go-to-view-id + :dispatch [:hide-bottom-sheet]} (when (#{:chat :community-overview} go-to-view-id) {:dispatch-later ;; 300 ms delay because, navigation is priority over shell card update [{:dispatch [:shell/add-switcher-card go-to-view-id screen-params] :ms 300}]}))) -(rf/defn navigate-to - {:events [:navigate-to]} - [cofx go-to-view-id screen-params] - (navigate-to-cofx cofx go-to-view-id screen-params)) +(rf/defn open-modal + {:events [:open-modal]} + [{:keys [db]} comp screen-params] + {:db (-> (assoc db :view-id comp) + (all-screens-params comp screen-params)) + :dispatch [:hide-bottom-sheet] + :open-modal-fx comp}) (rf/defn navigate-back {:events [:navigate-back]} [_] - {:navigate-back-fx nil}) + {:navigate-back nil}) (rf/defn pop-to-root {:events [:pop-to-root]} [_ tab] {:pop-to-root-fx tab}) +(rf/defn init-root + {:events [:init-root]} + [_ root-id] + {:set-root root-id}) + (rf/defn set-stack-root {:events [:set-stack-root]} [_ stack root] @@ -56,18 +66,41 @@ {:db db :navigate-replace-fx go-to-view-id})) -(rf/defn open-modal - {:events [:open-modal]} - [{:keys [db]} comp screen-params] - {:db (-> (assoc db :view-id comp) - (all-screens-params comp screen-params)) - :open-modal-fx comp}) +(rf/defn hide-bottom-sheet + {:events [:hide-bottom-sheet]} + [{:keys [db]}] + (let [{:keys [hide? sheets]} (:bottom-sheet db)] + (println :hide-bottom-sheet (not hide?) (seq sheets)) + (when (and (not hide?) (seq sheets)) + {:db (assoc-in db [:bottom-sheet :hide?] true)}))) -(rf/defn init-root - {:events [:init-root]} - [_ root-id] - {:init-root-fx root-id}) +(rf/defn bottom-sheet-hidden + {:events [:bottom-sheet-hidden]} + [{:keys [db]}] + (let [{:keys [sheets]} (:bottom-sheet db) + rest-sheets (butlast sheets)] + (merge + {:db (assoc db :bottom-sheet {:sheets rest-sheets :hide? false}) + :hide-bottom-sheet nil} + (when (seq rest-sheets) + {:dispatch [:show-next-bottom-sheet]})))) +(rf/defn show-next-bottom-sheet + {:events [:show-next-bottom-sheet]} + [_] + {:show-bottom-sheet nil}) + +(rf/defn show-bottom-sheet + {:events [:show-bottom-sheet]} + [{:keys [db]} content] + (let [{:keys [sheets hide?]} (:bottom-sheet db)] + (rf/merge {:db (update-in db [:bottom-sheet :sheets] #(conj % content))} + #(when-not hide? + (if (seq sheets) + (hide-bottom-sheet %) + {:show-bottom-sheet nil}))))) + +;; LEGACY (should be removed in status 2.0) (rf/defn hide-signing-sheet {:events [:hide-signing-sheet]} [_] @@ -98,19 +131,12 @@ (dissoc :wallet-connect/session-managed)) :hide-wallet-connect-app-management-sheet nil}) -;; NAVIGATION 2 -(rf/defn reload-new-ui - {:events [:reload-new-ui]} - [_] - {:shell/reset-bottom-tabs nil - :dispatch [:init-root :shell-stack]}) - -(rf/defn change-root-status-bar-style - {:events [:change-root-status-bar-style]} - [_ style] - {:change-root-status-bar-style-fx style}) - -(rf/defn change-root-nav-bar-color - {:events [:change-root-nav-bar-color]} - [_ color] - {:change-root-nav-bar-color-fx color}) +(rf/defn set-multiaccount-root + {:events [:set-multiaccount-root]} + [{:keys [db]}] + (let [key-uid (get-in db [:multiaccounts/login :key-uid]) + keycard-account? (boolean (get-in db + [:multiaccounts/multiaccounts + key-uid + :keycard-pairing]))] + {:set-root (if keycard-account? :multiaccounts-keycard :multiaccounts)})) diff --git a/src/status_im2/navigation/options.cljs b/src/status_im2/navigation/options.cljs new file mode 100644 index 0000000000..3a43ca0584 --- /dev/null +++ b/src/status_im2/navigation/options.cljs @@ -0,0 +1,110 @@ +(ns status-im2.navigation.options + (:require [quo2.foundations.colors :as colors] + [react-native.platform :as platform])) + +(defn default-options + [] + {:layout {:orientation :portrait} + :topBar {:visible false}}) + +(defn statusbar-and-navbar-root + [] + (if platform/android? + {:navigationBar {:backgroundColor colors/neutral-100} + :statusBar {:translucent true + :backgroundColor :transparent + :style :light + :drawBehind true}} + {:statusBar {:style :light}})) + +(defn default-root + [] + (merge (statusbar-and-navbar-root) + {:topBar {:visible false} + :layout {:componentBackgroundColor (colors/theme-colors colors/white colors/neutral-100) + :orientation :portrait + :backgroundColor (colors/theme-colors colors/white colors/neutral-100)}})) + +(defn navbar + [] + {:navigationBar {:backgroundColor (colors/theme-colors colors/white colors/neutral-100)}}) + +(defn statusbar + [] + (if platform/android? + {:statusBar {:translucent true + :backgroundColor :transparent + :drawBehind true + :style (if (colors/dark?) :light :dark)}} + {:statusBar {:style (if (colors/dark?) :light :dark)}})) + + +(defn statusbar-and-navbar + [] + (merge (navbar) (statusbar))) + +(defn topbar-options + [] + {:noBorder true + :scrollEdgeAppearance {:active false + :noBorder true} + :elevation 0 + :title {:color (colors/theme-colors colors/neutral-100 colors/white)} + :rightButtonColor (colors/theme-colors colors/neutral-100 colors/white) + :background {:color (colors/theme-colors colors/white colors/neutral-100)} + :backButton {:color (colors/theme-colors colors/neutral-100 colors/white) + :testID :back-button}}) + +(def transparent-screen-options + (merge + {:modalPresentationStyle :overCurrentContext + :layout {:componentBackgroundColor :transparent + :orientation :portrait + :backgroundColor :transparent}} + (if platform/android? + {:statusBar {:backgroundColor :transparent + :style :light + :drawBehind true}} + {:statusBar {:style :light}}))) + +(def sheet-options + {:layout {:componentBackgroundColor :transparent + :backgroundColor :transparent} + :modalPresentationStyle :overCurrentContext}) + +(def lightbox + {:topBar {:visible false} + :statusBar {:backgroundColor :transparent + :style :light + :animate true + :drawBehind true + :translucent true} + :navigationBar {:backgroundColor colors/black} + :layout {:componentBackgroundColor :transparent + :backgroundColor :transparent} + :animations {:push {:sharedElementTransitions [{:fromId :shared-element + :toId :shared-element + :interpolation {:type :decelerate + :factor 1.5}}]} + :pop {:sharedElementTransitions [{:fromId :shared-element + :toId :shared-element + :interpolation {:type + :decelerate + :factor 1.5}}]}}}) + +(defn merge-top-bar + [root-options options] + (let [options (:topBar options)] + {:topBar + (merge root-options + options + (when (or (:title root-options) (:title options)) + {:title (merge (:title root-options) (:title options))}) + (when (or (:background root-options) (:background options)) + {:background (merge (:background root-options) (:background options))}) + (when (or (:backButton root-options) (:backButton options)) + {:backButton (merge (:backButton root-options) (:backButton options))}) + (when (or (:leftButtons root-options) (:leftButtons options)) + {:leftButtons (merge (:leftButtons root-options) (:leftButtons options))}) + (when (or (:rightButtons root-options) (:rightButtons options)) + {:rightButtons (merge (:rightButtons root-options) (:rightButtons options))}))})) diff --git a/src/status_im2/navigation/roots.cljs b/src/status_im2/navigation/roots.cljs index 722a948f7f..02fd232fe6 100644 --- a/src/status_im2/navigation/roots.cljs +++ b/src/status_im2/navigation/roots.cljs @@ -1,78 +1,26 @@ (ns status-im2.navigation.roots - (:require [status-im2.constants :as constants] - [quo2.foundations.colors :as colors] - [react-native.platform :as platform] - [status-im2.navigation.view :as views] - [status-im2.navigation.state :as state])) - -(defn status-bar-options - [] - ;; dark-mode? = After login we are going to use theme as per user's choice (colors/dark?) - ;; but before login we only have dark mode (dark-mode? = true) - (let [dark-mode? (if (= @state/root-id :shell-stack) (colors/dark?) true)] - (if platform/android? - {:navigationBar {:backgroundColor colors/neutral-100} - :statusBar {:backgroundColor :transparent - :style (if dark-mode? :light :dark) - :drawBehind true}} - {:statusBar {:style (if dark-mode? :light :dark)}}))) - -(defn topbar-options - [] - {:noBorder true - :scrollEdgeAppearance {:active false - :noBorder true} - :elevation 0 - :title {:color (colors/theme-colors colors/neutral-100 colors/white)} - :rightButtonColor (colors/theme-colors colors/neutral-100 colors/white) - :background {:color (colors/theme-colors colors/white colors/neutral-100)} - :backButton {:color (colors/theme-colors colors/neutral-100 colors/white) - :testID :back-button}}) - -(defn default-root - [] - {:layout {:componentBackgroundColor (colors/theme-colors colors/white colors/neutral-100) - :orientation "portrait" - :backgroundColor (colors/theme-colors colors/white colors/neutral-100)}}) - -(defn merge-top-bar - [root-options options] - (let [options (:topBar options)] - {:topBar - (merge root-options - options - (when (or (:title root-options) (:title options)) - {:title (merge (:title root-options) (:title options))}) - (when (or (:background root-options) (:background options)) - {:background (merge (:background root-options) (:background options))}) - (when (or (:backButton root-options) (:backButton options)) - {:backButton (merge (:backButton root-options) (:backButton options))}) - (when (or (:leftButtons root-options) (:leftButtons options)) - {:leftButtons (merge (:leftButtons root-options) (:leftButtons options))}) - (when (or (:rightButtons root-options) (:rightButtons options)) - {:rightButtons (merge (:rightButtons root-options) (:rightButtons options))}))})) + (:require [status-im2.navigation.view :as views] + [status-im2.navigation.options :as options] + [status-im2.constants :as constants])) (defn get-screen-options [screen] (merge (get-in views/screens [screen :options]) - (status-bar-options) - (merge-top-bar (topbar-options) - (get-in views/screens [screen :options])))) + (options/statusbar-and-navbar-root) + (options/merge-top-bar (options/topbar-options) + (get-in views/screens [screen :options])))) -;;TODO problem here is that we have two places for screens, here and in screens ns, and we have handler -;;in navigate (defn old-roots [] - ;;TABS {;; ONBOARDING :onboarding {:root {:stack {:id :onboarding :children [{:component {:name :get-your-keys :id :get-your-keys - :options (status-bar-options)}}] - :options (merge (default-root) - (status-bar-options) - {:topBar (assoc (topbar-options) + :options (options/statusbar-and-navbar-root)}}] + :options (merge (options/default-root) + (options/statusbar-and-navbar-root) + {:topBar (assoc (options/topbar-options) :elevation 0 :noBorder true :animate false)})}}} @@ -81,9 +29,9 @@ :progress {:root {:stack {:children [{:component {:name :progress :id :progress - :options (status-bar-options)}}] - :options (merge (default-root) - {:topBar (assoc (topbar-options) :visible false)})}}} + :options (options/statusbar-and-navbar-root)}}] + :options (merge (options/default-root) + {:topBar (assoc (options/topbar-options) :visible false)})}}} ;;LOGIN :multiaccounts @@ -94,9 +42,9 @@ {:component {:name :login :id :login :options (get-screen-options :login)}}] - :options (merge (default-root) - (status-bar-options) - {:topBar (topbar-options)})}}} + :options (merge (options/default-root) + (options/statusbar-and-navbar-root) + {:topBar (options/topbar-options)})}}} :multiaccounts-keycard {:root {:stack {:id :multiaccounts-stack @@ -106,27 +54,27 @@ {:component {:name :keycard-login-pin :id :keycard-login-pin :options (get-screen-options :keycard-login-pin)}}] - :options (merge (default-root) - (status-bar-options) - {:topBar (topbar-options)})}}} + :options (merge (options/default-root) + (options/statusbar-and-navbar-root) + {:topBar (options/topbar-options)})}}} ;;NOTIFICATIONS :onboarding-notification {:root {:stack {:children [{:component {:name :onboarding-notification :id :onboarding-notification - :options (status-bar-options)}}] - :options (merge (default-root) - (status-bar-options) - {:topBar (assoc (topbar-options) :visible false)})}}} + :options (options/statusbar-and-navbar-root)}}] + :options (merge (options/default-root) + (options/statusbar-and-navbar-root) + {:topBar (assoc (options/topbar-options) :visible false)})}}} ;; TERMS OF SERVICE :tos {:root {:stack {:children [{:component {:name :force-accept-tos :id :force-accept-tos :options (get-screen-options :force-accept-tos)}}] - :options (merge (default-root) - (status-bar-options) - {:topBar (assoc (topbar-options) :visible false)})}}}}) + :options (merge (options/default-root) + (options/statusbar-and-navbar-root) + {:topBar (assoc (options/topbar-options) :visible false)})}}}}) ;; Theme Order for navigation roots ;; 1. Themes hardcoded in below map @@ -140,42 +88,33 @@ (defn roots [] - ;;TABS (merge (old-roots) - ;;INTRO (onboarding carousel) + {:intro {:root {:stack {:id :intro :children [{:component {:name :intro :id :intro - :options (merge (status-bar-options) - {:topBar {:visible false}})}}]}}}} - {:shell-stack + :options (options/default-root)}}]}}} + :shell-stack {:root {:stack {:id :shell-stack :children [{:component {:name :shell-stack :id :shell-stack - :options (merge (status-bar-options) - {:topBar {:visible false}})}}]}}} + :options (options/default-root)}}]}}} :profiles {:root {:stack {:id :profiles :children [{:component {:name :profiles :id :profiles - :options (merge - (status-bar-options) - {:topBar {:visible false}})}}]}}}} - {:enable-notifications + :options (options/default-root)}}]}}} + + :enable-notifications {:root {:stack {:children [{:component {:name :enable-notifications :id :enable-notifications - :options (merge - (status-bar-options) - {:statusBar {:style :light} - :topBar {:visible false}})}}]}}}} - {:welcome + :options (options/default-root)}}]}}} + + :welcome {:root {:stack {:children [{:component {:name :welcome :id :welcome - :options (merge - (status-bar-options) - {:statusBar {:style :light} - :topBar {:visible false}})}}]}}}})) + :options (options/default-root)}}]}}}})) diff --git a/src/status_im2/navigation/screens.cljs b/src/status_im2/navigation/screens.cljs index 51e40ad852..49e7ec1474 100644 --- a/src/status_im2/navigation/screens.cljs +++ b/src/status_im2/navigation/screens.cljs @@ -1,8 +1,6 @@ (ns status-im2.navigation.screens (:require - [quo2.foundations.colors :as colors] [react-native.platform :as platform] - [status-im.ui.screens.screens :as old-screens] [status-im2.config :as config] [status-im2.contexts.activity-center.view :as activity-center] [status-im2.contexts.add-new-contact.views :as add-new-contact] @@ -26,195 +24,104 @@ [status-im2.contexts.onboarding.profiles.view :as profiles] [status-im2.contexts.quo-preview.main :as quo.preview] [status-im2.contexts.shell.view :as shell] - [status-im2.contexts.syncing.view :as settings-syncing])) + [status-im2.contexts.syncing.view :as settings-syncing] + [status-im2.navigation.options :as options] + [status-im2.contexts.chat.group-details.view :as group-details] -(def components - []) - -(def transparent-screen-options - (merge - {:topBar {:visible false} - :modalPresentationStyle :overCurrentContext - :layout {:componentBackgroundColor :transparent - :orientation :portrait - :backgroundColor :transparent}} - (if platform/android? - {:statusBar {:backgroundColor :transparent - :style :light - :drawBehind true}} - {:statusBar {:style :light}}))) - -(def bottom-sheet-options - {:topBar {:visible false} - :layout {:componentBackgroundColor :transparent - :backgroundColor :transparent} - :modalPresentationStyle :overCurrentContext}) - -(def bottom-sheet-insets - {:top false}) + [status-im.ui.screens.screens :as old-screens] + [status-im2.contexts.communities.menus.request-to-join.view :as join-menu])) (defn screens [] (concat (old-screens/screens) + [{:name :intro - :options {:topBar {:visible false}} - :insets {:top false} :component intro/view} {:name :activity-center - :insets {:top false} - :options transparent-screen-options + :options options/transparent-screen-options :component activity-center/view} {:name :shell-stack - :insets {:top false} :component shell/shell-stack} {:name :chat - :options {:topBar {:visible false}} + :options {:insets {:top? true}} :component chat/chat} + {:name :group-add-manage-members + :options {:sheet? true} + :component group-details/add-manage-members} + + {:name :community-requests-to-join + :options {:sheet? true} + :component join-menu/request-to-join} + {:name :lightbox - :insets {:top false :bottom false} - :options {:topBar {:visible false} - :statusBar {:backgroundColor :transparent - :style :light - :animate true - :drawBehind true - :translucent true} - :navigationBar {:backgroundColor colors/black} - :layout {:componentBackgroundColor :transparent - :backgroundColor :transparent} - :animations {:push {:sharedElementTransitions [{:fromId :shared-element - :toId :shared-element - :interpolation {:type :decelerate - :factor 1.5}}]} - :pop {:sharedElementTransitions [{:fromId :shared-element - :toId :shared-element - :interpolation {:type - :decelerate - :factor 1.5}}]}}} + :options options/lightbox :component lightbox/lightbox} + {:name :photo-selector - :insets bottom-sheet-insets - :options bottom-sheet-options + :options {:sheet? true} :component photo-selector/photo-selector} {:name :album-selector - :options {:topBar {:visible false} - :modalPresentationStyle (if platform/ios? :overCurrentContext :none)} + :options {:modalPresentationStyle (if platform/ios? :overCurrentContext :none)} :component album-selector/album-selector} {:name :new-contact - :options {:topBar {:visible false}} :component add-new-contact/new-contact} {:name :discover-communities - :options {:topBar {:visible false}} :component communities.discover/discover} {:name :community-overview - :options {:topBar {:visible false}} :component communities.overview/overview} {:name :settings-syncing - :insets {:top false} :options {:statusBar {:style :light} - :topBar {:visible false}} + :insets {:top false}} :component settings-syncing/view} - ;; Onboarding {:name :profiles - :insets {:top false} :component profiles/views} - ;; Onboarding - new to Status {:name :new-to-status - :options {:statusBar {:style :light} - :topBar {:visible false}} - :insets {:top false} :component new-to-status/new-to-status} {:name :create-profile - :options {:statusBar {:style :light} - :topBar {:visible false}} - :insets {:top false} - :component new-to-status/new-to-status} - - {:name :create-profile - :options {:statusBar {:style :light} - :topBar {:visible false} - :navigationBar {:backgroundColor colors/black}} - :insets {:top false} :component create-profile/create-profile} {:name :create-profile-password - :options {:statusBar {:style :light} - :topBar {:visible false - :backButton {:popStackOnPress false}} - - :navigationBar {:backgroundColor colors/black}} - :insets {:top false} + :options {:insets {:top false}} :component create-password/create-password} {:name :enable-biometrics - :options {:statusBar {:style :light} - :topBar {:visible false} - :navigationBar {:backgroundColor colors/black}} - :insets {:top false} :component enable-biometrics/enable-biometrics} {:name :generating-keys - :options {:statusBar {:style :light} - :navigationBar {:backgroundColor colors/black} - :popGesture false + :options {:popGesture false :hardwareBackButton {:dismissModalOnPress false - :popStackOnPress false} - :topBar {:visible false - :backButton {:popStackOnPress false}}} - :insets {:top false} + :popStackOnPress false}} :component generating-keys/generating-keys} {:name :enter-seed-phrase - :options {:statusBar {:style :light} - :topBar {:visible false} - :navigationBar {:backgroundColor colors/black}} - :insets {:top false} :component enter-seed-phrase/enter-seed-phrase} {:name :enable-notifications - :options {:statusBar {:style :light} - :navigationBar {:backgroundColor colors/black} - :popGesture false + :options {:popGesture false :hardwareBackButton {:dismissModalOnPress false - :popStackOnPress false} - :topBar {:visible false - :backButton {:popStackOnPress false}}} - :insets {:top false} + :popStackOnPress false}} :component enable-notifications/enable-notifications} {:name :sign-in - :options {:statusBar {:style :light - :backgroundColor :transparent - :translucent true} - :topBar {:visible false} - :navigationBar {:backgroundColor colors/black}} - :insets {:top false} :component sign-in/view} {:name :syncing-devices - :options {:statusBar {:style :light} - :topBar {:visible false} - :navigationBar {:backgroundColor colors/black}} - :insets {:top false} :component syncing-devices/syncing-devices} {:name :welcome - :options {:statusBar {:style :light} - :topBar {:visible false} - :navigationBar {:backgroundColor colors/black}} - :insets {:top false} :component welcome/view}] (when config/quo-preview-enabled? diff --git a/src/status_im2/navigation/view.cljs b/src/status_im2/navigation/view.cljs index cd0a41b6f9..6e15da727b 100644 --- a/src/status_im2/navigation/view.cljs +++ b/src/status_im2/navigation/view.cljs @@ -1,11 +1,10 @@ (ns status-im2.navigation.view (:require [quo2.foundations.colors :as colors] - [re-frame.core :as re-frame] [react-native.core :as rn] [react-native.safe-area :as safe-area] [reagent.core :as reagent] - [status-im.keycard.test-menu :as keycard.test-menu] - [status-im2.common.bottom-sheet.sheets :as bottom-sheets] + [status-im.bottom-sheet.sheets :as bottom-sheets-old] + [status-im2.common.bottom-sheet.view :as bottom-sheet] [status-im.ui.screens.popover.views :as popover] [status-im.ui.screens.profile.visibility-status.views :as visibility-status-views] [status-im.ui.screens.signing.views :as signing] @@ -13,8 +12,9 @@ [status-im.ui.screens.wallet.send.views :as wallet.send.views] [status-im2.common.toasts.view :as toasts] [status-im2.navigation.screens :as screens] - [status-im2.config :as config] - [status-im2.setup.hot-reload :as reloader])) + [status-im2.setup.hot-reload :as reloader] + [utils.re-frame :as rf] + [status-im2.common.bottom-sheet-screen.view :as bottom-sheet-screen])) (defn get-screens [] @@ -24,31 +24,11 @@ {} (screens/screens))) -;;we need this for hot reload (for some reason it doesn't reload, so we have to call get-screens if -;;debug -;;true) (def screens (get-screens)) -(def components - (reduce - (fn [acc {:keys [name component]}] - (assoc acc name component)) - {} - (concat screens/components))) - -(defn wrapped-screen-style - [insets-options insets background-color] - (merge - {:flex 1 - :background-color (or background-color (colors/theme-colors colors/white colors/neutral-100))} - (when (get insets-options :bottom) - {:padding-bottom (:bottom insets)}) - (when (get insets-options :top true) - {:padding-top (:top insets)}))) - (defn inactive [] - (when @(re-frame/subscribe [:hide-screen?]) + (when (rf/sub [:hide-screen?]) [rn/view {:position :absolute :flex 1 @@ -59,13 +39,25 @@ :background-color (colors/theme-colors colors/white colors/neutral-100) :z-index 999999999999999999}])) +(defn wrapped-screen-style + [{:keys [top? bottom?]} insets background-color] + (merge + {:flex 1 + :background-color (or background-color (colors/theme-colors colors/white colors/neutral-100))} + (when bottom? + {:padding-bottom (:bottom insets)}) + (when top? + {:padding-top (:top insets)}))) + (defn screen [key] (reagent.core/reactify-component (fn [] - (let [{:keys [component insets options]} - (get (if js/goog.DEBUG (get-screens) screens) (keyword key)) - background-color (get-in options [:layout :backgroundColor])] + (let [{:keys [component options]} + (get (if js/goog.DEBUG (get-screens) screens) (keyword key)) ;; needed for hot reload + {:keys [insets sheet?]} options + background-color (or (get-in options [:layout :backgroundColor]) + (when sheet? :transparent))] ^{:key (str "root" key @reloader/cnt)} [safe-area/provider [safe-area/consumer @@ -73,17 +65,34 @@ [rn/view {:style (wrapped-screen-style insets safe-insets background-color)} [inactive] - [component]])] + (if sheet? + [bottom-sheet-screen/view component] + [component])])] (when js/goog.DEBUG [reloader/reload-view])])))) -(defn component - [comp] +(def bottom-sheet (reagent/reactify-component (fn [] - [rn/view {:width 500 :height 44} - [comp]]))) + ^{:key (str "sheet" @reloader/cnt)} + [safe-area/provider + [inactive] + [safe-area/consumer + (fn [insets] + (let [{:keys [sheets hide?]} (rf/sub [:bottom-sheet]) + sheet (last sheets)] + [rn/keyboard-avoiding-view + {:style {:position :relative :flex 1} + :keyboard-vertical-offset (- (max 20 (:bottom insets)))} + (when sheet + [:f> + bottom-sheet/view + {:insets insets :hide? hide?} + sheet])]))]]))) +(def toasts (reagent/reactify-component toasts/toasts)) + +;; LEGACY (should be removed in status 2.0) (def popover-comp (reagent/reactify-component (fn [] @@ -94,13 +103,6 @@ (when js/goog.DEBUG [reloader/reload-view])]))) -(def toasts-comp - (reagent/reactify-component - (fn [] - ;; DON'T wrap this in safe-area-provider, it makes it unable to click through toasts - ^{:key (str "toasts" @reloader/cnt)} - [toasts/toasts]))) - (def visibility-status-popover-comp (reagent/reactify-component (fn [] @@ -111,17 +113,13 @@ (when js/goog.DEBUG [reloader/reload-view])]))) -(def sheet-comp +(def sheet-comp-old (reagent/reactify-component (fn [] - ^{:key (str "sheet" @reloader/cnt)} + ^{:key (str "sheet-old" @reloader/cnt)} [safe-area/provider [inactive] - [bottom-sheets/bottom-sheet] - (when js/goog.DEBUG - [reloader/reload-view]) - (when config/keycard-test-menu-enabled? - [keycard.test-menu/test-menu])]))) + [bottom-sheets-old/bottom-sheet]]))) (def signing-comp (reagent/reactify-component diff --git a/src/status_im2/subs/general.cljs b/src/status_im2/subs/general.cljs index 7f0b442250..4ac3d95a67 100644 --- a/src/status_im2/subs/general.cljs +++ b/src/status_im2/subs/general.cljs @@ -199,7 +199,7 @@ (or seed {:step :intro}))) (re-frame/reg-sub - :bottom-sheet + :bottom-sheet-old :<- [:bottom-sheet/show?] :<- [:bottom-sheet/view] :<- [:bottom-sheet/options] diff --git a/src/status_im2/subs/root.cljs b/src/status_im2/subs/root.cljs index 0e570fbf41..b8d6a2c939 100644 --- a/src/status_im2/subs/root.cljs +++ b/src/status_im2/subs/root.cljs @@ -35,11 +35,14 @@ (reg-root-key-sub :shared-element-id :shared-element-id) -;;bottom sheet +;;bottom sheet old (reg-root-key-sub :bottom-sheet/show? :bottom-sheet/show?) (reg-root-key-sub :bottom-sheet/view :bottom-sheet/view) (reg-root-key-sub :bottom-sheet/options :bottom-sheet/options) +;;bottom sheet +(reg-root-key-sub :bottom-sheet :bottom-sheet) + ;;general (reg-root-key-sub :sync-state :sync-state) (reg-root-key-sub :network-status :network-status) diff --git a/src/utils/worklets/bottom_sheet.cljs b/src/utils/worklets/bottom_sheet.cljs index a8948cafa1..fdb8918b98 100644 --- a/src/utils/worklets/bottom_sheet.cljs +++ b/src/utils/worklets/bottom_sheet.cljs @@ -7,5 +7,5 @@ (.useTranslateY ^js bottom-sheet-js window-height bottom-sheet-dy pan-y)) (defn use-background-opacity - [translate-y bg-height window-height] - (.useBackgroundOpacity ^js bottom-sheet-js translate-y bg-height window-height)) + [translate-y bg-height window-height opacity] + (.useBackgroundOpacity ^js bottom-sheet-js translate-y bg-height window-height opacity)) diff --git a/test/appium/tests/critical/chats/test_1_1_public_chats.py b/test/appium/tests/critical/chats/test_1_1_public_chats.py index a16f175e3b..d7a3069142 100644 --- a/test/appium/tests/critical/chats/test_1_1_public_chats.py +++ b/test/appium/tests/critical/chats/test_1_1_public_chats.py @@ -1060,7 +1060,7 @@ class TestOneToOneChatMultipleSharedDevicesNewUi(MultipleSharedDeviceTestCase): self.chat_1.pinned_messages_list.message_element_by_text( self.message_2).click_inside_element_by_coordinate() self.home_1.just_fyi("Unpin one message so that another could be pinned") - self.chat_1.element_by_translation_id('unpin-from-chat').double_click() + self.chat_1.element_by_translation_id('unpin-from-chat').click() self.chat_1.chat_element_by_text(self.message_4).click() self.chat_1.pin_message(self.message_4, 'pin-to-chat') if not (self.chat_1.chat_element_by_text(self.message_4).pinned_by_label.is_element_displayed(30) and diff --git a/test/appium/tests/critical/chats/test_group_chat.py b/test/appium/tests/critical/chats/test_group_chat.py index 5d8c713e07..5e7823688e 100644 --- a/test/appium/tests/critical/chats/test_group_chat.py +++ b/test/appium/tests/critical/chats/test_group_chat.py @@ -308,7 +308,7 @@ class TestGroupChatMultipleDeviceMergedNewUI(MultipleSharedDeviceTestCase): self.chats[0].pin_message(self.message_4, 'pin-to-chat') self.chats[0].view_pinned_messages_button.click_until_presence_of_element(self.chats[0].pinned_messages_list) self.chats[0].pinned_messages_list.message_element_by_text(self.message_2).click_inside_element_by_coordinate() - self.chats[0].element_by_translation_id('unpin-from-chat').double_click() + self.chats[0].element_by_translation_id('unpin-from-chat').click() self.chats[0].chat_element_by_text(self.message_4).click() self.chats[0].pin_message(self.message_4, 'pin-to-chat') if not (self.chats[0].chat_element_by_text(self.message_4).pinned_by_label.is_element_displayed(30) and diff --git a/test/appium/views/chat_view.py b/test/appium/views/chat_view.py index fc0af9199c..09233d1e98 100644 --- a/test/appium/views/chat_view.py +++ b/test/appium/views/chat_view.py @@ -296,7 +296,7 @@ class UsernameOptions(Button): class UsernameCheckbox(Button): def __init__(self, driver, username): self.username = username - super().__init__(driver, xpath="//*[@text='%s']" % username) + super().__init__(driver, xpath="//*[@text='%s']/..//*[@content-desc='checkbox-off']" % username) def click(self): try: