-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Refactor FXIOS-12995 [Swift 6 Migration] Update NotificationCenter usage to use Notifiable pattern (part 1) #30250
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor FXIOS-12995 [Swift 6 Migration] Update NotificationCenter usage to use Notifiable pattern (part 1) #30250
Conversation
|
This pull request has conflicts when rebasing. Could you fix it @ih-codes? 🙏 |
|
Note: The BVC has a really big method that needs to be migrated, I will do this in a 2nd PR. |
ba84376 to
3ff295e
Compare
🥇 Perfect PR sizeSmaller PRs are easier to review. Thanks for making life easy for reviewers! ✨ 💬 Description craftsmanGreat PR description! Reviewers salute you 🫡 ❌ Per-file test coverage gateThe following changed file(s) are below 35.0% coverage:
Client.app: Coverage: 37.09
Generated by 🚫 Danger Swift against ff1bf66 |
There was a problem hiding this 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, |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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 🙈
| 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() | ||
| } |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
🚀 PR merged to |

📜 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
@objcselector 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