Skip to content
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 Utilities and applications support #23149

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

bmihai23
Copy link
Contributor

@bmihai23 bmihai23 commented Nov 15, 2024

📜 Tickets

Jira ticket
Github issue

💡 Description

  • This PR remove force_cast violations from:
    • PhotonActionSheetViewModel
    • TitleActivityItemProvider
    • ConfigurableGradientView
    • UITestAppDelegate
    • BackgroundNotificationSurfaceUtility
  • This PR is part of a series aimed at adding a new SwiftLint rule in the project, as described in Swiftlint: force_cast #22916

📝 Checklist

You have to check all boxes before merging

  • Filled in the above information (tickets numbers and description of your work)
  • Updated the PR name to follow our PR naming guidelines
  • Wrote unit tests and/or ensured the tests suite is passing
  • When working on UI, I checked and implemented accessibility (minimum Dynamic Text and VoiceOver)
  • If needed, I updated documentation / comments for complex code and public methods
  • If needed, added a backport comment (example @Mergifyio backport release/v120)

@bmihai23 bmihai23 requested a review from a team as a code owner November 15, 2024 10:28
@mobiletest-ci-bot
Copy link

Messages
📖 Project coverage: 32.81%
📖 Edited 5 files
📖 Created 0 files

Client.app: Coverage: 30.84

File Coverage
BackgroundNotificationSurfaceUtility.swift 0.0% ⚠️
UITestAppDelegate.swift 0.0% ⚠️
PhotonActionSheetViewModel.swift 15.76% ⚠️
TitleActivityItemProvider.swift 0.0% ⚠️
ConfigurableGradientView.swift 0.0% ⚠️

Generated by 🚫 Danger Swift against 6688ee4

Copy link
Collaborator

@mattreaganmozilla mattreaganmozilla left a comment

Choose a reason for hiding this comment

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

Thank you @bmihai23 for this PR 👍 Added a couple minor comments but overall changes lgtm.

@@ -146,7 +146,9 @@ class UITestAppDelegate: AppDelegate, FeatureFlaggable {
let output = URL(fileURLWithPath: "\(dirForTestProfile)/places.db")

let enumerator = FileManager.default.enumerator(atPath: dirForTestProfile)
let filePaths = enumerator?.allObjects as! [String]
guard let filePaths = enumerator?.allObjects as? [String] else {
fatalError("Failed to cast enumerator.allObjects to [String] during filePaths extraction")
Copy link
Collaborator

Choose a reason for hiding this comment

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

@bmihai23 Can we please double-check if there is any other way to handle this besides fatalError? This will crash just like as!, so this change really doesn't provide much benefit.

Comment on lines +60 to +62
self.logger.log("Failed to cast task to BGAppRefreshTask",
level: .fatal,
category: .lifecycle)
Copy link
Collaborator

Choose a reason for hiding this comment

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

This PR adds several new .fatal logs; I think that's fine, since these would be crashes anyway. But @cyndichin @adudenamedruby please LMK if we have an official policy (or team plan) on how we're updating these force-cast violations.

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.

3 participants