fix ios wrong status bar color in dark theme (#20540)

This commit is contained in:
Parvesh Monu 2024-06-27 20:23:51 +05:30 committed by GitHub
parent 3ce6a86e9b
commit 112b69c1d6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
9 changed files with 53 additions and 50 deletions

View File

@ -119,8 +119,6 @@
<array> <array>
<string>armv7</string> <string>armv7</string>
</array> </array>
<key>UIStatusBarStyle</key>
<string>UIStatusBarStyleLightContent</string>
<key>UISupportedInterfaceOrientations</key> <key>UISupportedInterfaceOrientations</key>
<array> <array>
<string>UIInterfaceOrientationPortrait</string> <string>UIInterfaceOrientationPortrait</string>
@ -133,7 +131,7 @@
<string>UIInterfaceOrientationLandscapeRight</string> <string>UIInterfaceOrientationLandscapeRight</string>
</array> </array>
<key>UIViewControllerBasedStatusBarAppearance</key> <key>UIViewControllerBasedStatusBarAppearance</key>
<false/> <true/>
<key>com.apple.developer.nfc.readersession.iso7816.select-identifiers</key> <key>com.apple.developer.nfc.readersession.iso7816.select-identifiers</key>
<array> <array>
<string>A00000080400010101</string> <string>A00000080400010101</string>

View File

@ -28,7 +28,7 @@
[{:keys [db] :as cofx} {:keys [auth-method logout?]}] [{:keys [db] :as cofx} {:keys [auth-method logout?]}]
(let [key-uid (get-in db [:profile/profile :key-uid])] (let [key-uid (get-in db [:profile/profile :key-uid])]
(rf/merge cofx (rf/merge cofx
{:set-root :progress {:dispatch [:init-root :progress]
:effects.shell/reset-state nil :effects.shell/reset-state nil
:hide-popover nil :hide-popover nil
::logout nil ::logout nil

View File

@ -53,7 +53,8 @@
[] []
[;;PROGRESS [;;PROGRESS
{:name :progress {:name :progress
:options {:insets {:top? true}} :options {:insets {:top? true}
:theme :dark}
:component progress/progress} :component progress/progress}
;;COMMUNITY ;;COMMUNITY

View File

@ -89,7 +89,7 @@
(merge (merge
{:db (assoc db :profile/profiles-overview multiaccounts)} {:db (assoc db :profile/profiles-overview multiaccounts)}
(when-not (seq multiaccounts) (when-not (seq multiaccounts)
{:set-root :screen/onboarding.intro})))) {:dispatch [:init-root :screen/onboarding.intro]}))))
(rf/defn password-set (rf/defn password-set
{:events [:onboarding/password-set]} {:events [:onboarding/password-set]}

View File

@ -45,14 +45,14 @@
(assoc :profile/profiles-overview profiles) (assoc :profile/profiles-overview profiles)
(update :profile/login #(select-profile % key-uid))) (update :profile/login #(select-profile % key-uid)))
db) db)
:fx [[:set-root :screen/profile.profiles] :fx [[:dispatch [:init-root :screen/profile.profiles]]
(when key-uid (when key-uid
[:effects.biometric/check-if-available [:effects.biometric/check-if-available
{:key-uid key-uid {:key-uid key-uid
:on-success (fn [auth-method] :on-success (fn [auth-method]
(rf/dispatch [:profile.login/check-biometric-success key-uid (rf/dispatch [:profile.login/check-biometric-success key-uid
auth-method]))}])]}) auth-method]))}])]})
{:fx [[:set-root :screen/onboarding.intro]]}))) {:fx [[:dispatch [:init-root :screen/onboarding.intro]]]})))
(rf/reg-event-fx (rf/reg-event-fx
:profile/update-setting-from-backup :profile/update-setting-from-backup

View File

@ -74,7 +74,7 @@
(cond (cond
pairing-completed? pairing-completed?
[[:set-root :screen/onboarding.syncing-results]] [[:dispatch [:init-root :screen/onboarding.syncing-results]]]
(get db :onboarding/new-account?) (get db :onboarding/new-account?)
[[:dispatch [:onboarding/finalize-setup]]] [[:dispatch [:onboarding/finalize-setup]]]
@ -85,7 +85,7 @@
constants/theme-type-dark) constants/theme-type-dark)
:shell-stack :shell-stack
false]] false]]
[:set-root :shell-stack] [:dispatch [:init-root :shell-stack]]
[:dispatch [:profile/show-testnet-mode-banner-if-enabled]]]))}))) [:dispatch [:profile/show-testnet-mode-banner-if-enabled]]]))})))
;; login phase 2: we want to load and show chats faster, so we split login into 2 phases ;; login phase 2: we want to load and show chats faster, so we split login into 2 phases
@ -179,7 +179,7 @@
{:db (-> db {:db (-> db
(assoc-in [:profile/login :password] password) (assoc-in [:profile/login :password] password)
(assoc-in [:profile/login :processing] true)) (assoc-in [:profile/login :processing] true))
:fx [[:set-root :progress] :fx [[:dispatch [:init-root :progress]]
[:effects.profile/login [:effects.profile/login
[(get-in db [:profile/login :key-uid]) [(get-in db [:profile/login :key-uid])
(security/safe-unmask-data password)]]]}))) (security/safe-unmask-data password)]]]})))

