Skip to content

Commit 4670689

Browse files
committed
feat: add HCE support for ios
1 parent c28e2f2 commit 4670689

File tree

4 files changed

+28
-3
lines changed

4 files changed

+28
-3
lines changed

example/ios/Podfile.lock

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1940,12 +1940,12 @@ EXTERNAL SOURCES:
19401940

19411941
CHECKOUT OPTIONS:
19421942
AkilesSDK:
1943-
:commit: 4337e0879ac16e3b8837492436b651fb4719c2cd
1943+
:commit: 2c1661d660bf74656085f8f7a166ede228d56f5e
19441944
:git: https://github.com/akiles/akiles-ios.git
19451945

19461946
SPEC CHECKSUMS:
19471947
Akiles: b9f50634e8bca29c39e034d9afe67d54e67e8e12
1948-
AkilesSDK: 809967590be3e50bdd50edaa91559ef9ddee6b96
1948+
AkilesSDK: a749c207ba610e45b18a305cb5bfb12a47fab998
19491949
boost: 7e761d76ca2ce687f7cc98e698152abd03a18f90
19501950
DoubleConversion: cb417026b2400c8f53ae97020b2be961b59470cb
19511951
fast_float: 06eeec4fe712a76acc9376682e4808b05ce978b6
@@ -2013,7 +2013,7 @@ SPEC CHECKSUMS:
20132013
React-timing: a90f4654cbda9c628614f9bee68967f1768bd6a5
20142014
React-utils: a612d50555b6f0f90c74b7d79954019ad47f5de6
20152015
ReactAppDependencyProvider: 04d5eb15eb46be6720e17a4a7fa92940a776e584
2016-
ReactCodegen: c63eda03ba1d94353fb97b031fc84f75a0d125ba
2016+
ReactCodegen: b1776680e51e03ed2b03adc39466fc55c30ca18d
20172017
ReactCommon: 76d2dc87136d0a667678668b86f0fca0c16fdeb0
20182018
RNCPicker: e51a9eb07c7dfbfba3d6c6cc567e083376c717cc
20192019
SocketRocket: d4aabe649be1e368d1318fdf28a022d714d65748

ios/AkilesAdapter.mm

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -471,6 +471,18 @@ - (NSString *)syncStatusString:(SyncStatus)status
471471
}];
472472
}
473473

474+
RCT_EXPORT_METHOD(startCardEmulation:(NSString *)language resolve:(RCTPromiseResolveBlock)resolve
475+
reject:(RCTPromiseRejectBlock)reject)
476+
{
477+
[self.akiles createCardSession:language completion:^(BOOL success, NSError * _Nullable error) {
478+
if (error) {
479+
resolve([self errorResultFromNSError:error]);
480+
} else {
481+
resolve([self successResultWithData:nil]);
482+
}
483+
}];
484+
}
485+
474486
RCT_EXPORT_SYNCHRONOUS_TYPED_METHOD(NSString *, scan)
475487
{
476488
NSString *opId = [[NSUUID UUID] UUIDString];

src/NativeAkiles.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,7 @@ export interface Spec extends TurboModule {
348348
cancel(opId: string): void;
349349
isBluetoothSupported(): boolean;
350350
isCardEmulationSupported(): Promise<boolean>;
351+
startCardEmulation(language: string): Promise<{ error?: ErrorInfo }>; // iOS only
351352
}
352353

353354
export default TurboModuleRegistry.getEnforcing<Spec>('AkilesAdapter');

src/index.tsx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -416,6 +416,18 @@ export async function isCardEmulationSupported(): Promise<boolean> {
416416
return await Akiles.isCardEmulationSupported();
417417
}
418418

419+
/**
420+
* Starts NFC Host Card Emulation.
421+
*
422+
* @returns A promise that resolves when the emulation is complete.
423+
* @throws AkilesError if an error occurs.
424+
*/
425+
export async function startCardEmulation(language: string): Promise<void> {
426+
const { error } = await Akiles.startCardEmulation(language);
427+
if (error) throw convertError(error);
428+
return;
429+
}
430+
419431
// Card class with uid, isAkilesCard, update, and close methods
420432
export class Card {
421433
constructor(

0 commit comments

Comments
 (0)