Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file.
60 changes: 60 additions & 0 deletions app/android/android-mrz-qr-scanner/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'

android {
compileSdkVersion 33
namespace "com.selfxyz.mrzqrscanner"

defaultConfig {
minSdkVersion 21
targetSdkVersion 33
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}
kotlinOptions {
jvmTarget = '17'
}
buildFeatures {
viewBinding true
}
}

dependencies {
implementation 'com.google.android.gms:play-services-mlkit-text-recognition:18.0.2'
implementation 'com.google.mlkit:text-recognition:16.0.0'
implementation 'com.google.zxing:core:3.5.2'
implementation 'com.google.zxing:android-core:3.3.0'
implementation "com.github.fotoapparat:fotoapparat:2.7.0"
implementation 'org.jmrtd:jmrtd:0.7.35'
implementation 'io.reactivex.rxjava2:rxandroid:2.1.1'
implementation 'io.reactivex.rxjava2:rxjava:2.2.19'
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'com.google.android.material:material:1.12.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'androidx.fragment:fragment-ktx:1.5.7'
implementation 'com.github.mhshams:jnbis:2.0.2'
compileOnly 'edu.ucar:jj2000:5.2'

// Camera dependencies
implementation "androidx.camera:camera-core:1.3.2"
implementation "androidx.camera:camera-camera2:1.3.2"
implementation "androidx.camera:camera-lifecycle:1.3.2"
implementation "androidx.camera:camera-view:1.3.2"

// Utility dependencies
implementation 'com.google.guava:guava:31.1-android'
implementation 'androidx.core:core-ktx:1.12.0'

// React Native dependencies
implementation 'com.facebook.react:react-native:+'
}
Comment on lines +58 to +60
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Pin the React Native artifact version

com.facebook.react:react-native:+ lets Gradle pick an arbitrary version at build time. That breaks reproducibility, risks silently pulling insecure releases, and can desynchronize this library from the app’s pinned React Native runtime. Please align this dependency with the exact version the app already ships with.

-    implementation 'com.facebook.react:react-native:+'
+    implementation "com.facebook.react:react-native:${rootProject.ext.get(\"reactNativeAndroidVersion\")}"

(Replace the property with whatever constant the app module already uses for the pinned React Native coordinate.)

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
// React Native dependencies
implementation 'com.facebook.react:react-native:+'
}
// React Native dependencies
implementation "com.facebook.react:react-native:${rootProject.ext.get(\"reactNativeAndroidVersion\")}"
}
🤖 Prompt for AI Agents
In app/android/android-mrz-qr-scanner/build.gradle around lines 58 to 60, the
dependency uses a floating version 'com.facebook.react:react-native:+', which
must be replaced with the app's pinned React Native coordinate; locate the
constant/property the main app module already uses for the pinned React Native
version (e.g. a project ext property or dependency constant), replace the '+'
with that exact coordinate or property reference so the library and app use the
same explicit version, then sync/clean the Gradle build to verify resolution.

Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.selfxyz.mrzqrscanner">
</manifest>
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package com.selfxyz.mrzqrscanner;

import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.bridge.ReactContextBaseJavaModule;

public class MRZQRScannerModule extends ReactContextBaseJavaModule {
public MRZQRScannerModule(ReactApplicationContext reactContext) {
super(reactContext);
}

@Override
public String getName() {
return "MRZQRScannerModule";
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package com.selfxyz.mrzqrscanner;

import com.facebook.react.ReactPackage;
import com.facebook.react.bridge.NativeModule;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.uimanager.ViewManager;
import com.selfxyz.mrzqrscanner.ui.PassportOCRViewManager;
import com.selfxyz.mrzqrscanner.ui.QRCodeScannerViewManager;

import java.util.ArrayList;
import java.util.List;

public class MRZQRScannerPackage implements ReactPackage {
@Override
public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {
List<ViewManager> viewManagers = new ArrayList<>();
viewManagers.add(new PassportOCRViewManager(reactContext));
viewManagers.add(new QRCodeScannerViewManager(reactContext));
return viewManagers;
}

@Override
public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) {
List<NativeModule> modules = new ArrayList<>();
modules.add(new MRZQRScannerModule(reactContext));
return modules;
}
}
Loading
Loading