Skip to content

Conversation

@ih-codes
Copy link
Collaborator

@ih-codes ih-codes commented Oct 29, 2025

📜 Tickets

Jira ticket
Github issue

💡 Description

This PR updates several lingering direct usages of NotificationCenter to instead use our Notifiable protocol to enforce safety with implicitly nonisolated @objc selector method.

Wiki documentation here: https://github.com/mozilla-mobile/firefox-ios/wiki/Notifable-Protocol-and-the-NotificationCenter

NOTE: The BVC has a really big method that needs to be migrated, I will do this in a 2nd PR.

cc @Cramsden @lmarceau @dataports | Swift 6 Migration

📝 Checklist

  • I filled in the ticket numbers and a description of my work
  • I updated the PR name to follow our PR naming guidelines
  • I ensured unit tests pass and wrote tests for new code
  • If working on UI, I checked and implemented accessibility (Dynamic Text and VoiceOver)
  • If adding telemetry, I read the data stewardship requirements and will request a data review
  • If adding or modifying strings, I read the guidelines and will request a string review from l10n
  • If needed, I updated documentation and added comments to complex code

@ih-codes ih-codes requested a review from Cramsden October 29, 2025 18:52
@ih-codes ih-codes requested a review from a team as a code owner October 29, 2025 18:52
@mergify
Copy link
Contributor

mergify bot commented Oct 29, 2025

This pull request has conflicts when rebasing. Could you fix it @ih-codes? 🙏

@ih-codes
Copy link
Collaborator Author

Note: The BVC has a really big method that needs to be migrated, I will do this in a 2nd PR.

@ih-codes ih-codes force-pushed the ih/FXIOS-12995-update-notificationcenter-usage-to-use-notifiable branch from ba84376 to 3ff295e Compare October 29, 2025 18:55
@mobiletest-ci-bot
Copy link

Messages
📖 Project coverage: 37.61%

🥇 Perfect PR size

Smaller PRs are easier to review. Thanks for making life easy for reviewers! ✨

💬 Description craftsman

Great PR description! Reviewers salute you 🫡

❌ Per-file test coverage gate

The following changed file(s) are below 35.0% coverage:

File Coverage Required
BrowserKit/Sources/ToolbarKit/ToolbarButton.swift 0.0% 35.0%
firefox-ios/Client/Frontend/Library/Bookmarks/BookmarksViewController.swift 10.0% 35.0%
firefox-ios/Client/Frontend/Library/Reader/ReaderPanel.swift 27.4% 35.0%
firefox-ios/Client/Frontend/PasswordManagement/PasswordManagerListViewController.swift 3.5% 35.0%
firefox-ios/Client/Frontend/Settings/Main/Account/AccountStatusSetting.swift 0.0% 35.0%
firefox-ios/Client/Frontend/Settings/Main/Account/SyncNowSetting.swift 0.0% 35.0%
firefox-ios/Client/Frontend/Settings/PasswordDetailViewController.swift 3.3% 35.0%

Client.app: Coverage: 37.09

File Coverage
HistoryCoordinator.swift 66.67%
AccountStatusSetting.swift 0.0% ⚠️
SyncNowSetting.swift 0.0% ⚠️
BookmarksViewController.swift 10.04% ⚠️
PasswordManagerListViewController.swift 3.46% ⚠️
ReaderPanel.swift 27.36% ⚠️
DownloadsPanel.swift 35.26% ⚠️
CreditCardTableViewController.swift 38.55% ⚠️
PasswordDetailViewController.swift 3.29% ⚠️

Generated by 🚫 Danger Swift against ff1bf66

Copy link
Contributor

@Cramsden Cramsden left a comment

Choose a reason for hiding this comment

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

Looking good to me! Just one quick question before I 🟢

import Shared

class SyncNowSetting: WithAccountSetting {
class SyncNowSetting: WithAccountSetting,
Copy link
Contributor

Choose a reason for hiding this comment

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

WithAccountSetting is a very annoying class name lololol

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The Settings inheritance chains are scary 🙈

Comment on lines 70 to +76
func startRotateSyncIcon() {
DispatchQueue.main.async {
self.imageView.layer.add(self.continuousRotateAnimation, forKey: "rotateKey")
}
self.imageView.layer.add(self.continuousRotateAnimation, forKey: "rotateKey")
}

@objc
func stopRotateSyncIcon() {
DispatchQueue.main.async {
self.imageView.layer.removeAllAnimations()
self.imageView.layer.removeAllAnimations()
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we isolate these functions to the MainActor?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

There's a super long scary inheritance chain of this class down to Setting which is @MainActor, so these are all isolated already!

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Screenshot 2025-10-31 at 12 49 11 PM Screenshot from main.

@ih-codes ih-codes requested a review from Cramsden October 31, 2025 18:48
@ih-codes ih-codes merged commit c12ede9 into main Oct 31, 2025
11 checks passed
@ih-codes ih-codes deleted the ih/FXIOS-12995-update-notificationcenter-usage-to-use-notifiable branch October 31, 2025 20:11
@github-actions
Copy link
Contributor

🚀 PR merged to main, targeting version: 145.1

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants