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

View File

@ -28,7 +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
{:dispatch [:init-root :progress]
:effects.shell/reset-state nil
:hide-popover nil
::logout nil

View File

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

View File

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

View File

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

View File

@ -74,7 +74,7 @@
(cond
pairing-completed?
[[:set-root :screen/onboarding.syncing-results]]
[[:dispatch [:init-root :screen/onboarding.syncing-results]]]
(get db :onboarding/new-account?)
[[:dispatch [:onboarding/finalize-setup]]]
@ -85,7 +85,7 @@
constants/theme-type-dark)
:shell-stack
false]]
[:set-root :shell-stack]
[:dispatch [:init-root :shell-stack]]
[: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
@ -179,7 +179,7 @@
{:db (-> db
(assoc-in [:profile/login :password] password)
(assoc-in [:profile/login :processing] true))
:fx [[:set-root :progress]
:fx [[:dispatch [:init-root :progress]]
[:effects.profile/login
[(get-in db [:profile/login :key-uid])
(security/safe-unmask-data password)]]]})))

View File

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

View File

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

View File

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