Refactor navigation files (#19068)
This commit is contained in:
parent
1a8bca56e0
commit
6bda54266b
|
@ -28,8 +28,7 @@
|
|||
[{:keys [db] :as cofx} {:keys [auth-method logout?]}]
|
||||
(let [key-uid (get-in db [:profile/profile :key-uid])]
|
||||
(rf/merge cofx
|
||||
{:set-root :progress
|
||||
:effects.shell/reset-state nil
|
||||
{:effects.shell/reset-state nil
|
||||
:hide-popover nil
|
||||
::logout nil
|
||||
:profile.settings/webview-debug-changed false
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
(ns legacy.status-im.ui.screens.screens
|
||||
(:require
|
||||
[legacy.status-im.ui.components.colors :as colors]
|
||||
[legacy.status-im.ui.components.icons.icons :as icons]
|
||||
[legacy.status-im.ui.screens.about-app.views :as about-app]
|
||||
[legacy.status-im.ui.screens.advanced-settings.views :as advanced-settings]
|
||||
[legacy.status-im.ui.screens.appearance.views :as appearance]
|
||||
|
@ -48,10 +47,18 @@
|
|||
[status-im.contexts.chat.group-details.view :as group-details]
|
||||
[utils.i18n :as i18n]))
|
||||
|
||||
(defn right-button-options
|
||||
[id icon]
|
||||
{:id id
|
||||
:icon (icons/icon-source icon)})
|
||||
(defn topbar-options
|
||||
[title]
|
||||
{:elevation 0
|
||||
:title {:color (if (colors/dark?) colors/white colors/black)
|
||||
:text (i18n/label title)}
|
||||
:rightButtonColor (if (colors/dark?) colors/white colors/black)
|
||||
:background {:color (if (colors/dark?) colors/black colors/white)}
|
||||
:backButton {:color (if (colors/dark?) colors/white colors/black)
|
||||
:id :legacy-back-button
|
||||
:testID :back-button
|
||||
:visible true
|
||||
:popStackOnPress false}})
|
||||
|
||||
(defn screens
|
||||
[]
|
||||
|
@ -77,7 +84,7 @@
|
|||
|
||||
{:name :stickers
|
||||
:options {:insets {:top? true}
|
||||
:topBar {:title {:text (i18n/label :t/sticker-market)}}}
|
||||
:topBar (topbar-options :t/sticker-market)}
|
||||
:component stickers/packs}
|
||||
|
||||
{:name :stickers-pack
|
||||
|
@ -90,7 +97,7 @@
|
|||
:component group-chat/new-group}
|
||||
|
||||
{:name :currency-settings
|
||||
:options {:topBar {:title {:text (i18n/label :t/main-currency)}}
|
||||
:options {:topBar (topbar-options :t/main-currency)
|
||||
:insets {:top? true}}
|
||||
:component currency-settings/currency-settings}
|
||||
|
||||
|
@ -100,27 +107,27 @@
|
|||
:options {:topBar {:visible false}}
|
||||
:component profile.user/my-profile}
|
||||
{:name :contacts-list
|
||||
:options {:topBar {:title {:text (i18n/label :t/contacts)}}
|
||||
:options {:topBar (topbar-options :t/contacts)
|
||||
:insets {:top? true}}
|
||||
:component contacts-list/contacts-list}
|
||||
{:name :ens-main
|
||||
:options {:topBar {:title {:text (i18n/label :t/ens-usernames)}}
|
||||
:options {:topBar (topbar-options :t/ens-usernames)
|
||||
:insets {:top? true}}
|
||||
:component ens/main}
|
||||
{:name :ens-search
|
||||
:options {:topBar {:title {:text (i18n/label :t/ens-your-username)}}
|
||||
:options {:topBar (topbar-options :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 (topbar-options :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 (topbar-options :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 (topbar-options :t/ens-terms-registration)
|
||||
:insets {:top? true}}
|
||||
:component ens/terms}
|
||||
{:name :ens-name-details
|
||||
|
@ -128,7 +135,7 @@
|
|||
:options {:insets {:top? true}}
|
||||
:component ens/name-details}
|
||||
{:name :blocked-users-list
|
||||
:options {:topBar {:title {:text (i18n/label :t/blocked-users)}}
|
||||
:options {:topBar (topbar-options :t/blocked-users)
|
||||
:insets {:top? true}}
|
||||
:component contacts-list/blocked-users-list}
|
||||
{:name :wakuv2-settings
|
||||
|
@ -144,7 +151,7 @@
|
|||
:options {:insets {:top? true}}
|
||||
:component bootnodes-settings/bootnodes-settings}
|
||||
{:name :installations
|
||||
:options {:topBar {:title {:text (i18n/label :t/devices)}}
|
||||
:options {:topBar (topbar-options (i18n/label :t/devices))
|
||||
:insets {:top? true}}
|
||||
:component pairing/installations}
|
||||
{:name :edit-bootnode
|
||||
|
@ -160,63 +167,63 @@
|
|||
:options {:insets {:top? true}}
|
||||
:component edit-mailserver/edit-mailserver}
|
||||
{:name :dapps-permissions
|
||||
:options {:topBar {:title {:text (i18n/label :t/dapps-permissions)}}
|
||||
:options {:topBar (topbar-options :t/dapps-permissions)
|
||||
:insets {:top? true}}
|
||||
:component dapps-permissions/dapps-permissions}
|
||||
{:name :privacy-and-security
|
||||
:options {:topBar {:title {:text (i18n/label :t/privacy-and-security)}}
|
||||
:options {:topBar (topbar-options :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 (topbar-options :t/accept-new-chats-from)
|
||||
:insets {:top? true}}
|
||||
:component messages-from-contacts-only/messages-from-contacts-only-view}
|
||||
{:name :appearance
|
||||
:options {:topBar {:title {:text (i18n/label :t/appearance)}}
|
||||
:options {:topBar (topbar-options :t/appearance)
|
||||
:insets {:top? true}}
|
||||
:component appearance/appearance-view}
|
||||
{:name :privacy-and-security-profile-pic-show-to
|
||||
:options {:topbar {:title {:text (i18n/label :t/show-profile-pictures-to)}}
|
||||
:options {:topbar (topbar-options :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 (topbar-options :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 (topbar-options :t/notification-settings)
|
||||
:insets {:top? true}}
|
||||
:component notifications-settings/notifications-settings}
|
||||
{:name :sync-settings
|
||||
:options {:topBar {:title {:text (i18n/label :t/sync-settings)}}
|
||||
:options {:topBar (topbar-options :t/sync-settings)
|
||||
:insets {:top? true}}
|
||||
:component sync-settings/sync-settings}
|
||||
{:name :advanced-settings
|
||||
:options {:topBar {:title {:text (i18n/label :t/advanced)}}
|
||||
:options {:topBar (topbar-options :t/advanced)
|
||||
:insets {:top? true}}
|
||||
:component advanced-settings/advanced-settings}
|
||||
{:name :help-center
|
||||
:options {:topBar {:title {:text (i18n/label :t/need-help)}}
|
||||
:options {:topBar (topbar-options :t/need-help)
|
||||
:insets {:top? true}}
|
||||
:component help-center/help-center}
|
||||
{:name :glossary
|
||||
:options {:topBar {:title {:text (i18n/label :t/glossary)}}
|
||||
:options {:topBar (topbar-options :t/glossary)
|
||||
:insets {:top? true}}
|
||||
:component glossary/glossary}
|
||||
{:name :about-app
|
||||
:options {:topBar {:title {:text (i18n/label :t/about-app)}}
|
||||
:options {:topBar (topbar-options :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 (topbar-options :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 (topbar-options :t/terms-of-service)
|
||||
:insets {:top? true}}
|
||||
:component about-app/tos}
|
||||
{:name :principles
|
||||
:options {:topBar {:title {:text (i18n/label :t/principles)}}
|
||||
:options {:topBar (topbar-options :t/principles)
|
||||
:insets {:top? true}}
|
||||
:component about-app/principles}
|
||||
{:name :manage-dapps-permissions
|
||||
|
@ -224,27 +231,27 @@
|
|||
:options {:insets {:top? true}}
|
||||
:component dapps-permissions/manage}
|
||||
{:name :rpc-usage-info
|
||||
:options {:topBar {:title {:text (i18n/label :t/rpc-usage-info)}}
|
||||
:options {:topBar (topbar-options :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 (topbar-options :t/peers-stats)
|
||||
:insets {:top? true}}
|
||||
:component peers-stats/peers-stats}
|
||||
{:name :log-level-settings
|
||||
:options {:topBar {:title {:text (i18n/label :t/log-level-settings)}}
|
||||
:options {:topBar (topbar-options :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 (topbar-options :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 (topbar-options :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 (topbar-options :t/backup-settings)
|
||||
:insets {:top? true}}
|
||||
:component backup-settings/backup-settings}
|
||||
{:name :backup-seed
|
||||
|
@ -252,14 +259,14 @@
|
|||
:options {:insets {:top? true}}
|
||||
:component profile.seed/backup-seed}
|
||||
{:name :reset-password
|
||||
:options {:topBar {:title {:text (i18n/label :t/reset-password)}}
|
||||
:options {:topBar (topbar-options :t/reset-password)
|
||||
:insets {:top? true}}
|
||||
:component reset-password/reset-password}
|
||||
{:name :delete-profile
|
||||
: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 (topbar-options :t/default-sync-period)
|
||||
:insets {:top? true}}
|
||||
:component default-sync-period-settings/default-sync-period-settings}
|
||||
|
||||
|
@ -268,7 +275,7 @@
|
|||
;[Chat] Link preview settings
|
||||
|
||||
{:name :link-previews-settings
|
||||
:options {:topBar {:title {:text (i18n/label :t/chat-link-previews)}}
|
||||
:options {:topBar (topbar-options :t/chat-link-previews)
|
||||
:insets {:top? true}}
|
||||
:component link-previews-settings/link-previews-settings}
|
||||
|
||||
|
@ -308,7 +315,7 @@
|
|||
;;TODO WHY MODAL?
|
||||
;[Profile] Notifications settings
|
||||
{:name :notifications-settings
|
||||
:options {:topBar {:title {:text (i18n/label :t/notification-settings)}}
|
||||
:options {:topBar (topbar-options :t/notification-settings)
|
||||
:popGesture false
|
||||
:hardwareBackButton {:dismissModalOnPress false
|
||||
:popStackOnPress false}
|
||||
|
|
|
@ -56,7 +56,9 @@
|
|||
(rf/dispatch event))
|
||||
(effects/dismiss-modal))
|
||||
(when-let [handler (get-in views/screens [(keyword id) :right-handler])]
|
||||
(handler)))))
|
||||
(handler)))
|
||||
(when (= "legacy-back-button" id)
|
||||
(rf/dispatch [:navigate-back]))))
|
||||
|
||||
(navigation/reg-modal-dismissed-listener
|
||||
(fn []
|
||||
|
@ -92,35 +94,16 @@
|
|||
(navigation/register-component
|
||||
"bottom-sheet"
|
||||
(fn [] (gesture/gesture-handler-root-hoc views/bottom-sheet))
|
||||
(fn [] views/bottom-sheet)))
|
||||
(fn [] views/bottom-sheet))
|
||||
|
||||
;;;; Alert Banner
|
||||
(navigation/register-component
|
||||
"alert-banner"
|
||||
(fn [] (gesture/gesture-handler-root-hoc views/alert-banner #js {:flex 0}))
|
||||
(fn [] views/alert-banner))
|
||||
;;;; Alert Banner
|
||||
(navigation/register-component
|
||||
"alert-banner"
|
||||
(fn [] (gesture/gesture-handler-root-hoc views/alert-banner #js {:flex 0}))
|
||||
(fn [] views/alert-banner))
|
||||
|
||||
|
||||
;; LEGACY (should be removed in status 2.0)
|
||||
|
||||
(defonce
|
||||
_
|
||||
[(navigation/register-component
|
||||
"popover"
|
||||
(fn [] (gesture/gesture-handler-root-hoc views/popover-comp))
|
||||
(fn [] views/popover-comp))
|
||||
|
||||
(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-old"
|
||||
(fn [] (gesture/gesture-handler-root-hoc views/sheet-comp-old))
|
||||
(fn [] views/sheet-comp-old))
|
||||
|
||||
(navigation/register-component
|
||||
"signing-sheet"
|
||||
(fn [] (gesture/gesture-handler-root-hoc views/signing-comp))
|
||||
(fn [] views/signing-comp))])
|
||||
;;;; LEGACY (should be removed in status 2.0)
|
||||
(navigation/register-component
|
||||
"bottom-sheet-old"
|
||||
(fn [] (gesture/gesture-handler-root-hoc views/sheet-comp-old))
|
||||
(fn [] views/sheet-comp-old)))
|
||||
|
|
|
@ -63,12 +63,8 @@
|
|||
(name @state/root-id)
|
||||
{:component {:id component
|
||||
:name component
|
||||
:options (merge (options/default-root)
|
||||
(options/statusbar-and-navbar)
|
||||
options
|
||||
(if (:topBar options)
|
||||
(options/merge-top-bar (options/topbar-options) options)
|
||||
{:topBar {:visible false}}))}})))
|
||||
:options (merge (options/root-options {:theme (:theme options)})
|
||||
options)}})))
|
||||
|
||||
(rf/reg-fx :navigate-to navigate)
|
||||
|
||||
|
@ -81,11 +77,9 @@
|
|||
(name comp-id)
|
||||
{:component {:id component
|
||||
:name component
|
||||
:options (merge (options/statusbar-and-navbar)
|
||||
options
|
||||
(if (:topBar options)
|
||||
(options/merge-top-bar (options/topbar-options) options)
|
||||
{:topBar {:visible false}}))}})))
|
||||
:options (merge
|
||||
(options/root-options {:theme (:theme options)})
|
||||
options)}})))
|
||||
|
||||
(rf/reg-fx :navigate-to-within-stack navigate-to-within-stack)
|
||||
|
||||
|
@ -140,8 +134,7 @@
|
|||
{:stack {:children [{:component
|
||||
{:name component
|
||||
:id component
|
||||
:options (merge (options/default-root)
|
||||
(options/statusbar-and-navbar)
|
||||
:options (merge (options/root-options {:theme (:theme options)})
|
||||
options
|
||||
(when sheet?
|
||||
options/sheet-options))}}]}})))))
|
||||
|
@ -157,7 +150,7 @@
|
|||
(navigation/show-overlay
|
||||
{:component {:name component
|
||||
:id component
|
||||
:options (merge (options/statusbar)
|
||||
:options (merge (options/statusbar-and-navbar-options (:theme opts) nil nil)
|
||||
{:layout {:componentBackgroundColor :transparent
|
||||
:orientation ["portrait"]}
|
||||
:overlay {:interceptTouchOutside true}}
|
||||
|
@ -201,9 +194,8 @@
|
|||
(let [{:keys [options]} (get views/screens component)]
|
||||
{:component {:id component
|
||||
:name component
|
||||
:options (merge (options/statusbar-and-navbar)
|
||||
options
|
||||
(options/merge-top-bar (options/topbar-options) options))}}))
|
||||
:options (merge (options/statusbar-and-navbar-options (:theme options) nil nil)
|
||||
options)}}))
|
||||
|
||||
(rf/reg-fx :set-stack-root-fx
|
||||
(fn [[stack component]]
|
||||
|
|
|
@ -155,22 +155,6 @@
|
|||
#(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]}
|
||||
[_]
|
||||
{:hide-signing-sheet nil})
|
||||
|
||||
(rf/defn set-multiaccount-root
|
||||
{:events [:set-multiaccount-root]}
|
||||
[{:keys [db]}]
|
||||
(let [key-uid (get-in db [:profile/login :key-uid])
|
||||
keycard-account? (boolean (get-in db
|
||||
[:profile/profiles-overview
|
||||
key-uid
|
||||
:keycard-pairing]))]
|
||||
{:set-root (if keycard-account? :multiaccounts-keycard :multiaccounts)}))
|
||||
|
||||
(rf/defn dismiss-all-overlays
|
||||
{:events [:dismiss-all-overlays]}
|
||||
[_]
|
||||
|
@ -178,7 +162,6 @@
|
|||
[:hide-visibility-status-popover]
|
||||
[:hide-bottom-sheet]
|
||||
[:bottom-sheet-hidden]
|
||||
[:hide-signing-sheet]
|
||||
[:bottom-sheet/hide-old-navigation-overlay]
|
||||
[:toasts/close-all-toasts]]})
|
||||
|
||||
|
|
|
@ -10,23 +10,23 @@
|
|||
{:layout {:orientation ["portrait"]}
|
||||
:topBar {:visible false}})
|
||||
|
||||
;; Note: Currently, the status bar style provided while setting the root has a high preference,
|
||||
;; and even if we change the status bar style later dynamically, the style gets restored to this
|
||||
;; set root style while navigating
|
||||
;; https://github.com/status-im/status-mobile/pull/15596
|
||||
(defn statusbar-and-navbar-root
|
||||
[& [status-bar-theme]]
|
||||
(if platform/android?
|
||||
{:navigationBar {:backgroundColor colors/neutral-100}
|
||||
:statusBar {:translucent true
|
||||
:backgroundColor :transparent
|
||||
:style (or status-bar-theme :light)
|
||||
:drawBehind true}}
|
||||
{:statusBar {:style (or status-bar-theme :light)}}))
|
||||
(defn statusbar-and-navbar-options
|
||||
[theme status-bar-theme nav-bar-color]
|
||||
(let [[status-bar-theme nav-bar-color]
|
||||
(if (= :dark (or theme (quo.theme/get-theme)))
|
||||
[(or status-bar-theme :light) (or nav-bar-color colors/neutral-100)]
|
||||
[(or status-bar-theme :dark) (or nav-bar-color colors/white)])]
|
||||
(if platform/android?
|
||||
{:navigationBar {:backgroundColor nav-bar-color}
|
||||
:statusBar {:translucent true
|
||||
:backgroundColor :transparent
|
||||
:style (or status-bar-theme :light)
|
||||
:drawBehind true}}
|
||||
{:statusBar {:style (or status-bar-theme :light)}})))
|
||||
|
||||
(defn default-root
|
||||
[& [status-bar-theme background-color]]
|
||||
(merge (statusbar-and-navbar-root status-bar-theme)
|
||||
(defn root-options
|
||||
[{:keys [background-color theme status-bar-theme nav-bar-color]}]
|
||||
(merge (statusbar-and-navbar-options theme status-bar-theme nav-bar-color)
|
||||
{:topBar {:visible false}
|
||||
:layout {:componentBackgroundColor (or background-color
|
||||
(colors/theme-colors colors/white colors/neutral-100))
|
||||
|
@ -35,6 +35,15 @@
|
|||
(colors/theme-colors colors/white
|
||||
colors/neutral-100))}}))
|
||||
|
||||
(defn dark-root-options
|
||||
[]
|
||||
(root-options
|
||||
{:background-color colors/neutral-100
|
||||
:theme :dark
|
||||
:status-bar-theme :light
|
||||
:nav-bar-color colors/neutral-100}))
|
||||
|
||||
;;;; Screen Specific Options
|
||||
(def onboarding-layout
|
||||
{:componentBackgroundColor colors/neutral-80-opa-80-blur
|
||||
:orientation ["portrait"]
|
||||
|
@ -45,49 +54,12 @@
|
|||
:orientation ["portrait"]
|
||||
:backgroundColor :transparent})
|
||||
|
||||
(defn navbar
|
||||
([dark?]
|
||||
{:navigationBar {:backgroundColor (if (or dark? (= :dark (quo.theme/get-theme)))
|
||||
colors/neutral-100
|
||||
colors/white)}})
|
||||
([] (navbar nil)))
|
||||
|
||||
(defn statusbar
|
||||
([dark?]
|
||||
(let [style (if (or dark? (= :dark (quo.theme/get-theme))) :light :dark)]
|
||||
(if platform/android?
|
||||
{:statusBar {:translucent true
|
||||
:backgroundColor :transparent
|
||||
:drawBehind true
|
||||
:style style}}
|
||||
{:statusBar {:style style}})))
|
||||
([] (statusbar nil)))
|
||||
|
||||
(defn statusbar-and-navbar
|
||||
([dark?]
|
||||
(merge (navbar dark?) (statusbar dark?)))
|
||||
([] (statusbar-and-navbar nil)))
|
||||
|
||||
(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
|
||||
(statusbar-and-navbar-root)
|
||||
{:modalPresentationStyle :overCurrentContext
|
||||
:theme :dark
|
||||
:layout {:componentBackgroundColor :transparent
|
||||
:orientation ["portrait"]
|
||||
:backgroundColor :transparent}}))
|
||||
{:modalPresentationStyle :overCurrentContext
|
||||
:theme :dark
|
||||
:layout {:componentBackgroundColor :transparent
|
||||
:orientation ["portrait"]
|
||||
:backgroundColor :transparent}})
|
||||
|
||||
(def transparent-modal-screen-options
|
||||
(merge
|
||||
|
@ -109,11 +81,10 @@
|
|||
{})})
|
||||
|
||||
(def dark-screen
|
||||
(merge (statusbar-and-navbar-root)
|
||||
{:theme :dark
|
||||
:layout {:componentBackgroundColor colors/neutral-95
|
||||
:orientation ["portrait"]
|
||||
:backgroundColor colors/neutral-95}}))
|
||||
{:theme :dark
|
||||
:layout {:componentBackgroundColor colors/neutral-95
|
||||
:orientation ["portrait"]
|
||||
:backgroundColor colors/neutral-95}})
|
||||
|
||||
(def lightbox
|
||||
{:topBar {:visible false}
|
||||
|
@ -136,20 +107,3 @@
|
|||
: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))}))}))
|
||||
|
|
|
@ -1,74 +1,8 @@
|
|||
(ns status-im.navigation.roots
|
||||
(:require
|
||||
[quo.foundations.colors :as colors]
|
||||
[quo.theme :as quo.theme]
|
||||
[status-im.constants :as constants]
|
||||
[status-im.navigation.options :as options]
|
||||
[status-im.navigation.view :as views]))
|
||||
|
||||
(defn get-screen-options
|
||||
[screen]
|
||||
(merge (get-in views/screens [screen :options])
|
||||
(options/statusbar-and-navbar-root)
|
||||
(options/merge-top-bar (options/topbar-options)
|
||||
(get-in views/screens [screen :options]))))
|
||||
|
||||
(defn old-roots
|
||||
[]
|
||||
{;; ONBOARDING
|
||||
:onboarding
|
||||
{:root {:stack {:id :onboarding
|
||||
:children [{:component {:name :get-your-keys
|
||||
:id :get-your-keys
|
||||
: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)})}}}
|
||||
|
||||
;;PROGRESS
|
||||
:progress
|
||||
{:root {:stack {:children [{:component {:name :progress
|
||||
:id :progress
|
||||
:options (options/statusbar-and-navbar-root)}}]
|
||||
:options (merge (options/default-root)
|
||||
{:topBar (assoc (options/topbar-options) :visible false)})}}}
|
||||
|
||||
;;LOGIN
|
||||
:multiaccounts
|
||||
{:root {:stack {:id :multiaccounts-stack
|
||||
:children [{:component {:name :multiaccounts
|
||||
:id :multiaccounts
|
||||
:options (get-screen-options :multiaccounts)}}
|
||||
{:component {:name :login
|
||||
:id :login
|
||||
:options (get-screen-options :login)}}]
|
||||
:options (merge (options/default-root)
|
||||
(options/statusbar-and-navbar-root)
|
||||
{:topBar (options/topbar-options)})}}}
|
||||
|
||||
:multiaccounts-keycard
|
||||
{:root {:stack {:id :multiaccounts-stack
|
||||
:children [{:component {:name :profiles
|
||||
:id :profiles
|
||||
:options (get-screen-options :multiaccounts)}}
|
||||
{:component {:name :keycard-login-pin
|
||||
:id :keycard-login-pin
|
||||
:options (get-screen-options :keycard-login-pin)}}]
|
||||
: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 (options/statusbar-and-navbar-root)}}]
|
||||
:options (merge (options/default-root)
|
||||
(options/statusbar-and-navbar-root)
|
||||
{:topBar (assoc (options/topbar-options) :visible false)})}}}})
|
||||
[status-im.navigation.options :as options]))
|
||||
|
||||
;; Theme Order for navigation roots
|
||||
;; 1. Themes hardcoded in below map
|
||||
|
@ -82,39 +16,36 @@
|
|||
|
||||
(defn roots
|
||||
[]
|
||||
(merge
|
||||
(old-roots)
|
||||
{:intro
|
||||
{:root
|
||||
{:stack {:id :intro
|
||||
:children [{:component {:name :intro
|
||||
:id :intro
|
||||
:options (options/dark-root-options)}}]}}}
|
||||
:shell-stack
|
||||
{:root
|
||||
{:stack {:id :shell-stack
|
||||
:children [{:component {:name :shell-stack
|
||||
:id :shell-stack
|
||||
:options (options/root-options
|
||||
{:nav-bar-color colors/neutral-100})}}]}}}
|
||||
:profiles
|
||||
{:root
|
||||
{:stack {:id :profiles
|
||||
:children [{:component {:name :profiles
|
||||
:id :profiles
|
||||
:options (options/dark-root-options)}}]}}}
|
||||
|
||||
{:intro
|
||||
{:root
|
||||
{:stack {:id :intro
|
||||
:children [{:component {:name :intro
|
||||
:id :intro
|
||||
:options (options/default-root nil colors/neutral-100)}}]}}}
|
||||
:shell-stack
|
||||
{:root
|
||||
{:stack {:id :shell-stack
|
||||
:children [{:component {:name :shell-stack
|
||||
:id :shell-stack
|
||||
:options (options/default-root
|
||||
(if (= :dark (quo.theme/get-theme)) :light :dark))}}]}}}
|
||||
:profiles
|
||||
{:root
|
||||
{:stack {:id :profiles
|
||||
:children [{:component {:name :profiles
|
||||
:id :profiles
|
||||
:options (options/default-root)}}]}}}
|
||||
:enable-notifications
|
||||
{:root {:stack {:children [{:component {:name :enable-notifications
|
||||
:id :enable-notifications
|
||||
:options (options/dark-root-options)}}]}}}
|
||||
|
||||
:enable-notifications
|
||||
{:root {:stack {:children [{:component {:name :enable-notifications
|
||||
:id :enable-notifications
|
||||
:options (options/default-root)}}]}}}
|
||||
|
||||
:welcome
|
||||
{:root {:stack {:children [{:component {:name :welcome
|
||||
:id :welcome
|
||||
:options (options/default-root)}}]}}}
|
||||
:syncing-results
|
||||
{:root {:stack {:children [{:component {:name :syncing-results
|
||||
:id :syncing-results
|
||||
:options (options/default-root)}}]}}}}))
|
||||
:welcome
|
||||
{:root {:stack {:children [{:component {:name :welcome
|
||||
:id :welcome
|
||||
:options (options/dark-root-options)}}]}}}
|
||||
:syncing-results
|
||||
{:root {:stack {:children [{:component {:name :syncing-results
|
||||
:id :syncing-results
|
||||
:options (options/dark-root-options)}}]}}}})
|
||||
|
|
|
@ -130,7 +130,7 @@
|
|||
:component lightbox/lightbox}
|
||||
|
||||
{:name :photo-selector
|
||||
:options (merge {:sheet? true} (options/statusbar-and-navbar-root))
|
||||
:options {:sheet? true}
|
||||
:component photo-selector/photo-selector}
|
||||
|
||||
{:name :camera-screen
|
||||
|
@ -230,17 +230,15 @@
|
|||
:component create-password/create-password}
|
||||
|
||||
{:name :enable-biometrics
|
||||
:options (merge
|
||||
(options/statusbar-and-navbar-root)
|
||||
{:theme :dark
|
||||
:layout options/onboarding-transparent-layout
|
||||
:animations (merge
|
||||
transitions/new-to-status-modal-animations
|
||||
transitions/push-animations-for-transparent-background)
|
||||
:popGesture false
|
||||
:modalPresentationStyle :overCurrentContext
|
||||
:hardwareBackButton {:dismissModalOnPress false
|
||||
:popStackOnPress false}})
|
||||
:options {:theme :dark
|
||||
:layout options/onboarding-transparent-layout
|
||||
:animations (merge
|
||||
transitions/new-to-status-modal-animations
|
||||
transitions/push-animations-for-transparent-background)
|
||||
:popGesture false
|
||||
:modalPresentationStyle :overCurrentContext
|
||||
:hardwareBackButton {:dismissModalOnPress false
|
||||
:popStackOnPress false}}
|
||||
:component enable-biometrics/view}
|
||||
|
||||
{:name :generating-keys
|
||||
|
@ -260,14 +258,12 @@
|
|||
:component enter-seed-phrase/enter-seed-phrase}
|
||||
|
||||
{:name :enable-notifications
|
||||
:options (merge
|
||||
(options/statusbar-and-navbar-root)
|
||||
{:theme :dark
|
||||
:layout options/onboarding-transparent-layout
|
||||
:animations (merge
|
||||
transitions/new-to-status-modal-animations
|
||||
transitions/push-animations-for-transparent-background)
|
||||
:modalPresentationStyle :overCurrentContext})
|
||||
:options {:theme :dark
|
||||
:layout options/onboarding-transparent-layout
|
||||
:animations (merge
|
||||
transitions/new-to-status-modal-animations
|
||||
transitions/push-animations-for-transparent-background)
|
||||
:modalPresentationStyle :overCurrentContext}
|
||||
:component enable-notifications/view}
|
||||
|
||||
{:name :identifiers
|
||||
|
@ -298,11 +294,9 @@
|
|||
:component sign-in/view}
|
||||
|
||||
{:name :syncing-progress
|
||||
:options (merge
|
||||
(options/statusbar-and-navbar-root)
|
||||
{:theme :dark
|
||||
:layout options/onboarding-layout
|
||||
:popGesture false})
|
||||
:options {:theme :dark
|
||||
:layout options/onboarding-layout
|
||||
:popGesture false}
|
||||
:component syncing-devices/view}
|
||||
|
||||
{:name :syncing-progress-intro
|
||||
|
@ -317,11 +311,9 @@
|
|||
:component syncing-results/view}
|
||||
|
||||
{:name :welcome
|
||||
:options (merge
|
||||
(options/statusbar-and-navbar-root)
|
||||
{:theme :dark
|
||||
:layout options/onboarding-transparent-layout
|
||||
:animations transitions/push-animations-for-transparent-background})
|
||||
:options {:theme :dark
|
||||
:layout options/onboarding-transparent-layout
|
||||
:animations transitions/push-animations-for-transparent-background}
|
||||
:component welcome/view}
|
||||
|
||||
{:name :emoji-picker
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
(ns status-im.navigation.view
|
||||
(:require
|
||||
[legacy.status-im.bottom-sheet.sheets :as bottom-sheets-old]
|
||||
[legacy.status-im.ui.screens.popover.views :as popover]
|
||||
[legacy.status-im.ui.screens.profile.visibility-status.views :as visibility-status-views]
|
||||
[legacy.status-im.ui.screens.signing.views :as signing]
|
||||
[quo.foundations.colors :as colors]
|
||||
[quo.theme :as theme]
|
||||
[react-native.core :as rn]
|
||||
|
@ -111,29 +108,15 @@
|
|||
|
||||
(def toasts (reagent/reactify-component toasts/toasts))
|
||||
|
||||
(def alert-banner
|
||||
(reagent/reactify-component
|
||||
(fn []
|
||||
^{:key (str "alert-banner" @reloader/cnt)}
|
||||
[theme/provider {:theme :dark}
|
||||
[alert-banner/view]])
|
||||
functional-compiler))
|
||||
|
||||
;; LEGACY (should be removed in status 2.0)
|
||||
(def popover-comp
|
||||
(reagent/reactify-component
|
||||
(fn []
|
||||
^{:key (str "popover" @reloader/cnt)}
|
||||
[:<>
|
||||
[inactive]
|
||||
[popover/popover]
|
||||
(when js/goog.DEBUG
|
||||
[reloader/reload-view])])
|
||||
functional-compiler))
|
||||
|
||||
(def visibility-status-popover-comp
|
||||
(reagent/reactify-component
|
||||
(fn []
|
||||
^{:key (str "visibility-status-popover" @reloader/cnt)}
|
||||
[rn/view
|
||||
[inactive]
|
||||
[visibility-status-views/visibility-status-popover]
|
||||
(when js/goog.DEBUG
|
||||
[reloader/reload-view])])
|
||||
functional-compiler))
|
||||
|
||||
(def sheet-comp-old
|
||||
(reagent/reactify-component
|
||||
(fn []
|
||||
|
@ -142,22 +125,3 @@
|
|||
[inactive]
|
||||
[bottom-sheets-old/bottom-sheet]])
|
||||
functional-compiler))
|
||||
|
||||
(def signing-comp
|
||||
(reagent/reactify-component
|
||||
(fn []
|
||||
^{:key (str "signing-sheet" @reloader/cnt)}
|
||||
[:<>
|
||||
[inactive]
|
||||
[signing/signing]
|
||||
(when js/goog.DEBUG
|
||||
[reloader/reload-view])])
|
||||
functional-compiler))
|
||||
|
||||
(def alert-banner
|
||||
(reagent/reactify-component
|
||||
(fn []
|
||||
^{:key (str "alert-banner" @reloader/cnt)}
|
||||
[theme/provider {:theme :dark}
|
||||
[alert-banner/view]])
|
||||
functional-compiler))
|
||||
|
|
Loading…
Reference in New Issue