@simplymobile/capacitor-godex-printer 0.0.1

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.
@@ -0,0 +1,17 @@
1
+ require 'json'
2
+
3
+ package = JSON.parse(File.read(File.join(__dir__, 'package.json')))
4
+
5
+ Pod::Spec.new do |s|
6
+ s.name = 'CapacitorGodexPrinter'
7
+ s.version = package['version']
8
+ s.summary = package['description']
9
+ s.license = package['license']
10
+ s.homepage = package['repository']['url']
11
+ s.author = package['author']
12
+ s.source = { :git => package['repository']['url'], :tag => s.version.to_s }
13
+ s.source_files = 'ios/Plugin/**/*.{swift,h,m,c,cc,mm,cpp}'
14
+ s.ios.deployment_target = '13.0'
15
+ s.dependency 'Capacitor'
16
+ s.swift_version = '5.1'
17
+ end
package/README.md ADDED
@@ -0,0 +1,85 @@
1
+ # @simplymobile/capacitor-godex-printer
2
+
3
+ Capacitor GoDEX printer plugin
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ npm install @simplymobile/capacitor-godex-printer
9
+ npx cap sync
10
+ ```
11
+
12
+ ## API
13
+
14
+ <docgen-index>
15
+
16
+ * [`getVersion()`](#getversion)
17
+ * [`connectToUSB()`](#connecttousb)
18
+ * [`printFromUSB(...)`](#printfromusb)
19
+ * [`disconnect()`](#disconnect)
20
+ * [`getPrinterDPI()`](#getprinterdpi)
21
+
22
+ </docgen-index>
23
+
24
+ <docgen-api>
25
+ <!--Update the source file JSDoc comments and rerun docgen to update the docs below-->
26
+
27
+ ### getVersion()
28
+
29
+ ```typescript
30
+ getVersion() => Promise<{ version: string; }>
31
+ ```
32
+
33
+ **Returns:** <code>Promise&lt;{ version: string; }&gt;</code>
34
+
35
+ --------------------
36
+
37
+
38
+ ### connectToUSB()
39
+
40
+ ```typescript
41
+ connectToUSB() => Promise<{ value: string; }>
42
+ ```
43
+
44
+ **Returns:** <code>Promise&lt;{ value: string; }&gt;</code>
45
+
46
+ --------------------
47
+
48
+
49
+ ### printFromUSB(...)
50
+
51
+ ```typescript
52
+ printFromUSB(options: { value: string; }) => Promise<{ value: boolean; }>
53
+ ```
54
+
55
+ | Param | Type |
56
+ | ------------- | ------------------------------- |
57
+ | **`options`** | <code>{ value: string; }</code> |
58
+
59
+ **Returns:** <code>Promise&lt;{ value: boolean; }&gt;</code>
60
+
61
+ --------------------
62
+
63
+
64
+ ### disconnect()
65
+
66
+ ```typescript
67
+ disconnect() => Promise<{ value: string; }>
68
+ ```
69
+
70
+ **Returns:** <code>Promise&lt;{ value: string; }&gt;</code>
71
+
72
+ --------------------
73
+
74
+
75
+ ### getPrinterDPI()
76
+
77
+ ```typescript
78
+ getPrinterDPI() => Promise<{ value: number; }>
79
+ ```
80
+
81
+ **Returns:** <code>Promise&lt;{ value: number; }&gt;</code>
82
+
83
+ --------------------
84
+
85
+ </docgen-api>
@@ -0,0 +1,57 @@
1
+ ext {
2
+ junitVersion = project.hasProperty('junitVersion') ? rootProject.ext.junitVersion : '4.13.2'
3
+ androidxAppCompatVersion = project.hasProperty('androidxAppCompatVersion') ? rootProject.ext.androidxAppCompatVersion : '1.4.2'
4
+ androidxJunitVersion = project.hasProperty('androidxJunitVersion') ? rootProject.ext.androidxJunitVersion : '1.1.3'
5
+ androidxEspressoCoreVersion = project.hasProperty('androidxEspressoCoreVersion') ? rootProject.ext.androidxEspressoCoreVersion : '3.4.0'
6
+ }
7
+
8
+ buildscript {
9
+ repositories {
10
+ google()
11
+ mavenCentral()
12
+ }
13
+ dependencies {
14
+ classpath 'com.android.tools.build:gradle:7.2.1'
15
+ }
16
+ }
17
+
18
+ apply plugin: 'com.android.library'
19
+
20
+ android {
21
+ compileSdkVersion project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 32
22
+ defaultConfig {
23
+ minSdkVersion project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion : 22
24
+ targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : 32
25
+ versionCode 1
26
+ versionName "1.0"
27
+ testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
28
+ }
29
+ buildTypes {
30
+ release {
31
+ minifyEnabled false
32
+ proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
33
+ }
34
+ }
35
+ lintOptions {
36
+ abortOnError false
37
+ }
38
+ compileOptions {
39
+ sourceCompatibility JavaVersion.VERSION_11
40
+ targetCompatibility JavaVersion.VERSION_11
41
+ }
42
+ }
43
+
44
+ repositories {
45
+ google()
46
+ mavenCentral()
47
+ }
48
+
49
+
50
+ dependencies {
51
+ implementation fileTree(dir: 'libs', include: ['*.jar'])
52
+ implementation project(':capacitor-android')
53
+ implementation "androidx.appcompat:appcompat:$androidxAppCompatVersion"
54
+ testImplementation "junit:junit:$junitVersion"
55
+ androidTestImplementation "androidx.test.ext:junit:$androidxJunitVersion"
56
+ androidTestImplementation "androidx.test.espresso:espresso-core:$androidxEspressoCoreVersion"
57
+ }
@@ -0,0 +1,3 @@
1
+ <manifest xmlns:android="http://schemas.android.com/apk/res/android"
2
+ package="pl.simplymobile.plugins.godexprinter">
3
+ </manifest>
@@ -0,0 +1,55 @@
1
+ package pl.simplymobile.plugins.godexprinter;
2
+
3
+ import android.content.Context;
4
+ import android.util.Log;
5
+
6
+ import com.godex.Godex;
7
+
8
+ import java.io.IOException;
9
+
10
+ public class GodexPrinter {
11
+
12
+ private boolean connected = false;
13
+
14
+ public void setDefaults(Context context) {
15
+ Godex.debug(3);
16
+ Godex.getMainContext(context);
17
+ }
18
+
19
+ public String getVersion() {
20
+ var value = Godex.getVersion();
21
+ Log.i("getVersion", value);
22
+ return Godex.getVersion();
23
+ }
24
+
25
+ public boolean printFromUSB(String value) {
26
+ Log.i("printFromUSB", "print started!");
27
+ return Godex.sendCommand(value);
28
+ }
29
+
30
+ public boolean connectToUSB() {
31
+ Log.i("connectToUSB", "connect started!");
32
+
33
+ if (connected) {
34
+ return true;
35
+ }
36
+
37
+ connected = Godex.openport(null, 3);
38
+ return connected;
39
+ }
40
+
41
+ public int getPrinterDPI() {
42
+ Log.i("getPrinterDPI", "connect started!");
43
+ return Godex.getPrinterDPI();
44
+ }
45
+
46
+ public boolean disconnect() {
47
+ connected = false;
48
+ try {
49
+ return Godex.close();
50
+ } catch (IOException e) {
51
+ Log.i("connectToUSB", e.getMessage());
52
+ return false;
53
+ }
54
+ }
55
+ }
@@ -0,0 +1,93 @@
1
+ package pl.simplymobile.plugins.godexprinter;
2
+
3
+ import com.getcapacitor.JSObject;
4
+ import com.getcapacitor.Plugin;
5
+ import com.getcapacitor.PluginCall;
6
+ import com.getcapacitor.PluginMethod;
7
+ import com.getcapacitor.annotation.CapacitorPlugin;
8
+
9
+ @CapacitorPlugin(name = "GodexPrinter")
10
+ public class GodexPrinterPlugin extends Plugin {
11
+
12
+ private GodexPrinter implementation;
13
+
14
+ @Override
15
+ public void load() {
16
+ implementation = new GodexPrinter();
17
+ implementation.setDefaults(this.getActivity().getApplicationContext());
18
+ }
19
+
20
+ @PluginMethod
21
+ public void getVersion(PluginCall call) {
22
+ JSObject ret = new JSObject();
23
+ ret.put("version", implementation.getVersion());
24
+ call.resolve(ret);
25
+ }
26
+
27
+ @PluginMethod
28
+ public void connectToUSB(PluginCall call) {
29
+ JSObject ret = new JSObject();
30
+ var result = implementation.connectToUSB();
31
+
32
+ if (result) {
33
+ ret.put("value", "USB Connected");
34
+ } else {
35
+ ret.put("value", "USB Connect fail");
36
+ }
37
+
38
+ call.resolve(ret);
39
+ }
40
+
41
+ @PluginMethod
42
+ public void printFromUSB(PluginCall call) {
43
+ String value = call.getString("value");
44
+ JSObject ret = new JSObject();
45
+
46
+ var connectResult = implementation.connectToUSB();
47
+ if (!connectResult) {
48
+ ret.put("value", "USB Connect fail");
49
+ call.resolve(ret);
50
+ return;
51
+ }
52
+
53
+ var printResult = implementation.printFromUSB(value);
54
+ if (!printResult) {
55
+ ret.put("value", "Print fail");
56
+ call.resolve(ret);
57
+ return;
58
+ }
59
+
60
+ var disconnectResult = implementation.disconnect();
61
+ if (!disconnectResult) {
62
+ ret.put("value", "Disconnect fail");
63
+ call.resolve(ret);
64
+ return;
65
+ }
66
+
67
+ ret.put("value", "Print success!");
68
+ call.resolve(ret);
69
+ }
70
+
71
+ @PluginMethod
72
+ public void disconnect(PluginCall call) {
73
+ JSObject ret = new JSObject();
74
+ var result = implementation.disconnect();
75
+
76
+ if (result) {
77
+ ret.put("value", "Disconnected");
78
+ } else {
79
+ ret.put("value", "Disconnect fail");
80
+ }
81
+
82
+ call.resolve(ret);
83
+ }
84
+
85
+ @PluginMethod
86
+ public void getPrinterDPI(PluginCall call) {
87
+ JSObject ret = new JSObject();
88
+
89
+ ret.put("value", implementation.getPrinterDPI());
90
+
91
+ call.resolve(ret);
92
+ }
93
+ }
File without changes
package/dist/docs.json ADDED
@@ -0,0 +1,71 @@
1
+ {
2
+ "api": {
3
+ "name": "GodexPrinterPlugin",
4
+ "slug": "godexprinterplugin",
5
+ "docs": "",
6
+ "tags": [],
7
+ "methods": [
8
+ {
9
+ "name": "getVersion",
10
+ "signature": "() => Promise<{ version: string; }>",
11
+ "parameters": [],
12
+ "returns": "Promise<{ version: string; }>",
13
+ "tags": [],
14
+ "docs": "",
15
+ "complexTypes": [],
16
+ "slug": "getversion"
17
+ },
18
+ {
19
+ "name": "connectToUSB",
20
+ "signature": "() => Promise<{ value: string; }>",
21
+ "parameters": [],
22
+ "returns": "Promise<{ value: string; }>",
23
+ "tags": [],
24
+ "docs": "",
25
+ "complexTypes": [],
26
+ "slug": "connecttousb"
27
+ },
28
+ {
29
+ "name": "printFromUSB",
30
+ "signature": "(options: { value: string; }) => Promise<{ value: boolean; }>",
31
+ "parameters": [
32
+ {
33
+ "name": "options",
34
+ "docs": "",
35
+ "type": "{ value: string; }"
36
+ }
37
+ ],
38
+ "returns": "Promise<{ value: boolean; }>",
39
+ "tags": [],
40
+ "docs": "",
41
+ "complexTypes": [],
42
+ "slug": "printfromusb"
43
+ },
44
+ {
45
+ "name": "disconnect",
46
+ "signature": "() => Promise<{ value: string; }>",
47
+ "parameters": [],
48
+ "returns": "Promise<{ value: string; }>",
49
+ "tags": [],
50
+ "docs": "",
51
+ "complexTypes": [],
52
+ "slug": "disconnect"
53
+ },
54
+ {
55
+ "name": "getPrinterDPI",
56
+ "signature": "() => Promise<{ value: number; }>",
57
+ "parameters": [],
58
+ "returns": "Promise<{ value: number; }>",
59
+ "tags": [],
60
+ "docs": "",
61
+ "complexTypes": [],
62
+ "slug": "getprinterdpi"
63
+ }
64
+ ],
65
+ "properties": []
66
+ },
67
+ "interfaces": [],
68
+ "enums": [],
69
+ "typeAliases": [],
70
+ "pluginConfigs": []
71
+ }
@@ -0,0 +1,19 @@
1
+ export interface GodexPrinterPlugin {
2
+ getVersion(): Promise<{
3
+ version: string;
4
+ }>;
5
+ connectToUSB(): Promise<{
6
+ value: string;
7
+ }>;
8
+ printFromUSB(options: {
9
+ value: string;
10
+ }): Promise<{
11
+ value: boolean;
12
+ }>;
13
+ disconnect(): Promise<{
14
+ value: string;
15
+ }>;
16
+ getPrinterDPI(): Promise<{
17
+ value: number;
18
+ }>;
19
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=definitions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"","sourcesContent":["export interface GodexPrinterPlugin {\n getVersion(): Promise<{ version: string }>;\n connectToUSB(): Promise<{ value: string }>;\n printFromUSB(options: { value: string }): Promise<{ value: boolean }>;\n disconnect(): Promise<{ value: string }>;\n getPrinterDPI(): Promise<{ value: number }>;\n}\n"]}
@@ -0,0 +1,4 @@
1
+ import type { GodexPrinterPlugin } from './definitions';
2
+ declare const GodexPrinter: GodexPrinterPlugin;
3
+ export * from './definitions';
4
+ export { GodexPrinter };
@@ -0,0 +1,7 @@
1
+ import { registerPlugin } from '@capacitor/core';
2
+ const GodexPrinter = registerPlugin('GodexPrinter', {
3
+ web: () => import('./web').then(m => new m.GodexPrinterWeb()),
4
+ });
5
+ export * from './definitions';
6
+ export { GodexPrinter };
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAIjD,MAAM,YAAY,GAAG,cAAc,CAAqB,cAAc,EAAE;IACtE,GAAG,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,eAAe,EAAE,CAAC;CAC9D,CAAC,CAAC;AAEH,cAAc,eAAe,CAAC;AAC9B,OAAO,EAAE,YAAY,EAAE,CAAC","sourcesContent":["import { registerPlugin } from '@capacitor/core';\n\nimport type { GodexPrinterPlugin } from './definitions';\n\nconst GodexPrinter = registerPlugin<GodexPrinterPlugin>('GodexPrinter', {\n web: () => import('./web').then(m => new m.GodexPrinterWeb()),\n});\n\nexport * from './definitions';\nexport { GodexPrinter };\n"]}
@@ -0,0 +1,21 @@
1
+ import { WebPlugin } from '@capacitor/core';
2
+ import type { GodexPrinterPlugin } from './definitions';
3
+ export declare class GodexPrinterWeb extends WebPlugin implements GodexPrinterPlugin {
4
+ getVersion(): Promise<{
5
+ version: string;
6
+ }>;
7
+ connectToUSB(): Promise<{
8
+ value: string;
9
+ }>;
10
+ printFromUSB(options: {
11
+ value: string;
12
+ }): Promise<{
13
+ value: boolean;
14
+ }>;
15
+ disconnect(): Promise<{
16
+ value: string;
17
+ }>;
18
+ getPrinterDPI(): Promise<{
19
+ value: number;
20
+ }>;
21
+ }
@@ -0,0 +1,24 @@
1
+ import { WebPlugin } from '@capacitor/core';
2
+ export class GodexPrinterWeb extends WebPlugin {
3
+ async getVersion() {
4
+ console.log('NOT IMPLEMENTED');
5
+ return { version: 'NOT IMPLEMENTED' };
6
+ }
7
+ async connectToUSB() {
8
+ console.log('NOT IMPLEMENTED');
9
+ return { value: 'NOT IMPLEMENTED' };
10
+ }
11
+ async printFromUSB(options) {
12
+ console.log('NOT IMPLEMENTED', options.value);
13
+ return { value: false };
14
+ }
15
+ async disconnect() {
16
+ console.log('NOT IMPLEMENTED');
17
+ return { value: 'NOT IMPLEMENTED' };
18
+ }
19
+ async getPrinterDPI() {
20
+ console.log('NOT IMPLEMENTED');
21
+ return { value: 0 };
22
+ }
23
+ }
24
+ //# sourceMappingURL=web.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAI5C,MAAM,OAAO,eAAgB,SAAQ,SAAS;IAC5C,KAAK,CAAC,UAAU;QACd,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC;QAC/B,OAAO,EAAE,OAAO,EAAE,iBAAiB,EAAE,CAAC;IACxC,CAAC;IAED,KAAK,CAAC,YAAY;QAChB,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC;QAC/B,OAAO,EAAE,KAAK,EAAE,iBAAiB,EAAE,CAAC;IACtC,CAAC;IAED,KAAK,CAAC,YAAY,CAAC,OAA0B;QAC3C,OAAO,CAAC,GAAG,CAAC,iBAAiB,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC;QAC9C,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC;IAC1B,CAAC;IAED,KAAK,CAAC,UAAU;QACd,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC;QAC/B,OAAO,EAAE,KAAK,EAAE,iBAAiB,EAAE,CAAC;IACtC,CAAC;IAED,KAAK,CAAC,aAAa;QACjB,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC;QAC/B,OAAO,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC;IACtB,CAAC;CACF","sourcesContent":["import { WebPlugin } from '@capacitor/core';\n\nimport type { GodexPrinterPlugin } from './definitions';\n\nexport class GodexPrinterWeb extends WebPlugin implements GodexPrinterPlugin {\n async getVersion(): Promise<{ version: string }> {\n console.log('NOT IMPLEMENTED');\n return { version: 'NOT IMPLEMENTED' };\n }\n\n async connectToUSB(): Promise<{ value: string }> {\n console.log('NOT IMPLEMENTED');\n return { value: 'NOT IMPLEMENTED' };\n }\n\n async printFromUSB(options: { value: string }): Promise<{ value: boolean }> {\n console.log('NOT IMPLEMENTED', options.value);\n return { value: false };\n }\n\n async disconnect(): Promise<{ value: string }> {\n console.log('NOT IMPLEMENTED');\n return { value: 'NOT IMPLEMENTED' };\n }\n\n async getPrinterDPI(): Promise<{ value: number }> {\n console.log('NOT IMPLEMENTED');\n return { value: 0 };\n }\n}\n"]}
@@ -0,0 +1,40 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var core = require('@capacitor/core');
6
+
7
+ const GodexPrinter = core.registerPlugin('GodexPrinter', {
8
+ web: () => Promise.resolve().then(function () { return web; }).then(m => new m.GodexPrinterWeb()),
9
+ });
10
+
11
+ class GodexPrinterWeb extends core.WebPlugin {
12
+ async getVersion() {
13
+ console.log('NOT IMPLEMENTED');
14
+ return { version: 'NOT IMPLEMENTED' };
15
+ }
16
+ async connectToUSB() {
17
+ console.log('NOT IMPLEMENTED');
18
+ return { value: 'NOT IMPLEMENTED' };
19
+ }
20
+ async printFromUSB(options) {
21
+ console.log('NOT IMPLEMENTED', options.value);
22
+ return { value: false };
23
+ }
24
+ async disconnect() {
25
+ console.log('NOT IMPLEMENTED');
26
+ return { value: 'NOT IMPLEMENTED' };
27
+ }
28
+ async getPrinterDPI() {
29
+ console.log('NOT IMPLEMENTED');
30
+ return { value: 0 };
31
+ }
32
+ }
33
+
34
+ var web = /*#__PURE__*/Object.freeze({
35
+ __proto__: null,
36
+ GodexPrinterWeb: GodexPrinterWeb
37
+ });
38
+
39
+ exports.GodexPrinter = GodexPrinter;
40
+ //# sourceMappingURL=plugin.cjs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.cjs.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\r\nconst GodexPrinter = registerPlugin('GodexPrinter', {\r\n web: () => import('./web').then(m => new m.GodexPrinterWeb()),\r\n});\r\nexport * from './definitions';\r\nexport { GodexPrinter };\r\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\r\nexport class GodexPrinterWeb extends WebPlugin {\r\n async getVersion() {\r\n console.log('NOT IMPLEMENTED');\r\n return { version: 'NOT IMPLEMENTED' };\r\n }\r\n async connectToUSB() {\r\n console.log('NOT IMPLEMENTED');\r\n return { value: 'NOT IMPLEMENTED' };\r\n }\r\n async printFromUSB(options) {\r\n console.log('NOT IMPLEMENTED', options.value);\r\n return { value: false };\r\n }\r\n async disconnect() {\r\n console.log('NOT IMPLEMENTED');\r\n return { value: 'NOT IMPLEMENTED' };\r\n }\r\n async getPrinterDPI() {\r\n console.log('NOT IMPLEMENTED');\r\n return { value: 0 };\r\n }\r\n}\r\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;;;;AACK,MAAC,YAAY,GAAGA,mBAAc,CAAC,cAAc,EAAE;AACpD,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,eAAe,EAAE,CAAC;AACjE,CAAC;;ACFM,MAAM,eAAe,SAASC,cAAS,CAAC;AAC/C,IAAI,MAAM,UAAU,GAAG;AACvB,QAAQ,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC;AACvC,QAAQ,OAAO,EAAE,OAAO,EAAE,iBAAiB,EAAE,CAAC;AAC9C,KAAK;AACL,IAAI,MAAM,YAAY,GAAG;AACzB,QAAQ,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC;AACvC,QAAQ,OAAO,EAAE,KAAK,EAAE,iBAAiB,EAAE,CAAC;AAC5C,KAAK;AACL,IAAI,MAAM,YAAY,CAAC,OAAO,EAAE;AAChC,QAAQ,OAAO,CAAC,GAAG,CAAC,iBAAiB,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC;AACtD,QAAQ,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC;AAChC,KAAK;AACL,IAAI,MAAM,UAAU,GAAG;AACvB,QAAQ,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC;AACvC,QAAQ,OAAO,EAAE,KAAK,EAAE,iBAAiB,EAAE,CAAC;AAC5C,KAAK;AACL,IAAI,MAAM,aAAa,GAAG;AAC1B,QAAQ,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC;AACvC,QAAQ,OAAO,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC;AAC5B,KAAK;AACL;;;;;;;;;"}
package/dist/plugin.js ADDED
@@ -0,0 +1,43 @@
1
+ var capacitorGodexPrinter = (function (exports, core) {
2
+ 'use strict';
3
+
4
+ const GodexPrinter = core.registerPlugin('GodexPrinter', {
5
+ web: () => Promise.resolve().then(function () { return web; }).then(m => new m.GodexPrinterWeb()),
6
+ });
7
+
8
+ class GodexPrinterWeb extends core.WebPlugin {
9
+ async getVersion() {
10
+ console.log('NOT IMPLEMENTED');
11
+ return { version: 'NOT IMPLEMENTED' };
12
+ }
13
+ async connectToUSB() {
14
+ console.log('NOT IMPLEMENTED');
15
+ return { value: 'NOT IMPLEMENTED' };
16
+ }
17
+ async printFromUSB(options) {
18
+ console.log('NOT IMPLEMENTED', options.value);
19
+ return { value: false };
20
+ }
21
+ async disconnect() {
22
+ console.log('NOT IMPLEMENTED');
23
+ return { value: 'NOT IMPLEMENTED' };
24
+ }
25
+ async getPrinterDPI() {
26
+ console.log('NOT IMPLEMENTED');
27
+ return { value: 0 };
28
+ }
29
+ }
30
+
31
+ var web = /*#__PURE__*/Object.freeze({
32
+ __proto__: null,
33
+ GodexPrinterWeb: GodexPrinterWeb
34
+ });
35
+
36
+ exports.GodexPrinter = GodexPrinter;
37
+
38
+ Object.defineProperty(exports, '__esModule', { value: true });
39
+
40
+ return exports;
41
+
42
+ })({}, capacitorExports);
43
+ //# sourceMappingURL=plugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\r\nconst GodexPrinter = registerPlugin('GodexPrinter', {\r\n web: () => import('./web').then(m => new m.GodexPrinterWeb()),\r\n});\r\nexport * from './definitions';\r\nexport { GodexPrinter };\r\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\r\nexport class GodexPrinterWeb extends WebPlugin {\r\n async getVersion() {\r\n console.log('NOT IMPLEMENTED');\r\n return { version: 'NOT IMPLEMENTED' };\r\n }\r\n async connectToUSB() {\r\n console.log('NOT IMPLEMENTED');\r\n return { value: 'NOT IMPLEMENTED' };\r\n }\r\n async printFromUSB(options) {\r\n console.log('NOT IMPLEMENTED', options.value);\r\n return { value: false };\r\n }\r\n async disconnect() {\r\n console.log('NOT IMPLEMENTED');\r\n return { value: 'NOT IMPLEMENTED' };\r\n }\r\n async getPrinterDPI() {\r\n console.log('NOT IMPLEMENTED');\r\n return { value: 0 };\r\n }\r\n}\r\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;AACK,UAAC,YAAY,GAAGA,mBAAc,CAAC,cAAc,EAAE;IACpD,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,eAAe,EAAE,CAAC;IACjE,CAAC;;ICFM,MAAM,eAAe,SAASC,cAAS,CAAC;IAC/C,IAAI,MAAM,UAAU,GAAG;IACvB,QAAQ,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC;IACvC,QAAQ,OAAO,EAAE,OAAO,EAAE,iBAAiB,EAAE,CAAC;IAC9C,KAAK;IACL,IAAI,MAAM,YAAY,GAAG;IACzB,QAAQ,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC;IACvC,QAAQ,OAAO,EAAE,KAAK,EAAE,iBAAiB,EAAE,CAAC;IAC5C,KAAK;IACL,IAAI,MAAM,YAAY,CAAC,OAAO,EAAE;IAChC,QAAQ,OAAO,CAAC,GAAG,CAAC,iBAAiB,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC;IACtD,QAAQ,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC;IAChC,KAAK;IACL,IAAI,MAAM,UAAU,GAAG;IACvB,QAAQ,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC;IACvC,QAAQ,OAAO,EAAE,KAAK,EAAE,iBAAiB,EAAE,CAAC;IAC5C,KAAK;IACL,IAAI,MAAM,aAAa,GAAG;IAC1B,QAAQ,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC;IACvC,QAAQ,OAAO,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC;IAC5B,KAAK;IACL;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,8 @@
1
+ import Foundation
2
+
3
+ @objc public class GodexPrinter: NSObject {
4
+ @objc public func echo(_ value: String) -> String {
5
+ print(value)
6
+ return value
7
+ }
8
+ }
@@ -0,0 +1,10 @@
1
+ #import <UIKit/UIKit.h>
2
+
3
+ //! Project version number for Plugin.
4
+ FOUNDATION_EXPORT double PluginVersionNumber;
5
+
6
+ //! Project version string for Plugin.
7
+ FOUNDATION_EXPORT const unsigned char PluginVersionString[];
8
+
9
+ // In this header, you should import all the public headers of your framework using statements like #import <Plugin/PublicHeader.h>
10
+
@@ -0,0 +1,8 @@
1
+ #import <Foundation/Foundation.h>
2
+ #import <Capacitor/Capacitor.h>
3
+
4
+ // Define the plugin using the CAP_PLUGIN Macro, and
5
+ // each method the plugin supports using the CAP_PLUGIN_METHOD macro.
6
+ CAP_PLUGIN(GodexPrinterPlugin, "GodexPrinter",
7
+ CAP_PLUGIN_METHOD(echo, CAPPluginReturnPromise);
8
+ )
@@ -0,0 +1,18 @@
1
+ import Foundation
2
+ import Capacitor
3
+
4
+ /**
5
+ * Please read the Capacitor iOS Plugin Development Guide
6
+ * here: https://capacitorjs.com/docs/plugins/ios
7
+ */
8
+ @objc(GodexPrinterPlugin)
9
+ public class GodexPrinterPlugin: CAPPlugin {
10
+ private let implementation = GodexPrinter()
11
+
12
+ @objc func echo(_ call: CAPPluginCall) {
13
+ let value = call.getString("value") ?? ""
14
+ call.resolve([
15
+ "value": implementation.echo(value)
16
+ ])
17
+ }
18
+ }
@@ -0,0 +1,24 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
+ <plist version="1.0">
4
+ <dict>
5
+ <key>CFBundleDevelopmentRegion</key>
6
+ <string>$(DEVELOPMENT_LANGUAGE)</string>
7
+ <key>CFBundleExecutable</key>
8
+ <string>$(EXECUTABLE_NAME)</string>
9
+ <key>CFBundleIdentifier</key>
10
+ <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
11
+ <key>CFBundleInfoDictionaryVersion</key>
12
+ <string>6.0</string>
13
+ <key>CFBundleName</key>
14
+ <string>$(PRODUCT_NAME)</string>
15
+ <key>CFBundlePackageType</key>
16
+ <string>FMWK</string>
17
+ <key>CFBundleShortVersionString</key>
18
+ <string>1.0</string>
19
+ <key>CFBundleVersion</key>
20
+ <string>$(CURRENT_PROJECT_VERSION)</string>
21
+ <key>NSPrincipalClass</key>
22
+ <string></string>
23
+ </dict>
24
+ </plist>
package/package.json ADDED
@@ -0,0 +1,78 @@
1
+ {
2
+ "name": "@simplymobile/capacitor-godex-printer",
3
+ "version": "0.0.1",
4
+ "description": "Capacitor GoDEX printer plugin",
5
+ "main": "dist/plugin.cjs.js",
6
+ "module": "dist/esm/index.js",
7
+ "types": "dist/esm/index.d.ts",
8
+ "unpkg": "dist/plugin.js",
9
+ "files": [
10
+ "android/src/main/",
11
+ "android/build.gradle",
12
+ "dist/",
13
+ "ios/Plugin/",
14
+ "CapacitorGodexPrinter.podspec"
15
+ ],
16
+ "author": "SimplyMobile",
17
+ "license": "Apache-2.0",
18
+ "repository": {
19
+ "type": "git",
20
+ "url": "git+https://dev.azure.com/simplymobilepl/framework/_git/framework.git"
21
+ },
22
+ "bugs": {
23
+ "url": "https://dev.azure.com/simplymobilepl/framework/_git/framework/issues"
24
+ },
25
+ "keywords": [
26
+ "capacitor",
27
+ "plugin",
28
+ "native"
29
+ ],
30
+ "scripts": {
31
+ "verify": "npm run verify:ios && npm run verify:android && npm run verify:web",
32
+ "verify:ios": "cd ios && pod install && xcodebuild -workspace Plugin.xcworkspace -scheme Plugin -destination generic/platform=iOS && cd ..",
33
+ "verify:android": "cd android && ./gradlew clean build test && cd ..",
34
+ "verify:web": "npm run build",
35
+ "lint": "npm run eslint && npm run prettier -- --check && npm run swiftlint -- lint",
36
+ "fmt": "npm run eslint -- --fix && npm run prettier -- --write && npm run swiftlint -- --fix --format",
37
+ "eslint": "eslint . --ext ts",
38
+ "prettier": "prettier \"**/*.{css,html,ts,js,java}\"",
39
+ "swiftlint": "node-swiftlint",
40
+ "docgen": "docgen --api GodexPrinterPlugin --output-readme README.md --output-json dist/docs.json",
41
+ "build": "npm run clean && npm run docgen && tsc && rollup -c rollup.config.js",
42
+ "clean": "rimraf ./dist",
43
+ "watch": "tsc --watch",
44
+ "prepublishOnly": "npm run build"
45
+ },
46
+ "devDependencies": {
47
+ "@capacitor/android": "^4.0.0",
48
+ "@capacitor/core": "^4.0.0",
49
+ "@capacitor/docgen": "^0.0.18",
50
+ "@capacitor/ios": "^4.0.0",
51
+ "@ionic/eslint-config": "^0.3.0",
52
+ "@ionic/prettier-config": "^1.0.1",
53
+ "@ionic/swiftlint-config": "^1.1.2",
54
+ "eslint": "^7.11.0",
55
+ "prettier": "~2.3.0",
56
+ "prettier-plugin-java": "~1.0.2",
57
+ "rimraf": "^3.0.2",
58
+ "rollup": "^2.32.0",
59
+ "swiftlint": "^1.0.1",
60
+ "typescript": "~4.1.5"
61
+ },
62
+ "peerDependencies": {
63
+ "@capacitor/core": "^4.0.0"
64
+ },
65
+ "prettier": "@ionic/prettier-config",
66
+ "swiftlint": "@ionic/swiftlint-config",
67
+ "eslintConfig": {
68
+ "extends": "@ionic/eslint-config/recommended"
69
+ },
70
+ "capacitor": {
71
+ "ios": {
72
+ "src": "ios"
73
+ },
74
+ "android": {
75
+ "src": "android"
76
+ }
77
+ }
78
+ }