Skip to content

New settings view#5680

Open
mazevedofs wants to merge 44 commits intoliquid-glassfrom
settings-view
Open

New settings view#5680
mazevedofs wants to merge 44 commits intoliquid-glassfrom
settings-view

Conversation

@mazevedofs
Copy link
Collaborator

@mazevedofs mazevedofs commented Feb 11, 2026

Phabricator: https://phabricator.wikimedia.org/T417322

Notes

  • Rewrite of the settings view and some child views in SwiftUI
  • The account, search, YiR, notifications and article storage child views were updated

Test Steps

  1. Test all settings items across various themes, languages, devices, and accessibility options
  2. Test settings embedded in the main tab
  3. Make sure we retain all existing functionality
  4. Design review can be done later, there was no offical Figma for this

Screenshots/Videos

mazevedofs added 30 commits July 3, 2025 10:33
talkPagePreferencesFooter: WMFLocalizedString("account-talk-preferences-auto-sign-discussions-setting-explanation", value: "Auto-signing of discussions will use the signature defined in Signature settings", comment: "Text explaining how setting the auto-signing of talk page discussions preference works")
)

// Migration: Check if old key exists and migrate to WMFData store
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure this area for migrating will work - would they have to open the Search settings for the migration to trigger? Just worried they would lose these settings and behavior until they dig into their Settings again. Maybe we can move it into the launch sequence?



@MainActor
private func asyncDismissProfile() async {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is unused.

import WMFData

@objc public class WMFDonateDataControllerWrapper: NSObject {
@objc public class WMFDonateDataControllerWrapper: NSObject { // TODO - delete
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Todo here!

// MARK: - ProfileCoordinatorDelegate Methods

public func handleProfileAction(_ action: ProfileAction) {
public func handleProfileAction(_ action: ProfileAction) async {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This may not need to be async.

private func profileBarItem(item: ProfileListItem) -> some View {
Button(action: {
item.action()
Task { @MainActor in
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be able to revert if asyncDismissProfile is unused.

await buildSections()
}

private func getMainSection() async -> SettingsSection {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I notice all of the accessory labels don't update when you drill in, change, then tap back.

  1. Tap my languages
  2. Change primary app language
  3. Tap back
  4. My languages label still shows outdated primary app language.

Same goes for Explore feed on/off, Year in Review on/off, and App theme setting.

item = SettingsItem(
image: WMFSFSymbolIcon.for(symbol: .personFilled),
color: WMFColor.gray100,
title: localizedStrings.accountTitle,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This string should say "Log in" if they are logged out.


// MARK: - Storage and Syncing Settings View

public struct WMFStorageAndSyncingSettingsView: View {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I notice the old StorageAndSyncingSettingsViewController file is still in the project, can we remove?

case .authorized, .provisional, .ephemeral:
permissionStatus = .authorized
// Load subscription status from UserDefaults
isPushEnabled = userDefaults.bool(forKey: "WMFIsSubscribedToEchoNotifications")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Optional) Maybe let's just set a local immutable property to avoid the same literal string in this file.

private let userDefaultsKey = "WMFIsSubscribedToEchoNotifications"

Bonus would be if we could also migrate this one to the new user defaults store.


public final class WMFSettingsHostingController: WMFComponentHostingController<WMFSettingsView> {}

@objc final class SettingsViewController: WMFCanvasViewController, WMFNavigationBarConfiguring, Themeable {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe rename so that it's clear in what way this is distinct from the WMFComponents WMFSettingsViewController. I was confused at first.


// MARK: - About
private func tappedAbout() {
dismissSettings {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think About and Help and Feedback pushed on before, now it looks like it's dismissing Settings first before pushing which may be an unexpected change.


// MARK: - Private methods - Actions

private func asyncDismissSettings() async {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is used.

Comment on lines +253 to +270
@objc private func userAuthenticationStateDidChange() {
Task { @MainActor [weak self] in
guard let self = self else { return }

let username = self.dataStore?.authenticationManager.authStatePermanentUsername
let tempUsername = self.dataStore?.authenticationManager.authStateTemporaryUsername
let isTempAccount = WMFTempAccountDataController.shared.primaryWikiHasTempAccountsEnabled &&
self.dataStore?.authenticationManager.authStateIsTemporary == true

await self.viewModel.updateAuthenticationState(
username: username,
tempUsername: tempUsername,
isTempAccount: isTempAccount
)

updateProfileButton()
}
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
@objc private func userAuthenticationStateDidChange() {
Task { @MainActor [weak self] in
guard let self = self else { return }
let username = self.dataStore?.authenticationManager.authStatePermanentUsername
let tempUsername = self.dataStore?.authenticationManager.authStateTemporaryUsername
let isTempAccount = WMFTempAccountDataController.shared.primaryWikiHasTempAccountsEnabled &&
self.dataStore?.authenticationManager.authStateIsTemporary == true
await self.viewModel.updateAuthenticationState(
username: username,
tempUsername: tempUsername,
isTempAccount: isTempAccount
)
updateProfileButton()
}
}
@objc private func userAuthenticationStateDidChange() {
let username = dataStore?.authenticationManager.authStatePermanentUsername
let tempUsername = dataStore?.authenticationManager.authStateTemporaryUsername
let isTempAccount =
WMFTempAccountDataController.shared.primaryWikiHasTempAccountsEnabled &&
dataStore?.authenticationManager.authStateIsTemporary == true
Task { @MainActor in
guard let self = self else { return }
await self.viewModel.updateAuthenticationState(
username: username,
tempUsername: tempUsername,
isTempAccount: isTempAccount
)
updateProfileButton()
}
}


@objc public static let rateTheAppTitle = WMFLocalizedString("main-menu-rate-app", value: "Rate the app", comment: "Button text for showing the app in the app store so user can rate the app")

@objc public static let helpAndfeedbackTitle = WMFLocalizedString("settings-help-and-feedback", value: "Help and feedback", comment: "Title for showing showing a screen that displays the FAQ and allows users to submit bug reports")

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
@objc public static let helpAndfeedbackTitle = WMFLocalizedString("settings-help-and-feedback", value: "Help and feedback", comment: "Title for showing showing a screen that displays the FAQ and allows users to submit bug reports")
@objc public static let helpAndfeedbackTitle = WMFLocalizedString("settings-help-and-feedback", value: "Help and feedback", comment: "Title for showing a screen that displays the FAQ and allows users to submit bug reports")

.listRowSeparator(.hidden)

case .icon:
Text("") // can't break

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can also use EmptyView() for placeholder instead empty text.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

3 participants