Skip to content

Fix dark mode issues #178

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

Merged
merged 6 commits into from
Jun 16, 2025
Merged

Fix dark mode issues #178

merged 6 commits into from
Jun 16, 2025

Conversation

tobitech
Copy link
Contributor

@tobitech tobitech commented Jun 16, 2025

User description

Story: https://app.shortcut.com/smileid/story/16965/

Summary

  • Refactor SmileIDSelfieCaptureView and SmileIDDocumentCaptureView to use the embedView helper on FlutterPlatformView for centralised customisation.

Known Issues

N/A.

Test Instructions

  • Run the sample app on iOS, make sure your device is set to dark mode.
  • Select Selfie Capture, you should see the flow screens in light mode.
  • Select Document Capture and you should see the flow screens in light mode.

Screenshot

N/A.


PR Type

Bug fix


Description

• Refactored iOS platform views to fix dark mode issues
• Replaced UIHostingController with UIView for consistent view management
• Standardized view controller lifecycle using embedView pattern
• Updated changelog to document the fixes


Changes walkthrough 📝

Relevant files
Bug fix
SmileIDDocumentCaptureView.swift
Refactor document capture view implementation                       

ios/Classes/SmileIDDocumentCaptureView.swift

• Replaced UIHostingController with UIView for view management

Simplified initialization by removing setupHostingController method

Added embedView pattern for consistent view controller lifecycle

Changed view() method to return _view instead of
_childViewController.view

+8/-12   
SmileIDSmartSelfieCaptureView.swift
Refactor smart selfie capture view implementation               

ios/Classes/SmileIDSmartSelfieCaptureView.swift

• Replaced UIHostingController with UIView for view management

Simplified initialization by removing setupHostingController method

Added embedView pattern for consistent view controller lifecycle

Removed commented code and cleaned up view() method

+9/-14   
Documentation
CHANGELOG.md
Document dark mode fixes in changelog                                       

CHANGELOG.md

• Added new unreleased section documenting dark mode fixes
• Updated
version 11.0.2 release date to June 16, 2025
• Documented refactoring
of iOS platform view implementations

+8/-1     

Need help?
  • Type /help how to ... in the comments thread for any questions about PR-Agent usage.
  • Check out the documentation for more information.
  • @tobitech tobitech requested a review from a team as a code owner June 16, 2025 18:34
    @prfectionist
    Copy link
    Contributor

    prfectionist bot commented Jun 16, 2025

    PR Reviewer Guide 🔍

    Here are some key observations to aid the review process:

    ⏱️ Estimated effort to review: 3 🔵🔵🔵⚪⚪
    🧪 No relevant tests
    🔒 No security concerns identified
    ⚡ Recommended focus areas for review

    Missing Implementation

    The embedView function is called but not defined or imported in this file. This will cause compilation errors unless the function is defined elsewhere in the codebase.

    _childViewController = embedView(rootView, in: _view, frame: frame)
    Missing Implementation

    Similar to the document capture view, the embedView function is called but not visible in the diff. Need to verify this function exists and is properly accessible.

    _childViewController = embedView(rootView, in: _view, frame: frame)
    Memory Management

    The _childViewController is stored as an optional but there's no explicit cleanup or deallocation handling visible. Should verify proper memory management for the view controller lifecycle.

    private var _childViewController: UIViewController?

    Comment on lines +28 to +35
    _view = UIView()
    _channel = FlutterMethodChannel(
    name: "\(SmileIDDocumentCaptureView.VIEW_TYPE_ID)_\(viewId)",
    binaryMessenger: messenger
    )
    _childViewController = nil

    super.init()
    Copy link
    Contributor

    Choose a reason for hiding this comment

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

    Suggestion: The super.init() call should occur before initializing instance properties to ensure proper initialization order. Moving it before property assignments prevents potential issues with the parent class initialization. [general, importance: 8]

    Suggested change
    _view = UIView()
    _channel = FlutterMethodChannel(
    name: "\(SmileIDDocumentCaptureView.VIEW_TYPE_ID)_\(viewId)",
    binaryMessenger: messenger
    )
    _childViewController = nil
    super.init()
    super.init()
    _view = UIView()
    _channel = FlutterMethodChannel(
    name: "\(SmileIDDocumentCaptureView.VIEW_TYPE_ID)_\(viewId)",
    binaryMessenger: messenger
    )
    _childViewController = nil

    private func setupHostingController(frame: CGRect) {
    _childViewController.view.frame = frame
    _childViewController.view.autoresizingMask = [.flexibleWidth, .flexibleHeight]
    _childViewController = embedView(rootView, in: _view, frame: frame)
    Copy link
    Contributor

    Choose a reason for hiding this comment

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

    Suggestion: The embedView function is called but not defined in the visible code. Ensure this function properly handles the view controller lifecycle and returns a valid UIViewController instance. [general, importance: 4]

    Suggested change
    _childViewController = embedView(rootView, in: _view, frame: frame)
    _childViewController = embedView(rootView, in: _view, frame: frame)
    // Ensure embedView returns a valid UIViewController and handles lifecycle properly

    Copy link
    Member

    @jumaallan jumaallan 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 🚀

    Copy link
    Member

    @wangerekaharun wangerekaharun left a comment

    Choose a reason for hiding this comment

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

    Tested this, the issue is now fixed🚀

    @jumaallan jumaallan merged commit fa2fd2b into main Jun 16, 2025
    4 checks passed
    @jumaallan jumaallan deleted the fix-dark-mode-issues branch June 16, 2025 19:01
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Projects
    None yet
    Development

    Successfully merging this pull request may close these issues.

    3 participants