Skip to content

Commit d7ce42e

Browse files
authoredMar 13, 2025
Bugfix FXIOS-11546 [App Icon 2025] Properly adjust transparent app icon backgrounds for iOS 18 (#25308)
* Fix for iOS 18 devices to properly show transparent app backgrounds based on color scheme.
1 parent de5236f commit d7ce42e

File tree

1 file changed

+20
-6
lines changed

1 file changed

+20
-6
lines changed
 

‎firefox-ios/Client/Frontend/Settings/AppIconSelection/AppIconView.swift

+20-6
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ struct AppIconView: View, ThemeApplicable {
1515
// MARK: - Theming
1616
// FIXME FXIOS-11472 Improve our SwiftUI theming
1717
@Environment(\.themeManager)
18-
var themeManager
19-
@State var currentTheme: Theme = LightTheme()
18+
private var themeManager
19+
@State private var currentTheme: Theme = LightTheme()
2020
@State private var themeColors: ThemeColourPalette = LightTheme().colors
2121

2222
struct UX {
@@ -30,13 +30,13 @@ struct AppIconView: View, ThemeApplicable {
3030
static let appIconDarkBackgroundColor = UIColor(rgb: 33).color
3131
}
3232

33-
var selectionImageAccessibilityLabel: String {
33+
private var selectionImageAccessibilityLabel: String {
3434
return isSelected
3535
? .Settings.AppIconSelection.Accessibility.AppIconSelectedLabel
3636
: .Settings.AppIconSelection.Accessibility.AppIconUnselectedLabel
3737
}
3838

39-
var selectionAccessibilityHint: String {
39+
private var selectionAccessibilityHint: String {
4040
return .localizedStringWithFormat(
4141
.Settings.AppIconSelection.Accessibility.AppIconSelectionHint,
4242
appIcon.displayName
@@ -63,14 +63,28 @@ struct AppIconView: View, ThemeApplicable {
6363
}
6464

6565
/// Devices prior to iOS 18 cannot change their icon display mode with their system settings
66-
var forceLightTheme: Bool {
66+
private var forceLightTheme: Bool {
6767
if #available(iOS 18, *) {
6868
return false
6969
} else {
7070
return true
7171
}
7272
}
7373

74+
/// The expected default app icon background for iOS 18+ app icons with transparency
75+
private var appIconBackgroundColor: Color {
76+
if forceLightTheme {
77+
return UX.appIconLightBackgroundColor
78+
} else {
79+
switch currentTheme.type.colorScheme {
80+
case .light:
81+
return UX.appIconLightBackgroundColor
82+
default:
83+
return UX.appIconDarkBackgroundColor
84+
}
85+
}
86+
}
87+
7488
private func button(for image: UIImage) -> some View {
7589
Button(action: {
7690
setAppIcon(appIcon)
@@ -85,7 +99,7 @@ struct AppIconView: View, ThemeApplicable {
8599
.background(
86100
forceLightTheme
87101
? UX.appIconLightBackgroundColor
88-
: UX.appIconDarkBackgroundColor
102+
: appIconBackgroundColor
89103
)
90104
// Pre iOS 18, force Light mode for the icons since users will only ever see Light home screen icons
91105
// Note: This fix does not work on iOS15 but it's a small user base

0 commit comments

Comments
 (0)
Failed to load comments.