tmalbonph / cordova-plugin-sunmi-inner-printer

Cordova/Ionic Plugin for Sunmi V1 Printer
MIT License
15 stars 19 forks source link

sunmiInnerPrinter is undefined #1

Closed ma851tos closed 5 years ago

ma851tos commented 5 years ago

hi

i installed this plugin successfully..

this is the response to cordova plugin list cordova-plugin-add-swift-support 2.0.2 "AddSwiftSupport" cordova-plugin-compat 1.2.0 "Compat" cordova-plugin-console 1.0.5 "Console" cordova-plugin-device 1.1.4 "Device" cordova-plugin-file 4.3.3 "File" cordova-plugin-inappbrowser 1.7.2 "InAppBrowser" cordova-plugin-ionic-webview 1.2.1 "cordova-plugin-ionic-webview" cordova-plugin-media-capture 1.4.3 "Capture" cordova-plugin-native-spinner 1.1.3 "Native Spinner" cordova-plugin-nativeaudio 3.0.9 "Cordova Native Audio" cordova-plugin-splashscreen 4.0.3 "Splashscreen" cordova-plugin-statusbar 2.4.2 "StatusBar" cordova-plugin-sunmi-inner-printer 1.1.0 "SunmiInnerPrinter" cordova-plugin-whitelist 1.3.1 "Whitelist" es6-promise-plugin 4.2.2 "Promise" ionic-plugin-keyboard 2.2.1 "Keyboard"

in the ts file i added declare var sunmiInnerPrinter:any; and then i try in the code sunmiInnerPrinter,printerInit(); sunmiInnerPrinter.printOriginalText('test');

if i use ' ionic serve ' to run it , i get this error : Runtime Error sunmiInnerPrinter is not defined

and if i build and run it on the Sunmi device, just nothing happens...

ma851tos commented 5 years ago

this is my environment

ionic info

Ionic:

Ionic CLI : 5.0.0 Ionic Framework : ionic-angular 3.6.0 @ionic/app-scripts : 2.1.4

Cordova:

Cordova CLI : 9.0.0 (cordova-lib@9.0.1) Cordova Platforms : android 6.2.3, browser 5.0.4, windows 4.4.2 Cordova Plugins : cordova-plugin-ionic-webview 1.2.1, (and 17 other plugins)

Utility:

cordova-res : not installed native-run : 0.2.2

System:

NodeJS : v11.9.0 (C:\node.exe) npm : 6.5.0 OS : Windows 10

tmalbonph commented 5 years ago

@ma851tos

Here is my environment

ionic info

Ionic:
   ionic (Ionic CLI) : 4.12.0 (/opt/nodejs/node-v10.15.1-linux-x64/lib/node_modules/ionic)
   Ionic Framework   : ionic1 1.3.4
   @ionic/v1-toolkit : 1.0.22
Cordova:
   cordova (Cordova CLI) : 9.0.0 (cordova-lib@9.0.1)
   Cordova Platforms     : none
   Cordova Plugins       : no whitelisted plugins (0 plugins total)
System:
   Android SDK Tools : 26.1.1 (/opt/android/sdk)
   NodeJS            : v10.15.1 (/opt/nodejs/node-v10.15.1-linux-x64/bin/node)
   npm               : 6.4.1
   OS                : Linux 4.15

Somewhere I have copy of updated plugin (my copy)

$ cd /Users/test
$ git clone https://github.com/tmalbonph/cordova-plugin-sunmi-inner-printer

$ cd cordova-plugin-sunmi-inner-printer
$ git log -1

#commit 885926a449c8076c234c7ce0684c304a368b992b
#Author: Teddy Albon Sr <tmalbonph@yahoo.com>
#Date:   Tue Oct 16 18:22:01 2018 +0800
#
#    Updated the AIDL with v2.1 and bump version to 1.1.0

For testing purposes, I have created an empty ionic 4 project

cd /Users/test

