Skip to content

Conversation

@transphorm
Copy link
Member

@transphorm transphorm commented Oct 7, 2025

Summary

  • declare the Android camera permission in the demo app manifest so runtime requests can succeed

Testing

  • not run (not requested)

https://chatgpt.com/codex/tasks/task_b_68e49b734270832dace1e57a3299630e

Summary by CodeRabbit

  • New Features

    • Document scanning screen now shows clear on-screen instructions, improved layout when results are detected, and the result card is repositioned for clarity.
  • Style

    • Added stateful toggle backgrounds (left/right/border) and new font families (bold, medium, regular) for a more polished UI.
  • Chores

    • Enabled Android module linkage and dependencies, added Material Components, adjusted packaging, and granted camera permission to support scanning.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 7, 2025

Walkthrough

Adds Android UI resources (drawables and fonts), wires Android native package via React Native config and demo app setup, changes MRZScannerView to use SelfOCRViewManager on Android, updates demo build (dependencies, packaging, CAMERA permission), and adjusts DocumentCamera UI and styles.

Changes

Cohort / File(s) Summary
Android drawable resources
packages/mobile-sdk-alpha/android/src/main/res/drawable/toggle_background_border.xml, packages/mobile-sdk-alpha/android/src/main/res/drawable/toggle_background_left.xml, packages/mobile-sdk-alpha/android/src/main/res/drawable/toggle_background_right.xml
Adds three drawable resources: a rounded border shape and stateful left/right toggle background selectors with checked/pressed/default shapes and fills.
Android font resources
packages/mobile-sdk-alpha/android/src/main/res/font/bold.xml, packages/mobile-sdk-alpha/android/src/main/res/font/medium.xml, packages/mobile-sdk-alpha/android/src/main/res/font/regular.xml
Adds Roboto font-family XMLs (bold/medium/regular) each declaring normal and italic font entries with weights.
RN Android integration & demo app wiring
packages/mobile-sdk-alpha/react-native.config.cjs, packages/mobile-sdk-demo/android/settings.gradle, packages/mobile-sdk-demo/android/app/build.gradle, packages/mobile-sdk-demo/android/app/src/main/java/com/selfxyz/demoapp/MainApplication.kt, packages/mobile-sdk-demo/android/app/src/main/AndroidManifest.xml
Replaces android: null with Android autolinking config (sourceDir, packageImportPath, packageInstance); includes :mobile-sdk-alpha module; adds packagingOptions exclude and Material dependency; manually adds RNSelfPassportReaderPackage() to returned package list; adds android.permission.CAMERA to manifest.
MRZ scanner bridging
packages/mobile-sdk-alpha/src/components/MRZScannerView.tsx
On Android, changes the fragment/component name passed to RCTFragment from "PassportOCRViewManager" to "SelfOCRViewManager".
Demo UI updates
packages/mobile-sdk-demo/src/screens/DocumentCamera.tsx
Reworks instructions layout (on-screen title/text), removes header rightAction and old overlay, adjusts actions spacing when MRZ result exists, reorders result card, and adds/updates related styles.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant App as Demo App
  participant RNHost as ReactNativeHost
  participant PkgList as PackageList
  participant MainApp as MainApplication
  participant RNSelf as RNSelfPassportReaderPackage

  App->>RNHost: Initialize
  RNHost->>PkgList: Build default packages
  PkgList-->>RNHost: packages
  RNHost->>MainApp: getPackages()
  MainApp->>MainApp: create mutable list from PackageList(this).packages
  MainApp->>RNSelf: instantiate new RNSelfPassportReaderPackage()
  MainApp-->>RNHost: return augmented package list
  note right of RNHost: react-native.config.cjs now\nprovides Android autolinking metadata
Loading
sequenceDiagram
  autonumber
  participant JS as MRZScannerView (JS)
  participant RCT as RCTFragment
  participant Mgr as SelfOCRViewManager (Android)
  participant View as Native OCR View

  JS->>RCT: create fragment ("SelfOCRViewManager")
  RCT->>Mgr: attach/instantiate manager
  Mgr->>View: configure/start OCR
  View-->>JS: onMRZDetected(data)
  View-->>JS: onError(error)
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested reviewers

  • remicolin
  • aaronmgdr

Poem

Rounded toggles, fonts in place,
Native wiring finds its space.
The scanner points a new named view,
Camera granted—demo renewed.
Small files land; the app hums true.

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Title Check ⚠️ Warning The title does not accurately summarize the main change, which is adding camera permission support in the demo app manifest rather than modifying the MRZ scan screen layout or behavior. Update the title to clearly reflect the primary change, for example “Add Android camera permission to demo app manifest” to summarize the actual purpose of the PR.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch codex/fix-camera-permission-button-issue

