-
Notifications
You must be signed in to change notification settings - Fork 3k
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-10467 - Remove force_cast violations from BrowserKit and firefox-ios #23412
Refactor FXIOS-10467 - Remove force_cast violations from BrowserKit and firefox-ios #23412
Conversation
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.
Thanks for the contributions 🎉 just some nit comments 💬. Great work again 😃
@@ -14,6 +14,15 @@ import class MozillaAppServices.Viaduct | |||
class NotificationService: UNNotificationServiceExtension { | |||
var display: SyncDataDisplay? | |||
var profile: BrowserProfile? | |||
private let logger: Logger | |||
|
|||
init(display: SyncDataDisplay? = nil, |
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.
I believe that unfortunately we can't have a custom init in the NotificationService since the system will call init()
when he needs an object from this class. We should restore this to previous implementation, i tried testing on simulator but i'm having some difficulties to fire the notification service extension, but i remember from previous work that trying to have custom init results in getting the notification service not working.
@@ -30,7 +39,12 @@ class NotificationService: UNNotificationServiceExtension { | |||
|
|||
let userInfo = request.content.userInfo | |||
|
|||
let content = request.content.mutableCopy() as! UNMutableNotificationContent | |||
guard let content = request.content.mutableCopy() as? UNMutableNotificationContent else { | |||
logger.log("Unable to create a mutable copy of UNNotificationContent from the notification request", |
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.
We should call contentHandler(request.content)
here instead of the log so the notification doesn't get deferred to the process termination.
NotificationService.appex: Coverage: 25.92
Generated by 🚫 Danger Swift against ac4ef09 |
Hi @clarmso could you please have a look to this PR, looks good to me on my side. Thanks very much 🎉 |
} else { | ||
XCTFail("Failed to retrieve the URL string from the address toolbar") | ||
return | ||
} |
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.
XCTAssertEqual
allows a message
argument: https://developer.apple.com/documentation/xctest/2142776-xctassertequal
XCTAssertEqual(url, "wikipedia.org", "Failed to retrieve the URL string from the address toolbar")
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.
Thank you @clarmso, I wasn't aware of the message
argument in XCTAssertEqual
, I've updated the code to include it. Please let me know if there's anything else to adjust
📜 Tickets
Jira ticket
Github issue
💡 Description
force_cast
violations from:📝 Checklist
You have to check all boxes before merging
@Mergifyio backport release/v120
)