Skip to content

Commit

Permalink
Merge pull request #66 from getbouncer/kingst/await_ready
Browse files Browse the repository at this point in the history
Ready call for iOS
  • Loading branch information
kingst-stripe authored Oct 13, 2021
2 parents 7f7a919 + 002b311 commit 9636dd6
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
3 changes: 2 additions & 1 deletion example/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ export default () => {
const [recentAction, setRecentAction] = useState('none');

const downloadModels = useCallback(async () => {
alert(await CardVerify.downloadModels());
CardVerify.downloadModels();
alert(await CardVerify.awaitReady());
}, []);

const scanCard = useCallback(async () => {
Expand Down
2 changes: 2 additions & 0 deletions ios/RNCardVerify.m
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
@interface RCT_EXTERN_MODULE(RNCardVerify, NSObject)
RCT_EXTERN_METHOD(isSupportedAsync:(RCTPromiseResolveBlock)resolve
:(RCTPromiseRejectBlock)reject)
RCT_EXTERN_METHOD(awaitReady:(RCTPromiseResolveBlock)resolve
:(RCTPromiseRejectBlock)reject)
RCT_EXTERN_METHOD(scan:(NSString * _Nullable)requiredIin
:(NSString * _Nullable)requiredLastFour
:(BOOL)skipVerificationOnModelDownloadFailure
Expand Down
9 changes: 8 additions & 1 deletion ios/RNCardVerify.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,14 @@ class RNCardVerify: NSObject {
@objc class func requiresMainQueueSetup() -> Bool {
return true
}


@objc func awaitReady(
_ resolve: RCTPromiseResolveBlock,
_ reject: RCTPromiseRejectBlock
) -> Void {
resolve([true])
}

@objc func isSupportedAsync(
_ resolve: RCTPromiseResolveBlock,
_ reject: RCTPromiseRejectBlock
Expand Down

0 comments on commit 9636dd6

Please sign in to comment.