# Create ionic project `sampleIonic4`
ionic start sampleIonic4 blank --type=ionic1

# When prompted
# ?Install the free Ionic Appflow SDK and connect your app? (Y/n), answer Y
# ?Email: youre@email
# ?Password: *************
# ?What would you like to do?
#   select Create a new app on Ionic Appflow
# ?Which git host would you like to use?
#   select GitHub
# ?Open browser:
#   select No

cd sampleIonic4

# Add Android platform as I am targeting a SUNMI V1 device
ionic cordova platform add android

# Last page something like the following
# > ionic cordova resources android --force
# ✔ Collecting resource configuration and source images - done!
# ✔ Filtering out image resources that do not need regeneration - done!
# ✔ Uploading source images to prepare for transformations: 2 / 2 complete - done!
# ✔ Generating platform resources: 18 / 18 complete - done!
# ✔ Modifying config.xml to add new image resources - done!

# Add the updated SUNMI plugin
ionic cordova plugin add /Users/test/cordova-plugin-sunmi-inner-printer

# Check to make sure the SUNMI plugin is properly included.
ionic cordova plugin ls
# > cordova plugin ls
# cordova-plugin-device 2.0.2 "Device"
# cordova-plugin-ionic-keyboard 2.1.3 "cordova-plugin-ionic-keyboard"
# cordova-plugin-ionic-webview 4.0.1 "cordova-plugin-ionic-webview"
# cordova-plugin-splashscreen 5.0.2 "Splashscreen"
# cordova-plugin-statusbar 2.4.2 "StatusBar"
# cordova-plugin-sunmi-inner-printer 1.1.0 "SunmiInnerPrinter"
# cordova-plugin-whitelist 1.3.3 "Whitelist"

# Please note that my updated SUNMI plugin is version 1.1.0, (original is 1.0.3)

# Install all package for the project
npm i

#audited 6419 packages in 12.307s
#found 12 vulnerabilities (2 low, 2 moderate, 8 high)
#  run `npm audit fix` to fix them, or `npm audit` for details

npm i cordova-plugin-ionic@5.3.0 --save

#+ cordova-plugin-ionic@5.3.0
#added 6 packages from 52 contributors and audited 6431 packages in 14.929s
#found 12 vulnerabilities (2 low, 2 moderate, 8 high)
#  run `npm audit fix` to fix them, or `npm audit` for details

npm audit fix --force

#+ gulp@4.0.2
#+ @ionic/v1-toolkit@2.0.1
#added 181 packages from 107 contributors, \
# removed 4 packages, updated 15 packages and moved 6 packages in 37.34s
#fixed 8 of 12 vulnerabilities in 6431 scanned packages
#  4 vulnerabilities required manual review and could not be updated
#  2 package updates for 8 vulns involved breaking changes

npm install @ionic/app-scripts@latest --save-dev

#+ @ionic/app-scripts@3.2.4
#added 204 packages from 367 contributors and audited 17724 packages in 43.64s
#found 6 vulnerabilities (1 low, 1 moderate, 4 high)
#  run `npm audit fix` to fix them, or `npm audit` for details

npm uninstall minimatch --save
npm install minimatch@3.0.2 --save
npm install lodash@4.17.11 --save

npm uninstall @ionic/v1-toolkit --save
#removed 108 packages and audited 13170 packages in 23.636s
#found 0 vulnerabilities

ionic cordova platform add browser@^6.0.0

npm i
#audited 13779 packages in 21.179s
#found 0 vulnerabilities
arnoldowicke commented 1 year ago

I apologize for my English. I need help regarding this error (Could not resolve all files for configuration ':app:debugCompileClasspath'. Could not find any matches for com.sunmi:sunmiui:latest.release as no versions of com.sunmi:sunmiui are available.) I am working on my Cordova project, and the information I have is that com.sunmi:sunmiui is no longer available. Could you please provide me with some guidance? I would greatly appreciate it.