react-native-nfc-manager 3.15.1 → 3.16.0
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/index.d.ts +7 -0
- package/ios/NfcManager+Iso15693.m +38 -0
- package/package.json +1 -1
- package/src/NfcManagerIOS.js +6 -0
- package/src/NfcTech/Iso15693HandlerIOS.js +8 -0
package/index.d.ts
CHANGED
|
@@ -204,6 +204,11 @@ declare module 'react-native-nfc-manager' {
|
|
|
204
204
|
flags: number;
|
|
205
205
|
blockNumber: number;
|
|
206
206
|
}) => Promise<number[]>;
|
|
207
|
+
extendedReadMultipleBlocks: (params: {
|
|
208
|
+
flags: number;
|
|
209
|
+
blockNumber: number;
|
|
210
|
+
blockCount: number;
|
|
211
|
+
}) => Promise<number[][]>;
|
|
207
212
|
extendedWriteSingleBlock: (params: {
|
|
208
213
|
flags: number;
|
|
209
214
|
blockNumber: number;
|
|
@@ -252,6 +257,8 @@ declare module 'react-native-nfc-manager' {
|
|
|
252
257
|
setAlertMessageIOS: (alertMessage: string) => Promise<void>;
|
|
253
258
|
invalidateSessionIOS: () => Promise<void>;
|
|
254
259
|
invalidateSessionWithErrorIOS: (errorMessage: string) => Promise<void>;
|
|
260
|
+
isSessionAvailableIOS: () => Promise<Boolean>;
|
|
261
|
+
isTagSessionAvailableIOS: () => Promise<Boolean>;
|
|
255
262
|
sendMifareCommandIOS: (bytes: number[]) => Promise<number[]>;
|
|
256
263
|
sendFelicaCommandIOS: (bytes: number[]) => Promise<number[]>;
|
|
257
264
|
sendCommandAPDUIOS: (
|
|
@@ -493,6 +493,44 @@ RCT_EXPORT_METHOD(iso15693_extendedReadSingleBlock:(NSDictionary *)options callb
|
|
|
493
493
|
}
|
|
494
494
|
}
|
|
495
495
|
|
|
496
|
+
RCT_EXPORT_METHOD(iso15693_extendedReadMultipleBlocks:(NSDictionary *)options callback:(nonnull RCTResponseSenderBlock)callback)
|
|
497
|
+
{
|
|
498
|
+
if (@available(iOS 14.0, *)) {
|
|
499
|
+
if (![self tagSession] || ![self tagSession].connectedTag) {
|
|
500
|
+
callback(@[@"Not connected", [NSNull null]]);
|
|
501
|
+
return;
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
id<NFCISO15693Tag> tag = [[self tagSession].connectedTag asNFCISO15693Tag];
|
|
505
|
+
if (!tag) {
|
|
506
|
+
callback(@[@"incorrect tag type", [NSNull null]]);
|
|
507
|
+
return;
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
RequestFlag flags = [[options objectForKey:@"flags"] unsignedIntValue];
|
|
511
|
+
NSRange blockRange = NSMakeRange(
|
|
512
|
+
[[options objectForKey:@"blockNumber"] unsignedIntValue],
|
|
513
|
+
[[options objectForKey:@"blockCount"] unsignedIntValue]
|
|
514
|
+
);
|
|
515
|
+
|
|
516
|
+
[tag extendedReadMultipleBlocksWithRequestFlags:flags
|
|
517
|
+
blockRange:blockRange
|
|
518
|
+
completionHandler:^(NSArray<NSData *> *dataBlocks, NSError *error) {
|
|
519
|
+
if (error) {
|
|
520
|
+
callback(@[getErrorMessage(error), [NSNull null]]);
|
|
521
|
+
return;
|
|
522
|
+
}
|
|
523
|
+
NSMutableArray *blocks = [NSMutableArray arrayWithCapacity:[dataBlocks count]];
|
|
524
|
+
[dataBlocks enumerateObjectsUsingBlock:^(NSData *blockData, NSUInteger idx, BOOL *stop) {
|
|
525
|
+
[blocks addObject:dataToArray(blockData)];
|
|
526
|
+
}];
|
|
527
|
+
callback(@[[NSNull null], blocks]);
|
|
528
|
+
}];
|
|
529
|
+
} else {
|
|
530
|
+
callback(@[@"Not support in this device", [NSNull null]]);
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
|
|
496
534
|
RCT_EXPORT_METHOD(iso15693_extendedWriteSingleBlock:(NSDictionary *)options callback:(nonnull RCTResponseSenderBlock)callback)
|
|
497
535
|
{
|
|
498
536
|
if (@available(iOS 14.0, *)) {
|
package/package.json
CHANGED
package/src/NfcManagerIOS.js
CHANGED
|
@@ -91,6 +91,12 @@ class NfcManagerIOS extends NfcManagerBase {
|
|
|
91
91
|
callNative('invalidateSessionWithError', [errorMessage]),
|
|
92
92
|
);
|
|
93
93
|
|
|
94
|
+
isSessionAvailableIOS = async () =>
|
|
95
|
+
handleNativeException(callNative('isSessionAvailable'));
|
|
96
|
+
|
|
97
|
+
isTagSessionAvailableIOS = async () =>
|
|
98
|
+
handleNativeException(callNative('isTagSessionAvailable'));
|
|
99
|
+
|
|
94
100
|
// -------------------------------------
|
|
95
101
|
// (iOS) NfcTech.MifareIOS API
|
|
96
102
|
// -------------------------------------
|
|
@@ -113,6 +113,14 @@ class Iso15693HandlerIOS {
|
|
|
113
113
|
);
|
|
114
114
|
}
|
|
115
115
|
|
|
116
|
+
extendedReadMultipleBlocks({flags, blockNumber, blockCount}) {
|
|
117
|
+
return handleNativeException(
|
|
118
|
+
callNative('iso15693_extendedReadMultipleBlocks', [
|
|
119
|
+
{flags, blockNumber, blockCount},
|
|
120
|
+
]),
|
|
121
|
+
);
|
|
122
|
+
}
|
|
123
|
+
|
|
116
124
|
extendedWriteSingleBlock({flags, blockNumber, dataBlock}) {
|
|
117
125
|
return handleNativeException(
|
|
118
126
|
callNative('iso15693_extendedWriteSingleBlock', [
|