Skip to content

Commit

Permalink
Align status bar color using same var as front end (#2827)
Browse files Browse the repository at this point in the history
  • Loading branch information
bgoncal committed Jun 27, 2024
1 parent 4770757 commit 5e234d2
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions Sources/App/Resources/WebSocketBridge.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const notifyThemeColors = () => {

[
'--app-header-background-color',
'--app-theme-color',
'--primary-background-color',
'--text-primary-color',
'--primary-color',
Expand Down
2 changes: 2 additions & 0 deletions Sources/App/Utilities/ThemeColors.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ public struct ThemeColors: Codable {
public enum Color: String, CaseIterable {
// these are in WebSocketBridge.js in this repo (we inject it)
case appHeaderBackgroundColor = "--app-header-background-color"
case appThemeColor = "--app-theme-color"
case primaryBackgroundColor = "--primary-background-color"
case textPrimaryColor = "--text-primary-color"
case primaryColor = "--primary-color"
Expand Down Expand Up @@ -77,6 +78,7 @@ private extension ThemeColors.Color {
case .primaryBackgroundColor: return UIColor(red: 0.98, green: 0.98, blue: 0.98, alpha: 1.0)
case .primaryColor: return UIColor.white
case .textPrimaryColor: return UIColor.white
case .appThemeColor: return UIColor(red: 0.01, green: 0.66, blue: 0.96, alpha: 1.0)
}
}
}
4 changes: 2 additions & 2 deletions Sources/App/WebView/WebViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -346,12 +346,12 @@ final class WebViewController: UIViewController, WKNavigationDelegate, WKUIDeleg
webView?.scrollView.backgroundColor = cachedColors[.primaryBackgroundColor]

if let statusBarView = view.viewWithTag(111) {
statusBarView.backgroundColor = cachedColors[.appHeaderBackgroundColor]
statusBarView.backgroundColor = cachedColors[.appThemeColor]
}

refreshControl.tintColor = cachedColors[.primaryColor]

let headerBackgroundIsLight = cachedColors[.appHeaderBackgroundColor].isLight
let headerBackgroundIsLight = cachedColors[.appThemeColor].isLight
underlyingPreferredStatusBarStyle = headerBackgroundIsLight ? .darkContent : .lightContent

setNeedsStatusBarAppearanceUpdate()
Expand Down

0 comments on commit 5e234d2

Please sign in to comment.