View File

@ -2,7 +2,6 @@
(:require (:require
[quo.foundations.colors :as colors] [quo.foundations.colors :as colors]
[quo.theme] [quo.theme]
[react-native.core :as rn]
[react-native.navigation :as navigation] [react-native.navigation :as navigation]
[react-native.platform :as platform] [react-native.platform :as platform]
[react-native.share :as share] [react-native.share :as share]
@ -17,37 +16,36 @@
(defn get-status-nav-color (defn get-status-nav-color
[view-id theme] [view-id theme]
(let [theme (or (get-in views/screens [view-id :options :theme]) (let [theme (or (get-in views/screens [view-id :options :theme])
theme) theme)
[rnn-status-bar rn-status-bar] status-bar-theme (if (or (= theme :dark)
(if (or (= theme :dark) @state/alert-banner-shown?
@state/alert-banner-shown? (and (= view-id :shell-stack)
(and (= view-id :shell-stack) (not (jump-to.utils/home-stack-open?)))) (not (jump-to.utils/home-stack-open?))))
[:light "light-content"] :light
[:dark "dark-content"]) :dark)
home-stack? (some #(= view-id %) shell.constants/stacks-ids) home-stack? (some #(= view-id %) shell.constants/stacks-ids)
;; Home screen nav bar always dark due to bottom tabs ;; Home screen nav bar always dark due to bottom tabs
nav-bar-color (if (or home-stack? nav-bar-color (if (or home-stack?
(= view-id :shell-stack) (= view-id :shell-stack)
(= theme :dark)) (= theme :dark))
colors/neutral-100 colors/neutral-100
colors/white) colors/white)
comp-id (if (or home-stack? comp-id (if (or home-stack?
(jump-to.utils/shell-navigation? view-id) (jump-to.utils/shell-navigation? view-id)
(= view-id :shell)) (= view-id :shell))
:shell-stack :shell-stack
view-id)] view-id)]
[rnn-status-bar rn-status-bar nav-bar-color comp-id])) [status-bar-theme nav-bar-color comp-id]))
(defn reload-status-nav-color-fx (defn reload-status-nav-color-fx
[[view-id theme]] [[view-id theme]]
(when (and (= @state/root-id :shell-stack) view-id) (when (and (= @state/root-id :shell-stack) view-id)
(let [[rnn-status-bar rn-status-bar nav-bar-color comp-id] (get-status-nav-color view-id theme)] (let [[status-bar-theme nav-bar-color comp-id] (get-status-nav-color view-id theme)]
(if platform/ios? (when platform/android?
(rn/set-status-bar-style rn-status-bar true)
(navigation/merge-options (navigation/merge-options
(name comp-id) (name comp-id)
{:statusBar {:style rnn-status-bar} {:statusBar {:style status-bar-theme}
:navigationBar {:backgroundColor nav-bar-color}}))))) :navigationBar {:backgroundColor nav-bar-color}})))))
(rf/reg-fx :reload-status-nav-color-fx reload-status-nav-color-fx) (rf/reg-fx :reload-status-nav-color-fx reload-status-nav-color-fx)
@ -72,8 +70,9 @@
;;;; Root ;;;; Root
(rf/reg-fx :set-root (rf/reg-fx :set-root
(fn [root-id] (fn [[root-id theme]]
(let [root (get (roots/roots) root-id)] (let [[status-bar-theme] (get-status-nav-color root-id theme)
root (get (roots/roots status-bar-theme) root-id)]
(dismiss-all-modals) (dismiss-all-modals)
(rf/dispatch [:profile.settings/switch-theme (rf/dispatch [:profile.settings/switch-theme
(get roots/themes root-id) (get roots/themes root-id)
@ -212,9 +211,9 @@
(rf/reg-fx :show-toasts (rf/reg-fx :show-toasts
(fn [[view-id theme]] (fn [[view-id theme]]
(let [[rnn-status-bar nav-bar-color] (get-status-nav-color view-id theme)] (let [[status-bar-theme nav-bar-color] (get-status-nav-color view-id theme)]
(show-overlay "toasts" (show-overlay "toasts"
(assoc (options/statusbar-and-navbar-options nil rnn-status-bar nav-bar-color) (assoc (options/statusbar-and-navbar-options nil status-bar-theme nav-bar-color)
:overlay :overlay
{:interceptTouchOutside false}))))) {:interceptTouchOutside false})))))
@ -233,7 +232,10 @@
;;;; Alert Banner ;;;; Alert Banner
(rf/reg-fx :show-alert-banner (rf/reg-fx :show-alert-banner
(fn [[view-id theme]] (fn [[view-id theme]]
(show-overlay "alert-banner" {:overlay {:interceptTouchOutside false}}) (show-overlay "alert-banner"
(assoc (options/statusbar-and-navbar-options nil :light nil)
:overlay
{:interceptTouchOutside false}))
(reset! state/alert-banner-shown? true) (reset! state/alert-banner-shown? true)
(reload-status-nav-color-fx [view-id theme]))) (reload-status-nav-color-fx [view-id theme])))

View File

@ -71,8 +71,8 @@
(rf/defn init-root (rf/defn init-root
{:events [:init-root]} {:events [:init-root]}
[_ root-id] [{:keys [db]} root-id]
{:set-root root-id}) {:set-root [root-id (:theme db)]})
(rf/defn set-stack-root (rf/defn set-stack-root
{:events [:set-stack-root]} {:events [:set-stack-root]}

View File

@ -15,7 +15,7 @@
:shell-stack nil}) :shell-stack nil})
(defn roots-internal (defn roots-internal
[] [status-bar-theme]
{:screen/onboarding.intro {:screen/onboarding.intro
{:root {:root
{:stack {:id :screen/onboarding.intro {:stack {:id :screen/onboarding.intro
@ -28,7 +28,8 @@
:children [{:component {:name :shell-stack :children [{:component {:name :shell-stack
:id :shell-stack :id :shell-stack
:options (options/root-options :options (options/root-options
{:nav-bar-color colors/neutral-100})}}]}}} {:nav-bar-color colors/neutral-100
:status-bar-theme status-bar-theme})}}]}}}
:screen/profile.profiles :screen/profile.profiles
{:root {:root
{:stack {:id :screen/profile.profiles {:stack {:id :screen/profile.profiles
@ -51,17 +52,18 @@
:options (options/dark-root-options)}}]}}}}) :options (options/dark-root-options)}}]}}}})
(defn old-roots (defn old-roots
[] [status-bar-theme]
{:progress {:progress
{:root {:stack {:children [{:component {:name :progress {:root {:stack {:children [{:component {:name :progress
:id :progress :id :progress
:options (options/root-options nil)}}] :options (options/root-options {:status-bar-theme
status-bar-theme})}}]
:options (assoc (options/root-options nil) :options (assoc (options/root-options nil)
:topBar :topBar
{:visible false})}}}}) {:visible false})}}}})
(defn roots (defn roots
[] [status-bar-theme]
(merge (merge
(old-roots) (old-roots status-bar-theme)
(roots-internal))) (roots-internal status-bar-theme)))