@capgo/capacitor-nfc 8.0.11 → 8.0.12
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/README.md +42 -0
- package/android/src/main/java/app/capgo/nfc/CapacitorNfcPlugin.java +7 -0
- package/dist/docs.json +10 -0
- package/dist/esm/definitions.d.ts +13 -0
- package/dist/esm/definitions.js.map +1 -1
- package/dist/esm/web.d.ts +3 -0
- package/dist/esm/web.js +3 -0
- package/dist/esm/web.js.map +1 -1
- package/dist/plugin.cjs.js +3 -0
- package/dist/plugin.cjs.js.map +1 -1
- package/dist/plugin.js +3 -0
- package/dist/plugin.js.map +1 -1
- package/ios/Sources/NfcPlugin/NfcPlugin.swift +15 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -44,6 +44,27 @@ Remember to add the required platform configuration:
|
|
|
44
44
|
|
|
45
45
|
## Usage
|
|
46
46
|
|
|
47
|
+
### Checking NFC hardware support
|
|
48
|
+
|
|
49
|
+
Before attempting to use NFC features, you can check if the device has NFC hardware:
|
|
50
|
+
|
|
51
|
+
```ts
|
|
52
|
+
import { CapacitorNfc } from '@capgo/capacitor-nfc';
|
|
53
|
+
|
|
54
|
+
const { supported } = await CapacitorNfc.isSupported();
|
|
55
|
+
if (!supported) {
|
|
56
|
+
console.warn('This device does not have NFC hardware');
|
|
57
|
+
// Hide NFC features in your UI
|
|
58
|
+
} else {
|
|
59
|
+
// Check if NFC is currently enabled
|
|
60
|
+
const { status } = await CapacitorNfc.getStatus();
|
|
61
|
+
if (status === 'NFC_DISABLED') {
|
|
62
|
+
console.warn('NFC is disabled. Prompt user to enable it.');
|
|
63
|
+
// Optionally show settings button
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
```
|
|
67
|
+
|
|
47
68
|
### Reading NDEF tags (default behavior)
|
|
48
69
|
|
|
49
70
|
```ts
|
|
@@ -125,6 +146,7 @@ await CapacitorNfc.stopScanning();
|
|
|
125
146
|
* [`getStatus()`](#getstatus)
|
|
126
147
|
* [`showSettings()`](#showsettings)
|
|
127
148
|
* [`getPluginVersion()`](#getpluginversion)
|
|
149
|
+
* [`isSupported()`](#issupported)
|
|
128
150
|
* [`addListener('nfcEvent', ...)`](#addlistenernfcevent-)
|
|
129
151
|
* [`addListener('tagDiscovered' | 'ndefDiscovered' | 'ndefMimeDiscovered' | 'ndefFormatableDiscovered', ...)`](#addlistenertagdiscovered--ndefdiscovered--ndefmimediscovered--ndefformatablediscovered-)
|
|
130
152
|
* [`addListener('nfcStateChange', ...)`](#addlistenernfcstatechange-)
|
|
@@ -267,6 +289,26 @@ Returns the version string baked into the native plugin.
|
|
|
267
289
|
--------------------
|
|
268
290
|
|
|
269
291
|
|
|
292
|
+
### isSupported()
|
|
293
|
+
|
|
294
|
+
```typescript
|
|
295
|
+
isSupported() => Promise<{ supported: boolean; }>
|
|
296
|
+
```
|
|
297
|
+
|
|
298
|
+
Checks whether the device has NFC hardware support.
|
|
299
|
+
|
|
300
|
+
Returns `true` if NFC hardware is present on the device, regardless of
|
|
301
|
+
whether NFC is currently enabled or disabled. Returns `false` if the
|
|
302
|
+
device does not have NFC hardware.
|
|
303
|
+
|
|
304
|
+
Use this method to determine if NFC features should be shown in your
|
|
305
|
+
app's UI. To check if NFC is currently enabled, use `getStatus()`.
|
|
306
|
+
|
|
307
|
+
**Returns:** <code>Promise<{ supported: boolean; }></code>
|
|
308
|
+
|
|
309
|
+
--------------------
|
|
310
|
+
|
|
311
|
+
|
|
270
312
|
### addListener('nfcEvent', ...)
|
|
271
313
|
|
|
272
314
|
```typescript
|
|
@@ -280,6 +280,13 @@ public class CapacitorNfcPlugin extends Plugin {
|
|
|
280
280
|
call.resolve(result);
|
|
281
281
|
}
|
|
282
282
|
|
|
283
|
+
@PluginMethod
|
|
284
|
+
public void isSupported(PluginCall call) {
|
|
285
|
+
JSObject result = new JSObject();
|
|
286
|
+
result.put("supported", adapter != null);
|
|
287
|
+
call.resolve(result);
|
|
288
|
+
}
|
|
289
|
+
|
|
283
290
|
private void performWrite(PluginCall call, Tag tag, NdefMessage message, boolean allowFormat) {
|
|
284
291
|
executor.execute(() -> {
|
|
285
292
|
Ndef ndef = Ndef.get(tag);
|
package/dist/docs.json
CHANGED
|
@@ -131,6 +131,16 @@
|
|
|
131
131
|
"complexTypes": [],
|
|
132
132
|
"slug": "getpluginversion"
|
|
133
133
|
},
|
|
134
|
+
{
|
|
135
|
+
"name": "isSupported",
|
|
136
|
+
"signature": "() => Promise<{ supported: boolean; }>",
|
|
137
|
+
"parameters": [],
|
|
138
|
+
"returns": "Promise<{ supported: boolean; }>",
|
|
139
|
+
"tags": [],
|
|
140
|
+
"docs": "Checks whether the device has NFC hardware support.\n\nReturns `true` if NFC hardware is present on the device, regardless of\nwhether NFC is currently enabled or disabled. Returns `false` if the\ndevice does not have NFC hardware.\n\nUse this method to determine if NFC features should be shown in your\napp's UI. To check if NFC is currently enabled, use `getStatus()`.",
|
|
141
|
+
"complexTypes": [],
|
|
142
|
+
"slug": "issupported"
|
|
143
|
+
},
|
|
134
144
|
{
|
|
135
145
|
"name": "addListener",
|
|
136
146
|
"signature": "(eventName: 'nfcEvent', listenerFunc: (event: NfcEvent) => void) => Promise<PluginListenerHandle>",
|
|
@@ -189,6 +189,19 @@ export interface CapacitorNfcPlugin {
|
|
|
189
189
|
getPluginVersion(): Promise<{
|
|
190
190
|
version: string;
|
|
191
191
|
}>;
|
|
192
|
+
/**
|
|
193
|
+
* Checks whether the device has NFC hardware support.
|
|
194
|
+
*
|
|
195
|
+
* Returns `true` if NFC hardware is present on the device, regardless of
|
|
196
|
+
* whether NFC is currently enabled or disabled. Returns `false` if the
|
|
197
|
+
* device does not have NFC hardware.
|
|
198
|
+
*
|
|
199
|
+
* Use this method to determine if NFC features should be shown in your
|
|
200
|
+
* app's UI. To check if NFC is currently enabled, use `getStatus()`.
|
|
201
|
+
*/
|
|
202
|
+
isSupported(): Promise<{
|
|
203
|
+
supported: boolean;
|
|
204
|
+
}>;
|
|
192
205
|
addListener(eventName: 'nfcEvent', listenerFunc: (event: NfcEvent) => void): Promise<PluginListenerHandle>;
|
|
193
206
|
addListener(eventName: 'tagDiscovered' | 'ndefDiscovered' | 'ndefMimeDiscovered' | 'ndefFormatableDiscovered', listenerFunc: (event: NfcEvent) => void): Promise<PluginListenerHandle>;
|
|
194
207
|
addListener(eventName: 'nfcStateChange', listenerFunc: (event: NfcStateChangeEvent) => void): Promise<PluginListenerHandle>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"","sourcesContent":["import type { PluginListenerHandle } from '@capacitor/core';\n\n/**\n * Possible NFC adapter states returned by {@link CapacitorNfcPlugin.getStatus}.\n *\n * Matches the constants provided by the original PhoneGap NFC plugin for\n * compatibility with existing applications.\n */\nexport type NfcStatus = 'NFC_OK' | 'NO_NFC' | 'NFC_DISABLED' | 'NDEF_PUSH_DISABLED';\n\n/**\n * Event type describing the kind of NFC discovery that happened.\n *\n * - `tag`: A generic NFC tag (no NDEF payload).\n * - `ndef`: A tag exposing an NDEF payload.\n * - `ndef-mime`: An NDEF tag that matched one of the MIME type filters.\n * - `ndef-formatable`: A tag that can be formatted to NDEF.\n */\nexport type NfcEventType = 'tag' | 'ndef' | 'ndef-mime' | 'ndef-formatable';\n\n/**\n * JSON structure representing a single NDEF record.\n *\n * Mirrors the data format returned by the legacy Cordova implementation and\n * uses integer arrays instead of strings to preserve the original payload\n * bytes.\n */\nexport interface NdefRecord {\n /**\n * Type Name Format identifier.\n */\n tnf: number;\n /**\n * Type field expressed as an array of byte values.\n */\n type: number[];\n /**\n * Record identifier expressed as an array of byte values.\n */\n id: number[];\n /**\n * Raw payload expressed as an array of byte values.\n */\n payload: number[];\n}\n\n/**\n * Representation of the full tag information returned by the native layers.\n *\n * Supports standard NFC Forum tags as well as MIFARE Ultralight cards (including\n * EV1 and NTAG variants). NDEF data is automatically extracted from MIFARE Ultralight\n * tags when available.\n */\nexport interface NfcTag {\n /**\n * Raw identifier bytes for the tag.\n */\n id?: number[];\n /**\n * List of Android tech strings (e.g. `android.nfc.tech.Ndef`).\n */\n techTypes?: string[];\n /**\n * Human readable tag type when available (e.g. `NFC Forum Type 2`, `MIFARE Ultralight`).\n */\n type?: string | null;\n /**\n * Maximum writable size in bytes for tags that expose NDEF information.\n */\n maxSize?: number | null;\n /**\n * Indicates whether the tag can be written to.\n */\n isWritable?: boolean | null;\n /**\n * Indicates whether the tag can be permanently locked.\n */\n canMakeReadOnly?: boolean | null;\n /**\n * Array of NDEF records discovered on the tag.\n */\n ndefMessage?: NdefRecord[] | null;\n}\n\n/**\n * Generic NFC discovery event dispatched by the plugin.\n */\nexport interface NfcEvent {\n type: NfcEventType;\n tag: NfcTag;\n}\n\n/**\n * Options controlling the behaviour of {@link CapacitorNfcPlugin.startScanning}.\n */\nexport interface StartScanningOptions {\n /**\n * iOS-only: closes the NFC session automatically after the first successful tag read.\n * Defaults to `true`.\n */\n invalidateAfterFirstRead?: boolean;\n /**\n * iOS-only: custom message displayed in the NFC system sheet while scanning.\n */\n alertMessage?: string;\n /**\n * iOS-only: session type to use for NFC scanning.\n * - `'ndef'`: Uses NFCNDEFReaderSession (default). Only detects NDEF-formatted tags.\n * - `'tag'`: Uses NFCTagReaderSession. Detects both NDEF and non-NDEF tags (e.g., raw MIFARE tags).\n * Allows reading UID from unformatted tags.\n * Defaults to `'ndef'` for backward compatibility.\n */\n iosSessionType?: 'ndef' | 'tag';\n /**\n * Android-only: raw flags passed to `NfcAdapter.enableReaderMode`.\n * Defaults to enabling all tag types with skipping NDEF checks.\n */\n androidReaderModeFlags?: number;\n}\n\n/**\n * Options used when writing an NDEF message on the current tag.\n */\nexport interface WriteTagOptions {\n /**\n * Array of records that compose the NDEF message to be written.\n */\n records: NdefRecord[];\n /**\n * When `true`, the plugin attempts to format NDEF-formattable tags before writing.\n * Defaults to `true`.\n */\n allowFormat?: boolean;\n}\n\n/**\n * Options used when sharing an NDEF message with another device using Android Beam / P2P mode.\n */\nexport interface ShareTagOptions {\n records: NdefRecord[];\n}\n\n/**\n * Event emitted whenever the NFC adapter availability changes.\n */\nexport interface NfcStateChangeEvent {\n status: NfcStatus;\n enabled: boolean;\n}\n\n/**\n * Public API surface for the Capacitor NFC plugin.\n *\n * The interface intentionally mirrors the behaviour of the reference PhoneGap\n * implementation to ease migration while embracing idiomatic Capacitor APIs.\n */\nexport interface CapacitorNfcPlugin {\n /**\n * Starts listening for NFC tags.\n */\n startScanning(options?: StartScanningOptions): Promise<void>;\n /**\n * Stops the ongoing NFC scanning session.\n */\n stopScanning(): Promise<void>;\n /**\n * Writes the provided NDEF records to the last discovered tag.\n */\n write(options: WriteTagOptions): Promise<void>;\n /**\n * Attempts to erase the last discovered tag by writing an empty NDEF message.\n */\n erase(): Promise<void>;\n /**\n * Attempts to make the last discovered tag read-only.\n */\n makeReadOnly(): Promise<void>;\n /**\n * Shares an NDEF message with another device via peer-to-peer (Android only).\n */\n share(options: ShareTagOptions): Promise<void>;\n /**\n * Stops sharing previously provided NDEF message (Android only).\n */\n unshare(): Promise<void>;\n /**\n * Returns the current NFC adapter status.\n */\n getStatus(): Promise<{ status: NfcStatus }>;\n /**\n * Opens the system settings page where the user can enable NFC.\n */\n showSettings(): Promise<void>;\n /**\n * Returns the version string baked into the native plugin.\n */\n getPluginVersion(): Promise<{ version: string }>;\n\n addListener(eventName: 'nfcEvent', listenerFunc: (event: NfcEvent) => void): Promise<PluginListenerHandle>;\n addListener(\n eventName: 'tagDiscovered' | 'ndefDiscovered' | 'ndefMimeDiscovered' | 'ndefFormatableDiscovered',\n listenerFunc: (event: NfcEvent) => void,\n ): Promise<PluginListenerHandle>;\n addListener(\n eventName: 'nfcStateChange',\n listenerFunc: (event: NfcStateChangeEvent) => void,\n ): Promise<PluginListenerHandle>;\n}\n\nexport type { PluginListenerHandle } from '@capacitor/core';\n"]}
|
|
1
|
+
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"","sourcesContent":["import type { PluginListenerHandle } from '@capacitor/core';\n\n/**\n * Possible NFC adapter states returned by {@link CapacitorNfcPlugin.getStatus}.\n *\n * Matches the constants provided by the original PhoneGap NFC plugin for\n * compatibility with existing applications.\n */\nexport type NfcStatus = 'NFC_OK' | 'NO_NFC' | 'NFC_DISABLED' | 'NDEF_PUSH_DISABLED';\n\n/**\n * Event type describing the kind of NFC discovery that happened.\n *\n * - `tag`: A generic NFC tag (no NDEF payload).\n * - `ndef`: A tag exposing an NDEF payload.\n * - `ndef-mime`: An NDEF tag that matched one of the MIME type filters.\n * - `ndef-formatable`: A tag that can be formatted to NDEF.\n */\nexport type NfcEventType = 'tag' | 'ndef' | 'ndef-mime' | 'ndef-formatable';\n\n/**\n * JSON structure representing a single NDEF record.\n *\n * Mirrors the data format returned by the legacy Cordova implementation and\n * uses integer arrays instead of strings to preserve the original payload\n * bytes.\n */\nexport interface NdefRecord {\n /**\n * Type Name Format identifier.\n */\n tnf: number;\n /**\n * Type field expressed as an array of byte values.\n */\n type: number[];\n /**\n * Record identifier expressed as an array of byte values.\n */\n id: number[];\n /**\n * Raw payload expressed as an array of byte values.\n */\n payload: number[];\n}\n\n/**\n * Representation of the full tag information returned by the native layers.\n *\n * Supports standard NFC Forum tags as well as MIFARE Ultralight cards (including\n * EV1 and NTAG variants). NDEF data is automatically extracted from MIFARE Ultralight\n * tags when available.\n */\nexport interface NfcTag {\n /**\n * Raw identifier bytes for the tag.\n */\n id?: number[];\n /**\n * List of Android tech strings (e.g. `android.nfc.tech.Ndef`).\n */\n techTypes?: string[];\n /**\n * Human readable tag type when available (e.g. `NFC Forum Type 2`, `MIFARE Ultralight`).\n */\n type?: string | null;\n /**\n * Maximum writable size in bytes for tags that expose NDEF information.\n */\n maxSize?: number | null;\n /**\n * Indicates whether the tag can be written to.\n */\n isWritable?: boolean | null;\n /**\n * Indicates whether the tag can be permanently locked.\n */\n canMakeReadOnly?: boolean | null;\n /**\n * Array of NDEF records discovered on the tag.\n */\n ndefMessage?: NdefRecord[] | null;\n}\n\n/**\n * Generic NFC discovery event dispatched by the plugin.\n */\nexport interface NfcEvent {\n type: NfcEventType;\n tag: NfcTag;\n}\n\n/**\n * Options controlling the behaviour of {@link CapacitorNfcPlugin.startScanning}.\n */\nexport interface StartScanningOptions {\n /**\n * iOS-only: closes the NFC session automatically after the first successful tag read.\n * Defaults to `true`.\n */\n invalidateAfterFirstRead?: boolean;\n /**\n * iOS-only: custom message displayed in the NFC system sheet while scanning.\n */\n alertMessage?: string;\n /**\n * iOS-only: session type to use for NFC scanning.\n * - `'ndef'`: Uses NFCNDEFReaderSession (default). Only detects NDEF-formatted tags.\n * - `'tag'`: Uses NFCTagReaderSession. Detects both NDEF and non-NDEF tags (e.g., raw MIFARE tags).\n * Allows reading UID from unformatted tags.\n * Defaults to `'ndef'` for backward compatibility.\n */\n iosSessionType?: 'ndef' | 'tag';\n /**\n * Android-only: raw flags passed to `NfcAdapter.enableReaderMode`.\n * Defaults to enabling all tag types with skipping NDEF checks.\n */\n androidReaderModeFlags?: number;\n}\n\n/**\n * Options used when writing an NDEF message on the current tag.\n */\nexport interface WriteTagOptions {\n /**\n * Array of records that compose the NDEF message to be written.\n */\n records: NdefRecord[];\n /**\n * When `true`, the plugin attempts to format NDEF-formattable tags before writing.\n * Defaults to `true`.\n */\n allowFormat?: boolean;\n}\n\n/**\n * Options used when sharing an NDEF message with another device using Android Beam / P2P mode.\n */\nexport interface ShareTagOptions {\n records: NdefRecord[];\n}\n\n/**\n * Event emitted whenever the NFC adapter availability changes.\n */\nexport interface NfcStateChangeEvent {\n status: NfcStatus;\n enabled: boolean;\n}\n\n/**\n * Public API surface for the Capacitor NFC plugin.\n *\n * The interface intentionally mirrors the behaviour of the reference PhoneGap\n * implementation to ease migration while embracing idiomatic Capacitor APIs.\n */\nexport interface CapacitorNfcPlugin {\n /**\n * Starts listening for NFC tags.\n */\n startScanning(options?: StartScanningOptions): Promise<void>;\n /**\n * Stops the ongoing NFC scanning session.\n */\n stopScanning(): Promise<void>;\n /**\n * Writes the provided NDEF records to the last discovered tag.\n */\n write(options: WriteTagOptions): Promise<void>;\n /**\n * Attempts to erase the last discovered tag by writing an empty NDEF message.\n */\n erase(): Promise<void>;\n /**\n * Attempts to make the last discovered tag read-only.\n */\n makeReadOnly(): Promise<void>;\n /**\n * Shares an NDEF message with another device via peer-to-peer (Android only).\n */\n share(options: ShareTagOptions): Promise<void>;\n /**\n * Stops sharing previously provided NDEF message (Android only).\n */\n unshare(): Promise<void>;\n /**\n * Returns the current NFC adapter status.\n */\n getStatus(): Promise<{ status: NfcStatus }>;\n /**\n * Opens the system settings page where the user can enable NFC.\n */\n showSettings(): Promise<void>;\n /**\n * Returns the version string baked into the native plugin.\n */\n getPluginVersion(): Promise<{ version: string }>;\n /**\n * Checks whether the device has NFC hardware support.\n *\n * Returns `true` if NFC hardware is present on the device, regardless of\n * whether NFC is currently enabled or disabled. Returns `false` if the\n * device does not have NFC hardware.\n *\n * Use this method to determine if NFC features should be shown in your\n * app's UI. To check if NFC is currently enabled, use `getStatus()`.\n */\n isSupported(): Promise<{ supported: boolean }>;\n\n addListener(eventName: 'nfcEvent', listenerFunc: (event: NfcEvent) => void): Promise<PluginListenerHandle>;\n addListener(\n eventName: 'tagDiscovered' | 'ndefDiscovered' | 'ndefMimeDiscovered' | 'ndefFormatableDiscovered',\n listenerFunc: (event: NfcEvent) => void,\n ): Promise<PluginListenerHandle>;\n addListener(\n eventName: 'nfcStateChange',\n listenerFunc: (event: NfcStateChangeEvent) => void,\n ): Promise<PluginListenerHandle>;\n}\n\nexport type { PluginListenerHandle } from '@capacitor/core';\n"]}
|
package/dist/esm/web.d.ts
CHANGED
|
@@ -16,6 +16,9 @@ export declare class CapacitorNfcWeb extends WebPlugin implements CapacitorNfcPl
|
|
|
16
16
|
getPluginVersion(): Promise<{
|
|
17
17
|
version: string;
|
|
18
18
|
}>;
|
|
19
|
+
isSupported(): Promise<{
|
|
20
|
+
supported: boolean;
|
|
21
|
+
}>;
|
|
19
22
|
addListener(eventName: 'nfcEvent', listenerFunc: (event: NfcEvent) => void): Promise<PluginListenerHandle>;
|
|
20
23
|
addListener(eventName: 'tagDiscovered' | 'ndefDiscovered' | 'ndefMimeDiscovered' | 'ndefFormatableDiscovered', listenerFunc: (event: NfcEvent) => void): Promise<PluginListenerHandle>;
|
|
21
24
|
addListener(eventName: 'nfcStateChange', listenerFunc: (event: NfcStateChangeEvent) => void): Promise<PluginListenerHandle>;
|
package/dist/esm/web.js
CHANGED
|
@@ -33,6 +33,9 @@ export class CapacitorNfcWeb extends WebPlugin {
|
|
|
33
33
|
async getPluginVersion() {
|
|
34
34
|
return { version: '0.0.0-web' };
|
|
35
35
|
}
|
|
36
|
+
async isSupported() {
|
|
37
|
+
return { supported: false };
|
|
38
|
+
}
|
|
36
39
|
async addListener(eventName, _listenerFunc) {
|
|
37
40
|
this.unsupported(`addListener(${eventName})`);
|
|
38
41
|
}
|
package/dist/esm/web.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAY5C,MAAM,OAAO,eAAgB,SAAQ,SAAS;IACpC,WAAW,CAAC,MAAc;QAChC,MAAM,IAAI,CAAC,aAAa,CAAC,gBAAgB,MAAM,6CAA6C,CAAC,CAAC;IAChG,CAAC;IAED,KAAK,CAAC,aAAa,CAAC,QAA+B;QACjD,IAAI,CAAC,WAAW,CAAC,eAAe,CAAC,CAAC;IACpC,CAAC;IAED,KAAK,CAAC,YAAY;QAChB,IAAI,CAAC,WAAW,CAAC,cAAc,CAAC,CAAC;IACnC,CAAC;IAED,KAAK,CAAC,KAAK,CAAC,QAAyB;QACnC,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;IAC5B,CAAC;IAED,KAAK,CAAC,KAAK;QACT,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;IAC5B,CAAC;IAED,KAAK,CAAC,YAAY;QAChB,IAAI,CAAC,WAAW,CAAC,cAAc,CAAC,CAAC;IACnC,CAAC;IAED,KAAK,CAAC,KAAK,CAAC,QAAyB;QACnC,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;IAC5B,CAAC;IAED,KAAK,CAAC,OAAO;QACX,IAAI,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC;IAC9B,CAAC;IAED,KAAK,CAAC,SAAS;QACb,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC;IAC9B,CAAC;IAED,KAAK,CAAC,YAAY;QAChB,IAAI,CAAC,WAAW,CAAC,cAAc,CAAC,CAAC;IACnC,CAAC;IAED,KAAK,CAAC,gBAAgB;QACpB,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,CAAC;IAClC,CAAC;IAWD,KAAK,CAAC,WAAW,CAAC,SAAiB,EAAE,aAAuC;QAC1E,IAAI,CAAC,WAAW,CAAC,eAAe,SAAS,GAAG,CAAC,CAAC;IAChD,CAAC;CACF","sourcesContent":["import { WebPlugin } from '@capacitor/core';\n\nimport type {\n CapacitorNfcPlugin,\n NfcStateChangeEvent,\n NfcEvent,\n ShareTagOptions,\n StartScanningOptions,\n WriteTagOptions,\n PluginListenerHandle,\n} from './definitions';\n\nexport class CapacitorNfcWeb extends WebPlugin implements CapacitorNfcPlugin {\n private unsupported(method: string): never {\n throw this.unimplemented(`CapacitorNfc.${method} is not available in a browser environment.`);\n }\n\n async startScanning(_options?: StartScanningOptions): Promise<void> {\n this.unsupported('startScanning');\n }\n\n async stopScanning(): Promise<void> {\n this.unsupported('stopScanning');\n }\n\n async write(_options: WriteTagOptions): Promise<void> {\n this.unsupported('write');\n }\n\n async erase(): Promise<void> {\n this.unsupported('erase');\n }\n\n async makeReadOnly(): Promise<void> {\n this.unsupported('makeReadOnly');\n }\n\n async share(_options: ShareTagOptions): Promise<void> {\n this.unsupported('share');\n }\n\n async unshare(): Promise<void> {\n this.unsupported('unshare');\n }\n\n async getStatus(): Promise<{ status: 'NO_NFC' }> {\n return { status: 'NO_NFC' };\n }\n\n async showSettings(): Promise<void> {\n this.unsupported('showSettings');\n }\n\n async getPluginVersion(): Promise<{ version: string }> {\n return { version: '0.0.0-web' };\n }\n\n addListener(eventName: 'nfcEvent', listenerFunc: (event: NfcEvent) => void): Promise<PluginListenerHandle>;\n addListener(\n eventName: 'tagDiscovered' | 'ndefDiscovered' | 'ndefMimeDiscovered' | 'ndefFormatableDiscovered',\n listenerFunc: (event: NfcEvent) => void,\n ): Promise<PluginListenerHandle>;\n addListener(\n eventName: 'nfcStateChange',\n listenerFunc: (event: NfcStateChangeEvent) => void,\n ): Promise<PluginListenerHandle>;\n async addListener(eventName: string, _listenerFunc: (..._args: any[]) => any): Promise<PluginListenerHandle> {\n this.unsupported(`addListener(${eventName})`);\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAY5C,MAAM,OAAO,eAAgB,SAAQ,SAAS;IACpC,WAAW,CAAC,MAAc;QAChC,MAAM,IAAI,CAAC,aAAa,CAAC,gBAAgB,MAAM,6CAA6C,CAAC,CAAC;IAChG,CAAC;IAED,KAAK,CAAC,aAAa,CAAC,QAA+B;QACjD,IAAI,CAAC,WAAW,CAAC,eAAe,CAAC,CAAC;IACpC,CAAC;IAED,KAAK,CAAC,YAAY;QAChB,IAAI,CAAC,WAAW,CAAC,cAAc,CAAC,CAAC;IACnC,CAAC;IAED,KAAK,CAAC,KAAK,CAAC,QAAyB;QACnC,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;IAC5B,CAAC;IAED,KAAK,CAAC,KAAK;QACT,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;IAC5B,CAAC;IAED,KAAK,CAAC,YAAY;QAChB,IAAI,CAAC,WAAW,CAAC,cAAc,CAAC,CAAC;IACnC,CAAC;IAED,KAAK,CAAC,KAAK,CAAC,QAAyB;QACnC,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;IAC5B,CAAC;IAED,KAAK,CAAC,OAAO;QACX,IAAI,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC;IAC9B,CAAC;IAED,KAAK,CAAC,SAAS;QACb,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC;IAC9B,CAAC;IAED,KAAK,CAAC,YAAY;QAChB,IAAI,CAAC,WAAW,CAAC,cAAc,CAAC,CAAC;IACnC,CAAC;IAED,KAAK,CAAC,gBAAgB;QACpB,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,CAAC;IAClC,CAAC;IAED,KAAK,CAAC,WAAW;QACf,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;IAC9B,CAAC;IAWD,KAAK,CAAC,WAAW,CAAC,SAAiB,EAAE,aAAuC;QAC1E,IAAI,CAAC,WAAW,CAAC,eAAe,SAAS,GAAG,CAAC,CAAC;IAChD,CAAC;CACF","sourcesContent":["import { WebPlugin } from '@capacitor/core';\n\nimport type {\n CapacitorNfcPlugin,\n NfcStateChangeEvent,\n NfcEvent,\n ShareTagOptions,\n StartScanningOptions,\n WriteTagOptions,\n PluginListenerHandle,\n} from './definitions';\n\nexport class CapacitorNfcWeb extends WebPlugin implements CapacitorNfcPlugin {\n private unsupported(method: string): never {\n throw this.unimplemented(`CapacitorNfc.${method} is not available in a browser environment.`);\n }\n\n async startScanning(_options?: StartScanningOptions): Promise<void> {\n this.unsupported('startScanning');\n }\n\n async stopScanning(): Promise<void> {\n this.unsupported('stopScanning');\n }\n\n async write(_options: WriteTagOptions): Promise<void> {\n this.unsupported('write');\n }\n\n async erase(): Promise<void> {\n this.unsupported('erase');\n }\n\n async makeReadOnly(): Promise<void> {\n this.unsupported('makeReadOnly');\n }\n\n async share(_options: ShareTagOptions): Promise<void> {\n this.unsupported('share');\n }\n\n async unshare(): Promise<void> {\n this.unsupported('unshare');\n }\n\n async getStatus(): Promise<{ status: 'NO_NFC' }> {\n return { status: 'NO_NFC' };\n }\n\n async showSettings(): Promise<void> {\n this.unsupported('showSettings');\n }\n\n async getPluginVersion(): Promise<{ version: string }> {\n return { version: '0.0.0-web' };\n }\n\n async isSupported(): Promise<{ supported: boolean }> {\n return { supported: false };\n }\n\n addListener(eventName: 'nfcEvent', listenerFunc: (event: NfcEvent) => void): Promise<PluginListenerHandle>;\n addListener(\n eventName: 'tagDiscovered' | 'ndefDiscovered' | 'ndefMimeDiscovered' | 'ndefFormatableDiscovered',\n listenerFunc: (event: NfcEvent) => void,\n ): Promise<PluginListenerHandle>;\n addListener(\n eventName: 'nfcStateChange',\n listenerFunc: (event: NfcStateChangeEvent) => void,\n ): Promise<PluginListenerHandle>;\n async addListener(eventName: string, _listenerFunc: (..._args: any[]) => any): Promise<PluginListenerHandle> {\n this.unsupported(`addListener(${eventName})`);\n }\n}\n"]}
|
package/dist/plugin.cjs.js
CHANGED
|
@@ -40,6 +40,9 @@ class CapacitorNfcWeb extends core.WebPlugin {
|
|
|
40
40
|
async getPluginVersion() {
|
|
41
41
|
return { version: '0.0.0-web' };
|
|
42
42
|
}
|
|
43
|
+
async isSupported() {
|
|
44
|
+
return { supported: false };
|
|
45
|
+
}
|
|
43
46
|
async addListener(eventName, _listenerFunc) {
|
|
44
47
|
this.unsupported(`addListener(${eventName})`);
|
|
45
48
|
}
|
package/dist/plugin.cjs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.cjs.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst CapacitorNfc = registerPlugin('CapacitorNfc', {\n web: () => import('./web').then((m) => new m.CapacitorNfcWeb()),\n});\nexport * from './definitions';\nexport { CapacitorNfc };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class CapacitorNfcWeb extends WebPlugin {\n unsupported(method) {\n throw this.unimplemented(`CapacitorNfc.${method} is not available in a browser environment.`);\n }\n async startScanning(_options) {\n this.unsupported('startScanning');\n }\n async stopScanning() {\n this.unsupported('stopScanning');\n }\n async write(_options) {\n this.unsupported('write');\n }\n async erase() {\n this.unsupported('erase');\n }\n async makeReadOnly() {\n this.unsupported('makeReadOnly');\n }\n async share(_options) {\n this.unsupported('share');\n }\n async unshare() {\n this.unsupported('unshare');\n }\n async getStatus() {\n return { status: 'NO_NFC' };\n }\n async showSettings() {\n this.unsupported('showSettings');\n }\n async getPluginVersion() {\n return { version: '0.0.0-web' };\n }\n async addListener(eventName, _listenerFunc) {\n this.unsupported(`addListener(${eventName})`);\n }\n}\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,CAAC,KAAK,IAAI,CAAC,CAAC,eAAe,EAAE,CAAC;AACnE,CAAC;;ACFM,MAAM,eAAe,SAASC,cAAS,CAAC;AAC/C,IAAI,WAAW,CAAC,MAAM,EAAE;AACxB,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,CAAC,aAAa,EAAE,MAAM,CAAC,2CAA2C,CAAC,CAAC;AACrG,IAAI;AACJ,IAAI,MAAM,aAAa,CAAC,QAAQ,EAAE;AAClC,QAAQ,IAAI,CAAC,WAAW,CAAC,eAAe,CAAC;AACzC,IAAI;AACJ,IAAI,MAAM,YAAY,GAAG;AACzB,QAAQ,IAAI,CAAC,WAAW,CAAC,cAAc,CAAC;AACxC,IAAI;AACJ,IAAI,MAAM,KAAK,CAAC,QAAQ,EAAE;AAC1B,QAAQ,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC;AACjC,IAAI;AACJ,IAAI,MAAM,KAAK,GAAG;AAClB,QAAQ,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC;AACjC,IAAI;AACJ,IAAI,MAAM,YAAY,GAAG;AACzB,QAAQ,IAAI,CAAC,WAAW,CAAC,cAAc,CAAC;AACxC,IAAI;AACJ,IAAI,MAAM,KAAK,CAAC,QAAQ,EAAE;AAC1B,QAAQ,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC;AACjC,IAAI;AACJ,IAAI,MAAM,OAAO,GAAG;AACpB,QAAQ,IAAI,CAAC,WAAW,CAAC,SAAS,CAAC;AACnC,IAAI;AACJ,IAAI,MAAM,SAAS,GAAG;AACtB,QAAQ,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE;AACnC,IAAI;AACJ,IAAI,MAAM,YAAY,GAAG;AACzB,QAAQ,IAAI,CAAC,WAAW,CAAC,cAAc,CAAC;AACxC,IAAI;AACJ,IAAI,MAAM,gBAAgB,GAAG;AAC7B,QAAQ,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE;AACvC,IAAI;AACJ,IAAI,MAAM,WAAW,CAAC,SAAS,EAAE,aAAa,EAAE;AAChD,QAAQ,IAAI,CAAC,WAAW,CAAC,CAAC,YAAY,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC;AACrD,IAAI;AACJ;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"plugin.cjs.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst CapacitorNfc = registerPlugin('CapacitorNfc', {\n web: () => import('./web').then((m) => new m.CapacitorNfcWeb()),\n});\nexport * from './definitions';\nexport { CapacitorNfc };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class CapacitorNfcWeb extends WebPlugin {\n unsupported(method) {\n throw this.unimplemented(`CapacitorNfc.${method} is not available in a browser environment.`);\n }\n async startScanning(_options) {\n this.unsupported('startScanning');\n }\n async stopScanning() {\n this.unsupported('stopScanning');\n }\n async write(_options) {\n this.unsupported('write');\n }\n async erase() {\n this.unsupported('erase');\n }\n async makeReadOnly() {\n this.unsupported('makeReadOnly');\n }\n async share(_options) {\n this.unsupported('share');\n }\n async unshare() {\n this.unsupported('unshare');\n }\n async getStatus() {\n return { status: 'NO_NFC' };\n }\n async showSettings() {\n this.unsupported('showSettings');\n }\n async getPluginVersion() {\n return { version: '0.0.0-web' };\n }\n async isSupported() {\n return { supported: false };\n }\n async addListener(eventName, _listenerFunc) {\n this.unsupported(`addListener(${eventName})`);\n }\n}\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,CAAC,KAAK,IAAI,CAAC,CAAC,eAAe,EAAE,CAAC;AACnE,CAAC;;ACFM,MAAM,eAAe,SAASC,cAAS,CAAC;AAC/C,IAAI,WAAW,CAAC,MAAM,EAAE;AACxB,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,CAAC,aAAa,EAAE,MAAM,CAAC,2CAA2C,CAAC,CAAC;AACrG,IAAI;AACJ,IAAI,MAAM,aAAa,CAAC,QAAQ,EAAE;AAClC,QAAQ,IAAI,CAAC,WAAW,CAAC,eAAe,CAAC;AACzC,IAAI;AACJ,IAAI,MAAM,YAAY,GAAG;AACzB,QAAQ,IAAI,CAAC,WAAW,CAAC,cAAc,CAAC;AACxC,IAAI;AACJ,IAAI,MAAM,KAAK,CAAC,QAAQ,EAAE;AAC1B,QAAQ,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC;AACjC,IAAI;AACJ,IAAI,MAAM,KAAK,GAAG;AAClB,QAAQ,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC;AACjC,IAAI;AACJ,IAAI,MAAM,YAAY,GAAG;AACzB,QAAQ,IAAI,CAAC,WAAW,CAAC,cAAc,CAAC;AACxC,IAAI;AACJ,IAAI,MAAM,KAAK,CAAC,QAAQ,EAAE;AAC1B,QAAQ,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC;AACjC,IAAI;AACJ,IAAI,MAAM,OAAO,GAAG;AACpB,QAAQ,IAAI,CAAC,WAAW,CAAC,SAAS,CAAC;AACnC,IAAI;AACJ,IAAI,MAAM,SAAS,GAAG;AACtB,QAAQ,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE;AACnC,IAAI;AACJ,IAAI,MAAM,YAAY,GAAG;AACzB,QAAQ,IAAI,CAAC,WAAW,CAAC,cAAc,CAAC;AACxC,IAAI;AACJ,IAAI,MAAM,gBAAgB,GAAG;AAC7B,QAAQ,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE;AACvC,IAAI;AACJ,IAAI,MAAM,WAAW,GAAG;AACxB,QAAQ,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE;AACnC,IAAI;AACJ,IAAI,MAAM,WAAW,CAAC,SAAS,EAAE,aAAa,EAAE;AAChD,QAAQ,IAAI,CAAC,WAAW,CAAC,CAAC,YAAY,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC;AACrD,IAAI;AACJ;;;;;;;;;"}
|
package/dist/plugin.js
CHANGED
|
@@ -39,6 +39,9 @@ var capacitorCapacitorNfc = (function (exports, core) {
|
|
|
39
39
|
async getPluginVersion() {
|
|
40
40
|
return { version: '0.0.0-web' };
|
|
41
41
|
}
|
|
42
|
+
async isSupported() {
|
|
43
|
+
return { supported: false };
|
|
44
|
+
}
|
|
42
45
|
async addListener(eventName, _listenerFunc) {
|
|
43
46
|
this.unsupported(`addListener(${eventName})`);
|
|
44
47
|
}
|
package/dist/plugin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst CapacitorNfc = registerPlugin('CapacitorNfc', {\n web: () => import('./web').then((m) => new m.CapacitorNfcWeb()),\n});\nexport * from './definitions';\nexport { CapacitorNfc };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class CapacitorNfcWeb extends WebPlugin {\n unsupported(method) {\n throw this.unimplemented(`CapacitorNfc.${method} is not available in a browser environment.`);\n }\n async startScanning(_options) {\n this.unsupported('startScanning');\n }\n async stopScanning() {\n this.unsupported('stopScanning');\n }\n async write(_options) {\n this.unsupported('write');\n }\n async erase() {\n this.unsupported('erase');\n }\n async makeReadOnly() {\n this.unsupported('makeReadOnly');\n }\n async share(_options) {\n this.unsupported('share');\n }\n async unshare() {\n this.unsupported('unshare');\n }\n async getStatus() {\n return { status: 'NO_NFC' };\n }\n async showSettings() {\n this.unsupported('showSettings');\n }\n async getPluginVersion() {\n return { version: '0.0.0-web' };\n }\n async addListener(eventName, _listenerFunc) {\n this.unsupported(`addListener(${eventName})`);\n }\n}\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,CAAC,KAAK,IAAI,CAAC,CAAC,eAAe,EAAE,CAAC;IACnE,CAAC;;ICFM,MAAM,eAAe,SAASC,cAAS,CAAC;IAC/C,IAAI,WAAW,CAAC,MAAM,EAAE;IACxB,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,CAAC,aAAa,EAAE,MAAM,CAAC,2CAA2C,CAAC,CAAC;IACrG,IAAI;IACJ,IAAI,MAAM,aAAa,CAAC,QAAQ,EAAE;IAClC,QAAQ,IAAI,CAAC,WAAW,CAAC,eAAe,CAAC;IACzC,IAAI;IACJ,IAAI,MAAM,YAAY,GAAG;IACzB,QAAQ,IAAI,CAAC,WAAW,CAAC,cAAc,CAAC;IACxC,IAAI;IACJ,IAAI,MAAM,KAAK,CAAC,QAAQ,EAAE;IAC1B,QAAQ,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC;IACjC,IAAI;IACJ,IAAI,MAAM,KAAK,GAAG;IAClB,QAAQ,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC;IACjC,IAAI;IACJ,IAAI,MAAM,YAAY,GAAG;IACzB,QAAQ,IAAI,CAAC,WAAW,CAAC,cAAc,CAAC;IACxC,IAAI;IACJ,IAAI,MAAM,KAAK,CAAC,QAAQ,EAAE;IAC1B,QAAQ,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC;IACjC,IAAI;IACJ,IAAI,MAAM,OAAO,GAAG;IACpB,QAAQ,IAAI,CAAC,WAAW,CAAC,SAAS,CAAC;IACnC,IAAI;IACJ,IAAI,MAAM,SAAS,GAAG;IACtB,QAAQ,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE;IACnC,IAAI;IACJ,IAAI,MAAM,YAAY,GAAG;IACzB,QAAQ,IAAI,CAAC,WAAW,CAAC,cAAc,CAAC;IACxC,IAAI;IACJ,IAAI,MAAM,gBAAgB,GAAG;IAC7B,QAAQ,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE;IACvC,IAAI;IACJ,IAAI,MAAM,WAAW,CAAC,SAAS,EAAE,aAAa,EAAE;IAChD,QAAQ,IAAI,CAAC,WAAW,CAAC,CAAC,YAAY,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC;IACrD,IAAI;IACJ;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"plugin.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst CapacitorNfc = registerPlugin('CapacitorNfc', {\n web: () => import('./web').then((m) => new m.CapacitorNfcWeb()),\n});\nexport * from './definitions';\nexport { CapacitorNfc };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class CapacitorNfcWeb extends WebPlugin {\n unsupported(method) {\n throw this.unimplemented(`CapacitorNfc.${method} is not available in a browser environment.`);\n }\n async startScanning(_options) {\n this.unsupported('startScanning');\n }\n async stopScanning() {\n this.unsupported('stopScanning');\n }\n async write(_options) {\n this.unsupported('write');\n }\n async erase() {\n this.unsupported('erase');\n }\n async makeReadOnly() {\n this.unsupported('makeReadOnly');\n }\n async share(_options) {\n this.unsupported('share');\n }\n async unshare() {\n this.unsupported('unshare');\n }\n async getStatus() {\n return { status: 'NO_NFC' };\n }\n async showSettings() {\n this.unsupported('showSettings');\n }\n async getPluginVersion() {\n return { version: '0.0.0-web' };\n }\n async isSupported() {\n return { supported: false };\n }\n async addListener(eventName, _listenerFunc) {\n this.unsupported(`addListener(${eventName})`);\n }\n}\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,CAAC,KAAK,IAAI,CAAC,CAAC,eAAe,EAAE,CAAC;IACnE,CAAC;;ICFM,MAAM,eAAe,SAASC,cAAS,CAAC;IAC/C,IAAI,WAAW,CAAC,MAAM,EAAE;IACxB,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,CAAC,aAAa,EAAE,MAAM,CAAC,2CAA2C,CAAC,CAAC;IACrG,IAAI;IACJ,IAAI,MAAM,aAAa,CAAC,QAAQ,EAAE;IAClC,QAAQ,IAAI,CAAC,WAAW,CAAC,eAAe,CAAC;IACzC,IAAI;IACJ,IAAI,MAAM,YAAY,GAAG;IACzB,QAAQ,IAAI,CAAC,WAAW,CAAC,cAAc,CAAC;IACxC,IAAI;IACJ,IAAI,MAAM,KAAK,CAAC,QAAQ,EAAE;IAC1B,QAAQ,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC;IACjC,IAAI;IACJ,IAAI,MAAM,KAAK,GAAG;IAClB,QAAQ,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC;IACjC,IAAI;IACJ,IAAI,MAAM,YAAY,GAAG;IACzB,QAAQ,IAAI,CAAC,WAAW,CAAC,cAAc,CAAC;IACxC,IAAI;IACJ,IAAI,MAAM,KAAK,CAAC,QAAQ,EAAE;IAC1B,QAAQ,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC;IACjC,IAAI;IACJ,IAAI,MAAM,OAAO,GAAG;IACpB,QAAQ,IAAI,CAAC,WAAW,CAAC,SAAS,CAAC;IACnC,IAAI;IACJ,IAAI,MAAM,SAAS,GAAG;IACtB,QAAQ,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE;IACnC,IAAI;IACJ,IAAI,MAAM,YAAY,GAAG;IACzB,QAAQ,IAAI,CAAC,WAAW,CAAC,cAAc,CAAC;IACxC,IAAI;IACJ,IAAI,MAAM,gBAAgB,GAAG;IAC7B,QAAQ,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE;IACvC,IAAI;IACJ,IAAI,MAAM,WAAW,GAAG;IACxB,QAAQ,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE;IACnC,IAAI;IACJ,IAAI,MAAM,WAAW,CAAC,SAAS,EAAE,aAAa,EAAE;IAChD,QAAQ,IAAI,CAAC,WAAW,CAAC,CAAC,YAAY,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC;IACrD,IAAI;IACJ;;;;;;;;;;;;;;;"}
|
|
@@ -4,7 +4,7 @@ import UIKit
|
|
|
4
4
|
|
|
5
5
|
@objc(NfcPlugin)
|
|
6
6
|
public class NfcPlugin: CAPPlugin, CAPBridgedPlugin {
|
|
7
|
-
private let pluginVersion: String = "8.0.
|
|
7
|
+
private let pluginVersion: String = "8.0.12"
|
|
8
8
|
|
|
9
9
|
public let identifier = "NfcPlugin"
|
|
10
10
|
public let jsName = "CapacitorNfc"
|
|
@@ -18,7 +18,8 @@ public class NfcPlugin: CAPPlugin, CAPBridgedPlugin {
|
|
|
18
18
|
CAPPluginMethod(name: "unshare", returnType: CAPPluginReturnPromise),
|
|
19
19
|
CAPPluginMethod(name: "getStatus", returnType: CAPPluginReturnPromise),
|
|
20
20
|
CAPPluginMethod(name: "showSettings", returnType: CAPPluginReturnPromise),
|
|
21
|
-
CAPPluginMethod(name: "getPluginVersion", returnType: CAPPluginReturnPromise)
|
|
21
|
+
CAPPluginMethod(name: "getPluginVersion", returnType: CAPPluginReturnPromise),
|
|
22
|
+
CAPPluginMethod(name: "isSupported", returnType: CAPPluginReturnPromise)
|
|
22
23
|
]
|
|
23
24
|
|
|
24
25
|
private var ndefReaderSession: NFCNDEFReaderSession?
|
|
@@ -175,6 +176,18 @@ public class NfcPlugin: CAPPlugin, CAPBridgedPlugin {
|
|
|
175
176
|
])
|
|
176
177
|
}
|
|
177
178
|
|
|
179
|
+
@objc public func isSupported(_ call: CAPPluginCall) {
|
|
180
|
+
#if targetEnvironment(simulator)
|
|
181
|
+
call.resolve([
|
|
182
|
+
"supported": false
|
|
183
|
+
])
|
|
184
|
+
#else
|
|
185
|
+
call.resolve([
|
|
186
|
+
"supported": NFCNDEFReaderSession.readingAvailable
|
|
187
|
+
])
|
|
188
|
+
#endif
|
|
189
|
+
}
|
|
190
|
+
|
|
178
191
|
private func performWrite(message: NFCNDEFMessage, on tag: NFCNDEFTag, session: NFCNDEFReaderSession, call: CAPPluginCall) {
|
|
179
192
|
session.connect(to: tag) { [weak self] error in
|
|
180
193
|
guard let self else {
|
package/package.json
CHANGED