From 24811ce496221ef5b746b4d95cb6b3cc9d72d83d Mon Sep 17 00:00:00 2001 From: Denis Averin Date: Sun, 22 Mar 2026 03:42:15 +0700 Subject: [PATCH 1/9] Fix Java templates --- codegen/Templates/java/README.mustache | 2 +- codegen/Templates/java/api.mustache | 2 +- codegen/Templates/java/pom.mustache | 55 ++++++++++++++++++++++++-- 3 files changed, 53 insertions(+), 6 deletions(-) diff --git a/codegen/Templates/java/README.mustache b/codegen/Templates/java/README.mustache index 0b1bad6..43c5795 100644 --- a/codegen/Templates/java/README.mustache +++ b/codegen/Templates/java/README.mustache @@ -1,7 +1,7 @@ # {{artifactDescription}} [![License](https://img.shields.io/github/license/aspose-barcode-cloud/aspose-barcode-cloud-java)](LICENSE) -[![Java CI with Maven](https://github.com/aspose-barcode-cloud/aspose-barcode-cloud-java/actions/workflows/maven.yml/badge.svg?branch=main)](https://github.com/aspose-barcode-cloud/aspose-barcode-cloud-java/actions/workflows/maven.yml) +[![Java CI with Maven](https://github.com/aspose-barcode-cloud/aspose-barcode-cloud-java/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/aspose-barcode-cloud/aspose-barcode-cloud-java/actions/workflows/ci.yml) [![Maven metadata URL](https://img.shields.io/maven-metadata/v?metadataUrl=https%3A%2F%2Freleases.aspose.cloud%2Fjava%2Frepo%2Fcom%2Faspose%2Faspose-barcode-cloud%2Fmaven-metadata.xml)](https://releases.aspose.cloud/java/repo/com/aspose/aspose-barcode-cloud/) - API version: {{appVersion}} diff --git a/codegen/Templates/java/api.mustache b/codegen/Templates/java/api.mustache index cab45d8..24c62d9 100644 --- a/codegen/Templates/java/api.mustache +++ b/codegen/Templates/java/api.mustache @@ -78,7 +78,7 @@ public class {{classname}} { // create path and map variables String {{localVariablePrefix}}path = "{{{path}}}"{{#pathParams}} - .replaceAll("\\{" + "{{baseName}}" + "}", request.{{{paramName}}}.toString()){{/pathParams}}; + .replace("{" + "{{baseName}}" + "}", request.{{{paramName}}}.toString()){{/pathParams}}; {{javaUtilPrefix}}List {{localVariablePrefix}}queryParams = new {{javaUtilPrefix}}ArrayList<>(); {{javaUtilPrefix}}List {{localVariablePrefix}}collectionQueryParams = new {{javaUtilPrefix}}ArrayList<>();{{#queryParams}} diff --git a/codegen/Templates/java/pom.mustache b/codegen/Templates/java/pom.mustache index 3b9b6fb..b3a12f7 100644 --- a/codegen/Templates/java/pom.mustache +++ b/codegen/Templates/java/pom.mustache @@ -141,6 +141,52 @@ + + org.jacoco + jacoco-maven-plugin + ${jacoco.version} + + + prepare-agent + + prepare-agent + + + + report + test + + report + + + + check + test + + check + + + + + CLASS + + com.aspose.barcode.cloud.api.GenerateApi + com.aspose.barcode.cloud.api.RecognizeApi + com.aspose.barcode.cloud.api.ScanApi + + + + METHOD + COVEREDRATIO + 0.81 + + + + + + + + org.codehaus.mojo versions-maven-plugin @@ -250,9 +296,9 @@ ${java.version} 1.9.0 {{! Check version compatibility with gson-fire }} - 2.11.0 - 1.6.15 - 4.12.0 + 2.13.2 + 1.6.16 + 5.3.2 {{#joda}} 2.9.9 {{/joda}} @@ -261,7 +307,8 @@ {{/threetenbp}} 1.0.0 4.13.2 - 2.18.0 + 0.8.12 + 2.21.0 UTF-8 From 51d041dd07914b8988c5d9e864d918ae2e52a9d1 Mon Sep 17 00:00:00 2001 From: Denis Averin Date: Mon, 23 Mar 2026 19:24:41 +0700 Subject: [PATCH 2/9] Bump Java version to 26.3.2 --- codegen/config-java.json | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/codegen/config-java.json b/codegen/config-java.json index 5258e81..b062044 100644 --- a/codegen/config-java.json +++ b/codegen/config-java.json @@ -1,20 +1,20 @@ { - "apiPackage": "com.aspose.barcode.cloud.api", - "artifactDescription": "Aspose.BarCode Cloud SDK for Java", - "artifactId": "aspose-barcode-cloud", - "artifactUrl": "https://www.aspose.cloud", - "artifactVersion": "26.2.0", - "developerEmail": "denis.averin@aspose.com", - "developerName": "Denis Averin", - "developerOrganization": "Aspose", - "developerOrganizationUrl": "https://www.aspose.cloud", - "groupId": "com.aspose", - "hideGenerationTimestamp": true, - "invokerPackage": "com.aspose.barcode.cloud", - "licenseName": "MIT License", - "licenseUrl": "http://www.opensource.org/licenses/mit-license.php", - "modelPackage": "com.aspose.barcode.cloud.model", - "scmConnection": "scm:git:git@github.com:aspose-barcode-cloud/aspose-barcode-cloud-java.git", - "scmDeveloperConnection": "scm:git:git@github.com:aspose-barcode-cloud/aspose-barcode-cloud-java.git", - "scmUrl": "https://github.com/aspose-barcode-cloud/aspose-barcode-cloud-java" -} \ No newline at end of file + "apiPackage": "com.aspose.barcode.cloud.api", + "artifactDescription": "Aspose.BarCode Cloud SDK for Java", + "artifactId": "aspose-barcode-cloud", + "artifactUrl": "https://www.aspose.cloud", + "artifactVersion": "26.3.2", + "developerEmail": "denis.averin@aspose.com", + "developerName": "Denis Averin", + "developerOrganization": "Aspose", + "developerOrganizationUrl": "https://www.aspose.cloud", + "groupId": "com.aspose", + "hideGenerationTimestamp": true, + "invokerPackage": "com.aspose.barcode.cloud", + "licenseName": "MIT License", + "licenseUrl": "http://www.opensource.org/licenses/mit-license.php", + "modelPackage": "com.aspose.barcode.cloud.model", + "scmConnection": "scm:git:git@github.com:aspose-barcode-cloud/aspose-barcode-cloud-java.git", + "scmDeveloperConnection": "scm:git:git@github.com:aspose-barcode-cloud/aspose-barcode-cloud-java.git", + "scmUrl": "https://github.com/aspose-barcode-cloud/aspose-barcode-cloud-java" +} From 8e3619d56e565b5b56714f660dd39b5a61173d75 Mon Sep 17 00:00:00 2001 From: Denis Averin Date: Tue, 24 Mar 2026 17:59:12 +0700 Subject: [PATCH 3/9] Bump SDK versions to 26.3 Co-Authored-By: Claude Opus 4.6 (1M context) --- codegen/config-dart.json | 2 +- codegen/config-go.json | 2 +- codegen/config-php.json | 2 +- codegen/config-python.json | 2 +- codegen/config.json | 4 ++-- submodules/dart | 2 +- submodules/dotnet | 2 +- submodules/go | 2 +- submodules/java | 2 +- submodules/php | 2 +- submodules/python | 2 +- 11 files changed, 12 insertions(+), 12 deletions(-) diff --git a/codegen/config-dart.json b/codegen/config-dart.json index 65935b5..9f0f515 100644 --- a/codegen/config-dart.json +++ b/codegen/config-dart.json @@ -3,6 +3,6 @@ "browserClient": false, "pubDescription": "This SDK allows you to work with Aspose.BarCode for Cloud REST APIs in your Dart or Flutter applications quickly and easily", "pubName": "aspose_barcode_cloud", - "pubVersion": "4.26.2", + "pubVersion": "4.26.3", "useEnumExtension": true } \ No newline at end of file diff --git a/codegen/config-go.json b/codegen/config-go.json index 601ccc6..1496e18 100644 --- a/codegen/config-go.json +++ b/codegen/config-go.json @@ -1,4 +1,4 @@ { "packageName": "barcode", - "packageVersion": "4.2602.0" + "packageVersion": "4.2603.0" } \ No newline at end of file diff --git a/codegen/config-php.json b/codegen/config-php.json index 43cd390..c5372b1 100644 --- a/codegen/config-php.json +++ b/codegen/config-php.json @@ -1,4 +1,4 @@ { - "artifactVersion": "26.2.0", + "artifactVersion": "26.3.0", "invokerPackage": "Aspose\\BarCode" } \ No newline at end of file diff --git a/codegen/config-python.json b/codegen/config-python.json index bf455ca..d8c3d53 100644 --- a/codegen/config-python.json +++ b/codegen/config-python.json @@ -1,6 +1,6 @@ { "packageName": "aspose_barcode_cloud", "packageUrl": "https://github.com/aspose-barcode-cloud/aspose-barcode-cloud-python", - "packageVersion": "26.2.0", + "packageVersion": "26.3.0", "projectName": "aspose-barcode-cloud" } \ No newline at end of file diff --git a/codegen/config.json b/codegen/config.json index 372e93e..0249eea 100644 --- a/codegen/config.json +++ b/codegen/config.json @@ -1,9 +1,9 @@ { "artifactVersion": "23.7.0", "npmName": "aspose-barcode-cloud-node", - "npmVersion": "26.2.0", + "npmVersion": "26.3.0", "packageName": "Aspose.BarCode.Cloud.Sdk", - "packageVersion": "26.2.0", + "packageVersion": "26.3.0", "supportsES6": true, "targetFramework": "netstandard2.0" } \ No newline at end of file diff --git a/submodules/dart b/submodules/dart index e982c07..5c765be 160000 --- a/submodules/dart +++ b/submodules/dart @@ -1 +1 @@ -Subproject commit e982c07ab0e1d2b00ee4c520b50ae340479bb1e7 +Subproject commit 5c765bef71d88155268e62964a4fb8d986757c5c diff --git a/submodules/dotnet b/submodules/dotnet index 43fadc9..712baf6 160000 --- a/submodules/dotnet +++ b/submodules/dotnet @@ -1 +1 @@ -Subproject commit 43fadc9b41e6fc59384f99e416facb054f2105b9 +Subproject commit 712baf64eace6ee04f46e97784475fac956a166e diff --git a/submodules/go b/submodules/go index b808611..1529278 160000 --- a/submodules/go +++ b/submodules/go @@ -1 +1 @@ -Subproject commit b8086110e8f28fcd39018059a519f423154c3273 +Subproject commit 15292780f73b2dde7dd6eb40c1c88d3440346191 diff --git a/submodules/java b/submodules/java index 68416f8..d5c31fe 160000 --- a/submodules/java +++ b/submodules/java @@ -1 +1 @@ -Subproject commit 68416f83e155b808da9ea2dbe110fc25d5912e53 +Subproject commit d5c31fedd8c1ec16285a723090184845dc4d70c6 diff --git a/submodules/php b/submodules/php index 531171e..193b3d1 160000 --- a/submodules/php +++ b/submodules/php @@ -1 +1 @@ -Subproject commit 531171e2bb7da7cead5e83f760de37dfbca26b86 +Subproject commit 193b3d119f0cc4908943bc9b1d67f1fcad0ac633 diff --git a/submodules/python b/submodules/python index f2b2e46..6ee9250 160000 --- a/submodules/python +++ b/submodules/python @@ -1 +1 @@ -Subproject commit f2b2e46fd64f9671088d2700d9387cc83164db45 +Subproject commit 6ee9250cdaebb40535c5a81184a9f0864187674d From 4d0cb475ecc3b225fc720779df15518788b73a69 Mon Sep 17 00:00:00 2001 From: Denis Averin Date: Tue, 24 Mar 2026 17:59:17 +0700 Subject: [PATCH 4/9] Add Go Report Card badge to README template Co-Authored-By: Claude Opus 4.6 (1M context) --- codegen/Templates/go/README.mustache | 1 + 1 file changed, 1 insertion(+) diff --git a/codegen/Templates/go/README.mustache b/codegen/Templates/go/README.mustache index 30ad312..d9a027c 100644 --- a/codegen/Templates/go/README.mustache +++ b/codegen/Templates/go/README.mustache @@ -1,6 +1,7 @@ # Aspose.BarCode Cloud SDK for Go [![License](https://img.shields.io/github/license/aspose-barcode-cloud/aspose-barcode-cloud-go)](LICENSE) +[![Go Report Card](https://goreportcard.com/badge/github.com/aspose-barcode-cloud/aspose-barcode-cloud-go)](https://goreportcard.com/report/github.com/aspose-barcode-cloud/aspose-barcode-cloud-go) [![Go](https://github.com/aspose-barcode-cloud/aspose-barcode-cloud-go/actions/workflows/go.yml/badge.svg?branch=main)](https://github.com/aspose-barcode-cloud/aspose-barcode-cloud-go/actions/workflows/go.yml) [![GitHub tag (latest SemVer)](https://img.shields.io/github/v/tag/aspose-barcode-cloud/aspose-barcode-cloud-go?label=module&sort=semver)](https://pkg.go.dev/github.com/aspose-barcode-cloud/aspose-barcode-cloud-go) From bd0a000c1a0e4896e05fe11870a8e19b24a6d912 Mon Sep 17 00:00:00 2001 From: Denis Averin Date: Tue, 24 Mar 2026 17:59:21 +0700 Subject: [PATCH 5/9] Set PHP_CS_FIXER_IGNORE_ENV in PHP generator Co-Authored-By: Claude Opus 4.6 (1M context) --- codegen/generate-php.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/codegen/generate-php.bash b/codegen/generate-php.bash index 59faf75..d95dc60 100755 --- a/codegen/generate-php.bash +++ b/codegen/generate-php.bash @@ -40,4 +40,4 @@ cp ../scripts/check-badges.bash "$targetDir/scripts/" rm -rf "${tempDir}" -pushd "${targetDir}" && make after-gen && popd >/dev/null +pushd "${targetDir}" && PHP_CS_FIXER_IGNORE_ENV=1 make after-gen && popd >/dev/null From 0c57f28b2c3e4effb0eb3a14caf0dfea67cce8e2 Mon Sep 17 00:00:00 2001 From: Denis Averin Date: Tue, 24 Mar 2026 17:59:27 +0700 Subject: [PATCH 6/9] Update Android templates for modern APIs Modernize templates: AGP 9.1.0, Java 17, SDK 36, Activity Result APIs, Photo Picker, edge-to-edge support. Remove deprecated onActivityResult/startActivityForResult, storage permissions, and Kotlin plugin (handled by AGP 9+). Co-Authored-By: Claude Opus 4.6 (1M context) --- .../Templates/android/apiException.mustache | 186 +++++++----------- codegen/Templates/android/build.mustache | 6 +- .../Templates/android/git_push.sh.mustache | 2 - codegen/Templates/android/gradlew.mustache | 47 ++--- codegen/Templates/android/manifest.mustache | 12 +- codegen/Templates/android/pom.mustache | 2 +- codegen/config-android.json | 4 +- submodules/android | 2 +- 8 files changed, 99 insertions(+), 162 deletions(-) diff --git a/codegen/Templates/android/apiException.mustache b/codegen/Templates/android/apiException.mustache index a274963..a2861bc 100644 --- a/codegen/Templates/android/apiException.mustache +++ b/codegen/Templates/android/apiException.mustache @@ -2,12 +2,11 @@ {{>licenseInfo}} package {{invokerPackage}} -import android.Manifest import android.app.Activity import android.content.Intent -import android.content.pm.PackageManager import android.graphics.Bitmap import android.graphics.BitmapFactory +import android.net.Uri import android.os.Bundle import android.provider.MediaStore import android.util.Size @@ -17,47 +16,41 @@ import android.widget.ArrayAdapter import android.widget.EditText import android.widget.ImageView import android.widget.Spinner +import androidx.activity.result.PickVisualMediaRequest +import androidx.activity.result.contract.ActivityResultContracts import androidx.appcompat.app.AppCompatActivity -import androidx.core.content.ContextCompat +import androidx.core.os.BundleCompat +import androidx.core.view.ViewCompat +import androidx.core.view.WindowCompat +import androidx.core.view.WindowInsetsCompat import com.aspose.barcode.cloud.ApiClient import com.aspose.barcode.cloud.ApiException import com.aspose.barcode.cloud.api.GenerateApi import com.aspose.barcode.cloud.api.ScanApi import com.aspose.barcode.cloud.model.BarcodeImageFormat -import com.aspose.barcode.cloud.model.BarcodeResponseList import com.aspose.barcode.cloud.model.EncodeBarcodeType -import com.aspose.barcode.cloud.model.EncodeDataType import com.aspose.barcode.cloud.requests.GenerateRequestWrapper import com.aspose.barcode.cloud.requests.ScanMultipartRequestWrapper import com.google.android.material.snackbar.Snackbar import java.io.File import java.io.FileOutputStream import kotlin.math.floor - +import androidx.core.graphics.scale class MainActivity : AppCompatActivity() { companion object { - const val PERMISSION_REQUEST_CALLBACK_CODE = 1 - const val ACTION_GET_CONTENT_CALLBACK_CODE = 2 - const val ACTION_IMAGE_CAPTURE_CALLBACK_CODE = 3 - private fun imageSize(width: Int, height: Int, maxSize: Int = 384): Size { val ratio = width.toFloat() / height if (ratio > 1) { - // width > height - // use width if (width < maxSize) { - // do not resize return Size(width, height) } val newHeight = floor(maxSize / ratio).toInt() return Size(maxSize, newHeight) } - // width <= height - // use height + if (height < maxSize) { - // do not resize return Size(width, height) } val newWidth = floor(maxSize * ratio).toInt() @@ -66,7 +59,7 @@ class MainActivity : AppCompatActivity() { private fun reduceBitmapSize(image: Bitmap): Bitmap { val newSize = imageSize(image.width, image.height) - return Bitmap.createScaledBitmap(image, newSize.width, newSize.height, true) + return image.scale(newSize.width, newSize.height) } } @@ -76,11 +69,35 @@ class MainActivity : AppCompatActivity() { private lateinit var scanApi: ScanApi private lateinit var generateApi: GenerateApi - private val encodeTypes = EncodeBarcodeType.values().map { it.toString() }.sorted() + private val encodeTypes = EncodeBarcodeType.entries.map { it.toString() }.sorted() + + private val cameraLauncher = + registerForActivityResult(ActivityResultContracts.StartActivityForResult()) { result -> + if (result.resultCode == Activity.RESULT_OK) { + val bmpImage = result.data?.extras?.let { + BundleCompat.getParcelable(it, "data", Bitmap::class.java) + } + if (bmpImage == null) { + showErrorMessage("No photo captured") + return@registerForActivityResult + } + recognizeBarcode(bmpImage) + } + } + + private val photoPickerLauncher = + registerForActivityResult(ActivityResultContracts.PickVisualMedia()) { uri -> + if (uri == null) { + return@registerForActivityResult + } + + recognizeSelectedImage(uri) + } override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_main) + configureEdgeToEdge() val client = ApiClient( "Client Id from https://dashboard.aspose.cloud/applications", @@ -99,6 +116,18 @@ class MainActivity : AppCompatActivity() { barcodeImgView = findViewById(R.id.imageView) } + private fun configureEdgeToEdge() { + WindowCompat.setDecorFitsSystemWindows(window, false) + + val rootLayout = findViewById(R.id.rootLayout) + ViewCompat.setOnApplyWindowInsetsListener(rootLayout) { view, windowInsets -> + val insets = windowInsets.getInsets(WindowInsetsCompat.Type.systemBars()) + view.setPadding(insets.left, insets.top, insets.right, insets.bottom) + windowInsets + } + ViewCompat.requestApplyInsets(rootLayout) + } + private fun showErrorMessage(error: String) { Snackbar.make(findViewById(android.R.id.content), error, Snackbar.LENGTH_LONG).show() } @@ -110,82 +139,26 @@ class MainActivity : AppCompatActivity() { barcodeTypeSpinner.setSelection(encodeTypes.indexOf("QR")) } - private fun requestPermissionAndPickFile(context: Activity) { - if (ContextCompat.checkSelfPermission( - context, - Manifest.permission.READ_EXTERNAL_STORAGE - ) == PackageManager.PERMISSION_GRANTED - ) { - pickFile() - } else { - requestPermissions( - arrayOf(Manifest.permission.READ_EXTERNAL_STORAGE), - PERMISSION_REQUEST_CALLBACK_CODE - ) - } - } - - - override fun onRequestPermissionsResult( - requestCode: Int, - permissions: Array, grantResults: IntArray - ) { - super.onRequestPermissionsResult(requestCode, permissions, grantResults) - when (requestCode) { - PERMISSION_REQUEST_CALLBACK_CODE -> { - // If request is cancelled, the result arrays are empty. - if ((grantResults.isNotEmpty() && - grantResults[0] == PackageManager.PERMISSION_GRANTED) - ) { - // Permission is granted. Continue the action or workflow - // in your app. - pickFile() - } else { - // Explain to the user that the feature is unavailable because - // the features requires a permission that the user has denied. - // At the same time, respect the user's decision. Don't link to - // system settings in an effort to convince the user to change - // their decision. - showErrorMessage("Permission to read image denied") - } + private fun recognizeSelectedImage(uri: Uri) { + try { + val bytes = contentResolver.openInputStream(uri)?.use { it.readBytes() } + if (bytes == null) { + showErrorMessage("Unable to read selected image") return } - // Add other 'when' lines to check for other - // permissions this app might request. - else -> { - // Ignore all other requests. - } - } - } - - - override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) { - super.onActivityResult(requestCode, resultCode, data) - - when (requestCode) { - ACTION_GET_CONTENT_CALLBACK_CODE -> { - if (resultCode == Activity.RESULT_OK) { - val bytes = contentResolver.openInputStream(data?.data!!)!!.readBytes() - val bmpImage = BitmapFactory.decodeByteArray(bytes, 0, bytes.size) - recognizeBarcode(bmpImage) - } - } - - ACTION_IMAGE_CAPTURE_CALLBACK_CODE -> { - if (resultCode == RESULT_OK) { - val bmpImage = data?.extras?.get("data") as Bitmap - recognizeBarcode(bmpImage) - } + val bmpImage = BitmapFactory.decodeByteArray(bytes, 0, bytes.size) + if (bmpImage == null) { + showErrorMessage("Unable to decode selected image") + return } - else -> { - showErrorMessage("No file selected") - } + recognizeBarcode(bmpImage) + } catch (_: Exception) { + showErrorMessage("Unable to read selected image") } } - private fun recognizeBarcode(image: Bitmap) { try { val smallerBmp = reduceBitmapSize(image) @@ -199,7 +172,7 @@ class MainActivity : AppCompatActivity() { smallerBmp.compress(Bitmap.CompressFormat.PNG, 100, output) } - val apiRequest = ScanMultipartRequestWrapper(tmpFile); + val apiRequest = ScanMultipartRequestWrapper(tmpFile) Thread { try { @@ -234,9 +207,8 @@ class MainActivity : AppCompatActivity() { } } }.start() - - } catch (e: java.lang.Exception) { - showErrorMessage(e.message!!) + } catch (e: Exception) { + showErrorMessage(e.message ?: "Unknown error") } } @@ -251,25 +223,20 @@ class MainActivity : AppCompatActivity() { } fun onBtnGenerateClick(@Suppress("UNUSED_PARAMETER") view: View) { + val type = EncodeBarcodeType.fromValue(barcodeTypeSpinner.selectedItem.toString()) - val type: EncodeBarcodeType = EncodeBarcodeType.fromValue(barcodeTypeSpinner.selectedItem.toString()) - - val genRequest = GenerateRequestWrapper( - type, barcodeTextEdit.text.toString()); - - genRequest.imageFormat = BarcodeImageFormat.PNG; + val genRequest = GenerateRequestWrapper(type, barcodeTextEdit.text.toString()) + genRequest.imageFormat = BarcodeImageFormat.PNG genRequest.imageHeight = barcodeImgView.measuredHeight.toFloat() genRequest.imageWidth = barcodeImgView.measuredWidth.toFloat() - Thread { try { - val generated: File? = generateApi.generate(genRequest); + val generated = generateApi.generate(genRequest) runOnUiThread { val bitmap = BitmapFactory.decodeFile(generated!!.absolutePath) barcodeImgView.setImageBitmap(bitmap) } - } catch (e: ApiException) { runOnUiThread { var message = e.message + ": " + e.details @@ -289,26 +256,13 @@ class MainActivity : AppCompatActivity() { fun onBtnTakePhotoClick(@Suppress("UNUSED_PARAMETER") view: View) { val takePictureIntent = Intent(MediaStore.ACTION_IMAGE_CAPTURE) if (takePictureIntent.resolveActivity(packageManager) != null) { - startActivityForResult(takePictureIntent, ACTION_IMAGE_CAPTURE_CALLBACK_CODE) + cameraLauncher.launch(takePictureIntent) } } fun onBtnSelectImageClick(@Suppress("UNUSED_PARAMETER") view: View) { - requestPermissionAndPickFile(this) - } - - private fun pickFile() { - val getContentIntent = Intent(Intent.ACTION_GET_CONTENT) - getContentIntent.type = "image/*" - getContentIntent.addCategory(Intent.CATEGORY_OPENABLE) - try { - startActivityForResult( - Intent.createChooser(getContentIntent, "Select an Image to Recognize"), - ACTION_GET_CONTENT_CALLBACK_CODE - ) - } catch (ex: java.lang.Exception) { - showErrorMessage("Unable to start file selector") - } - + photoPickerLauncher.launch( + PickVisualMediaRequest(ActivityResultContracts.PickVisualMedia.ImageOnly) + ) } } diff --git a/codegen/Templates/android/build.mustache b/codegen/Templates/android/build.mustache index 1f1e200..49d1228 100644 --- a/codegen/Templates/android/build.mustache +++ b/codegen/Templates/android/build.mustache @@ -1,7 +1,5 @@ // Top-level build file where you can add configuration options common to all sub-projects/modules. plugins { - id 'com.android.application' version '8.7.3' apply false - id 'com.android.library' version '8.7.3' apply false - id 'org.jetbrains.kotlin.android' version '2.1.0' apply false + id 'com.android.application' version '9.1.0' apply false + id 'com.android.library' version '9.1.0' apply false } -ext.kotlin_version = '2.1.0' diff --git a/codegen/Templates/android/git_push.sh.mustache b/codegen/Templates/android/git_push.sh.mustache index f404c73..7f7355f 100644 --- a/codegen/Templates/android/git_push.sh.mustache +++ b/codegen/Templates/android/git_push.sh.mustache @@ -22,6 +22,4 @@ kotlin.code.style=official # resources declared in the library itself and none from the library's dependencies, # thereby reducing the size of the R class for that library android.nonTransitiveRClass=true -android.defaults.buildfeatures.buildconfig=true -android.nonFinalResIds=false org.gradle.configuration-cache=true diff --git a/codegen/Templates/android/gradlew.mustache b/codegen/Templates/android/gradlew.mustache index 39a8296..b534553 100644 --- a/codegen/Templates/android/gradlew.mustache +++ b/codegen/Templates/android/gradlew.mustache @@ -1,52 +1,47 @@ {{! app/build.gradle }} plugins { id 'com.android.application' - id 'org.jetbrains.kotlin.android' } android { - namespace 'com.aspose.barcode.cloud.demo_app' - compileSdk {{androidSdkVersion}} + namespace = 'com.aspose.barcode.cloud.demo_app' + compileSdk = {{androidSdkVersion}} defaultConfig { - applicationId "com.aspose.barcode.cloud.demo_app" - minSdk 23 - targetSdk {{androidSdkVersion}} - versionCode 1 - versionName "1.0" + applicationId = "com.aspose.barcode.cloud.demo_app" + minSdk = 23 + targetSdk = {{androidSdkVersion}} + versionCode = 1 + versionName = "1.0" - testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" + testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" } buildTypes { release { - minifyEnabled false + minifyEnabled = false proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' } } + compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 } - kotlinOptions { - jvmTarget = '1.8' -} + buildFeatures { - viewBinding true + buildConfig = true + viewBinding = true } } dependencies { -implementation fileTree(dir: "libs", include: ["*.jar"]) - implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" - implementation 'androidx.core:core-ktx:1.9.0' - implementation 'androidx.appcompat:appcompat:1.6.0' - implementation 'androidx.constraintlayout:constraintlayout:2.1.4' + implementation 'androidx.core:core-ktx:1.18.0' + implementation 'androidx.appcompat:appcompat:1.7.1' + implementation 'androidx.constraintlayout:constraintlayout:2.2.1' implementation 'com.aspose:aspose-barcode-cloud:{{artifactVersion}}' - implementation 'com.google.android.material:material:1.8.0' - androidTestImplementation 'androidx.test.ext:junit:1.1.5' - androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1' + implementation 'com.google.android.material:material:1.13.0' testImplementation 'junit:junit:4.13.2' - androidTestImplementation 'androidx.test.ext:junit:1.1.5' - androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1' + androidTestImplementation 'androidx.test.ext:junit:1.3.0' + androidTestImplementation 'androidx.test.espresso:espresso-core:3.7.0' } diff --git a/codegen/Templates/android/manifest.mustache b/codegen/Templates/android/manifest.mustache index 15d49ab..4268a9f 100644 --- a/codegen/Templates/android/manifest.mustache +++ b/codegen/Templates/android/manifest.mustache @@ -2,20 +2,11 @@ - - - - - - - - - diff --git a/codegen/Templates/android/pom.mustache b/codegen/Templates/android/pom.mustache index 4d7cbec..8afa8eb 100644 --- a/codegen/Templates/android/pom.mustache +++ b/codegen/Templates/android/pom.mustache @@ -11,7 +11,7 @@ dependencyResolutionManagement { repositories { google() mavenCentral() - maven { url 'https://releases.aspose.cloud/java/repo/' } + maven { url = 'https://releases.aspose.cloud/java/repo/' } } } diff --git a/codegen/config-android.json b/codegen/config-android.json index 844f3fe..e5ba356 100644 --- a/codegen/config-android.json +++ b/codegen/config-android.json @@ -1,10 +1,10 @@ { "androidBuildToolsVersion": "30.0.1", "androidGradleVersion": "4.2.2", - "androidSdkVersion": "33", + "androidSdkVersion": "36", "apiPackage": "com.aspose.barcode.cloud.demo_app", "artifactId": "Android Application for Barcode Processing in the Cloud via REST API", - "artifactVersion": "26.2.0", + "artifactVersion": "26.3.2", "groupId": "com.aspose", "invokerPackage": "com.aspose.barcode.cloud.demo_app", "modelPackage": "com.aspose.barcode.cloud.demo_app.model" diff --git a/submodules/android b/submodules/android index def2bac..5a3d8c1 160000 --- a/submodules/android +++ b/submodules/android @@ -1 +1 @@ -Subproject commit def2bac0a7b25595ed19b9f774dbfb2882a52987 +Subproject commit 5a3d8c1891dc3809ad6c1a7102e5abd3e8876805 From 62f24aafd1259320dc05816cc2f3dfff0aafd4c0 Mon Sep 17 00:00:00 2001 From: Denis Averin Date: Tue, 24 Mar 2026 17:59:33 +0700 Subject: [PATCH 7/9] Update Node.js package template for ESM exports Add ESM exports map, split build/prepare scripts, disable sourcemap and minify in tsup config, update dev dependency versions. Co-Authored-By: Claude Opus 4.6 (1M context) --- codegen/Templates/nodejs/package.mustache | 26 +++++++++++++++++------ submodules/node | 2 +- 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/codegen/Templates/nodejs/package.mustache b/codegen/Templates/nodejs/package.mustache index 2211d12..bc63062 100644 --- a/codegen/Templates/nodejs/package.mustache +++ b/codegen/Templates/nodejs/package.mustache @@ -124,7 +124,17 @@ ], "author": "Aspose.BarCode Team", "main": "dist/index.js", + "module": "dist/index.mjs", "typings": "dist/index.d.ts", + "exports": { + ".": { + "types": "./dist/index.d.ts", + "import": "./dist/index.mjs", + "require": "./dist/index.js" + }, + "./dist/*": "./dist/*", + "./package.json": "./package.json" + }, "files": [ "dist" ], @@ -137,7 +147,9 @@ "cover": "npx jest --coverage", "lint": "npx eslint src test snippets", "format": "npx eslint src test snippets eslint.config.mjs --fix", - "prepare": "npx tsup", + "build": "npx tsup", + "build:min": "npx tsup --minify --outDir dist/min --no-dts", + "prepare": "npm run build", "check-updates": "ncu -u --enginesNode" }, "prettier": { @@ -152,9 +164,9 @@ "format": ["cjs", "esm"], "dts": true, "splitting": false, - "sourcemap": true, + "sourcemap": false, "clean": true, - "minify": true + "minify": false }, "devDependencies": { "@types/jest": "^30.0.0", @@ -162,12 +174,12 @@ "@typescript-eslint/parser": "^8.40.0", "eslint": "^9.33.0", "eslint-config-prettier": "^10.1.8", - "eslint-plugin-prettier": "^5.5.4", + "eslint-plugin-prettier": "^5.5.5", "npm-check-updates": "^17.1.18", - "prettier": "^3.6.2", - "ts-jest": "^29.4.1", + "prettier": "^3.8.1", + "ts-jest": "^29.4.6", "tslib": "^2.8.1", - "tsup": "^8.5.0", + "tsup": "^8.5.1", "uuid": "^13.0.0" }, "bugs": { diff --git a/submodules/node b/submodules/node index 2715151..c27b172 160000 --- a/submodules/node +++ b/submodules/node @@ -1 +1 @@ -Subproject commit 271515181d3ddd54c235b9ab1116d65d43aa5a93 +Subproject commit c27b172be507ac423b0dee747a044e912625c988 From a1ec3d24a839665ebf483e246b71060689cb6328 Mon Sep 17 00:00:00 2001 From: Denis Averin Date: Tue, 24 Mar 2026 18:09:38 +0700 Subject: [PATCH 8/9] Split config.json into config-dotnet.json, config-node.json --- codegen/config-dotnet.json | 5 +++++ codegen/config-node.json | 5 +++++ codegen/config.json | 9 --------- codegen/generate-dotnet.bash | 6 +++--- codegen/generate-node.bash | 14 +++++++------- scripts/new-version.py | 4 ++-- 6 files changed, 22 insertions(+), 21 deletions(-) create mode 100644 codegen/config-dotnet.json create mode 100644 codegen/config-node.json delete mode 100644 codegen/config.json diff --git a/codegen/config-dotnet.json b/codegen/config-dotnet.json new file mode 100644 index 0000000..c5be95a --- /dev/null +++ b/codegen/config-dotnet.json @@ -0,0 +1,5 @@ +{ + "packageName": "Aspose.BarCode.Cloud.Sdk", + "packageVersion": "26.3.0", + "targetFramework": "netstandard2.0" +} \ No newline at end of file diff --git a/codegen/config-node.json b/codegen/config-node.json new file mode 100644 index 0000000..e6a13fb --- /dev/null +++ b/codegen/config-node.json @@ -0,0 +1,5 @@ +{ + "npmName": "aspose-barcode-cloud-node", + "npmVersion": "26.3.0", + "supportsES6": true +} \ No newline at end of file diff --git a/codegen/config.json b/codegen/config.json deleted file mode 100644 index 0249eea..0000000 --- a/codegen/config.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "artifactVersion": "23.7.0", - "npmName": "aspose-barcode-cloud-node", - "npmVersion": "26.3.0", - "packageName": "Aspose.BarCode.Cloud.Sdk", - "packageVersion": "26.3.0", - "supportsES6": true, - "targetFramework": "netstandard2.0" -} \ No newline at end of file diff --git a/codegen/generate-dotnet.bash b/codegen/generate-dotnet.bash index b3805e1..01a7030 100755 --- a/codegen/generate-dotnet.bash +++ b/codegen/generate-dotnet.bash @@ -13,9 +13,9 @@ fi # Templates src https://github.com/OpenAPITools/openapi-generator/tree/master/modules/openapi-generator/src/main/resources/csharp # Generate Operations and Models for Debug purposes -# java -DdebugOperations -jar Tools/openapi-generator-cli.jar generate -i "$specSource" -g csharp -t Templates/csharp -o $tempDir -c config.json > debugOperations.cs.json ; exit -# java -DdebugModels -jar Tools/openapi-generator-cli.jar generate -i "$specSource" -g csharp -t Templates/csharp -o $tempDir -c config.json > debugModels.cs.json ; exit -java -jar Tools/openapi-generator-cli.jar generate -i "$specSource" -g csharp -t Templates/csharp -o $tempDir -c config.json +# java -DdebugOperations -jar Tools/openapi-generator-cli.jar generate -i "$specSource" -g csharp -t Templates/csharp -o $tempDir -c config-dotnet.json > debugOperations.cs.json ; exit +# java -DdebugModels -jar Tools/openapi-generator-cli.jar generate -i "$specSource" -g csharp -t Templates/csharp -o $tempDir -c config-dotnet.json > debugModels.cs.json ; exit +java -jar Tools/openapi-generator-cli.jar generate -i "$specSource" -g csharp -t Templates/csharp -o $tempDir -c config-dotnet.json # python Tools/split-cs-file.py $tempDir/src/Aspose.BarCode.Cloud.Sdk/Api/GenerateApi.cs $tempDir/src/Aspose.BarCode.Cloud.Sdk/Model/Requests/ # python Tools/split-cs-file.py $tempDir/src/Aspose.BarCode.Cloud.Sdk/Api/ScanApi.cs $tempDir/src/Aspose.BarCode.Cloud.Sdk/Model/Requests/ diff --git a/codegen/generate-node.bash b/codegen/generate-node.bash index a350e02..0a957a0 100755 --- a/codegen/generate-node.bash +++ b/codegen/generate-node.bash @@ -11,19 +11,19 @@ then fi # java -jar Tools/openapi-generator-cli.jar config-help -g typescript-node -java -jar Tools/openapi-generator-cli.jar generate -i "$specSource" -g typescript-node -t Templates/nodejs -o $tempDir -c config.json -# java -DdebugModels -jar Tools/openapi-generator-cli.jar generate -i "$specSource" -g typescript-node -t Templates/nodejs -o $tempDir -c config.json > debugModels.ts.json; exit -# java -DdebugOperations -jar Tools/openapi-generator-cli.jar generate -i "$specSource" -g typescript-node -t Templates/nodejs -o $tempDir -c config.json > debugOperations.ts.json; exit -# java -DdebugSupportingFiles -jar Tools/openapi-generator-cli.jar generate -i "$specSource" -g typescript-node -t Templates/nodejs -o $tempDir -c config.json 2> debugSupportingFiles.ts.txt +java -jar Tools/openapi-generator-cli.jar generate -i "$specSource" -g typescript-node -t Templates/nodejs -o $tempDir -c config-node.json +# java -DdebugModels -jar Tools/openapi-generator-cli.jar generate -i "$specSource" -g typescript-node -t Templates/nodejs -o $tempDir -c config-node.json > debugModels.ts.json; exit +# java -DdebugOperations -jar Tools/openapi-generator-cli.jar generate -i "$specSource" -g typescript-node -t Templates/nodejs -o $tempDir -c config-node.json > debugOperations.ts.json; exit +# java -DdebugSupportingFiles -jar Tools/openapi-generator-cli.jar generate -i "$specSource" -g typescript-node -t Templates/nodejs -o $tempDir -c config-node.json 2> debugSupportingFiles.ts.txt mv "$tempDir/api.ts" "$targetDir/src/" mv "$tempDir/package.json" "$targetDir/" mv "$tempDir/git_push.sh" "$targetDir/src/models.ts" # Use typescript-node one more time because typescript-node does not generate docs -java -jar Tools/openapi-generator-cli.jar generate -i "$specSource" -g typescript-node -t Templates/nodejs/docs -o $tempDir/docs -c config.json -#java -DdebugModels -jar Tools/openapi-generator-cli.jar generate -i "$specSource" -g typescript-node -t Templates/nodejs/docs -o $tempDir/docs -c config.json > debugModels.node.json -#java -DdebugOperations -jar Tools/openapi-generator-cli.jar generate -i "$specSource" -g typescript-node -t Templates/nodejs/docs -o $tempDir/docs -c config.json > debugOperations.node.json +java -jar Tools/openapi-generator-cli.jar generate -i "$specSource" -g typescript-node -t Templates/nodejs/docs -o $tempDir/docs -c config-node.json +#java -DdebugModels -jar Tools/openapi-generator-cli.jar generate -i "$specSource" -g typescript-node -t Templates/nodejs/docs -o $tempDir/docs -c config-node.json > debugModels.node.json +#java -DdebugOperations -jar Tools/openapi-generator-cli.jar generate -i "$specSource" -g typescript-node -t Templates/nodejs/docs -o $tempDir/docs -c config-node.json > debugOperations.node.json mv "$tempDir/docs/api.ts" "$targetDir/docs/index.md" mv "$tempDir/docs/git_push.sh" "$targetDir/docs/models.md" diff --git a/scripts/new-version.py b/scripts/new-version.py index 99eefef..394f9ca 100755 --- a/scripts/new-version.py +++ b/scripts/new-version.py @@ -42,13 +42,13 @@ def set_java_version(new_version, filename=os.path.join(BASE_CONFIG_DIR, "config save_config(config, filename) -def set_net_version(new_version, filename=os.path.join(BASE_CONFIG_DIR, "config.json")): +def set_net_version(new_version, filename=os.path.join(BASE_CONFIG_DIR, "config-dotnet.json")): config = read_config(filename) config["packageVersion"] = str.join(".", map(str, new_version)) save_config(config, filename) -def set_node_version(new_version, filename=os.path.join(BASE_CONFIG_DIR, "config.json")): +def set_node_version(new_version, filename=os.path.join(BASE_CONFIG_DIR, "config-node.json")): config = read_config(filename) config["npmVersion"] = str.join(".", map(str, new_version)) save_config(config, filename) From e20da9c86569e24e190ae218c2bc0da75b1c277e Mon Sep 17 00:00:00 2001 From: Denis Averin Date: Tue, 24 Mar 2026 18:27:29 +0700 Subject: [PATCH 9/9] Ignore example.com urls --- scripts/check-urls.py | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/check-urls.py b/scripts/check-urls.py index 4ca7fc6..fbd4d1d 100644 --- a/scripts/check-urls.py +++ b/scripts/check-urls.py @@ -77,6 +77,7 @@ # Regular domains "barcode.qa.aspose.cloud", "editorconfig.org", + "example.com", ] )