react-native-nfc-manager 3.13.2 → 3.13.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/CHANGELOG.md
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
## [3.0.2](https://github.com/whitedogg13/react-native-nfc-manager/compare/v3.0.1...v3.0.2) (2021-02-22)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* **android:** allow requestTechnology resolves to tags even when tech ([8b7f862](https://github.com/whitedogg13/react-native-nfc-manager/commit/8b7f8629a8e46304f2a68d62f01e745047fe01dc))
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
## [3.0.1](https://github.com/whitedogg13/react-native-nfc-manager/compare/v3.0.0...v3.0.1) (2021-02-20)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Bug Fixes
|
|
14
|
+
|
|
15
|
+
* [#371](https://github.com/whitedogg13/react-native-nfc-manager/issues/371) missing MIFARE_BLOCK_SIZE for mifareClassicHandlerAndroid ([b136419](https://github.com/whitedogg13/react-native-nfc-manager/commit/b1364197c80ab16542bbb823483a2079a896e169))
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
# [3.0.0](https://github.com/whitedogg13/react-native-nfc-manager/compare/v3.0.0-0...v3.0.0) (2021-02-18)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
### Features
|
|
23
|
+
|
|
24
|
+
* expose RTD_URI_PROTOCOLS ([26516a7](https://github.com/whitedogg13/react-native-nfc-manager/commit/26516a7ce8309ade21464df13a8e5c799c0e417c))
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
# [3.0.0-0](https://github.com/whitedogg13/react-native-nfc-manager/compare/v2.0.0-beta.1...v3.0.0-0) (2021-02-10)
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
### Bug Fixes
|
|
32
|
+
|
|
33
|
+
* disable 18092 polling (cause iOS freeze) ([64115f8](https://github.com/whitedogg13/react-native-nfc-manager/commit/64115f80f8cd93ed5ef3b01987d6c628a5a9127b))
|
|
34
|
+
* **ios:** add polling for iso18092 ([b7984a5](https://github.com/whitedogg13/react-native-nfc-manager/commit/b7984a59ea27076d7fd34a2614592f468c80f5e1))
|
|
35
|
+
* add callback type null possible ([1371533](https://github.com/whitedogg13/react-native-nfc-manager/commit/13715334ea908b89654b42eba4ec902bcc6f4229))
|
|
36
|
+
* cancelTechnology might cause exception if there's a connected tag ([af2f1f9](https://github.com/whitedogg13/react-native-nfc-manager/commit/af2f1f92bbd7bfcf8c604db48b790289c3ca4946))
|
|
37
|
+
* cancelTechnology might cause exception if there's a connected tag ([dcb26b8](https://github.com/whitedogg13/react-native-nfc-manager/commit/dcb26b85a955ce17ae633e00f6f189a895e8adcb))
|
|
38
|
+
* getNdefMessage should use the same structure for platforms ([73859fb](https://github.com/whitedogg13/react-native-nfc-manager/commit/73859fbac8939277f1e7fc2ad13ececee8c9d4c7))
|
|
39
|
+
* import NfcManager from new location ([c95cc76](https://github.com/whitedogg13/react-native-nfc-manager/commit/c95cc76a0a3b52c751c1a0f00895cf1b34b66b28))
|
|
40
|
+
* ios isSupported ([adcc966](https://github.com/whitedogg13/react-native-nfc-manager/commit/adcc966c8ed4a565c2800fabc5e5a0cad07ea376))
|
|
41
|
+
* promise won't be rejected when calling cancelTechnologyRequest in ([64c9cbd](https://github.com/whitedogg13/react-native-nfc-manager/commit/64c9cbd05e34e975fa4744727859efd08ea610bf))
|
|
42
|
+
* reject tech request promise when native iOS cancel button is pressed ([7915b98](https://github.com/whitedogg13/react-native-nfc-manager/commit/7915b98132cf5c6f86eb96dfe242b67bef32e8a7))
|
|
43
|
+
* remove getNdefMessage's parameter declaration ([6fc257e](https://github.com/whitedogg13/react-native-nfc-manager/commit/6fc257e61e1da5600a7aac44d9a8a97a7ecc988c))
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
### Features
|
|
47
|
+
|
|
48
|
+
* extract more NfcTech handlers ([0032408](https://github.com/whitedogg13/react-native-nfc-manager/commit/0032408af21cafa3f5f92c16083f914325450524))
|
|
49
|
+
* **android:** getNdefStatus ([4cc68ce](https://github.com/whitedogg13/react-native-nfc-manager/commit/4cc68ce233d81c03760b791fc2f568fe4b8415c4))
|
|
50
|
+
* **ios:** enhance didDetectTags and add queryNDEFStatus / makeReadOnly ([32dd3be](https://github.com/whitedogg13/react-native-nfc-manager/commit/32dd3be2968abbe095ae42fd12793a9a8c0725c6))
|
|
51
|
+
* invalidateSessionWithErrorIOS ([c631110](https://github.com/whitedogg13/react-native-nfc-manager/commit/c631110b6454c08821607014a28b8dffb20fe8b0))
|
|
52
|
+
* ios 13 ndef read and write ([31a3ae6](https://github.com/whitedogg13/react-native-nfc-manager/commit/31a3ae6e141e41f3f36a102d5c2bb5ce04ba78a5))
|
|
53
|
+
* requestTechnology support multi-techs ([65e8f02](https://github.com/whitedogg13/react-native-nfc-manager/commit/65e8f02b83820cb72e65c8443a607b6dca2c8fae))
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
# [2.0.0-beta.1](https://github.com/whitedogg13/react-native-nfc-manager/compare/0.0.9...v2.0.0-beta.1) (2019-07-13)
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
### Bug Fixes
|
|
61
|
+
|
|
62
|
+
* call the correct method `mifareUltralightReadPages` (notice the tailing s) ([60feee8](https://github.com/whitedogg13/react-native-nfc-manager/commit/60feee88c2d20bc18af23b3abb6d8cb22fe17e16))
|
|
63
|
+
* ios crash on registerTagEvent ([e654d93](https://github.com/whitedogg13/react-native-nfc-manager/commit/e654d9359751327284d20b3bee1139c78657dcb4))
|
|
64
|
+
* MifareClassic should also support `transceive` ([dd4a902](https://github.com/whitedogg13/react-native-nfc-manager/commit/dd4a902257a402e5d6d3eae8bd43f9d37c03928b))
|
|
65
|
+
* use non-cached ndef for getNdefMessage API ([49f8541](https://github.com/whitedogg13/react-native-nfc-manager/commit/49f85415a5bc6d0218992dc6ba2b9303cee8e3ac))
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
### Features
|
|
69
|
+
|
|
70
|
+
* mifareultralight support ([4a53a13](https://github.com/whitedogg13/react-native-nfc-manager/commit/4a53a135c594ef340927ae053dfc142ebfd0b9b6))
|
|
71
|
+
* support `getMaxTransceiveLength` and `setTimeout` ([e759c39](https://github.com/whitedogg13/react-native-nfc-manager/commit/e759c399008e9060ae6f5fe23d7b31a61b1f8037))
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
## [0.0.9](https://github.com/whitedogg13/react-native-nfc-manager/compare/0.0.8...0.0.9) (2018-01-02)
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
## [0.0.8](https://github.com/whitedogg13/react-native-nfc-manager/compare/0.0.7...0.0.8) (2017-12-09)
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
## [0.0.7](https://github.com/whitedogg13/react-native-nfc-manager/compare/0.0.6...0.0.7) (2017-12-04)
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
## [0.0.6](https://github.com/whitedogg13/react-native-nfc-manager/compare/0.0.3...0.0.6) (2017-11-17)
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
## [0.0.3](https://github.com/whitedogg13/react-native-nfc-manager/compare/0.0.2...0.0.3) (2017-09-27)
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
## 0.0.2 (2017-08-01)
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
|
package/README.md
CHANGED
|
@@ -69,6 +69,12 @@ We have a full featured NFC utility app using this library available for downloa
|
|
|
69
69
|
|
|
70
70
|
It also open sourced in this repo: [React Native NFC ReWriter App](https://github.com/revtel/react-native-nfc-rewriter)
|
|
71
71
|
|
|
72
|
+
## Learn
|
|
73
|
+
|
|
74
|
+
We have published a React Native NFC course with [newline.co](https://www.newline.co/), check it out!
|
|
75
|
+
- Free course (1 hour) about basic NFC setup and concept [here](https://www.youtube.com/watch?v=rAS-DvNUFck)
|
|
76
|
+
- Full course (3 hours) for more (NDEF, Deep Linking, NTAG password protection, signature with UID) [here](https://www.newline.co/courses/newline-guide-to-nfcs-with-react-native)
|
|
77
|
+
|
|
72
78
|
## Usage
|
|
73
79
|
|
|
74
80
|
The simplest (and most common) use case for this library is to read `NFC` tags containing `NDEF`, which can be achieved via the following codes:
|
|
@@ -536,6 +536,99 @@ class NfcManager extends ReactContextBaseJavaModule implements ActivityEventList
|
|
|
536
536
|
}
|
|
537
537
|
}
|
|
538
538
|
|
|
539
|
+
@ReactMethod
|
|
540
|
+
public void mifareClassicIncrementBlock(int blockIndex, int value, Callback callback) {
|
|
541
|
+
synchronized(this) {
|
|
542
|
+
if (techRequest != null) {
|
|
543
|
+
try {
|
|
544
|
+
MifareClassic mifareTag = (MifareClassic) techRequest.getTechHandle();
|
|
545
|
+
if (mifareTag == null || mifareTag.getType() == MifareClassic.TYPE_UNKNOWN) {
|
|
546
|
+
// Not a mifare card, fail
|
|
547
|
+
callback.invoke("mifareClassicIncrementBlock fail: TYPE_UNKNOWN");
|
|
548
|
+
return;
|
|
549
|
+
} else if (blockIndex >= mifareTag.getBlockCount()) {
|
|
550
|
+
// Check if in range
|
|
551
|
+
String msg = String.format("mifareClassicIncrementBlock fail: invalid block %d (max %d)", blockIndex, mifareTag.getBlockCount());
|
|
552
|
+
callback.invoke(msg);
|
|
553
|
+
return;
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
mifareTag.increment(blockIndex, value);
|
|
557
|
+
|
|
558
|
+
callback.invoke(null, true);
|
|
559
|
+
} catch (TagLostException ex) {
|
|
560
|
+
callback.invoke("mifareClassicIncrementBlock fail: TAG_LOST");
|
|
561
|
+
} catch (Exception ex) {
|
|
562
|
+
callback.invoke("mifareClassicIncrementBlock fail: " + ex.toString());
|
|
563
|
+
}
|
|
564
|
+
} else {
|
|
565
|
+
callback.invoke(ERR_NO_TECH_REQ);
|
|
566
|
+
}
|
|
567
|
+
}
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
@ReactMethod
|
|
571
|
+
public void mifareClassicDecrementBlock(int blockIndex, int value, Callback callback) {
|
|
572
|
+
synchronized(this) {
|
|
573
|
+
if (techRequest != null) {
|
|
574
|
+
try {
|
|
575
|
+
MifareClassic mifareTag = (MifareClassic) techRequest.getTechHandle();
|
|
576
|
+
if (mifareTag == null || mifareTag.getType() == MifareClassic.TYPE_UNKNOWN) {
|
|
577
|
+
// Not a mifare card, fail
|
|
578
|
+
callback.invoke("mifareClassicDecrementBlock fail: TYPE_UNKNOWN");
|
|
579
|
+
return;
|
|
580
|
+
} else if (blockIndex >= mifareTag.getBlockCount()) {
|
|
581
|
+
// Check if in range
|
|
582
|
+
String msg = String.format("mifareClassicDecrementBlock fail: invalid block %d (max %d)", blockIndex, mifareTag.getBlockCount());
|
|
583
|
+
callback.invoke(msg);
|
|
584
|
+
return;
|
|
585
|
+
}
|
|
586
|
+
|
|
587
|
+
mifareTag.decrement(blockIndex, value);
|
|
588
|
+
|
|
589
|
+
callback.invoke(null, true);
|
|
590
|
+
} catch (TagLostException ex) {
|
|
591
|
+
callback.invoke("mifareClassicDecrementBlock fail: TAG_LOST");
|
|
592
|
+
} catch (Exception ex) {
|
|
593
|
+
callback.invoke("mifareClassicDecrementBlock fail: " + ex.toString());
|
|
594
|
+
}
|
|
595
|
+
} else {
|
|
596
|
+
callback.invoke(ERR_NO_TECH_REQ);
|
|
597
|
+
}
|
|
598
|
+
}
|
|
599
|
+
}
|
|
600
|
+
|
|
601
|
+
@ReactMethod
|
|
602
|
+
public void mifareClassicTransferBlock(int blockIndex, Callback callback) {
|
|
603
|
+
synchronized(this) {
|
|
604
|
+
if (techRequest != null) {
|
|
605
|
+
try {
|
|
606
|
+
MifareClassic mifareTag = (MifareClassic) techRequest.getTechHandle();
|
|
607
|
+
if (mifareTag == null || mifareTag.getType() == MifareClassic.TYPE_UNKNOWN) {
|
|
608
|
+
// Not a mifare card, fail
|
|
609
|
+
callback.invoke("mifareClassicTransferBlock fail: TYPE_UNKNOWN");
|
|
610
|
+
return;
|
|
611
|
+
} else if (blockIndex >= mifareTag.getBlockCount()) {
|
|
612
|
+
// Check if in range
|
|
613
|
+
String msg = String.format("mifareClassicTransferBlock fail: invalid block %d (max %d)", blockIndex, mifareTag.getBlockCount());
|
|
614
|
+
callback.invoke(msg);
|
|
615
|
+
return;
|
|
616
|
+
}
|
|
617
|
+
|
|
618
|
+
mifareTag.transfer(blockIndex);
|
|
619
|
+
|
|
620
|
+
callback.invoke(null, true);
|
|
621
|
+
} catch (TagLostException ex) {
|
|
622
|
+
callback.invoke("mifareClassicTransferBlock fail: TAG_LOST");
|
|
623
|
+
} catch (Exception ex) {
|
|
624
|
+
callback.invoke("mifareClassicTransferBlock fail: " + ex.toString());
|
|
625
|
+
}
|
|
626
|
+
} else {
|
|
627
|
+
callback.invoke(ERR_NO_TECH_REQ);
|
|
628
|
+
}
|
|
629
|
+
}
|
|
630
|
+
}
|
|
631
|
+
|
|
539
632
|
@ReactMethod
|
|
540
633
|
public void mifareUltralightReadPages(int pageOffset, Callback callback) {
|
|
541
634
|
synchronized(this) {
|
package/index.d.ts
CHANGED
|
@@ -123,11 +123,26 @@ declare module 'react-native-nfc-manager' {
|
|
|
123
123
|
block: ArrayLike<number>,
|
|
124
124
|
simpliArr: any[],
|
|
125
125
|
) => Promise<void>;
|
|
126
|
+
mifareClassicIncrementBlock: (
|
|
127
|
+
block: ArrayLike<number>,
|
|
128
|
+
data: number,
|
|
129
|
+
) => Promise<void>;
|
|
130
|
+
mifareClassicDecrementBlock: (
|
|
131
|
+
block: ArrayLike<number>,
|
|
132
|
+
data: number,
|
|
133
|
+
) => Promise<void>;
|
|
134
|
+
mifareClassicTransferBlock: (
|
|
135
|
+
block: ArrayLike<number>,
|
|
136
|
+
) => Promise<void>;
|
|
126
137
|
mifareClassicGetSectorCount: () => Promise<number>;
|
|
127
138
|
mifareClassicAuthenticateA: (
|
|
128
139
|
sector: number,
|
|
129
140
|
keys: number[],
|
|
130
141
|
) => Promise<void>;
|
|
142
|
+
mifareClassicAuthenticateB: (
|
|
143
|
+
sector: number,
|
|
144
|
+
keys: number[],
|
|
145
|
+
) => Promise<void>;
|
|
131
146
|
}
|
|
132
147
|
|
|
133
148
|
interface MifareUltralightHandlerAndroid {
|
package/package.json
CHANGED
|
@@ -67,6 +67,48 @@ class MifareClassicHandlerAndroid {
|
|
|
67
67
|
callNative('mifareClassicWriteBlock', [block, data]),
|
|
68
68
|
);
|
|
69
69
|
}
|
|
70
|
+
|
|
71
|
+
async mifareClassicIncrementBlock(block, value) {
|
|
72
|
+
if (
|
|
73
|
+
!value ||
|
|
74
|
+
Number.isNaN(value)) {
|
|
75
|
+
throw new Error(
|
|
76
|
+
`value should be a number`,
|
|
77
|
+
);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
return handleNativeException(
|
|
81
|
+
callNative('mifareClassicIncrementBlock', [block, value]),
|
|
82
|
+
);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
async mifareClassicDecrementBlock(block, value) {
|
|
86
|
+
if (
|
|
87
|
+
!value ||
|
|
88
|
+
Number.isNaN(value)) {
|
|
89
|
+
throw new Error(
|
|
90
|
+
`value should be a number`,
|
|
91
|
+
);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
return handleNativeException(
|
|
95
|
+
callNative('mifareClassicDecrementBlock', [block, value]),
|
|
96
|
+
);
|
|
97
|
+
}
|
|
98
|
+
async mifareClassicTransferBlock(block) {
|
|
99
|
+
if (
|
|
100
|
+
!block ||
|
|
101
|
+
Number.isNaN(block)) {
|
|
102
|
+
throw new Error(
|
|
103
|
+
`block should be a number`,
|
|
104
|
+
);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
return handleNativeException(
|
|
108
|
+
callNative('mifareClassicTransferBlock', [block]),
|
|
109
|
+
);
|
|
110
|
+
}
|
|
111
|
+
|
|
70
112
|
}
|
|
71
113
|
|
|
72
114
|
export {MifareClassicHandlerAndroid};
|