From ea2d615ce6a57cbdf7b0e62754ba0cf856ecb1be Mon Sep 17 00:00:00 2001 From: m1ga Date: Mon, 28 Mar 2022 09:15:43 +0200 Subject: [PATCH 01/11] android: update library --- android/build.gradle | 2 +- android/manifest | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/android/build.gradle b/android/build.gradle index a8f8de2e..5d912c70 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -1,6 +1,6 @@ dependencies { - implementation 'com.google.zxing:core:3.3.3' + implementation 'com.google.zxing:core:3.4.1' implementation 'com.google.zxing:android-core:3.3.0' implementation 'com.google.zxing:android-integration:3.3.0' } diff --git a/android/manifest b/android/manifest index e8c251f1..bf87a4cf 100644 --- a/android/manifest +++ b/android/manifest @@ -2,7 +2,7 @@ # this is your module manifest and used by Titanium # during compilation, packaging, distribution, etc. # -version: 6.0.1 +version: 6.1.0 apiversion: 4 architectures: arm64-v8a armeabi-v7a x86 x86_64 description: Lets you process 1D/2D barcodes. From 5268e5c2a904157325c7fe080917ed491e5d4b24 Mon Sep 17 00:00:00 2001 From: m1ga Date: Sat, 30 Apr 2022 09:11:01 +0200 Subject: [PATCH 02/11] new proptery: resultDuration --- android/src/ti/barcode/BarcodeModule.java | 1 + 1 file changed, 1 insertion(+) diff --git a/android/src/ti/barcode/BarcodeModule.java b/android/src/ti/barcode/BarcodeModule.java index 976b508e..023f8b31 100644 --- a/android/src/ti/barcode/BarcodeModule.java +++ b/android/src/ti/barcode/BarcodeModule.java @@ -361,6 +361,7 @@ public void capture(@Kroll.argument(optional = true) HashMap args) intent.putExtra(Intents.Scan.ALLOW_MENU, properties.optBoolean("allowMenu", true)); intent.putExtra(Intents.Scan.ALLOW_INSTRUCTIONS, properties.optBoolean("allowInstructions", true)); intent.putExtra(Intents.Scan.PROMPT_MESSAGE, properties.optString("displayedMessage", null)); + intent.putExtra(Intents.Scan.RESULT_DISPLAY_DURATION_MS, properties.optInt("resultDuration", 1500)); // [MOD-217] -- Must set the package in order for it to automatically select the application as the source of the scanning activity. intent.setPackage(TiApplication.getInstance().getPackageName()); From effb19e9999cb80af810913970bf92639c44cceb Mon Sep 17 00:00:00 2001 From: m1ga Date: Mon, 2 May 2022 23:14:41 +0200 Subject: [PATCH 03/11] new xzing version --- android/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/android/build.gradle b/android/build.gradle index 5d912c70..c769e6b2 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -1,6 +1,6 @@ dependencies { - implementation 'com.google.zxing:core:3.4.1' + implementation 'com.google.zxing:core:3.5.0' implementation 'com.google.zxing:android-core:3.3.0' implementation 'com.google.zxing:android-integration:3.3.0' } From 20d5594ce139866d04b059940c17cfc160f5be7c Mon Sep 17 00:00:00 2001 From: m1ga Date: Mon, 2 May 2022 23:31:44 +0200 Subject: [PATCH 04/11] fix int - long, move default waiting time to 10ms --- .../src/com/google/zxing/client/android/CaptureActivity.java | 2 +- android/src/ti/barcode/BarcodeModule.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/android/src/com/google/zxing/client/android/CaptureActivity.java b/android/src/com/google/zxing/client/android/CaptureActivity.java index 56ffa472..36585448 100755 --- a/android/src/com/google/zxing/client/android/CaptureActivity.java +++ b/android/src/com/google/zxing/client/android/CaptureActivity.java @@ -81,7 +81,7 @@ public final class CaptureActivity extends Activity implements SurfaceHolder.Cal private static final String TAG = CaptureActivity.class.getSimpleName(); - private static final long DEFAULT_INTENT_RESULT_DURATION_MS = 1500L; + private static final long DEFAULT_INTENT_RESULT_DURATION_MS = 10L; private static final long BULK_MODE_SCAN_DELAY_MS = 1000L; private static final String[] ZXING_URLS = { "http://zxing.appspot.com/scan", "zxing://scan/" }; diff --git a/android/src/ti/barcode/BarcodeModule.java b/android/src/ti/barcode/BarcodeModule.java index 023f8b31..e19141c9 100644 --- a/android/src/ti/barcode/BarcodeModule.java +++ b/android/src/ti/barcode/BarcodeModule.java @@ -361,7 +361,7 @@ public void capture(@Kroll.argument(optional = true) HashMap args) intent.putExtra(Intents.Scan.ALLOW_MENU, properties.optBoolean("allowMenu", true)); intent.putExtra(Intents.Scan.ALLOW_INSTRUCTIONS, properties.optBoolean("allowInstructions", true)); intent.putExtra(Intents.Scan.PROMPT_MESSAGE, properties.optString("displayedMessage", null)); - intent.putExtra(Intents.Scan.RESULT_DISPLAY_DURATION_MS, properties.optInt("resultDuration", 1500)); + intent.putExtra(Intents.Scan.RESULT_DISPLAY_DURATION_MS, (long) properties.optInt("resultDuration", 10)); // [MOD-217] -- Must set the package in order for it to automatically select the application as the source of the scanning activity. intent.setPackage(TiApplication.getInstance().getPackageName()); From 9b9b74bcaf476e82f81508f88b9167497d53efa1 Mon Sep 17 00:00:00 2001 From: m1ga Date: Tue, 3 May 2022 13:32:32 +0200 Subject: [PATCH 05/11] updated example and docs --- .../zxing/client/android/CaptureActivity.java | 17 ++-- android/src/ti/barcode/BarcodeModule.java | 3 +- apidoc/BarcodeModule.yml | 18 +++-- example/app.js | 77 +++++++++++++------ 4 files changed, 74 insertions(+), 41 deletions(-) diff --git a/android/src/com/google/zxing/client/android/CaptureActivity.java b/android/src/com/google/zxing/client/android/CaptureActivity.java index 36585448..b3a7b4a1 100755 --- a/android/src/com/google/zxing/client/android/CaptureActivity.java +++ b/android/src/com/google/zxing/client/android/CaptureActivity.java @@ -16,6 +16,7 @@ package com.google.zxing.client.android; + import com.google.zxing.BarcodeFormat; import com.google.zxing.DecodeHintType; import com.google.zxing.Result; @@ -26,8 +27,6 @@ import com.google.zxing.client.android.result.ResultButtonListener; import com.google.zxing.client.android.result.ResultHandler; import com.google.zxing.client.android.result.ResultHandlerFactory; -import com.google.zxing.client.android.result.supplement.SupplementalInfoRetriever; -import com.google.zxing.client.android.share.ShareActivity; import android.app.Activity; import android.app.AlertDialog; @@ -81,7 +80,7 @@ public final class CaptureActivity extends Activity implements SurfaceHolder.Cal private static final String TAG = CaptureActivity.class.getSimpleName(); - private static final long DEFAULT_INTENT_RESULT_DURATION_MS = 10L; + private static final long DEFAULT_INTENT_RESULT_DURATION_MS = 1500L; private static final long BULK_MODE_SCAN_DELAY_MS = 1000L; private static final String[] ZXING_URLS = { "http://zxing.appspot.com/scan", "zxing://scan/" }; @@ -651,12 +650,9 @@ private void handleDecodeInternally(Result rawResult, ResultHandler resultHandle } // Briefly show the contents of the barcode, then handle the result outside Barcode Scanner. - private void handleDecodeExternally(Result rawResult, ResultHandler resultHandler, Bitmap barcode) { - - if (barcode != null) { - viewfinderView.drawResultBitmap(barcode); - } + private void handleDecodeExternally(Result rawResult, ResultHandler resultHandler, Bitmap barcode) { + // get display time long resultDurationMS; if (getIntent() == null) { resultDurationMS = DEFAULT_INTENT_RESULT_DURATION_MS; @@ -664,7 +660,6 @@ private void handleDecodeExternally(Result rawResult, ResultHandler resultHandle resultDurationMS = getIntent().getLongExtra(Intents.Scan.RESULT_DISPLAY_DURATION_MS, DEFAULT_INTENT_RESULT_DURATION_MS); } - if (resultDurationMS > 0) { String rawResultString = String.valueOf(rawResult); if (rawResultString.length() > 32) { @@ -675,6 +670,10 @@ private void handleDecodeExternally(Result rawResult, ResultHandler resultHandle } } + if (barcode != null && resultDurationMS > 0) { + viewfinderView.drawResultBitmap(barcode); + } + maybeSetClipboard(resultHandler); if (source == IntentSource.NATIVE_APP_INTENT) { diff --git a/android/src/ti/barcode/BarcodeModule.java b/android/src/ti/barcode/BarcodeModule.java index e19141c9..0249c99a 100644 --- a/android/src/ti/barcode/BarcodeModule.java +++ b/android/src/ti/barcode/BarcodeModule.java @@ -351,6 +351,7 @@ public void capture(@Kroll.argument(optional = true) HashMap args) frameHeight = argsDict.optInt("frameHeight", 0); intent.putExtra(Intents.Scan.SHOW_INFO_TEXT, argsDict.optBoolean("showInfoText", false)); intent.putExtra(Intents.Scan.PREVENT_ROTATION, argsDict.optBoolean("preventRotation", true)); + intent.putExtra(Intents.Scan.RESULT_DISPLAY_DURATION_MS, (long) argsDict.optInt("resultDuration", 1500)); } else { Intents.Scan.overlayProxy = null; intent.putExtra(Intents.Scan.SHOW_RECTANGLE, true); @@ -361,8 +362,6 @@ public void capture(@Kroll.argument(optional = true) HashMap args) intent.putExtra(Intents.Scan.ALLOW_MENU, properties.optBoolean("allowMenu", true)); intent.putExtra(Intents.Scan.ALLOW_INSTRUCTIONS, properties.optBoolean("allowInstructions", true)); intent.putExtra(Intents.Scan.PROMPT_MESSAGE, properties.optString("displayedMessage", null)); - intent.putExtra(Intents.Scan.RESULT_DISPLAY_DURATION_MS, (long) properties.optInt("resultDuration", 10)); - // [MOD-217] -- Must set the package in order for it to automatically select the application as the source of the scanning activity. intent.setPackage(TiApplication.getInstance().getPackageName()); // CaptureActivity.PACKAGE_NAME = TiApplication.getInstance().getPackageName(); diff --git a/apidoc/BarcodeModule.yml b/apidoc/BarcodeModule.yml index ff1432ae..1ad97cbe 100644 --- a/apidoc/BarcodeModule.yml +++ b/apidoc/BarcodeModule.yml @@ -404,11 +404,11 @@ events: summary: The format of the barcode. Reported with a value of one of the Modules.Barcode.FORMAT_* constant if matching a known format. Otehrwise, may report a string value. type: [String,Number] platforms: [android, iphone, ipad] - + - name: result summary: The raw contents of the barcode type: String - + - name: code summary: | The activity result code from the scanning activity. Use the result constants defined in the [Ti.Android](Titanium.Android) namespace @@ -429,14 +429,14 @@ events: - name: bytes summary: The raw byte array contents of the barcode, when available type: Titanium.Buffer - + - name: error summary: Sent when an error occurs. properties: - name: message summary: The error message type: String - + - name: code summary: | The activity result code from the scanning activity. Use the result constants defined in the [Ti.Android](Titanium.Android) namespace @@ -452,7 +452,7 @@ events: - name: message summary: The error message type: String - + - name: code summary: | The activity result code from the scanning activity. Use the result constants defined in the [Ti.Android](Titanium.Android) namespace @@ -524,6 +524,14 @@ properties: default: true platforms: [android, iphone, ipad] + - name: resultDuration + summary: | + Time in milliseconds that the result will be visible after a scan. + type: Number + optional: true + default: 1500 + platforms: [android] + - name: frameWidth summary: | Width of the rectangle that is shown in the scanner diff --git a/example/app.js b/example/app.js index a7475356..0ac94df4 100644 --- a/example/app.js +++ b/example/app.js @@ -8,7 +8,7 @@ Barcode.allowRotation = true; Barcode.displayedMessage = ' '; Barcode.allowMenu = false; Barcode.allowInstructions = false; -Barcode.useLED = true; +// Barcode.useLED = true; var isAndroid = Ti.Platform.osname === 'android'; var isiOS = !isAndroid; @@ -50,12 +50,12 @@ var switchButton = Ti.UI.createButton({ borderRadius: 10, borderWidth: 1, opacity: 0.5, - width: 220, + width: 250, height: 30, bottom: 10 }); -switchButton.addEventListener('click', function () { +switchButton.addEventListener('click', function() { Barcode.useFrontCamera = !Barcode.useFrontCamera; switchButton.title = Barcode.useFrontCamera ? 'Back Camera' : 'Front Camera'; }); @@ -76,11 +76,11 @@ var cancelButton = Ti.UI.createButton({ borderRadius: 10, borderWidth: 1, opacity: 0.5, - width: 220, + width: 250, height: 30, - top: 20 + top: 10 }); -cancelButton.addEventListener('click', function () { +cancelButton.addEventListener('click', function() { Barcode.cancel(); }); overlay.add(cancelButton); @@ -89,10 +89,16 @@ overlay.add(cancelButton); * Create a button that will trigger the barcode scanner. */ var scanCode = Ti.UI.createButton({ - title: 'Scan the Code', - width: 150, - height: 60, - top: 20 + title: 'Scan the Code (continuous)', + width: 300, + height: 50, + top: 10 +}); +var scanCodeOnce = Ti.UI.createButton({ + title: 'Scan the Code (one time)', + width: 300, + height: 50, + top: 10 }); var cameraPermission = (callback) => { @@ -102,7 +108,7 @@ var cameraPermission = (callback) => { callback(true); } } else { - Ti.Media.requestCameraPermissions(function (e) { + Ti.Media.requestCameraPermissions(function(e) { if (e.success) { if (callback) { callback(true); @@ -124,8 +130,8 @@ var cameraPermission = (callback) => { } }; -scanCode.addEventListener('click', function () { - cameraPermission(function (re) { +scanCode.addEventListener('click', function() { + cameraPermission(function(re) { reset(); // Note: while the simulator will NOT show a camera stream in the simulator, you may still call "Barcode.capture" // to test your barcode scanning overlay. @@ -135,29 +141,50 @@ scanCode.addEventListener('click', function () { showCancel: false, showRectangle: false, keepOpen: true - /* , - acceptedFormats: [ - Barcode.FORMAT_QR_CODE - ]*/ + /*, + acceptedFormats: [ + Barcode.FORMAT_QR_CODE + ]*/ }); }); }); scrollView.add(scanCode); +scanCodeOnce.addEventListener('click', function() { + cameraPermission(function(re) { + reset(); + // Note: while the simulator will NOT show a camera stream in the simulator, you may still call "Barcode.capture" + // to test your barcode scanning overlay. + Barcode.capture({ + animate: true, + overlay: overlay, + showCancel: false, + showRectangle: false, + keepOpen: false, + resultDuration: 0 + /*, + acceptedFormats: [ + Barcode.FORMAT_QR_CODE + ]*/ + }); + }); +}); +scrollView.add(scanCodeOnce); + /** * Create a button that will show the gallery picker. */ var scanImage = Ti.UI.createButton({ title: 'Scan Image from Gallery', - width: 150, - height: 60, - top: 20 + width: 300, + height: 50, + top: 10 }); -scanImage.addEventListener('click', function () { +scanImage.addEventListener('click', function() { reset(); Ti.Media.openPhotoGallery({ - success: function (evt) { + success: function(evt) { Barcode.parse({ image: evt.media /* , @@ -189,7 +216,7 @@ function reset() { scanParsed.text = ' '; } -Barcode.addEventListener('error', function (e) { +Barcode.addEventListener('error', function(e) { scanContentType.text = ' '; scanFormat.text = ' '; scanParsed.text = ' '; @@ -197,11 +224,11 @@ Barcode.addEventListener('error', function (e) { console.log('An Error occured: ' + e); }); -Barcode.addEventListener('cancel', function (e) { +Barcode.addEventListener('cancel', function(e) { Ti.API.info('Cancel received'); }); -Barcode.addEventListener('success', function (e) { +Barcode.addEventListener('success', function(e) { Ti.API.info('Success called with barcode: ' + e.result); if (!scannedBarcodes['' + e.result]) { scannedBarcodes[e.result] = true; From 6970d588e597b9b4424c36ec4447a366fd7e2d5f Mon Sep 17 00:00:00 2001 From: m1ga Date: Mon, 3 Apr 2023 11:44:24 +0200 Subject: [PATCH 06/11] 3.5.1 --- android/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/android/build.gradle b/android/build.gradle index c769e6b2..d7d5085d 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -1,6 +1,6 @@ dependencies { - implementation 'com.google.zxing:core:3.5.0' + implementation 'com.google.zxing:core:3.5.1' implementation 'com.google.zxing:android-core:3.3.0' implementation 'com.google.zxing:android-integration:3.3.0' } From fb632d8e00e3b57ec173cd8fb0e4a596b19b7197 Mon Sep 17 00:00:00 2001 From: m1ga Date: Mon, 3 Apr 2023 11:48:46 +0200 Subject: [PATCH 07/11] lint --- example/app.js | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/example/app.js b/example/app.js index 0ac94df4..226483d8 100644 --- a/example/app.js +++ b/example/app.js @@ -55,7 +55,7 @@ var switchButton = Ti.UI.createButton({ bottom: 10 }); -switchButton.addEventListener('click', function() { +switchButton.addEventListener('click', function () { Barcode.useFrontCamera = !Barcode.useFrontCamera; switchButton.title = Barcode.useFrontCamera ? 'Back Camera' : 'Front Camera'; }); @@ -80,7 +80,7 @@ var cancelButton = Ti.UI.createButton({ height: 30, top: 10 }); -cancelButton.addEventListener('click', function() { +cancelButton.addEventListener('click', function () { Barcode.cancel(); }); overlay.add(cancelButton); @@ -108,7 +108,7 @@ var cameraPermission = (callback) => { callback(true); } } else { - Ti.Media.requestCameraPermissions(function(e) { + Ti.Media.requestCameraPermissions(function (e) { if (e.success) { if (callback) { callback(true); @@ -130,8 +130,8 @@ var cameraPermission = (callback) => { } }; -scanCode.addEventListener('click', function() { - cameraPermission(function(re) { +scanCode.addEventListener('click', function () { + cameraPermission(function (_re) { reset(); // Note: while the simulator will NOT show a camera stream in the simulator, you may still call "Barcode.capture" // to test your barcode scanning overlay. @@ -141,7 +141,7 @@ scanCode.addEventListener('click', function() { showCancel: false, showRectangle: false, keepOpen: true - /*, + /* , acceptedFormats: [ Barcode.FORMAT_QR_CODE ]*/ @@ -150,8 +150,8 @@ scanCode.addEventListener('click', function() { }); scrollView.add(scanCode); -scanCodeOnce.addEventListener('click', function() { - cameraPermission(function(re) { +scanCodeOnce.addEventListener('click', function () { + cameraPermission(function (_re) { reset(); // Note: while the simulator will NOT show a camera stream in the simulator, you may still call "Barcode.capture" // to test your barcode scanning overlay. @@ -162,7 +162,7 @@ scanCodeOnce.addEventListener('click', function() { showRectangle: false, keepOpen: false, resultDuration: 0 - /*, + /* , acceptedFormats: [ Barcode.FORMAT_QR_CODE ]*/ @@ -181,10 +181,10 @@ var scanImage = Ti.UI.createButton({ top: 10 }); -scanImage.addEventListener('click', function() { +scanImage.addEventListener('click', function () { reset(); Ti.Media.openPhotoGallery({ - success: function(evt) { + success: function (evt) { Barcode.parse({ image: evt.media /* , @@ -216,7 +216,7 @@ function reset() { scanParsed.text = ' '; } -Barcode.addEventListener('error', function(e) { +Barcode.addEventListener('error', function (e) { scanContentType.text = ' '; scanFormat.text = ' '; scanParsed.text = ' '; @@ -224,11 +224,11 @@ Barcode.addEventListener('error', function(e) { console.log('An Error occured: ' + e); }); -Barcode.addEventListener('cancel', function(e) { +Barcode.addEventListener('cancel', function (e) { Ti.API.info('Cancel received'); }); -Barcode.addEventListener('success', function(e) { +Barcode.addEventListener('success', function (e) { Ti.API.info('Success called with barcode: ' + e.result); if (!scannedBarcodes['' + e.result]) { scannedBarcodes[e.result] = true; From 642b72b04cf3b321319e5cd03279fc0cbf9559bf Mon Sep 17 00:00:00 2001 From: m1ga Date: Tue, 14 May 2024 19:56:33 +0200 Subject: [PATCH 08/11] set 'copy to clipboard' to be disabled by default --- .../src/com/google/zxing/client/android/BeepManager.java | 2 +- .../com/google/zxing/client/android/CaptureActivity.java | 4 +--- android/src/com/google/zxing/client/android/Intents.java | 1 + android/src/ti/barcode/BarcodeModule.java | 2 ++ apidoc/BarcodeModule.yml | 7 +++++++ example/app.js | 1 + 6 files changed, 13 insertions(+), 4 deletions(-) diff --git a/android/src/com/google/zxing/client/android/BeepManager.java b/android/src/com/google/zxing/client/android/BeepManager.java index 76e8651e..c6515edb 100644 --- a/android/src/com/google/zxing/client/android/BeepManager.java +++ b/android/src/com/google/zxing/client/android/BeepManager.java @@ -75,7 +75,7 @@ synchronized void playBeepSoundAndVibrate() { } private static boolean shouldBeep(SharedPreferences prefs, Context activity) { - boolean shouldPlayBeep = prefs.getBoolean(PreferencesActivity.KEY_PLAY_BEEP, true); + boolean shouldPlayBeep = prefs.getBoolean(PreferencesActivity.KEY_PLAY_BEEP, false); if (shouldPlayBeep) { // See if sound settings overrides this AudioManager audioService = (AudioManager) activity.getSystemService(Context.AUDIO_SERVICE); diff --git a/android/src/com/google/zxing/client/android/CaptureActivity.java b/android/src/com/google/zxing/client/android/CaptureActivity.java index b3a7b4a1..fd9577a7 100755 --- a/android/src/com/google/zxing/client/android/CaptureActivity.java +++ b/android/src/com/google/zxing/client/android/CaptureActivity.java @@ -235,9 +235,7 @@ private void resume(){ inactivityTimer.onResume(); - copyToClipboard = prefs.getBoolean(PreferencesActivity.KEY_COPY_TO_CLIPBOARD, true) - && (intent == null || intent.getBooleanExtra(Intents.Scan.SAVE_HISTORY, true)); - + copyToClipboard = intent.getBooleanExtra(Intents.Scan.KEY_COPY_TO_CLIPBOARD, false); source = IntentSource.NONE; sourceUrl = null; scanFromWebPageManager = null; diff --git a/android/src/com/google/zxing/client/android/Intents.java b/android/src/com/google/zxing/client/android/Intents.java index 8c77ad46..89108ef3 100755 --- a/android/src/com/google/zxing/client/android/Intents.java +++ b/android/src/com/google/zxing/client/android/Intents.java @@ -185,6 +185,7 @@ public static final class Scan { * Setting this to false will not save scanned codes in the history. Specified as a {@code boolean}. */ public static final String SAVE_HISTORY = "SAVE_HISTORY"; + public static final String KEY_COPY_TO_CLIPBOARD = "KEY_COPY_TO_CLIPBOARD"; private Scan() { } diff --git a/android/src/ti/barcode/BarcodeModule.java b/android/src/ti/barcode/BarcodeModule.java index 0249c99a..73903d6d 100644 --- a/android/src/ti/barcode/BarcodeModule.java +++ b/android/src/ti/barcode/BarcodeModule.java @@ -131,6 +131,7 @@ public BarcodeModule() defaultValues.put("allowInstructions", true); defaultValues.put("useFrontCamera", false); defaultValues.put("useLED", false); + defaultValues.put("copyToClipboard", false); } private static BarcodeModule _instance; @@ -361,6 +362,7 @@ public void capture(@Kroll.argument(optional = true) HashMap args) intent.putExtra(Intents.Scan.ALLOW_MENU, properties.optBoolean("allowMenu", true)); intent.putExtra(Intents.Scan.ALLOW_INSTRUCTIONS, properties.optBoolean("allowInstructions", true)); + intent.putExtra(Intents.Scan.KEY_COPY_TO_CLIPBOARD, properties.optBoolean("copyToClipboard", false)); intent.putExtra(Intents.Scan.PROMPT_MESSAGE, properties.optString("displayedMessage", null)); // [MOD-217] -- Must set the package in order for it to automatically select the application as the source of the scanning activity. intent.setPackage(TiApplication.getInstance().getPackageName()); diff --git a/apidoc/BarcodeModule.yml b/apidoc/BarcodeModule.yml index 1ad97cbe..c4760038 100644 --- a/apidoc/BarcodeModule.yml +++ b/apidoc/BarcodeModule.yml @@ -335,6 +335,13 @@ properties: since: "3.1.0" platforms: [android] + - name: copyToClipboard + summary: Whether or not copy the result to the clipboard + type: Boolean + default: false + since: "6.1.0" + platforms: [android] + - name: displayedMessage summary: Controls the message that is displayed to the end user when they are capturing a barcode. type: String diff --git a/example/app.js b/example/app.js index 226483d8..a13fb1b5 100644 --- a/example/app.js +++ b/example/app.js @@ -8,6 +8,7 @@ Barcode.allowRotation = true; Barcode.displayedMessage = ' '; Barcode.allowMenu = false; Barcode.allowInstructions = false; +// Barcode.copyToClipboard = true; // Barcode.useLED = true; var isAndroid = Ti.Platform.osname === 'android'; From 3e4430912411c0fb0fd0af9899d70ccd49b699a7 Mon Sep 17 00:00:00 2001 From: m1ga Date: Tue, 14 May 2024 19:59:56 +0200 Subject: [PATCH 09/11] update version --- android/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/android/build.gradle b/android/build.gradle index d7d5085d..c8dde5cd 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -1,6 +1,6 @@ dependencies { - implementation 'com.google.zxing:core:3.5.1' + implementation 'com.google.zxing:core:3.5.3' implementation 'com.google.zxing:android-core:3.3.0' implementation 'com.google.zxing:android-integration:3.3.0' } From e1949a44c8a6a68a207ab74ca706546ac6abc0a1 Mon Sep 17 00:00:00 2001 From: m1ga Date: Tue, 14 May 2024 20:03:59 +0200 Subject: [PATCH 10/11] actions --- .github/workflows/android.yml | 16 ++++++++-------- .github/workflows/docs.yml | 8 ++++---- .github/workflows/ios.yml | 16 ++++++++-------- .github/workflows/js.yml | 14 +++++++------- 4 files changed, 27 insertions(+), 27 deletions(-) diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml index 333b0882..ae6343e3 100644 --- a/.github/workflows/android.yml +++ b/.github/workflows/android.yml @@ -1,5 +1,5 @@ name: Android Build -on: +on: push: paths-ignore: - 'ios/**' @@ -17,19 +17,19 @@ jobs: env: CCACHE_DIR: ${{ github.workspace }}/.ccache USE_CCACHE: 1 - SDK_VERSION: 9.3.2.GA + SDK_VERSION: 12.3.0.GA MODULE_ID: ti.barcode steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - - name: Use Node.js 12.x - uses: actions/setup-node@v1 + - name: Use Node.js + uses: actions/setup-node@v4 with: - node-version: '12.x' + node-version: '18.x' - name: Cache Node.js modules id: node-cache - uses: actions/cache@v2 + uses: actions/cache@v4 with: path: node_modules key: ${{ runner.OS }}-node-modules-${{ hashFiles('package-lock.json') }} @@ -42,7 +42,7 @@ jobs: if: steps.node-cache.outputs.cache-hit != 'true' - name: Cache Gradle packages - uses: actions/cache@v2 + uses: actions/cache@v4 with: path: | ~/.gradle/caches diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 3de93aac..a6cc0cf1 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -12,12 +12,12 @@ jobs: runs-on: ubuntu-latest name: Docs steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - - name: Use Node.js 12.x - uses: actions/setup-node@v1 + - name: Use Node.js + uses: actions/setup-node@v4 with: - node-version: '12.x' + node-version: '18.x' - run: npm ci name: Install dependencies diff --git a/.github/workflows/ios.yml b/.github/workflows/ios.yml index 6ed35cd2..bbed24c2 100644 --- a/.github/workflows/ios.yml +++ b/.github/workflows/ios.yml @@ -1,5 +1,5 @@ name: iOS Build -on: +on: push: paths-ignore: - 'android/**' @@ -9,25 +9,25 @@ on: - 'android/**' - 'apidoc/**' workflow_dispatch: - + jobs: ios: runs-on: macos-latest name: iOS env: - SDK_VERSION: 9.3.2.GA + SDK_VERSION: 12.3.0.GA MODULE_ID: ti.barcode steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - - name: Use Node.js 12.x - uses: actions/setup-node@v1 + - name: Use Node.js + uses: actions/setup-node@v4 with: - node-version: '12.x' + node-version: '18.x' - name: Cache Node.js modules id: node-cache - uses: actions/cache@v2 + uses: actions/cache@v4 with: path: node_modules key: ${{ runner.OS }}-node-modules-${{ hashFiles('package-lock.json') }} diff --git a/.github/workflows/js.yml b/.github/workflows/js.yml index 00d19f75..ee98ff59 100644 --- a/.github/workflows/js.yml +++ b/.github/workflows/js.yml @@ -1,5 +1,5 @@ name: JavaScript Lint -on: +on: push: paths: - '**.js' @@ -11,22 +11,22 @@ on: - '**.json' - '**.eslint*' workflow_dispatch: - + jobs: js: runs-on: ubuntu-latest name: JavaScript steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - - name: Use Node.js 12.x - uses: actions/setup-node@v1 + - name: Use Node.js + uses: actions/setup-node@v4 with: - node-version: '12.x' + node-version: '18.x' - name: Cache Node.js modules id: node-cache - uses: actions/cache@v2 + uses: actions/cache@v4 with: path: node_modules key: ${{ runner.OS }}-node-modules-${{ hashFiles('package-lock.json') }} From 9d1558ecc8f708b3ac7889b04643315d0d07f9a0 Mon Sep 17 00:00:00 2001 From: m1ga Date: Tue, 14 May 2024 20:10:12 +0200 Subject: [PATCH 11/11] build action --- .github/workflows/android.yml | 2 +- ios/titanium.xcconfig | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml index 75171724..59f08ccb 100644 --- a/.github/workflows/android.yml +++ b/.github/workflows/android.yml @@ -30,7 +30,7 @@ jobs: - uses: actions/setup-java@v3 with: distribution: 'adopt' - java-version: '11' + java-version: '17' - name: Cache Node.js modules id: node-cache diff --git a/ios/titanium.xcconfig b/ios/titanium.xcconfig index 258993f2..2a613683 100755 --- a/ios/titanium.xcconfig +++ b/ios/titanium.xcconfig @@ -4,10 +4,10 @@ // OF YOUR TITANIUM SDK YOU'RE BUILDING FOR // // -TITANIUM_SDK_VERSION = 9.3.2.GA +TITANIUM_SDK_VERSION = 12.3.0.GA -// +// // THESE SHOULD BE OK GENERALLY AS-IS // TITANIUM_SDK = /Users/$(USER)/Library/Application Support/Titanium/mobilesdk/osx/$(TITANIUM_SDK_VERSION)