rename module, restore export

This commit is contained in:
Michele Balistreri 2020-12-01 14:55:31 +03:00
parent ace294cdd6
commit 3f1e320b7a
3 changed files with 11 additions and 18 deletions

5
index.js Normal file
View File

@ -0,0 +1,5 @@
import { NativeModules } from 'react-native';
const { RNStatusKeycard } = NativeModules;
export default RNStatusKeycard;

View File

@ -1,11 +1,8 @@
#import <React/RCTBridgeModule.h>
@interface RCT_EXTERN_MODULE(StatusKeycard, NSObject)
@interface RCT_EXTERN_REMAP_MODULE(RNStatusKeycard, StatusKeycard, NSObject)
RCT_EXTERN_METHOD(multiply:(float)a withB:(float)b
withResolver:(RCTPromiseResolveBlock)resolve
withRejecter:(RCTPromiseRejectBlock)reject)
RCT_EXTERN_METHOD(hasKeycardSDK:(RCTPromiseResolveBlock)resolve rejecter: (RCTPromiseRejectBlock)reject)
RCT_EXTERN_METHOD(hasNFC:(RCTPromiseResolveBlock)resolve rejecter: (RCTPromiseRejectBlock)reject)
RCT_EXTERN_METHOD(nfcIsSupported:(RCTPromiseResolveBlock)resolve rejecter: (RCTPromiseRejectBlock)reject)
RCT_EXTERN_METHOD(openNfcSettings:(RCTPromiseResolveBlock)resolve rejecter: (RCTPromiseRejectBlock)reject)
@end

View File

@ -7,11 +7,6 @@ class StatusKeycard: NSObject {
@available(iOS 13.0, *)
private(set) lazy var keycardController: KeycardController? = nil
@objc(multiply:withB:withResolver:withRejecter:)
func multiply(a: Float, b: Float, resolve:RCTPromiseResolveBlock,reject:RCTPromiseRejectBlock) -> Void {
resolve(a*b)
}
@objc
func select() {
if #available(iOS 13.0, *) {
@ -37,16 +32,12 @@ class StatusKeycard: NSObject {
}
@objc
func hasKeycardSDK(_ resolve: RCTPromiseResolveBlock, rejecter _: RCTPromiseRejectBlock) -> Void {
if #available(iOS 13.0, *) {
resolve(true)
} else {
resolve(false)
}
func openNfcSettings(_ resolve: RCTPromiseResolveBlock, rejecter reject: RCTPromiseRejectBlock) -> Void {
reject("E_KEYCARD", "Unsupported on iOS", nil)
}
@objc
func hasNFC(_ resolve: RCTPromiseResolveBlock, rejecter _: RCTPromiseRejectBlock) -> Void {
func nfcIsSupported(_ resolve: RCTPromiseResolveBlock, rejecter _: RCTPromiseRejectBlock) -> Void {
if #available(iOS 13.0, *) {
resolve(KeycardController.isAvailable)
} else {