@sincpro/printer-expo 1.0.1 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/android/build.gradle
CHANGED
|
@@ -1,54 +1,26 @@
|
|
|
1
1
|
plugins {
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
id 'com.android.library'
|
|
3
|
+
id 'expo-module-gradle-plugin'
|
|
4
4
|
}
|
|
5
5
|
|
|
6
6
|
group = 'sincpro.expo.printer'
|
|
7
|
-
version = '
|
|
7
|
+
version = '1.0.3'
|
|
8
8
|
|
|
9
9
|
android {
|
|
10
10
|
namespace "sincpro.expo.printer"
|
|
11
|
-
compileSdk 35
|
|
12
|
-
|
|
13
11
|
defaultConfig {
|
|
14
|
-
minSdk 21
|
|
15
|
-
targetSdk 35
|
|
16
12
|
versionCode 1
|
|
17
|
-
versionName "
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
compileOptions {
|
|
21
|
-
sourceCompatibility JavaVersion.VERSION_17
|
|
22
|
-
targetCompatibility JavaVersion.VERSION_17
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
kotlinOptions {
|
|
26
|
-
jvmTarget = '17'
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
lintOptions {
|
|
30
|
-
abortOnError false
|
|
13
|
+
versionName "1.0.3"
|
|
31
14
|
}
|
|
32
15
|
}
|
|
33
16
|
|
|
34
17
|
dependencies {
|
|
35
|
-
//
|
|
36
|
-
implementation files(
|
|
37
|
-
|
|
38
|
-
// Bixolon PDF support (AAR no puede embeber otro AAR)
|
|
39
|
-
implementation files('libs/pdf/Bixolon_pdf.aar')
|
|
40
|
-
|
|
41
|
-
// Expo modules (provided by host app)
|
|
42
|
-
compileOnly 'expo.modules:modules-core'
|
|
18
|
+
// AAR locales - mismo nivel como test app
|
|
19
|
+
implementation files("${projectDir}/libs/sincpro-printer-sdk.aar")
|
|
20
|
+
implementation files("${projectDir}/libs/Bixolon_pdf.aar")
|
|
43
21
|
|
|
22
|
+
// Dependencias Android
|
|
44
23
|
implementation 'androidx.core:core-ktx:1.12.0'
|
|
45
24
|
implementation 'androidx.appcompat:appcompat:1.6.1'
|
|
46
25
|
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.3'
|
|
47
|
-
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
|
|
48
|
-
}
|
|
49
|
-
repositories {
|
|
50
|
-
mavenCentral()
|
|
51
|
-
}
|
|
52
|
-
kotlin {
|
|
53
|
-
jvmToolchain(17)
|
|
54
26
|
}
|
|
@@ -8,6 +8,7 @@ import com.sincpro.printer.domain.FontSize
|
|
|
8
8
|
import com.sincpro.printer.domain.MediaConfig
|
|
9
9
|
import com.sincpro.printer.domain.Receipt
|
|
10
10
|
import com.sincpro.printer.domain.ReceiptLine
|
|
11
|
+
import expo.modules.kotlin.functions.Coroutine
|
|
11
12
|
import expo.modules.kotlin.modules.Module
|
|
12
13
|
import expo.modules.kotlin.modules.ModuleDefinition
|
|
13
14
|
|
|
@@ -58,7 +59,7 @@ class PrinterModule : Module() {
|
|
|
58
59
|
// CONNECTION API
|
|
59
60
|
// ============================================================
|
|
60
61
|
|
|
61
|
-
AsyncFunction("connectBluetooth") { address: String, timeoutMs: Double? ->
|
|
62
|
+
AsyncFunction("connectBluetooth") Coroutine { address: String, timeoutMs: Double? ->
|
|
62
63
|
sdk.bixolon.connectivity
|
|
63
64
|
.connectBluetooth(
|
|
64
65
|
address = address,
|
|
@@ -66,7 +67,7 @@ class PrinterModule : Module() {
|
|
|
66
67
|
).getOrThrow()
|
|
67
68
|
}
|
|
68
69
|
|
|
69
|
-
AsyncFunction("connectWifi") { ip: String, port: Int?, timeoutMs: Double? ->
|
|
70
|
+
AsyncFunction("connectWifi") Coroutine { ip: String, port: Int?, timeoutMs: Double? ->
|
|
70
71
|
sdk.bixolon.connectivity
|
|
71
72
|
.connectWifi(
|
|
72
73
|
ip = ip,
|
|
@@ -75,13 +76,13 @@ class PrinterModule : Module() {
|
|
|
75
76
|
).getOrThrow()
|
|
76
77
|
}
|
|
77
78
|
|
|
78
|
-
AsyncFunction("connectUsb") {
|
|
79
|
+
AsyncFunction("connectUsb") Coroutine {
|
|
79
80
|
sdk.bixolon.connectivity
|
|
80
81
|
.connectUsb()
|
|
81
82
|
.getOrThrow()
|
|
82
83
|
}
|
|
83
84
|
|
|
84
|
-
AsyncFunction("disconnect") {
|
|
85
|
+
AsyncFunction("disconnect") Coroutine {
|
|
85
86
|
sdk.bixolon.connectivity
|
|
86
87
|
.disconnect()
|
|
87
88
|
.getOrThrow()
|
|
@@ -91,7 +92,7 @@ class PrinterModule : Module() {
|
|
|
91
92
|
sdk.bixolon.connectivity.isConnected()
|
|
92
93
|
}
|
|
93
94
|
|
|
94
|
-
AsyncFunction("getStatus") {
|
|
95
|
+
AsyncFunction("getStatus") Coroutine {
|
|
95
96
|
val status =
|
|
96
97
|
sdk.bixolon.connectivity
|
|
97
98
|
.getStatus()
|
|
@@ -106,7 +107,7 @@ class PrinterModule : Module() {
|
|
|
106
107
|
)
|
|
107
108
|
}
|
|
108
109
|
|
|
109
|
-
AsyncFunction("getInfo") {
|
|
110
|
+
AsyncFunction("getInfo") Coroutine {
|
|
110
111
|
val info =
|
|
111
112
|
sdk.bixolon.connectivity
|
|
112
113
|
.getInfo()
|
|
@@ -114,7 +115,7 @@ class PrinterModule : Module() {
|
|
|
114
115
|
mapOf(
|
|
115
116
|
"model" to info.model,
|
|
116
117
|
"firmware" to info.firmware,
|
|
117
|
-
"serial" to info.
|
|
118
|
+
"serial" to info.serialNumber,
|
|
118
119
|
"dpi" to info.dpi,
|
|
119
120
|
)
|
|
120
121
|
}
|
|
@@ -127,7 +128,7 @@ class PrinterModule : Module() {
|
|
|
127
128
|
// PRINT API - Text
|
|
128
129
|
// ============================================================
|
|
129
130
|
|
|
130
|
-
AsyncFunction("printText") { text: String, options: Map<String, Any?>? ->
|
|
131
|
+
AsyncFunction("printText") Coroutine { text: String, options: Map<String, Any?>? ->
|
|
131
132
|
val fontSize = parseFontSize(options?.get("fontSize") as? String)
|
|
132
133
|
val alignment = parseAlignment(options?.get("alignment") as? String)
|
|
133
134
|
val bold = options?.get("bold") as? Boolean ?: false
|
|
@@ -138,7 +139,7 @@ class PrinterModule : Module() {
|
|
|
138
139
|
.getOrThrow()
|
|
139
140
|
}
|
|
140
141
|
|
|
141
|
-
AsyncFunction("printTexts") { texts: List<String>, options: Map<String, Any?>? ->
|
|
142
|
+
AsyncFunction("printTexts") Coroutine { texts: List<String>, options: Map<String, Any?>? ->
|
|
142
143
|
val fontSize = parseFontSize(options?.get("fontSize") as? String)
|
|
143
144
|
val media = parseMediaConfig(options?.get("media") as? Map<String, Any?>)
|
|
144
145
|
|
|
@@ -151,7 +152,7 @@ class PrinterModule : Module() {
|
|
|
151
152
|
// PRINT API - QR & Barcode
|
|
152
153
|
// ============================================================
|
|
153
154
|
|
|
154
|
-
AsyncFunction("printQR") { data: String, options: Map<String, Any?>? ->
|
|
155
|
+
AsyncFunction("printQR") Coroutine { data: String, options: Map<String, Any?>? ->
|
|
155
156
|
val size = (options?.get("size") as? Number)?.toInt() ?: 5
|
|
156
157
|
val alignment = parseAlignment(options?.get("alignment") as? String)
|
|
157
158
|
val media = parseMediaConfig(options?.get("media") as? Map<String, Any?>)
|
|
@@ -161,7 +162,7 @@ class PrinterModule : Module() {
|
|
|
161
162
|
.getOrThrow()
|
|
162
163
|
}
|
|
163
164
|
|
|
164
|
-
AsyncFunction("printBarcode") { data: String, options: Map<String, Any?>? ->
|
|
165
|
+
AsyncFunction("printBarcode") Coroutine { data: String, options: Map<String, Any?>? ->
|
|
165
166
|
val type = parseBarcodeType(options?.get("type") as? String)
|
|
166
167
|
val height = (options?.get("height") as? Number)?.toInt() ?: 60
|
|
167
168
|
val alignment = parseAlignment(options?.get("alignment") as? String)
|
|
@@ -176,7 +177,7 @@ class PrinterModule : Module() {
|
|
|
176
177
|
// PRINT API - Images & PDF
|
|
177
178
|
// ============================================================
|
|
178
179
|
|
|
179
|
-
AsyncFunction("printImageBase64") { base64Data: String, options: Map<String, Any?>? ->
|
|
180
|
+
AsyncFunction("printImageBase64") Coroutine { base64Data: String, options: Map<String, Any?>? ->
|
|
180
181
|
val alignment = parseAlignment(options?.get("alignment") as? String)
|
|
181
182
|
val media = parseMediaConfig(options?.get("media") as? Map<String, Any?>)
|
|
182
183
|
|
|
@@ -185,7 +186,7 @@ class PrinterModule : Module() {
|
|
|
185
186
|
.getOrThrow()
|
|
186
187
|
}
|
|
187
188
|
|
|
188
|
-
AsyncFunction("printPdfBase64") { base64Data: String, options: Map<String, Any?>? ->
|
|
189
|
+
AsyncFunction("printPdfBase64") Coroutine { base64Data: String, options: Map<String, Any?>? ->
|
|
189
190
|
val page = (options?.get("page") as? Number)?.toInt() ?: 1
|
|
190
191
|
val alignment = parseAlignment(options?.get("alignment") as? String)
|
|
191
192
|
val media = parseMediaConfig(options?.get("media") as? Map<String, Any?>)
|
|
@@ -203,7 +204,7 @@ class PrinterModule : Module() {
|
|
|
203
204
|
// PRINT API - Receipt (High Level)
|
|
204
205
|
// ============================================================
|
|
205
206
|
|
|
206
|
-
AsyncFunction("printReceipt") { receiptData: Map<String, Any?>, options: Map<String, Any?>? ->
|
|
207
|
+
AsyncFunction("printReceipt") Coroutine { receiptData: Map<String, Any?>, options: Map<String, Any?>? ->
|
|
207
208
|
val receipt = parseReceipt(receiptData)
|
|
208
209
|
val media = parseMediaConfig(options?.get("media") as? Map<String, Any?>)
|
|
209
210
|
val copies = (options?.get("copies") as? Number)?.toInt() ?: 1
|
|
@@ -217,7 +218,7 @@ class PrinterModule : Module() {
|
|
|
217
218
|
// PRINT API - Columns (Key-Value style)
|
|
218
219
|
// ============================================================
|
|
219
220
|
|
|
220
|
-
AsyncFunction("printKeyValue") { key: String, value: String, options: Map<String, Any?>? ->
|
|
221
|
+
AsyncFunction("printKeyValue") Coroutine { key: String, value: String, options: Map<String, Any?>? ->
|
|
221
222
|
val fontSize = parseFontSize(options?.get("fontSize") as? String)
|
|
222
223
|
val bold = options?.get("bold") as? Boolean ?: false
|
|
223
224
|
val media = parseMediaConfig(options?.get("media") as? Map<String, Any?>)
|
package/expo-module.config.json
CHANGED
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"platforms": ["android"],
|
|
3
3
|
"android": {
|
|
4
|
-
"modules": ["sincpro.expo.printer.entrypoint.PrinterModule"]
|
|
4
|
+
"modules": ["sincpro.expo.printer.entrypoint.PrinterModule"],
|
|
5
|
+
"gradleAarProjects": [
|
|
6
|
+
{
|
|
7
|
+
"name": "sincpro-printer-sdk",
|
|
8
|
+
"aarFilePath": "android/libs/sincpro-printer-sdk.aar"
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
"name": "bixolon-pdf",
|
|
12
|
+
"aarFilePath": "android/libs/pdf/Bixolon_pdf.aar"
|
|
13
|
+
}
|
|
14
|
+
]
|
|
5
15
|
}
|
|
6
16
|
}
|
package/package.json
CHANGED
|
File without changes
|