iOS compatibility
This commit is contained in:
parent
52a4db3110
commit
0e6b891deb
|
@ -494,8 +494,10 @@
|
|||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CODE_SIGN_ENTITLEMENTS = keycardExit/keycardExit.entitlements;
|
||||
CODE_SIGN_IDENTITY = "Apple Development";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
DEVELOPMENT_TEAM = 53K9KT584X;
|
||||
DEVELOPMENT_TEAM = 8B5X2M6H2Y;
|
||||
ENABLE_BITCODE = NO;
|
||||
INFOPLIST_FILE = keycardExit/Info.plist;
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
|
@ -510,6 +512,7 @@
|
|||
);
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)";
|
||||
PRODUCT_NAME = keycardExit;
|
||||
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||
SWIFT_VERSION = 5.0;
|
||||
VERSIONING_SYSTEM = "apple-generic";
|
||||
|
@ -523,8 +526,10 @@
|
|||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CODE_SIGN_ENTITLEMENTS = keycardExit/keycardExit.entitlements;
|
||||
CODE_SIGN_IDENTITY = "Apple Development";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
DEVELOPMENT_TEAM = 53K9KT584X;
|
||||
DEVELOPMENT_TEAM = 8B5X2M6H2Y;
|
||||
INFOPLIST_FILE = keycardExit/Info.plist;
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
|
@ -538,6 +543,7 @@
|
|||
);
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)";
|
||||
PRODUCT_NAME = keycardExit;
|
||||
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||
SWIFT_VERSION = 5.0;
|
||||
VERSIONING_SYSTEM = "apple-generic";
|
||||
};
|
||||
|
|
|
@ -2,6 +2,14 @@
|
|||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>com.apple.developer.nfc.readersession.iso7816.select-identifiers</key>
|
||||
<array>
|
||||
<string>A00000080400010101</string>
|
||||
<string>A00000080400010301</string>
|
||||
<string>A000000151000000</string>
|
||||
</array>
|
||||
<key>NFCReaderUsageDescription</key>
|
||||
<string>Enable Keycard</string>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>en</string>
|
||||
<key>CFBundleDisplayName</key>
|
||||
|
@ -32,7 +40,7 @@
|
|||
<true/>
|
||||
</dict>
|
||||
<key>NSLocationWhenInUseUsageDescription</key>
|
||||
<string/>
|
||||
<string></string>
|
||||
<key>UILaunchStoryboardName</key>
|
||||
<string>LaunchScreen</string>
|
||||
<key>UIRequiredDeviceCapabilities</key>
|
||||
|
|
20
src/Main.tsx
20
src/Main.tsx
|
@ -1,5 +1,5 @@
|
|||
import React, { useEffect, useRef, useState } from 'react';
|
||||
import { SafeAreaView, StyleSheet, DeviceEventEmitter } from 'react-native';
|
||||
import { SafeAreaView, StyleSheet, NativeEventEmitter } from 'react-native';
|
||||
import AsyncStorage from '@react-native-async-storage/async-storage';
|
||||
|
||||
import DiscoveryScreen from './components/steps/DiscoveryScreen';
|
||||
|
@ -61,7 +61,6 @@ const Main = () => {
|
|||
|
||||
try {
|
||||
const appInfo = await Keycard.getApplicationInfo();
|
||||
|
||||
if (appInfo["new-pairing"]) {
|
||||
await addPairing(appInfo["instance-uid"], appInfo["new-pairing"]);
|
||||
}
|
||||
|
@ -122,6 +121,12 @@ const Main = () => {
|
|||
stepRef.current = step;
|
||||
isListeningCard.current = isModalVisible;
|
||||
|
||||
const eventEmitter = new NativeEventEmitter(Keycard);
|
||||
let onConnectedListener = eventEmitter.addListener('keyCardOnConnected', keycardConnectHandler);
|
||||
let onDisconnectedListener = eventEmitter.addListener('keyCardOnDisconnected', () => console.log("keycard disconnected"));
|
||||
let onNFCEnabledListener = eventEmitter.addListener('keyCardOnNFCEnabled', () => console.log("nfc enabled"));
|
||||
let onNFCDisabledListener = eventEmitter.addListener('keyCardOnNFCDisabled', () => console.log("nfc disabled"));
|
||||
|
||||
if (!didMount.current) {
|
||||
didMount.current = true;
|
||||
|
||||
|
@ -130,11 +135,14 @@ const Main = () => {
|
|||
};
|
||||
|
||||
loadPairing().catch(console.log);
|
||||
DeviceEventEmitter.addListener("keyCardOnConnected", keycardConnectHandler);
|
||||
DeviceEventEmitter.addListener("keyCardOnDisconnected", () => console.log("keycard disconnected"));
|
||||
DeviceEventEmitter.addListener("keyCardOnNFCEnabled", () => console.log("nfc enabled"));
|
||||
DeviceEventEmitter.addListener("keyCardOnNFCDisabled", () => console.log("nfc disabled"));
|
||||
}
|
||||
|
||||
return () => {
|
||||
onConnectedListener.remove();
|
||||
onDisconnectedListener.remove();
|
||||
onNFCEnabledListener.remove();
|
||||
onNFCDisabledListener.remove();
|
||||
};
|
||||
});
|
||||
|
||||
const connectCard = async () => {
|
||||
|
|
Loading…
Reference in New Issue