Skip to content

MS-1496 Frame provider implementation in ocr capture - #1767

Merged
luhmirin-s merged 1 commit into
feature/MS-1494-unified-camera-frame-providerfrom
feature/MS-1496-frame-provider-mfid-ocr
Aug 11, 2026
Merged

MS-1496 Frame provider implementation in ocr capture#1767
luhmirin-s merged 1 commit into
feature/MS-1494-unified-camera-frame-providerfrom
feature/MS-1496-frame-provider-mfid-ocr

Conversation

@luhmirin-s

Copy link
Copy Markdown
Contributor

JIRA ticket
Will be released in: 2026.3.0

Notable changes

  • Migrating MFID OCR fragment to use the new camera frame provider.
  • Switch between "high resolution" and regular frame processing happens on screen start.
  • Cropping has been delegated to post-processing use case.

Testing guidance

  • Testiny MFID OCR test cases. There should be no changes in UX.

Additional work checklist

  • Effect on other features and security has been considered
  • Design document marked as "In development" (if applicable)
  • External (Gitbook) and internal (Confluence) Documentation is up to date (or ticket created)
  • Test cases in Testiny are up to date (or ticket created)
  • Other teams notified about the changes (if applicable)

Copilot AI left a comment

Copy link
Copy Markdown

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 migrates the MFID OCR capture flow in :feature:external-credential from a feature-local CameraX + bitmap pre-processing pipeline to the shared :infra:camera frame provider and post-processing crop use case, aligning OCR capture with the new camera architecture.

Changes:

  • Replace per-frame bitmap normalization/cropping with CameraFrameProvider + FrameCropToTargetUseCase.
  • Move OCR config readiness to an awaited flow (awaitOcrConfig) and initialise the camera once the preview/target bounds are known.
  • Remove obsolete OCR camera/crop config use cases and their unit tests; update ViewModel tests to use Frame input.

Reviewed changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
feature/external-credential/src/test/java/com/simprints/feature/externalcredential/screens/scanocr/usecase/NormalizeBitmapToPreviewUseCaseTest.kt Removed tests for feature-local bitmap normalization (now handled elsewhere).
feature/external-credential/src/test/java/com/simprints/feature/externalcredential/screens/scanocr/usecase/CropDocumentFromPreviewUseCaseTest.kt Removed tests for feature-local cropping (cropping moved to post-processing use case).
feature/external-credential/src/test/java/com/simprints/feature/externalcredential/screens/scanocr/usecase/BuildOcrCropConfigUseCaseTest.kt Removed tests for feature-local crop-config building (target rect now provided to frame provider).
feature/external-credential/src/test/java/com/simprints/feature/externalcredential/screens/scanocr/ExternalCredentialScanOcrViewModelTest.kt Updated tests to pass Frame and mock FrameCropToTargetUseCase.
feature/external-credential/src/main/java/com/simprints/feature/externalcredential/screens/scanocr/usecase/ProvideCameraListenerUseCase.kt Removed obsolete CameraX binding wrapper (replaced by CameraFrameProvider).
feature/external-credential/src/main/java/com/simprints/feature/externalcredential/screens/scanocr/usecase/NormalizeBitmapToPreviewUseCase.kt Removed feature-local bitmap normalization (now using new pipeline).
feature/external-credential/src/main/java/com/simprints/feature/externalcredential/screens/scanocr/usecase/CropDocumentFromPreviewUseCase.kt Removed feature-local cropping (delegated to post-processing).
feature/external-credential/src/main/java/com/simprints/feature/externalcredential/screens/scanocr/usecase/BuildOcrCropConfigUseCase.kt Removed feature-local crop config builder (target bounds now computed once).
feature/external-credential/src/main/java/com/simprints/feature/externalcredential/screens/scanocr/model/OcrCropConfig.kt Removed crop config model (no longer needed in new flow).
feature/external-credential/src/main/java/com/simprints/feature/externalcredential/screens/scanocr/ExternalCredentialScanOcrViewModel.kt Switched processing to Frame input + post-process crop; moved config to flow; refactored processing state flag.
feature/external-credential/src/main/java/com/simprints/feature/externalcredential/screens/scanocr/ExternalCredentialScanOcrFragment.kt Initialises CameraFrameProvider with target bounds; processes emitted frames and gates emission based on processing flag.
feature/external-credential/build.gradle.kts Adds :infra:camera dependency needed for the new frame provider flow.
Suppressed comments (2)

feature/external-credential/src/main/java/com/simprints/feature/externalcredential/screens/scanocr/ExternalCredentialScanOcrViewModel.kt:169

  • finishOcrEvent.send(...) won’t compile because send(...) is an extension on MutableLiveData<LiveDataEventWithContent<T>>, not on LiveData. Use the backing MutableLiveData (e.g. _finishOcrEvent).
        viewModelScope.launch {
            val scannedCredentialResult = buildScannedCredentialResultUseCase(scannedMfidDocuments, ocrDocumentType, startTime)
            finishOcrEvent.send(scannedCredentialResult)
            scannedMfidDocuments = emptyList()

feature/external-credential/src/main/java/com/simprints/feature/externalcredential/screens/scanocr/ExternalCredentialScanOcrFragment.kt:102

  • cameraFocusManagerFactory and bgDispatcher are injected but no longer used after switching to CameraFrameProvider (focus setup is handled inside CameraFrameProvider.initialiseCamera(...)). Removing these avoids unused DI bindings (and lets you drop the now-unused imports/annotation).
    @Inject
    lateinit var cameraFocusManagerFactory: CameraFocusManager.Factory

    @Inject
    @DispatcherBG
    lateinit var bgDispatcher: CoroutineDispatcher

@luhmirin-s
luhmirin-s force-pushed the feature/MS-1496-frame-provider-mfid-ocr branch from 24c5b38 to e3c42f8 Compare August 6, 2026 10:51
@luhmirin-s
luhmirin-s requested review from a team, BurningAXE, TristramN, alex-vt, alexandr-simprints, meladRaouf and ybourgery and removed request for a team August 6, 2026 11:05
@luhmirin-s
luhmirin-s force-pushed the feature/MS-1496-frame-provider-mfid-ocr branch from e3c42f8 to d1367e5 Compare August 6, 2026 12:31
@luhmirin-s
luhmirin-s force-pushed the feature/MS-1496-frame-provider-mfid-ocr branch 3 times, most recently from 8a56cb4 to e5107cb Compare August 11, 2026 08:47
@luhmirin-s
luhmirin-s force-pushed the feature/MS-1496-frame-provider-mfid-ocr branch from e5107cb to 2d3971f Compare August 11, 2026 08:48
@sonarqubecloud

Copy link
Copy Markdown

@luhmirin-s
luhmirin-s merged commit b31a1b3 into main Aug 11, 2026
14 checks passed
@luhmirin-s
luhmirin-s deleted the feature/MS-1496-frame-provider-mfid-ocr branch August 11, 2026 12:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants