From dfe270bbe0245697d1a8c628c93ec7d09e908c90 Mon Sep 17 00:00:00 2001 From: Alexandru Farcasanu Date: Wed, 22 Oct 2025 14:28:14 +0300 Subject: [PATCH 1/4] =?UTF-8?q?FXIOS-13896=20#30108=20=E2=81=83=20[iOS=202?= =?UTF-8?q?6]=20The=20Done=20button=20color=20in=20Edit=20bookmarks=20menu?= =?UTF-8?q?=20is=20not=20consistent=20(not=20blue)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CreditCardInputView.swift | 15 +++++++++++- .../Bookmarks/BookmarksViewController.swift | 12 ++++++++++ .../EditBookmarkViewController.swift | 5 +++- .../EditFolderViewController.swift | 5 +++- .../LibraryViewController.swift | 11 ++++++++- .../Protocols/OnboardingCardDelegate.swift | 5 +++- .../Protocols/OnboardingService.swift | 6 ++++- .../Views/PrivacyPolicyViewController.swift | 6 ++++- .../PrivacyPreferencesViewController.swift | 6 ++++- .../AddCredentialViewController.swift | 8 +++++-- .../StylingViewModifiers.swift | 23 +++++++++++++++++++ .../ContentBlockerSettingViewController.swift | 4 ++++ .../Settings/CustomSearchViewController.swift | 4 ++++ .../HomePageSettingViewController.swift | 4 ++++ .../Main/AppSettingsTableViewController.swift | 6 ++++- .../SearchSettingsTableViewController.swift | 9 +++++++- 16 files changed, 117 insertions(+), 12 deletions(-) diff --git a/firefox-ios/Client/Frontend/Autofill/CreditCard/CreditCardSettingsView/CreditCardInputView.swift b/firefox-ios/Client/Frontend/Autofill/CreditCard/CreditCardSettingsView/CreditCardInputView.swift index d610a195da57d..975cffdea1076 100644 --- a/firefox-ios/Client/Frontend/Autofill/CreditCard/CreditCardSettingsView/CreditCardInputView.swift +++ b/firefox-ios/Client/Frontend/Autofill/CreditCard/CreditCardSettingsView/CreditCardInputView.swift @@ -30,6 +30,8 @@ struct CreditCardInputView: View { @State var borderColor: Color = .clear @State var textFieldBackgroundColor: Color = .clear @State var barButtonColor: Color = .clear + @State var saveButtonColor: Color = .clear + @State var editButtonColor: Color = .clear @State var saveButtonDisabledColor: Color = .clear var body: some View { @@ -169,6 +171,8 @@ struct CreditCardInputView: View { backgroundColor = Color(color.layer1) textFieldBackgroundColor = Color(color.layer2) barButtonColor = Color(color.actionPrimary) + saveButtonColor = Color(color.textAccent) + editButtonColor = Color(color.textPrimary) saveButtonDisabledColor = Color(color.textSecondary) } @@ -210,7 +214,16 @@ struct CreditCardInputView: View { } } } - .foregroundColor(viewModel.isRightBarButtonEnabled ? barButtonColor : saveButtonDisabledColor) + .modifier( + CreditCardViewButtonStyle( + isEnabled: viewModel.isRightBarButtonEnabled, + barButtonColor: barButtonColor, + editStateColor: editButtonColor, + saveStateColor: saveButtonColor, + saveDisableStateColor: saveButtonDisabledColor, + buttonState: btnState + ) + ) .onDisappear { viewModel.isRightBarButtonEnabled = false } diff --git a/firefox-ios/Client/Frontend/Library/Bookmarks/BookmarksViewController.swift b/firefox-ios/Client/Frontend/Library/Bookmarks/BookmarksViewController.swift index ff0a4592329f7..08812c1c57d8e 100644 --- a/firefox-ios/Client/Frontend/Library/Bookmarks/BookmarksViewController.swift +++ b/firefox-ios/Client/Frontend/Library/Bookmarks/BookmarksViewController.swift @@ -45,16 +45,28 @@ final class BookmarksViewController: SiteTableViewController, switch state { case .bookmarks(state: .mainView), .bookmarks(state: .inFolder): bottomRightButton.title = .BookmarksEdit + if #available(iOS 26.0, *) { + bottomRightButton.tintColor = themeManager.getCurrentTheme(for: windowUUID).colors.textPrimary + } return [flexibleSpace, bottomRightButton] case .bookmarks(state: .inFolderEditMode): bottomRightButton.title = String.AppSettingsDone + if #available(iOS 26.0, *) { + bottomRightButton.tintColor = themeManager.getCurrentTheme(for: windowUUID).colors.textAccent + } return [bottomLeftButton, flexibleSpace, bottomRightButton] case .bookmarks(state: .itemEditMode): bottomRightButton.title = String.AppSettingsDone + if #available(iOS 26.0, *) { + bottomRightButton.tintColor = themeManager.getCurrentTheme(for: windowUUID).colors.textAccent + } bottomRightButton.isEnabled = true return [flexibleSpace, bottomRightButton] case .bookmarks(state: .itemEditModeInvalidField): bottomRightButton.title = String.AppSettingsDone + if #available(iOS 26.0, *) { + bottomRightButton.tintColor = themeManager.getCurrentTheme(for: windowUUID).colors.textAccent + } bottomRightButton.isEnabled = false return [flexibleSpace, bottomRightButton] default: diff --git a/firefox-ios/Client/Frontend/Library/Bookmarks/Edit Bookmark/EditBookmarkViewController.swift b/firefox-ios/Client/Frontend/Library/Bookmarks/Edit Bookmark/EditBookmarkViewController.swift index 4ab468fab9d65..792d668ba4faa 100644 --- a/firefox-ios/Client/Frontend/Library/Bookmarks/Edit Bookmark/EditBookmarkViewController.swift +++ b/firefox-ios/Client/Frontend/Library/Bookmarks/Edit Bookmark/EditBookmarkViewController.swift @@ -46,7 +46,7 @@ class EditBookmarkViewController: UIViewController, private lazy var saveBarButton: UIBarButtonItem = { let button = UIBarButtonItem( title: String.Bookmarks.Menu.EditBookmarkSave, - style: .done, + style: .plain, target: self, action: #selector(saveButtonAction) ) @@ -180,6 +180,9 @@ class EditBookmarkViewController: UIViewController, navigationController?.navigationBar.tintColor = theme.colors.actionPrimary view.backgroundColor = theme.colors.layer1 tableView.backgroundColor = theme.colors.layer1 + if #available(iOS 26.0, *) { + saveBarButton.tintColor = theme.colors.textAccent + } } // MARK: - Configure Table View Cells diff --git a/firefox-ios/Client/Frontend/Library/Bookmarks/Edit Folder/EditFolderViewController.swift b/firefox-ios/Client/Frontend/Library/Bookmarks/Edit Folder/EditFolderViewController.swift index 475bbe9eb6d23..f49bdf28b00b7 100644 --- a/firefox-ios/Client/Frontend/Library/Bookmarks/Edit Folder/EditFolderViewController.swift +++ b/firefox-ios/Client/Frontend/Library/Bookmarks/Edit Folder/EditFolderViewController.swift @@ -53,7 +53,7 @@ class EditFolderViewController: UIViewController, private lazy var saveBarButton: UIBarButtonItem = { let button = UIBarButtonItem( title: String.Bookmarks.Menu.EditBookmarkSave, - style: .done, + style: .plain, target: self, action: #selector(saveButtonAction) ) @@ -158,6 +158,9 @@ class EditFolderViewController: UIViewController, navigationController?.navigationBar.tintColor = theme.colors.actionPrimary view.backgroundColor = theme.colors.layer1 tableView.backgroundColor = theme.colors.layer1 + if #available(iOS 26.0, *) { + saveBarButton.tintColor = theme.colors.textAccent + } } // MARK: - UITableViewDataSource & UITableViewDelegate diff --git a/firefox-ios/Client/Frontend/Library/LibraryViewController/LibraryViewController.swift b/firefox-ios/Client/Frontend/Library/LibraryViewController/LibraryViewController.swift index cde5848f18b91..1370adeb4e0e7 100644 --- a/firefox-ios/Client/Frontend/Library/LibraryViewController/LibraryViewController.swift +++ b/firefox-ios/Client/Frontend/Library/LibraryViewController/LibraryViewController.swift @@ -59,7 +59,7 @@ class LibraryViewController: UIViewController, Themeable { private lazy var topRightButton: UIBarButtonItem = { let button = UIBarButtonItem( title: String.AppSettingsDone, - style: .done, + style: .plain, target: self, action: #selector(topRightButtonAction) ) @@ -301,14 +301,23 @@ class LibraryViewController: UIViewController, Themeable { navigationItem.rightBarButtonItem = nil case .bookmarks(state: .itemEditMode): topRightButton.title = .SettingsAddCustomEngineSaveButtonText + if #available(iOS 26.0, *) { + topRightButton.tintColor = themeManager.getCurrentTheme(for: windowUUID).colors.textAccent + } navigationItem.rightBarButtonItem = topRightButton navigationItem.rightBarButtonItem?.isEnabled = true case .bookmarks(state: .itemEditModeInvalidField): topRightButton.title = .SettingsAddCustomEngineSaveButtonText + if #available(iOS 26.0, *) { + topRightButton.tintColor = themeManager.getCurrentTheme(for: windowUUID).colors.textAccent + } navigationItem.rightBarButtonItem = topRightButton navigationItem.rightBarButtonItem?.isEnabled = false default: topRightButton.title = String.AppSettingsDone + if #available(iOS 26.0, *) { + topRightButton.tintColor = themeManager.getCurrentTheme(for: windowUUID).colors.textPrimary + } navigationItem.rightBarButtonItem = topRightButton navigationItem.rightBarButtonItem?.isEnabled = true } diff --git a/firefox-ios/Client/Frontend/Onboarding/Protocols/OnboardingCardDelegate.swift b/firefox-ios/Client/Frontend/Onboarding/Protocols/OnboardingCardDelegate.swift index c18a84a6510d2..e865c81ace5fd 100644 --- a/firefox-ios/Client/Frontend/Onboarding/Protocols/OnboardingCardDelegate.swift +++ b/firefox-ios/Client/Frontend/Onboarding/Protocols/OnboardingCardDelegate.swift @@ -152,9 +152,12 @@ extension OnboardingCardDelegate where Self: OnboardingViewControllerProtocol, windowUUID: windowUUID) let buttonItem = UIBarButtonItem( title: .SettingsSearchDoneButton, - style: .done, + style: .plain, target: self, action: selector) + if #available(iOS 26.0, *) { + buttonItem.tintColor = themeManager.getCurrentTheme(for: windowUUID).colors.textPrimary + } singInSyncVC.navigationItem.rightBarButtonItem = buttonItem (singInSyncVC as? FirefoxAccountSignInViewController)?.qrCodeNavigationHandler = qrCodeNavigationHandler diff --git a/firefox-ios/Client/Frontend/Onboarding/Protocols/OnboardingService.swift b/firefox-ios/Client/Frontend/Onboarding/Protocols/OnboardingService.swift index a835b04f3dc5a..4739c91eb1eb2 100644 --- a/firefox-ios/Client/Frontend/Onboarding/Protocols/OnboardingService.swift +++ b/firefox-ios/Client/Frontend/Onboarding/Protocols/OnboardingService.swift @@ -290,7 +290,11 @@ final class OnboardingService: FeatureFlaggable { style: .plain, target: self, action: #selector(dismissSelector)) - buttonItem.tintColor = themeManager.getCurrentTheme(for: windowUUID).colors.actionPrimary + if #available(iOS 26.0, *) { + buttonItem.tintColor = themeManager.getCurrentTheme(for: windowUUID).colors.textPrimary + } else { + buttonItem.tintColor = themeManager.getCurrentTheme(for: windowUUID).colors.actionPrimary + } singInSyncVC.navigationItem.rightBarButtonItem = buttonItem (singInSyncVC as? FirefoxAccountSignInViewController)?.qrCodeNavigationHandler = qrCodeNavigationHandler diff --git a/firefox-ios/Client/Frontend/Onboarding/Views/PrivacyPolicyViewController.swift b/firefox-ios/Client/Frontend/Onboarding/Views/PrivacyPolicyViewController.swift index 6848932cb3235..50119cbb17224 100644 --- a/firefox-ios/Client/Frontend/Onboarding/Views/PrivacyPolicyViewController.swift +++ b/firefox-ios/Client/Frontend/Onboarding/Views/PrivacyPolicyViewController.swift @@ -64,7 +64,11 @@ class PrivacyPolicyViewController: UIViewController, Themeable { // MARK: - Theming func applyTheme() { let theme = themeManager.getCurrentTheme(for: windowUUID) - navigationItem.rightBarButtonItem?.tintColor = theme.colors.actionPrimary + if #available(iOS 26.0, *) { + navigationItem.rightBarButtonItem?.tintColor = theme.colors.textPrimary + } else { + navigationItem.rightBarButtonItem?.tintColor = theme.colors.actionPrimary + } } } diff --git a/firefox-ios/Client/Frontend/Onboarding/Views/PrivacyPreferencesViewController.swift b/firefox-ios/Client/Frontend/Onboarding/Views/PrivacyPreferencesViewController.swift index 34198d60a802e..bd35ca2f286a3 100644 --- a/firefox-ios/Client/Frontend/Onboarding/Views/PrivacyPreferencesViewController.swift +++ b/firefox-ios/Client/Frontend/Onboarding/Views/PrivacyPreferencesViewController.swift @@ -285,7 +285,11 @@ final class PrivacyPreferencesViewController: UIViewController, } titleLabel.textColor = theme.colors.textPrimary - doneButton.setTitleColor(theme.colors.textAccent, for: .normal) + if #available(iOS 26.0, *) { + doneButton.setTitleColor(theme.colors.textPrimary, for: .normal) + } else { + doneButton.setTitleColor(theme.colors.textAccent, for: .normal) + } crashReportsSwitch.applyTheme(theme: theme) technicalDataSwitch.applyTheme(theme: theme) setupContentViews() diff --git a/firefox-ios/Client/Frontend/PasswordManagement/AddCredentialViewController.swift b/firefox-ios/Client/Frontend/PasswordManagement/AddCredentialViewController.swift index 24381d98cdf41..f302215688da4 100644 --- a/firefox-ios/Client/Frontend/PasswordManagement/AddCredentialViewController.swift +++ b/firefox-ios/Client/Frontend/PasswordManagement/AddCredentialViewController.swift @@ -53,12 +53,16 @@ class AddCredentialViewController: UIViewController, Themeable { fileprivate lazy var saveButton: UIBarButtonItem = { let button = UIBarButtonItem( title: .SettingsAddCustomEngineSaveButtonText, - style: .done, + style: .plain, target: self, action: #selector(addCredential) ) button.isEnabled = false - button.tintColor = themeManager.getCurrentTheme(for: windowUUID).colors.actionPrimary + if #available(iOS 26.0, *) { + button.tintColor = themeManager.getCurrentTheme(for: windowUUID).colors.textAccent + } else { + button.tintColor = themeManager.getCurrentTheme(for: windowUUID).colors.actionPrimary + } return button }() diff --git a/firefox-ios/Client/Frontend/Settings/AppearanceSettings/StylingViewModifiers.swift b/firefox-ios/Client/Frontend/Settings/AppearanceSettings/StylingViewModifiers.swift index 2f21ceafe54e5..0d2b4d50e2d60 100644 --- a/firefox-ios/Client/Frontend/Settings/AppearanceSettings/StylingViewModifiers.swift +++ b/firefox-ios/Client/Frontend/Settings/AppearanceSettings/StylingViewModifiers.swift @@ -164,3 +164,26 @@ struct ToggleStyle: ViewModifier { } } } + +struct CreditCardViewButtonStyle: ViewModifier { + let isEnabled: Bool + let barButtonColor: Color + let editStateColor: Color + let saveStateColor: Color + let saveDisableStateColor: Color + let buttonState: CreditCardRightBarButton + + func body(content: Content) -> some View { + if #available(iOS 26.0, *) { + content + .foregroundColor( + !isEnabled ? saveDisableStateColor : + buttonState == .edit ? editStateColor : + saveStateColor + ) + } else { + content + .foregroundColor(isEnabled ? barButtonColor : saveDisableStateColor) + } + } +} diff --git a/firefox-ios/Client/Frontend/Settings/ContentBlockerSettingViewController.swift b/firefox-ios/Client/Frontend/Settings/ContentBlockerSettingViewController.swift index 437753d843273..c37856d5d7b21 100644 --- a/firefox-ios/Client/Frontend/Settings/ContentBlockerSettingViewController.swift +++ b/firefox-ios/Client/Frontend/Settings/ContentBlockerSettingViewController.swift @@ -36,6 +36,10 @@ class ContentBlockerSettingViewController: SettingsTableViewController, style: .plain, target: self, action: #selector(done)) + if #available(iOS 26.0, *) { + let theme = themeManager.getCurrentTheme(for: windowUUID) + navigationItem.rightBarButtonItem?.tintColor = theme.colors.textPrimary + } } } diff --git a/firefox-ios/Client/Frontend/Settings/CustomSearchViewController.swift b/firefox-ios/Client/Frontend/Settings/CustomSearchViewController.swift index fee5775c80b19..abff23dc3c9d8 100644 --- a/firefox-ios/Client/Frontend/Settings/CustomSearchViewController.swift +++ b/firefox-ios/Client/Frontend/Settings/CustomSearchViewController.swift @@ -204,6 +204,10 @@ class CustomSearchViewController: SettingsTableViewController { target: self, action: #selector(self.addCustomSearchEngine) ) + if #available(iOS 26.0, *) { + let theme = themeManager.getCurrentTheme(for: windowUUID) + self.navigationItem.rightBarButtonItem?.tintColor = theme.colors.textAccent + } self.navigationItem.rightBarButtonItem?.accessibilityIdentifier = "customEngineSaveButton" self.navigationItem.rightBarButtonItem?.isEnabled = false diff --git a/firefox-ios/Client/Frontend/Settings/HomepageSettings/HomePageSettingViewController.swift b/firefox-ios/Client/Frontend/Settings/HomepageSettings/HomePageSettingViewController.swift index 7ad18f9c554cb..ba8425d269908 100644 --- a/firefox-ios/Client/Frontend/Settings/HomepageSettings/HomePageSettingViewController.swift +++ b/firefox-ios/Client/Frontend/Settings/HomepageSettings/HomePageSettingViewController.swift @@ -43,6 +43,10 @@ class HomePageSettingViewController: SettingsTableViewController, FeatureFlaggab style: .plain, target: self, action: #selector(done)) + if #available(iOS 26.0, *) { + let theme = themeManager.getCurrentTheme(for: windowUUID) + navigationItem.rightBarButtonItem?.tintColor = theme.colors.textPrimary + } } required init?(coder aDecoder: NSCoder) { diff --git a/firefox-ios/Client/Frontend/Settings/Main/AppSettingsTableViewController.swift b/firefox-ios/Client/Frontend/Settings/Main/AppSettingsTableViewController.swift index b417c0d3ab078..d7cd62145a69b 100644 --- a/firefox-ios/Client/Frontend/Settings/Main/AppSettingsTableViewController.swift +++ b/firefox-ios/Client/Frontend/Settings/Main/AppSettingsTableViewController.swift @@ -146,9 +146,13 @@ class AppSettingsTableViewController: SettingsTableViewController, navigationItem.title = String.AppSettingsTitle navigationItem.rightBarButtonItem = UIBarButtonItem( title: .AppSettingsDone, - style: .done, + style: .plain, target: self, action: #selector(done)) + if #available(iOS 26.0, *) { + let theme = themeManager.getCurrentTheme(for: windowUUID) + navigationItem.rightBarButtonItem?.tintColor = theme.colors.textPrimary + } } // MARK: - Accessibility Identifiers diff --git a/firefox-ios/Client/Frontend/Settings/SearchSettingsTableViewController.swift b/firefox-ios/Client/Frontend/Settings/SearchSettingsTableViewController.swift index 961784ce21f1a..f58d7a795a4af 100644 --- a/firefox-ios/Client/Frontend/Settings/SearchSettingsTableViewController.swift +++ b/firefox-ios/Client/Frontend/Settings/SearchSettingsTableViewController.swift @@ -123,10 +123,14 @@ final class SearchSettingsTableViewController: ThemedTableViewController, Featur if !(self.navigationController is ThemedNavigationController) { self.navigationItem.leftBarButtonItem = UIBarButtonItem( title: .SettingsSearchDoneButton, - style: .done, + style: .plain, target: self, action: #selector(self.dismissAnimated) ) + if #available(iOS 26.0, *) { + let textColor = themeManager.getCurrentTheme(for: windowUUID).colors.textPrimary + self.navigationItem.leftBarButtonItem?.tintColor = textColor + } } navigationItem.rightBarButtonItem = UIBarButtonItem( @@ -584,6 +588,9 @@ final class SearchSettingsTableViewController: ThemedTableViewController, Featur showDeletion = editing UIView.performWithoutAnimation { self.navigationItem.rightBarButtonItem?.title = editing ? .SettingsSearchDoneButton : .SettingsSearchEditButton + let theme = themeManager.getCurrentTheme(for: windowUUID) + let textColor = editing ? theme.colors.textAccent : theme.colors.textPrimary + self.navigationItem.rightBarButtonItem?.tintColor = textColor } navigationItem.rightBarButtonItem?.isEnabled = isEditable navigationItem.rightBarButtonItem?.action = editing ? From ea3bc8fa3594ca58369f517b148fd41472ccde74 Mon Sep 17 00:00:00 2001 From: Alexandru Farcasanu Date: Fri, 24 Oct 2025 15:30:55 +0300 Subject: [PATCH 2/4] Refactor for theme --- .../CreditCardInputView.swift | 75 ++++++++----------- .../CreditCardSettingsViewController.swift | 6 +- .../Bookmarks/BookmarksViewController.swift | 8 +- .../LibraryViewController.swift | 18 +++-- .../StylingViewModifiers.swift | 34 ++++++--- 5 files changed, 74 insertions(+), 67 deletions(-) diff --git a/firefox-ios/Client/Frontend/Autofill/CreditCard/CreditCardSettingsView/CreditCardInputView.swift b/firefox-ios/Client/Frontend/Autofill/CreditCard/CreditCardSettingsView/CreditCardInputView.swift index 975cffdea1076..1704036f2c333 100644 --- a/firefox-ios/Client/Frontend/Autofill/CreditCard/CreditCardSettingsView/CreditCardInputView.swift +++ b/firefox-ios/Client/Frontend/Autofill/CreditCard/CreditCardSettingsView/CreditCardInputView.swift @@ -8,7 +8,7 @@ import SwiftUI import struct MozillaAppServices.CreditCard -struct CreditCardInputView: View { +struct CreditCardInputView: ThemeableView { private struct UX { static let cornerRadius: CGFloat = 24 static let blurRadius: CGFloat = 10 @@ -24,27 +24,24 @@ struct CreditCardInputView: View { // Theming let windowUUID: WindowUUID - @Environment(\.themeManager) - var themeManager - @State var backgroundColor: Color = .clear - @State var borderColor: Color = .clear - @State var textFieldBackgroundColor: Color = .clear - @State var barButtonColor: Color = .clear - @State var saveButtonColor: Color = .clear - @State var editButtonColor: Color = .clear - @State var saveButtonDisabledColor: Color = .clear + var themeManager: ThemeManager + @State var theme: Theme + + init( + viewModel: CreditCardInputViewModel, + windowUUID: WindowUUID, + themeManager: ThemeManager + ) { + self.viewModel = viewModel + self.windowUUID = windowUUID + self.themeManager = themeManager + self.theme = themeManager.getCurrentTheme(for: windowUUID) + } var body: some View { NavigationView { main .blur(radius: isBlurred ? UX.blurRadius : 0) - .onAppear { - applyTheme(theme: themeManager.getCurrentTheme(for: windowUUID)) - } - .onReceive(NotificationCenter.default.publisher(for: .ThemeDidChange)) { notification in - guard let uuid = notification.windowUUID, uuid == windowUUID else { return } - applyTheme(theme: themeManager.getCurrentTheme(for: windowUUID)) - } .onReceive(NotificationCenter.default.publisher( for: UIApplication.willResignActiveNotification) ) { _ in @@ -56,11 +53,12 @@ struct CreditCardInputView: View { isBlurred = false } } + .listenToThemeChanges(theme: $theme, manager: themeManager, windowUUID: windowUUID) } private var main: some View { return ZStack { - backgroundColor.ignoresSafeArea() + Color(theme.colors.layer1).ignoresSafeArea() form .navigationBarTitle(viewModel.state.title, displayMode: .inline) @@ -68,15 +66,15 @@ struct CreditCardInputView: View { ToolbarItem(placement: .navigationBarTrailing) { rightBarButton() .disabled(!viewModel.isRightBarButtonEnabled) - .foregroundColor(barButtonColor) + .foregroundColor(Color(theme.colors.actionPrimary)) } ToolbarItem(placement: .navigationBarLeading) { leftBarButton() - .foregroundColor(barButtonColor) + .foregroundColor(Color(theme.colors.actionPrimary)) } } .padding(.top, 0) - .background(backgroundColor.edgesIgnoringSafeArea(.bottom)) + .background(Color(theme.colors.layer1).edgesIgnoringSafeArea(.bottom)) } } @@ -85,21 +83,21 @@ struct CreditCardInputView: View { if #unavailable(iOS 26.0) { Divider() .frame(height: UX.dividerHeight) - .foregroundColor(borderColor) + .foregroundColor(.clear) } name - .background(textFieldBackgroundColor) + .background(Color(theme.colors.layer2)) .modifier(NewStyleRoundedCorners(topLeadingCorner: UX.cornerRadius, topTrailingCorner: UX.cornerRadius, bottomLeadingCorner: nil, bottomTrailingCorner: nil)) number - .background(textFieldBackgroundColor) + .background(Color(theme.colors.layer2)) expiration - .background(textFieldBackgroundColor) + .background(Color(theme.colors.layer2)) .modifier(NewStyleRoundedCorners(topLeadingCorner: nil, topTrailingCorner: nil, bottomLeadingCorner: UX.cornerRadius, @@ -129,7 +127,7 @@ struct CreditCardInputView: View { Divider() .frame(height: UX.dividerHeight) - .foregroundColor(borderColor) + .foregroundColor(.clear) .padding(.top, UX.dividerPaddingTop) } } @@ -144,7 +142,7 @@ struct CreditCardInputView: View { Divider() .frame(height: UX.dividerHeight) - .foregroundColor(borderColor) + .foregroundColor(.clear) .padding(.top, UX.dividerPaddingTop) } } @@ -160,22 +158,12 @@ struct CreditCardInputView: View { if #unavailable(iOS 26.0) { Divider() .frame(height: UX.dividerHeight) - .foregroundColor(borderColor) + .foregroundColor(.clear) .padding(.top, UX.dividerPaddingTop) } } } - func applyTheme(theme: Theme) { - let color = theme.colors - backgroundColor = Color(color.layer1) - textFieldBackgroundColor = Color(color.layer2) - barButtonColor = Color(color.actionPrimary) - saveButtonColor = Color(color.textAccent) - editButtonColor = Color(color.textPrimary) - saveButtonDisabledColor = Color(color.textSecondary) - } - func rightBarButton() -> some View { let btnState = viewModel.state.rightBarBtn return Button(btnState.title) { @@ -217,10 +205,7 @@ struct CreditCardInputView: View { .modifier( CreditCardViewButtonStyle( isEnabled: viewModel.isRightBarButtonEnabled, - barButtonColor: barButtonColor, - editStateColor: editButtonColor, - saveStateColor: saveButtonColor, - saveDisableStateColor: saveButtonDisabledColor, + theme: theme, buttonState: btnState ) ) @@ -263,6 +248,10 @@ struct CreditCardEditView_Previews: PreviewProvider { creditCard: sampleCreditCard, state: .view) - return CreditCardInputView(viewModel: viewModel, windowUUID: .XCTestDefaultUUID) + return CreditCardInputView( + viewModel: viewModel, + windowUUID: .XCTestDefaultUUID, + themeManager: DefaultThemeManager(sharedContainerIdentifier: "") + ) } } diff --git a/firefox-ios/Client/Frontend/Autofill/CreditCard/CreditCardSettingsView/CreditCardSettingsViewController.swift b/firefox-ios/Client/Frontend/Autofill/CreditCard/CreditCardSettingsView/CreditCardSettingsViewController.swift index fc06383b3350b..39adc0f30b032 100644 --- a/firefox-ios/Client/Frontend/Autofill/CreditCard/CreditCardSettingsView/CreditCardSettingsViewController.swift +++ b/firefox-ios/Client/Frontend/Autofill/CreditCard/CreditCardSettingsView/CreditCardSettingsViewController.swift @@ -163,7 +163,11 @@ class CreditCardSettingsViewController: SensitiveViewController, UIAdaptivePrese viewModel.cardInputViewModel.creditCard = creditCard } viewModel.cardInputViewModel.updateState(state: editState) - creditCardEditView = CreditCardInputView(viewModel: viewModel.cardInputViewModel, windowUUID: windowUUID) + creditCardEditView = CreditCardInputView( + viewModel: viewModel.cardInputViewModel, + windowUUID: windowUUID, + themeManager: themeManager + ) viewModel.cardInputViewModel.dismiss = { [weak self] status, successVal in DispatchQueue.main.async { if successVal { diff --git a/firefox-ios/Client/Frontend/Library/Bookmarks/BookmarksViewController.swift b/firefox-ios/Client/Frontend/Library/Bookmarks/BookmarksViewController.swift index 08812c1c57d8e..684f6453b35b4 100644 --- a/firefox-ios/Client/Frontend/Library/Bookmarks/BookmarksViewController.swift +++ b/firefox-ios/Client/Frontend/Library/Bookmarks/BookmarksViewController.swift @@ -46,26 +46,26 @@ final class BookmarksViewController: SiteTableViewController, case .bookmarks(state: .mainView), .bookmarks(state: .inFolder): bottomRightButton.title = .BookmarksEdit if #available(iOS 26.0, *) { - bottomRightButton.tintColor = themeManager.getCurrentTheme(for: windowUUID).colors.textPrimary + bottomRightButton.tintColor = currentTheme().colors.textPrimary } return [flexibleSpace, bottomRightButton] case .bookmarks(state: .inFolderEditMode): bottomRightButton.title = String.AppSettingsDone if #available(iOS 26.0, *) { - bottomRightButton.tintColor = themeManager.getCurrentTheme(for: windowUUID).colors.textAccent + bottomRightButton.tintColor = currentTheme().colors.textAccent } return [bottomLeftButton, flexibleSpace, bottomRightButton] case .bookmarks(state: .itemEditMode): bottomRightButton.title = String.AppSettingsDone if #available(iOS 26.0, *) { - bottomRightButton.tintColor = themeManager.getCurrentTheme(for: windowUUID).colors.textAccent + bottomRightButton.tintColor = currentTheme().colors.textAccent } bottomRightButton.isEnabled = true return [flexibleSpace, bottomRightButton] case .bookmarks(state: .itemEditModeInvalidField): bottomRightButton.title = String.AppSettingsDone if #available(iOS 26.0, *) { - bottomRightButton.tintColor = themeManager.getCurrentTheme(for: windowUUID).colors.textAccent + bottomRightButton.tintColor = currentTheme().colors.textAccent } bottomRightButton.isEnabled = false return [flexibleSpace, bottomRightButton] diff --git a/firefox-ios/Client/Frontend/Library/LibraryViewController/LibraryViewController.swift b/firefox-ios/Client/Frontend/Library/LibraryViewController/LibraryViewController.swift index 1370adeb4e0e7..18c30682b6e57 100644 --- a/firefox-ios/Client/Frontend/Library/LibraryViewController/LibraryViewController.swift +++ b/firefox-ios/Client/Frontend/Library/LibraryViewController/LibraryViewController.swift @@ -302,21 +302,21 @@ class LibraryViewController: UIViewController, Themeable { case .bookmarks(state: .itemEditMode): topRightButton.title = .SettingsAddCustomEngineSaveButtonText if #available(iOS 26.0, *) { - topRightButton.tintColor = themeManager.getCurrentTheme(for: windowUUID).colors.textAccent + topRightButton.tintColor = currentTheme().colors.textAccent } navigationItem.rightBarButtonItem = topRightButton navigationItem.rightBarButtonItem?.isEnabled = true case .bookmarks(state: .itemEditModeInvalidField): topRightButton.title = .SettingsAddCustomEngineSaveButtonText if #available(iOS 26.0, *) { - topRightButton.tintColor = themeManager.getCurrentTheme(for: windowUUID).colors.textAccent + topRightButton.tintColor = currentTheme().colors.textAccent } navigationItem.rightBarButtonItem = topRightButton navigationItem.rightBarButtonItem?.isEnabled = false default: topRightButton.title = String.AppSettingsDone if #available(iOS 26.0, *) { - topRightButton.tintColor = themeManager.getCurrentTheme(for: windowUUID).colors.textPrimary + topRightButton.tintColor = currentTheme().colors.textPrimary } navigationItem.rightBarButtonItem = topRightButton navigationItem.rightBarButtonItem?.isEnabled = true @@ -372,7 +372,7 @@ class LibraryViewController: UIViewController, Themeable { } private func setupToolBarAppearance() { - let theme = themeManager.getCurrentTheme(for: windowUUID) + let theme = currentTheme() let standardAppearance = UIToolbarAppearance() standardAppearance.configureWithDefaultBackground() standardAppearance.backgroundColor = theme.colors.layer1 @@ -385,9 +385,9 @@ class LibraryViewController: UIViewController, Themeable { private func updateSegmentControl() { guard librarySegmentControl.numberOfSegments > 0 else { return } - + let panelState = getCurrentPanelState() - + switch panelState { case .bookmarks(state: .inFolderEditMode): let affectedOptions: [LibraryPanelType] = [.history, .downloads, .readingList] @@ -401,6 +401,10 @@ class LibraryViewController: UIViewController, Themeable { } } + private func currentTheme() -> Theme { + return themeManager.getCurrentTheme(for: windowUUID) + } + func applyTheme() { // There is an ANNOYING bar in the nav bar above the segment control. These are the // UIBarBackgroundShadowViews. We must set them to be clear images in order to @@ -408,7 +412,7 @@ class LibraryViewController: UIViewController, Themeable { navigationController?.navigationBar.setBackgroundImage(UIImage(), for: .default) navigationController?.navigationBar.shadowImage = UIImage() - let theme = themeManager.getCurrentTheme(for: windowUUID) + let theme = currentTheme() view.backgroundColor = theme.colors.layer1 navigationController?.navigationBar.barTintColor = theme.colors.layer1 navigationController?.navigationBar.tintColor = theme.colors.actionPrimary diff --git a/firefox-ios/Client/Frontend/Settings/AppearanceSettings/StylingViewModifiers.swift b/firefox-ios/Client/Frontend/Settings/AppearanceSettings/StylingViewModifiers.swift index 0d2b4d50e2d60..92e67264d4046 100644 --- a/firefox-ios/Client/Frontend/Settings/AppearanceSettings/StylingViewModifiers.swift +++ b/firefox-ios/Client/Frontend/Settings/AppearanceSettings/StylingViewModifiers.swift @@ -167,23 +167,33 @@ struct ToggleStyle: ViewModifier { struct CreditCardViewButtonStyle: ViewModifier { let isEnabled: Bool - let barButtonColor: Color - let editStateColor: Color - let saveStateColor: Color - let saveDisableStateColor: Color + let theme: Theme let buttonState: CreditCardRightBarButton func body(content: Content) -> some View { if #available(iOS 26.0, *) { - content - .foregroundColor( - !isEnabled ? saveDisableStateColor : - buttonState == .edit ? editStateColor : - saveStateColor - ) + content.foregroundColor(getColorForiOS26()) } else { - content - .foregroundColor(isEnabled ? barButtonColor : saveDisableStateColor) + content.foregroundColor(getColorForLegacyiOS()) + } + } + + private func getColorForiOS26() -> Color { + if !isEnabled { + return Color(theme.colors.textSecondary) + } + + switch buttonState { + case .edit: + return Color(theme.colors.textPrimary) + default: + return Color(theme.colors.textAccent) } } + + private func getColorForLegacyiOS() -> Color { + return isEnabled + ? Color(theme.colors.actionPrimary) + : Color(theme.colors.textSecondary) + } } From 95145610e6e6a6e6c1878b1f9682021e8fe9bece Mon Sep 17 00:00:00 2001 From: Alexandru Farcasanu Date: Fri, 24 Oct 2025 17:42:49 +0300 Subject: [PATCH 3/4] Fixed SwiftLint warning --- .../Library/LibraryViewController/LibraryViewController.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/firefox-ios/Client/Frontend/Library/LibraryViewController/LibraryViewController.swift b/firefox-ios/Client/Frontend/Library/LibraryViewController/LibraryViewController.swift index 18c30682b6e57..787e2647a5f87 100644 --- a/firefox-ios/Client/Frontend/Library/LibraryViewController/LibraryViewController.swift +++ b/firefox-ios/Client/Frontend/Library/LibraryViewController/LibraryViewController.swift @@ -385,9 +385,9 @@ class LibraryViewController: UIViewController, Themeable { private func updateSegmentControl() { guard librarySegmentControl.numberOfSegments > 0 else { return } - + let panelState = getCurrentPanelState() - + switch panelState { case .bookmarks(state: .inFolderEditMode): let affectedOptions: [LibraryPanelType] = [.history, .downloads, .readingList] From 68bfe19f4f2dca37b5854c98d6a84d25507fd75d Mon Sep 17 00:00:00 2001 From: Alexandru Farcasanu Date: Tue, 4 Nov 2025 17:30:34 +0200 Subject: [PATCH 4/4] Fixed testInputViewFormValuesClearedOnDismiss() --- .../CreditCard/CreditCardSettingsViewControllerTests.swift | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/firefox-ios/firefox-ios-tests/Tests/ClientTests/CreditCard/CreditCardSettingsViewControllerTests.swift b/firefox-ios/firefox-ios-tests/Tests/ClientTests/CreditCard/CreditCardSettingsViewControllerTests.swift index a580a3a17c549..217a547928d68 100644 --- a/firefox-ios/firefox-ios-tests/Tests/ClientTests/CreditCard/CreditCardSettingsViewControllerTests.swift +++ b/firefox-ios/firefox-ios-tests/Tests/ClientTests/CreditCard/CreditCardSettingsViewControllerTests.swift @@ -25,12 +25,17 @@ final class CreditCardSettingsViewControllerTests: XCTestCase { viewModel = nil } + @MainActor func testInputViewFormValuesClearedOnDismiss() { let subject = createSubject() subject.viewModel.cardInputViewModel.nameOnCard = "Ashton Mealy" subject.viewModel.cardInputViewModel.cardNumber = "4268811063712243" subject.viewModel.cardInputViewModel.expirationDate = "1288" - let creditCardInputView = CreditCardInputView(viewModel: viewModel, windowUUID: WindowUUID.XCTestDefaultUUID) + let creditCardInputView = CreditCardInputView( + viewModel: viewModel, + windowUUID: WindowUUID.XCTestDefaultUUID, + themeManager: MockThemeManager() + ) let hostingController = UIHostingController(rootView: creditCardInputView) subject.present(hostingController, animated: true) let presentationController = UIPresentationController(