Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@KatherineInCode
Copy link
Contributor

🎟️ Tracking

https://bitwarden.atlassian.net/browse/PM-26060

📔 Objective

This moves some UIViewController extensions to BitwardenKit, as part of an effort to migrate shared objects to BitwardenKit. Future PRs will bring other objects over, which will enable bringing the Select Language UI over.

⏰ Reminders before review

  • Contributor guidelines followed
  • All formatters and local linters executed and passed
  • Written new unit and / or integration tests where applicable
  • Protected functional changes with optionality (feature flags)
  • Used internationalization (i18n) for all UI strings
  • CI builds passed
  • Communicated to DevOps any deployment requirements
  • Updated any necessary documentation (Confluence, contributing docs) or informed the documentation team

🦮 Reviewer guidelines

  • 👍 (:+1:) or similar for great changes
  • 📝 (:memo:) or ℹ️ (:information_source:) for notes or general info
  • ❓ (:question:) for questions
  • 🤔 (:thinking:) or 💭 (:thought_balloon:) for more open inquiry that's not quite a confirmed issue and could potentially benefit from discussion
  • 🎨 (:art:) for suggestions / improvements
  • ❌ (:x:) or ⚠️ (:warning:) for more significant problems or concerns needing attention
  • 🌱 (:seedling:) or ♻️ (:recycle:) for future improvements or indications of technical debt
  • ⛏ (:pick:) for minor or nitpick changes

@KatherineInCode KatherineInCode force-pushed the pm-26060/consolidate-uivc-extensions branch from dde8d20 to 0df9b8f Compare October 27, 2025 14:35
@github-actions
Copy link
Contributor

github-actions bot commented Oct 27, 2025

Logo
Checkmarx One – Scan Summary & Details143fb0f4-710f-4ae7-89b6-36e73171bee0

Great job! No new security vulnerabilities introduced in this pull request

@KatherineInCode KatherineInCode marked this pull request as ready for review October 27, 2025 16:09
/// - onCompletion: A closure to call on completion.
///
public func present(
func present(
Copy link
Member

Choose a reason for hiding this comment

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

🤔 Just wanted to call out @matt-livefront is doing a change on this file and not sure how it's going to be handled with the movement: https://github.com/bitwarden/ios/pull/2066/files#diff-6acbabcb171e0616679a1aecbd152bd300e152d7798345ca093d63a1fecdc310R21.
Perhaps we could let Matt's PR be merged first and then do this file movement?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good call; Matt's being merged first is reasonable

@claude
Copy link

claude bot commented Oct 28, 2025

Claude finished @KatherineInCode's task —— View job


Code Review Complete

I've thoroughly reviewed PR #2072 which consolidates UIViewController extensions into BitwardenKit. Here are my findings:


Summary of Changes

This PR successfully consolidates UIViewController extensions by:

  1. Moving UIViewController.swift and UIViewControllerTests.swift from BitwardenShared to BitwardenKit
  2. Deleting the duplicate UIViewController.swift and UIViewControllerTests.swift from AuthenticatorShared
  3. Removing a duplicate present(_:animated:overFullscreen:onCompletion:) implementation from StackNavigator in AuthenticatorShared

The consolidation is valid because both BitwardenShared and AuthenticatorShared already import BitwardenKit, ensuring continued access to these extensions.


Critical Issues

⚠️ Issue 1: Inconsistent Implementation Removed from StackNavigator

Location: AuthenticatorShared/UI/Platform/Application/Utilities/StackNavigator.swift

The PR removes a present() method implementation from StackNavigator that was less robust than the version now available from BitwardenKit. The removed implementation was missing:

  1. Missing isBeingDismissed check: The while loop didn't check if a view controller is being dismissed:

    // Removed (incomplete):
    while presentedChild != nil {
    
    // BitwardenKit version (correct):
    while presentedChild != nil, presentedChild?.isBeingDismissed == false {
  2. Missing popover configuration: The removed implementation lacked iPad popover crash prevention that exists in the BitwardenKit version (lines 27-38 of the moved file).

Assessment: ✅ This is actually a positive change - by removing the incomplete duplicate and relying on the BitwardenKit extension, AuthenticatorShared now gets the more robust implementation with proper dismissal handling and iPad popover support.


Suggested Improvements

📝 Improvement 1: Consider Adding Public Access Control Consistency

Location: BitwardenKit/UI/Platform/Application/Extensions/UIViewController.swift:12

The extension is declared as public extension UIViewController (line 3), but the present() method is not explicitly marked as public (line 12), while the comment still says "public func" from the original.

Current:

public extension UIViewController {
    /// ...
    func present(

Consideration: The method inherits public access from the extension, so this works correctly. However, for clarity and consistency with Swift conventions, you might consider either:

  • Keeping it as-is (implicit public from extension) ✅ Recommended
  • Or explicitly marking it public func present( for clarity

Note: As noted in the review comment thread, PR #2066 is modifying this same file and should be merged first to avoid conflicts.


Good Practices Observed

  • ✅ Proper consolidation eliminates code duplication
  • ✅ Tests were moved along with implementation
  • ✅ Dependency structure supports the move (both modules import BitwardenKit)
  • ✅ More robust implementation (with isBeingDismissed and popover handling) is now shared
  • ✅ Clean removal of inferior duplicate implementation

Action Items

  1. Already addressed: Wait for PR [PM-27219] Fix update and set master password errors #2066 to merge first to avoid conflicts (per review discussion)
  2. ⏸️ Optional: Consider whether explicit public keyword on the present() method would improve code clarity (low priority, current approach is valid)

Verdict

This is a clean refactoring PR that successfully consolidates duplicate code into a shared location. The consolidation actually improves code quality by ensuring all consumers use the more robust implementation with proper dismissal handling and iPad popover support. No blocking issues identified.

The PR is ready to merge after PR #2066 is merged first (as agreed in the review comments).


@github-actions
Copy link
Contributor

Warning

@KatherineInCode Uploading code coverage report failed. Please check the "Upload to codecov.io" step of Process Test Reports job for more details.

@github-actions
Copy link
Contributor

Warning

@KatherineInCode Uploading code coverage report failed. Please check the "Upload to codecov.io" step of Process Test Reports job for more details.

@KatherineInCode KatherineInCode merged commit 52a3da8 into main Oct 29, 2025
14 checks passed
@KatherineInCode KatherineInCode deleted the pm-26060/consolidate-uivc-extensions branch October 29, 2025 14:23
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