Skip to content

Conversation

obaidgini
Copy link
Contributor

Description

Here is the Jira Ticket Link

Notes for reviewer

Fixes crash in the example app, when GiniCapture SDK is started.

Reason detected:
Android system was not able to create GiniCaptureFragment because this class have parameterized constructor, So fragment factory is provided in the example app, which Android system will use to construct the fragment in case of orientation change.

Also, changed the lateinit giniCaptureFragmentListener property of GiniCaptureFragment to nullable, so it can be marked as null when the onDestroy is called, and it can be collected by GC.
Because we are setting the listener again in the event of orientation change through ClientCaptureSDKFragmentFactory, so we will keep getting the updates.

Thank you.

Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes a crash in the example app when the GiniCapture SDK is started by implementing proper fragment recreation handling for orientation changes and improving memory management through nullable listeners.

  • Adds a custom FragmentFactory to handle GiniCaptureFragment creation with parameterized constructor
  • Changes GiniCaptureFragment listener from lateinit to nullable for better memory management
  • Updates example app structure to properly handle fragment state restoration

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
GiniCaptureFragment.kt Changes listener to nullable and adds null-safe calls to prevent crashes and improve GC
activity_stand_alone_capture_flow.xml New layout file for standalone capture flow with FragmentContainerView
CaptureResultListener.kt Adds missing boolean parameter to ExtractionsActivity intent
ClientCaptureSDKFragment.kt Simplifies fragment by delegating result handling and adding nullable listener management
CaptureSdkStandAloneActivity.kt Implements FragmentFactory pattern and proper fragment state restoration

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Copy link

sonarqubecloud bot commented Sep 8, 2025

Copy link
Contributor

@abolfazlimahdi abolfazlimahdi left a comment

Choose a reason for hiding this comment

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

I have added a comment. Please take a look and if applicable, try to fix it. Thank you!

@obaidgini obaidgini added the Waiting for QA Pr's which were raised, but not picked by QA yet. After testing it will be merged. label Sep 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Waiting for QA Pr's which were raised, but not picked by QA yet. After testing it will be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants