Update library to support flex device#5
Conversation
There was a problem hiding this comment.
Pull request overview
Adds an explicit runtime check for internal printer availability (useful for Flex / devices where a printer service may exist without printer hardware) and updates Android build/dependency configuration accordingly.
Changes:
- Add
SunmiV2Printer.isInternalPrinterAvailable()to the native module + TypeScript typings. - Implement internal printer availability verification in
SunmiPrintHelper(service bound + hardware present + printer state). - Migrate away from
jcenter()and bumpcom.sunmi:printerlibraryto1.0.24.
Reviewed changes
Copilot reviewed 3 out of 5 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
index.d.ts |
Exposes isInternalPrinterAvailable() in the public TypeScript API; minor signature formatting update. |
android/src/main/java/com/sunmi/v2/printer/SunmiV2PrinterModule.java |
Adds a new ReactMethod that resolves internal printer availability to JS. |
android/src/main/java/com/sunmi/v2/printer/SunmiPrintHelper.java |
Implements the internal printer availability check using hasPrinter() + updatePrinterState(). |
android/build.gradle |
Switches repositories to Maven Central and updates the Sunmi printer library dependency version. |
Comments suppressed due to low confidence (1)
android/build.gradle:8
buildscript.repositoriesnow only usesmavenCentral(), but the Android Gradle plugin declared here (com.android.tools.build:gradle:2.3.0) is hosted in Google's Maven repository (and not in Maven Central). This will break Gradle plugin resolution for consumers that rely on this module-level buildscript block. Addgoogle()back tobuildscript.repositories(or remove thisbuildscriptblock and rely on the root project’s buildscript).
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.0'
}
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| } | ||
|
|
||
| int state = sunmiPrinterService.updatePrinterState(); | ||
| boolean available = state != 505; |
There was a problem hiding this comment.
Could you please include a link to the documentation that defines this status code? Right now it appears to be a magic number without any explanation or context.
There was a problem hiding this comment.
It's in SUNMI Inbuilt Printer Developer Documentation and also documented in getPrinterStatus inside android/src/main/java/com/sunmi/v2/printer/SunmiPrintHelper.java and in PrinterServiceAvailability inside index.js
There was a problem hiding this comment.
In that case, please add comment in the code with a link to the relevant documentation for reference. Thanks!
No description provided.