📜 Recent review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 649b77d and 0cf0612.

📒 Files selected for processing (2)
  • packages/mobile-sdk-alpha/android/src/main/res/drawable/toggle_background_left.xml (1 hunks)
  • packages/mobile-sdk-alpha/android/src/main/res/drawable/toggle_background_right.xml (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • packages/mobile-sdk-alpha/android/src/main/res/drawable/toggle_background_right.xml
  • packages/mobile-sdk-alpha/android/src/main/res/drawable/toggle_background_left.xml
⏰ Context from checks skipped due to timeout of 300000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: build-deps
  • GitHub Check: e2e-ios
  • GitHub Check: analyze-android
  • GitHub Check: analyze-ios

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@transphorm transphorm changed the title Add camera permission to demo manifest Tweak demo app mrz scan screen Oct 7, 2025
@transphorm transphorm marked this pull request as ready for review October 8, 2025 00:42
@@ -0,0 +1,8 @@
<shape xmlns:android="http://schemas.android.com/apk/res/android"
Copy link
Member Author

Choose a reason for hiding this comment

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

@seshanthS i was able to get the demo app mrz scan going...but I had to add these files to the msdk

@transphorm transphorm changed the title Tweak demo app mrz scan screen Working demo app mrz scan screen Oct 8, 2025
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f7c5ef0 and 649b77d.

⛔ Files ignored due to path filters (6)
  • packages/mobile-sdk-alpha/android/src/main/res/font/roboto_bold.ttf is excluded by !**/*.ttf
  • packages/mobile-sdk-alpha/android/src/main/res/font/roboto_bold_italic.ttf is excluded by !**/*.ttf
  • packages/mobile-sdk-alpha/android/src/main/res/font/roboto_italic.ttf is excluded by !**/*.ttf
  • packages/mobile-sdk-alpha/android/src/main/res/font/roboto_medium.ttf is excluded by !**/*.ttf
  • packages/mobile-sdk-alpha/android/src/main/res/font/roboto_medium_italic.ttf is excluded by !**/*.ttf
  • packages/mobile-sdk-alpha/android/src/main/res/font/roboto_regular.ttf is excluded by !**/*.ttf
📒 Files selected for processing (13)
  • packages/mobile-sdk-alpha/android/src/main/res/drawable/toggle_background_border.xml (1 hunks)
  • packages/mobile-sdk-alpha/android/src/main/res/drawable/toggle_background_left.xml (1 hunks)
  • packages/mobile-sdk-alpha/android/src/main/res/drawable/toggle_background_right.xml (1 hunks)
  • packages/mobile-sdk-alpha/android/src/main/res/font/bold.xml (1 hunks)
  • packages/mobile-sdk-alpha/android/src/main/res/font/medium.xml (1 hunks)
  • packages/mobile-sdk-alpha/android/src/main/res/font/regular.xml (1 hunks)
  • packages/mobile-sdk-alpha/react-native.config.cjs (1 hunks)
  • packages/mobile-sdk-alpha/src/components/MRZScannerView.tsx (1 hunks)
  • packages/mobile-sdk-demo/android/app/build.gradle (2 hunks)
  • packages/mobile-sdk-demo/android/app/src/main/AndroidManifest.xml (1 hunks)
  • packages/mobile-sdk-demo/android/app/src/main/java/com/selfxyz/demoapp/MainApplication.kt (1 hunks)
  • packages/mobile-sdk-demo/android/settings.gradle (1 hunks)
  • packages/mobile-sdk-demo/src/screens/DocumentCamera.tsx (6 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
**/*.{js,ts,tsx,jsx,sol,nr}

📄 CodeRabbit inference engine (.cursorrules)

**/*.{js,ts,tsx,jsx,sol,nr}: NEVER log sensitive data including PII (names, DOB, passport numbers, addresses), credentials, tokens, API keys, private keys, or session identifiers.
ALWAYS redact/mask sensitive fields in logs using consistent patterns (e.g., ***-***-1234 for passport numbers, J*** D*** for names).

Files:

  • packages/mobile-sdk-demo/src/screens/DocumentCamera.tsx
  • packages/mobile-sdk-alpha/src/components/MRZScannerView.tsx
packages/mobile-sdk-alpha/**/*.{ts,tsx}

📄 CodeRabbit inference engine (packages/mobile-sdk-alpha/AGENTS.md)

packages/mobile-sdk-alpha/**/*.{ts,tsx}: Use strict TypeScript type checking across the codebase
Follow ESLint TypeScript-specific rules
Avoid introducing circular dependencies

Files:

  • packages/mobile-sdk-alpha/src/components/MRZScannerView.tsx
packages/mobile-sdk-alpha/**/*.{ts,tsx,js,jsx}

⚙️ CodeRabbit configuration file

packages/mobile-sdk-alpha/**/*.{ts,tsx,js,jsx}: Review alpha mobile SDK code for:

  • API consistency with core SDK
  • Platform-neutral abstractions
  • Performance considerations
  • Clear experimental notes or TODOs

Files:

  • packages/mobile-sdk-alpha/src/components/MRZScannerView.tsx
🧠 Learnings (7)
📚 Learning: 2025-08-29T15:31:15.924Z
Learnt from: CR
PR: selfxyz/self#0
File: packages/mobile-sdk-alpha/AGENTS.md:0-0
Timestamp: 2025-08-29T15:31:15.924Z
Learning: Applies to packages/mobile-sdk-alpha/**/package.json : Ensure package exports are properly configured

Applied to files:

  • packages/mobile-sdk-alpha/react-native.config.cjs
📚 Learning: 2025-08-24T21:22:29.459Z
Learnt from: transphorm
PR: selfxyz/self#943
File: app/android/app/src/main/java/com/proofofpassportapp/MainApplication.kt:17-17
Timestamp: 2025-08-24T21:22:29.459Z
Learning: OpenSourceMergedSoMapping from com.facebook.react.soloader.OpenSourceMergedSoMapping is available and functional in React Native 0.75.x. It can be safely imported and used for SoLoader initialization in MainApplication.kt without causing build failures.

Applied to files:

  • packages/mobile-sdk-demo/android/app/src/main/java/com/selfxyz/demoapp/MainApplication.kt
📚 Learning: 2025-08-29T15:31:15.924Z
Learnt from: CR
PR: selfxyz/self#0
File: packages/mobile-sdk-alpha/AGENTS.md:0-0
Timestamp: 2025-08-29T15:31:15.924Z
Learning: Applies to packages/mobile-sdk-alpha/{**/*.test.{ts,tsx},**/__tests__/**/*.{ts,tsx}} : Verify extractMRZInfo() using published sample MRZ strings (e.g., ICAO examples)

Applied to files:

  • packages/mobile-sdk-alpha/src/components/MRZScannerView.tsx
📚 Learning: 2025-08-24T18:54:04.809Z
Learnt from: CR
PR: selfxyz/self#0
File: .cursor/rules/mobile-sdk-migration.mdc:0-0
Timestamp: 2025-08-24T18:54:04.809Z
Learning: Applies to packages/mobile-sdk-alpha/demo/** : Provide an in-SDK lightweight React Native demo under packages/mobile-sdk-alpha/demo/

Applied to files:

  • packages/mobile-sdk-demo/android/settings.gradle
📚 Learning: 2025-08-24T18:54:04.809Z
Learnt from: CR
PR: selfxyz/self#0
File: .cursor/rules/mobile-sdk-migration.mdc:0-0
Timestamp: 2025-08-24T18:54:04.809Z
Learning: Applies to packages/mobile-sdk-alpha/samples/** : Create sample applications under packages/mobile-sdk-alpha/samples/ (RN demo and web demo)

Applied to files:

  • packages/mobile-sdk-demo/android/settings.gradle
📚 Learning: 2025-08-24T18:54:04.809Z
Learnt from: CR
PR: selfxyz/self#0
File: .cursor/rules/mobile-sdk-migration.mdc:0-0
Timestamp: 2025-08-24T18:54:04.809Z
Learning: Update the app to consume the mobile-sdk-alpha package and replace local modules with SDK imports

Applied to files:

  • packages/mobile-sdk-demo/android/app/build.gradle
📚 Learning: 2025-08-24T18:54:04.809Z
Learnt from: CR
PR: selfxyz/self#0
File: .cursor/rules/mobile-sdk-migration.mdc:0-0
Timestamp: 2025-08-24T18:54:04.809Z
Learning: Applies to packages/mobile-sdk-alpha/src/artifacts/** : Place artifact and manifest management in packages/mobile-sdk-alpha/src/artifacts/

Applied to files:

  • packages/mobile-sdk-demo/android/app/build.gradle
🧬 Code graph analysis (1)
packages/mobile-sdk-demo/src/screens/DocumentCamera.tsx (1)
packages/mobile-sdk-demo/src/components/DocumentScanResultCard.tsx (1)
  • DocumentScanResultCard (14-66)
⏰ Context from checks skipped due to timeout of 300000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (6)
  • GitHub Check: type-check
  • GitHub Check: build-deps
  • GitHub Check: android-build-test
  • GitHub Check: e2e-ios
  • GitHub Check: analyze-ios
  • GitHub Check: analyze-android
🔇 Additional comments (16)
packages/mobile-sdk-demo/src/screens/DocumentCamera.tsx (4)

85-88: Clear UI improvement for instruction visibility.

Moving the instructions above the camera view (rather than as an overlay) improves readability and ensures users see the guidance before interacting with the scanner. The structured layout with separate title and text enhances scannability.


109-109: Good responsive layout handling.

The conditional styling appropriately adds spacing when a scan result is present, ensuring visual separation between the action buttons and the result card below.


119-119: Logical content flow enhancement.

Positioning the result card after the action buttons creates a natural top-to-bottom reading flow: instructions → scanner → status → actions → results. The conditional rendering ensures users only see the card when scan data is available.


133-146: Well-structured and consistent styling.

The new styles demonstrate good practices:

  • Clear typographic hierarchy (instructionsTitle at 16px/600 weight, instructionsText at 14px)
  • Consistent color palette usage (#0f172a, #475569)
  • Proper spacing values that align with the existing design system
  • Centered status alignment improves visual polish

Also applies to: 162-163, 167-167, 187-189

packages/mobile-sdk-demo/android/app/src/main/AndroidManifest.xml (1)

4-4: LGTM - Camera permission correctly declared.

The CAMERA permission declaration is properly placed and aligns with the PR objective to enable runtime permission requests for camera functionality.

packages/mobile-sdk-demo/android/settings.gradle (1)

8-9: LGTM - Module inclusion correctly configured.

The mobile-sdk-alpha module is properly included with the correct relative path. This enables the demo app to use the native Android SDK components.

packages/mobile-sdk-alpha/android/src/main/res/drawable/toggle_background_border.xml (1)

7-7: Referenced color resource exists
@color/grey_2 is defined in colors.xml:14.

packages/mobile-sdk-alpha/android/src/main/res/font/medium.xml (1)

7-7: Font resource files are present. Both roboto_medium.ttf and roboto_medium_italic.ttf exist in res/font, so no action required.

packages/mobile-sdk-alpha/android/src/main/res/font/regular.xml (1)

7-7: Font files verified. Both roboto_regular.ttf and roboto_italic.ttf are present in packages/mobile-sdk-alpha/android/src/main/res/font/.

packages/mobile-sdk-alpha/src/components/MRZScannerView.tsx (1)

128-128: Verify Android native ViewManager registration.
No occurrences of SelfOCRViewManager (or PassportOCRViewManager) were found in the Android Java sources—confirm that the native code (Java/Kotlin) registers a ViewManager with the exact name "SelfOCRViewManager", or update accordingly to prevent runtime crashes.

packages/mobile-sdk-alpha/android/src/main/res/font/bold.xml (1)

7-7: Referenced font files exist
Found both roboto_bold.ttf and roboto_bold_italic.ttf in packages/mobile-sdk-alpha/android/src/main/res/font/.

packages/mobile-sdk-demo/android/app/src/main/java/com/selfxyz/demoapp/MainApplication.kt (1)

18-21: Enable Corepack and re-run autolinking to confirm package discovery
Due to the Yarn version mismatch, autolinking isn’t running; enable Corepack (or use Yarn 4.6.0) and run npx react-native config in packages/mobile-sdk-demo/android to verify that RNSelfPassportReaderPackage is auto-linked—then remove the manual packages.add(RNSelfPassportReaderPackage()) if it appears.

packages/mobile-sdk-demo/android/app/build.gradle (3)

46-50: LGTM!

The packaging exclusion for META-INF/versions/9/OSGI-INF/MANIFEST.MF correctly resolves a common multi-module dependency conflict.


1-65: Inconsistency: Camera permission missing from review.

The PR objective states "Declares the Android camera permission in the demo app manifest so runtime permission requests can succeed," but the AndroidManifest.xml file is not included in this review. Please ensure the camera permission declaration is present.


62-64: All dependencies are secure
No vulnerabilities found for com.google.android.material:material:1.12.0.

packages/mobile-sdk-alpha/react-native.config.cjs (1)

17-21: LGTM!

The Android platform configuration correctly wires the native module with proper sourceDir, packageImportPath, and packageInstance. This follows React Native best practices for native module integration.

@transphorm transphorm merged commit fecfc6b into dev Oct 8, 2025
27 checks passed
@transphorm transphorm deleted the codex/fix-camera-permission-button-issue branch October 8, 2025 01:45
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.

2 participants