adjust navigation colors and small bugfixes (#14403)

* adjust navigation colors and small bugfixes
This commit is contained in:
flexsurfer 2022-11-23 17:30:11 +01:00 committed by GitHub
parent c6e8aad745
commit 3152cf0aa3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 47 additions and 40 deletions

View File

@ -27,7 +27,6 @@
status-im.mailserver.constants
[status-im.mailserver.core :as mailserver]
[status-im.multiaccounts.biometric.core :as biometric]
[status-im.multiaccounts.core :as multiaccounts]
status-im.multiaccounts.login.core
status-im.multiaccounts.logout.core
status-im.multiaccounts.update.core
@ -57,7 +56,8 @@
status-im.wallet.custom-tokens.core
status-im.wallet-connect.core
status-im.wallet-connect-legacy.core
status-im.network.net-info))
status-im.network.net-info
[status-im.multiaccounts.model :as multiaccounts.model]))
(re-frame/reg-fx
:dismiss-keyboard
@ -111,9 +111,10 @@
(fx/defn system-theme-mode-changed
{:events [:system-theme-mode-changed]}
[_ theme]
{::multiaccounts/switch-theme (if (= :dark theme) 2 1)
:dispatch [:reload-new-ui]})
[cofx _]
(when (multiaccounts.model/logged-in? cofx)
{:multiaccounts.ui/switch-theme (get-in cofx [:db :multiaccount :appearance])
:dispatch [:reload-new-ui]}))
(def authentication-options
{:reason (i18n/label :t/biometric-auth-reason-login)})

View File

@ -162,7 +162,7 @@
{::blank-preview-flag-changed private?}))
(re-frame/reg-fx
::switch-theme
:multiaccounts.ui/switch-theme
(fn [theme-id]
(let [theme (if (or (= 2 theme-id) (and (= 0 theme-id) (utils.theme/dark-mode?)))
:dark
@ -173,7 +173,7 @@
{:events [:multiaccounts.ui/appearance-switched]}
[cofx theme]
(fx/merge cofx
{::switch-theme theme}
{:multiaccounts.ui/switch-theme theme}
(multiaccounts.update/multiaccount-update :appearance theme {})))
(fx/defn switch-profile-picture-show-to

View File

@ -336,7 +336,7 @@
:on-success #(re-frame/dispatch [::initialize-dapp-permissions %])}]})
(fx/defn initialize-appearance [cofx]
{::multiaccounts/switch-theme (get-in cofx [:db :multiaccount :appearance])})
{:multiaccounts.ui/switch-theme (get-in cofx [:db :multiaccount :appearance])})
(fx/defn get-group-chat-invitations [_]
{::json-rpc/call

View File

@ -10,6 +10,8 @@
[status-im2.contexts.shell.bottom-tabs :as bottom-tabs]
[status-im2.common.home.view :as common.home]))
;;TODO move styles to style namespace
(defn placeholder []
[rn/view {:style {:position :absolute
:top 0

View File

@ -32,6 +32,13 @@
(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 {:backgroundColor (colors/theme-colors colors/white colors/neutral-100)
:style (if (colors/dark?) :light :dark)}}
{:statusBar {:style (if (colors/dark?) :light :dark)}}))
;; PUSH SCREEN TO THE CURRENT STACK
(defn navigate [comp]
(log/debug "NAVIGATE" comp)
@ -41,7 +48,7 @@
{:component {:id comp
:name comp
:options (merge options
(roots/status-bar-options)
(status-bar-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)))

View File

@ -1,6 +1,5 @@
(ns status-im2.navigation.events
(:require [utils.re-frame :as rf]
[status-im2.setup.hot-reload :as hot-reload]))
(:require [utils.re-frame :as rf]))
(defn- all-screens-params [db view screen-params]
(cond-> db
@ -39,9 +38,8 @@
(rf/defn change-tab
{:events [:navigate-change-tab]}
[_ tab]
[_ tab])
;{:change-tab-fx tab} ; TODO: effect needs to be implemented (may not be possible: https://github.com/wix/react-native-navigation/issues/4837)
)
(rf/defn navigate-replace
{:events [:navigate-replace]}
@ -106,7 +104,6 @@
(rf/defn reload-new-ui
{:events [:reload-new-ui]}
[_]
(hot-reload/reload)
{:new-ui/reset-bottom-tabs nil
:dispatch [:init-root :shell-stack]})

View File

@ -5,29 +5,27 @@
(defn status-bar-options []
(if platform/android?
{:navigationBar {:backgroundColor colors/white}
:statusBar {:backgroundColor colors/white
:style (if (colors/dark?) :light :dark)}}
{:statusBar {:style (if (colors/dark?) :light :dark)}}))
{:navigationBar {:backgroundColor colors/neutral-100}
:statusBar {:backgroundColor :transparent
:style :light
:drawBehind true}}
{:statusBar {:style :light}}))
(defn topbar-options []
{:noBorder true
:scrollEdgeAppearance {:active false
:noBorder true}
:elevation 0
:title {:color colors/neutral-100}
:rightButtonColor colors/neutral-100
:background {:color colors/white}
:backButton {:testID :back-button}
;; TODO adjust colors and icons with quo2
;;:backButton
#_{:icon (icons/icon-source :main-icons/arrow-left)
:color colors/neutral-100}})
: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/white
{:layout {:componentBackgroundColor (colors/theme-colors colors/white colors/neutral-100)
:orientation "portrait"
:backgroundColor colors/white}})
:backgroundColor (colors/theme-colors colors/white colors/neutral-100)}})
(defn merge-top-bar [root-options options]
(let [options (:topBar options)]

View File

@ -1,22 +1,22 @@
(ns status-im2.navigation.view
(:require [reagent.core :as reagent]
[status-im2.setup.hot-reload :as reloader]
[oops.core :refer [oget]]
[re-frame.core :as re-frame]
[react-native.core :as rn]
[react-native.platform :as platform]
[react-native.safe-area :as safe-area]
[status-im2.navigation.screens :as screens]
[status-im2.setup.config :as config]
[status-im2.setup.hot-reload :as reloader]
;; TODO (14/11/22 flexsurfer) move to status-im2 namespace
;; TODO (14/11/22 flexsurfer) move to status-im2 namespace
[status-im.ui.screens.popover.views :as popover]
[status-im.ui.screens.profile.visibility-status.views :as visibility-status-views]
[status-im.ui.screens.bottom-sheets.views :as bottom-sheets]
[status-im.ui.screens.signing.views :as signing]
[status-im.ui.screens.wallet.send.views :as wallet.send.views]
[status-im.ui.screens.wallet-connect.session-proposal.views :as wallet-connect]
[status-im.keycard.test-menu :as keycard.test-menu]))
[status-im.keycard.test-menu :as keycard.test-menu]
[quo2.foundations.colors :as colors]))
(defn get-screens []
(reduce
@ -37,11 +37,8 @@
(defn wrapped-screen-style [{:keys [insets style]} insets-obj]
(merge
{:flex 1}
;:background-color colors/white} ;; TODO ajust color
(when platform/android?
{:border-bottom-width 1})
;:border-bottom-color colors/gray-lighter}) ;; TODO ajust color
{:flex 1
:background-color (colors/theme-colors colors/white colors/neutral-100)}
style
(when (get insets :bottom)
{:padding-bottom (+ (oget insets-obj "bottom")
@ -55,7 +52,7 @@
(defn inactive []
(when @(re-frame/subscribe [:hide-screen?])
[rn/view {:position :absolute :flex 1 :top 0 :bottom 0 :left 0 :right 0
;:background-color :white ;; TODO ajust color
:background-color (colors/theme-colors colors/white colors/neutral-100)
:z-index 999999999999999999}]))
(defn screen [key]

View File

@ -14,7 +14,8 @@
"Cannot read property 'message' of undefined"
"InternalError Metro has encountered an error"
"undefined Unable to resolve module `parse-svg-path`"
"group12"]))
"group12"
"Setting a timer for a long period of time"]))
;; List of ignored warnings/errors:
;; 1. "evaluating 'e.message'": Not sure why this error is happening, but it is coming from here
@ -24,6 +25,7 @@
;; 4. "undefined Unable to resolve module `parse-svg-path`": an error that happens when losing connection to metro, can be safely ignored
;; 5. "group12": referring to the group-icon size 12x12. Currently, it is not available. When the design team adds it to the
;; icon set it will be added to project.
;; 6. Setting a timer for a long period of time. Not sure why this error is happening
(defn setup []
(rf/set-mergeable-keys #{:filters/load-filters

View File

@ -7,6 +7,7 @@
[utils.re-frame :as rf]
;; TODO (14/11/22 flexsurfer move to status-im2 namespace
[quo.theme :as quo.theme]
[status-im.multiaccounts.login.core :as multiaccounts.login]
[status-im.native-module.core :as status]
[status-im.utils.keychain.core :as keychain]
@ -21,7 +22,9 @@
:setup/init-theme
(fn []
(theme/add-mode-change-listener #(re-frame/dispatch [:system-theme-mode-changed %]))
(quo2.theme/set-theme (if (theme/dark-mode?) :dark :light))))
(quo2.theme/set-theme (if (theme/dark-mode?) :dark :light))
;; TODO legacy support
(quo.theme/set-theme (if (theme/dark-mode?) :dark :light))))
(rf/defn initialize-views
{:events [:setup/initialize-view]}