Skip to content

Update library to support flex device#5

Open
jose-dominguez-msp wants to merge 5 commits into
masterfrom
Update-library-to-support-Flex-device
Open

Update library to support flex device#5
jose-dominguez-msp wants to merge 5 commits into
masterfrom
Update-library-to-support-Flex-device

Conversation

@jose-dominguez-msp
Copy link
Copy Markdown
Member

No description provided.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 bump com.sunmi:printerlibrary to 1.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.repositories now only uses mavenCentral(), 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. Add google() back to buildscript.repositories (or remove this buildscript block 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.

Comment thread android/src/main/java/com/sunmi/v2/printer/SunmiPrintHelper.java
}

int state = sunmiPrinterService.updatePrinterState();
boolean available = state != 505;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

In that case, please add comment in the code with a link to the relevant documentation for reference. Thanks!

Comment thread android/src/main/java/com/sunmi/v2/printer/SunmiPrintHelper.java Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants