diff --git a/.changeset/purple-seahorses-switch.md b/.changeset/purple-seahorses-switch.md new file mode 100644 index 0000000..a872cd3 --- /dev/null +++ b/.changeset/purple-seahorses-switch.md @@ -0,0 +1,6 @@ +--- +'@capacitor-mlkit/barcode-scanning': patch +'@capacitor-mlkit/translation': patch +--- + +fix(android): invalid `progress` values diff --git a/packages/barcode-scanning/android/src/main/java/io/capawesome/capacitorjs/plugins/mlkit/barcodescanning/ModuleInstallProgressListener.java b/packages/barcode-scanning/android/src/main/java/io/capawesome/capacitorjs/plugins/mlkit/barcodescanning/ModuleInstallProgressListener.java index b06cb68..27be09c 100644 --- a/packages/barcode-scanning/android/src/main/java/io/capawesome/capacitorjs/plugins/mlkit/barcodescanning/ModuleInstallProgressListener.java +++ b/packages/barcode-scanning/android/src/main/java/io/capawesome/capacitorjs/plugins/mlkit/barcodescanning/ModuleInstallProgressListener.java @@ -32,7 +32,7 @@ public void onInstallStatusUpdated(ModuleInstallStatusUpdate update) { // Progress info is only set when modules are in the progress of downloading. Integer progress = null; if (progressInfo != null) { - progress = (int) (progressInfo.getBytesDownloaded() / progressInfo.getTotalBytesToDownload()); + progress = (int) (100 * (progressInfo.getBytesDownloaded() / progressInfo.getTotalBytesToDownload())); } implementation.handleGoogleBarcodeScannerModuleInstallProgress(state, progress); }