Skip to content

Commit

Permalink
feat: invalidateSessionWithErrorIOS
Browse files Browse the repository at this point in the history
  • Loading branch information
whitedogg13 committed Oct 24, 2019
1 parent e95ea41 commit c631110
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
15 changes: 15 additions & 0 deletions NfcManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -847,6 +847,21 @@ class NfcManager {
})
}

invalidateSessionWithErrorIOS(errorMessage='Error') {
if (Platform.OS !== 'ios') {
return Promise.reject('not implemented');
}

return new Promise((resolve, reject) => {
NativeNfcManager.invalidateSessionWithError(errorMessage, (err) => {
if (err) {
reject(err);
} else {
resolve();
}
});
})
}
}

export default new NfcManager();
Expand Down
15 changes: 15 additions & 0 deletions ios/NfcManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,21 @@ + (BOOL)requiresMainQueueSetup
}
}

RCT_EXPORT_METHOD(invalidateSessionWithError:(NSString *)errorMessage callback:(nonnull RCTResponseSenderBlock)callback)
{
if (@available(iOS 13.0, *)) {
if (session != nil) {
[session invalidateSessionWithErrorMessage: errorMessage];
callback(@[]);
} else if (sessionEx != nil) {
[sessionEx invalidateSessionWithErrorMessage: errorMessage];
callback(@[]);
} else {
callback(@[@"No active session", [NSNull null]]);
}
}
}

RCT_EXPORT_METHOD(getTag: (nonnull RCTResponseSenderBlock)callback)
{
if (@available(iOS 13.0, *)) {
Expand Down

0 comments on commit c631110

Please sign in to comment.