From feb8dfce07951f330d4ac835bf8ac83a332fa8e7 Mon Sep 17 00:00:00 2001 From: Gheorghe Pinzaru Date: Mon, 10 Aug 2020 11:49:09 +0300 Subject: [PATCH] Enable Quo Preview in dev app Signed-off-by: Gheorghe Pinzaru --- .env | 1 + src/quo/previews/main.cljs | 23 ++-- .../ui/screens/profile/user/views.cljs | 7 ++ src/status_im/ui/screens/routing/main.cljs | 117 ++++++++++-------- src/status_im/utils/config.cljs | 1 + 5 files changed, 84 insertions(+), 65 deletions(-) diff --git a/.env b/.env index be3d8669d3..91830fbf77 100644 --- a/.env +++ b/.env @@ -23,3 +23,4 @@ KEYCARD_TEST_MENU=0 QR_READ_TEST_MENU=1 ENABLE_ROOT_ALERT=1 ENABLE_REFERRAL_INVITE=1 +ENABLE_QUO_PREVIEW=1 diff --git a/src/quo/previews/main.cljs b/src/quo/previews/main.cljs index 0badbdefb0..2dd1ca34c1 100644 --- a/src/quo/previews/main.cljs +++ b/src/quo/previews/main.cljs @@ -82,17 +82,20 @@ (reset! navigation-state state-obj) (resolve true)))) -(defn preview-screens [] +(defn preview-stack [] (let [stack (navigation/create-stack)] - [navigation/navigation-container - {:ref navigation/set-navigator-ref - :initial-state @navigation-state - :on-state-change persist-state!} - [stack {} - (into [{:name :main - :insets {:top false} - :component main-screen}] - screens)]])) + [stack {} + (into [{:name :main + :insets {:top false} + :component main-screen}] + screens)])) + +(defn preview-screens [] + [navigation/navigation-container + {:ref navigation/set-navigator-ref + :initial-state @navigation-state + :on-state-change persist-state!} + [preview-stack]]) diff --git a/src/status_im/ui/screens/profile/user/views.cljs b/src/status_im/ui/screens/profile/user/views.cljs index b462366d4d..beb9f389f5 100644 --- a/src/status_im/ui/screens/profile/user/views.cljs +++ b/src/status_im/ui/screens/profile/user/views.cljs @@ -115,6 +115,13 @@ :accessory (when mnemonic [components.common/counter {:size 22} 1]) :on-press #(re-frame/dispatch [:navigate-to :privacy-and-security])}] + (when config/quo-preview-enabled? + [quo/list-item + {:icon :main-icons/appearance + :title "Quo Preview" + :accessibility-label :appearance-settings-button + :chevron true + :on-press #(re-frame/dispatch [:navigate-to :quo-preview])}]) [quo/list-item {:icon :main-icons/appearance :title (i18n/label :t/appearance) diff --git a/src/status_im/ui/screens/routing/main.cljs b/src/status_im/ui/screens/routing/main.cljs index 5df0b050da..09c68720d4 100644 --- a/src/status_im/ui/screens/routing/main.cljs +++ b/src/status_im/ui/screens/routing/main.cljs @@ -20,6 +20,8 @@ [status-im.ui.components.invite.views :as invite] [status-im.ui.screens.routing.core :as navigation] [status-im.utils.platform :as platform] + [quo.previews.main :as quo.preview] + [status-im.utils.config :as config] [status-im.ui.screens.chat.image.preview.views :as image-preview] [status-im.ui.screens.notifications-settings.views :as notifications-settings])) @@ -52,58 +54,63 @@ ;; https://github.com/react-navigation/react-navigation/issues/6520 (when platform/ios? {:mode :modal})) - [(if logged-in? - {:name :tabs - :insets {:top false} - :component tabs} - {:name :intro-stack - :insets {:top false - :bottom true} - :component intro-login-stack/intro-stack}) - {:name :stickers-pack-modal - :component stickers/pack-modal} - {:name :tribute-learn-more - :component tr-to-talk/learn-more} - {:name :welcome - :back-handler :noop - :component home/welcome} - {:name :new-chat - :on-focus [::new-chat.events/new-chat-focus] - :transition :presentation-ios - :component new-chat/new-chat} - {:name :new-contact - :on-focus [::new-chat.events/new-chat-focus] - :transition :presentation-ios - :component new-chat/new-contact} - {:name :new-public-chat - :transition :presentation-ios - :insets {:bottom true} - :component new-public-chat/new-public-chat} - {:name :edit-group-chat-name - :transition :presentation-ios - :insets {:bottom true} - :component group-chat/edit-group-chat-name} - {:name :create-group-chat - :transition :presentation-ios - :component chat-stack/new-group-chat} - {:name :referral-invite - :transition :presentation-ios - :insets {:bottom true} - :component invite/referral-invite} - {:name :add-participants-toggle-list - :on-focus [::group.events/add-participants-toggle-list] - :transition :presentation-ios - :insets {:bottom true} - :component group-chat/add-participants-toggle-list} - {:name :contact-code - :component wallet.components/contact-code} - {:name :qr-scanner - :insets {:top false :bottom false} - :component qr-scanner/qr-scanner} - {:name :image-preview - :insets {:top false :bottom false} - :component image-preview/preview-image} - {:name :notifications-settings - :back-handler :noop - :insets {:bottom true} - :component notifications-settings/notifications-settings}]])) + (concat + [(if logged-in? + {:name :tabs + :insets {:top false} + :component tabs} + {:name :intro-stack + :insets {:top false + :bottom true} + :component intro-login-stack/intro-stack}) + {:name :stickers-pack-modal + :component stickers/pack-modal} + {:name :tribute-learn-more + :component tr-to-talk/learn-more} + {:name :welcome + :back-handler :noop + :component home/welcome} + {:name :new-chat + :on-focus [::new-chat.events/new-chat-focus] + :transition :presentation-ios + :component new-chat/new-chat} + {:name :new-contact + :on-focus [::new-chat.events/new-chat-focus] + :transition :presentation-ios + :component new-chat/new-contact} + {:name :new-public-chat + :transition :presentation-ios + :insets {:bottom true} + :component new-public-chat/new-public-chat} + {:name :edit-group-chat-name + :transition :presentation-ios + :insets {:bottom true} + :component group-chat/edit-group-chat-name} + {:name :create-group-chat + :transition :presentation-ios + :component chat-stack/new-group-chat} + {:name :referral-invite + :transition :presentation-ios + :insets {:bottom true} + :component invite/referral-invite} + {:name :add-participants-toggle-list + :on-focus [::group.events/add-participants-toggle-list] + :transition :presentation-ios + :insets {:bottom true} + :component group-chat/add-participants-toggle-list} + {:name :contact-code + :component wallet.components/contact-code} + {:name :qr-scanner + :insets {:top false :bottom false} + :component qr-scanner/qr-scanner} + {:name :image-preview + :insets {:top false :bottom false} + :component image-preview/preview-image} + {:name :notifications-settings + :back-handler :noop + :insets {:bottom true} + :component notifications-settings/notifications-settings}] + (when config/quo-preview-enabled? + [{:name :quo-preview + :insets {:top false :bottom false} + :component quo.preview/preview-stack}]))])) diff --git a/src/status_im/utils/config.cljs b/src/status_im/utils/config.cljs index 387063f1cf..7582d8d384 100644 --- a/src/status_im/utils/config.cljs +++ b/src/status_im/utils/config.cljs @@ -40,6 +40,7 @@ (def keycard-test-menu-enabled? (enabled? (get-config :KEYCARD_TEST_MENU "0"))) (def qr-test-menu-enabled? (enabled? (get-config :QR_READ_TEST_MENU "0"))) (def referrals-invite-enabled? (enabled? (get-config :ENABLE_REFERRAL_INVITE "0"))) +(def quo-preview-enabled? (enabled? (get-config :ENABLE_QUO_PREVIEW "0"))) ;; CONFIG VALUES (def log-level