|
| 1 | +diff --git a/node_modules/react-native-plaid-link-sdk/ios/RNLinksdk.mm b/node_modules/react-native-plaid-link-sdk/ios/RNLinksdk.mm |
| 2 | +index cca454e..a1b66d7 100644 |
| 3 | +--- a/node_modules/react-native-plaid-link-sdk/ios/RNLinksdk.mm |
| 4 | ++++ b/node_modules/react-native-plaid-link-sdk/ios/RNLinksdk.mm |
| 5 | +@@ -12,6 +12,12 @@ static NSString* const kRNLinkKitEventNameKey = @"event"; |
| 6 | + static NSString* const kRNLinkKitEventMetadataKey = @"metadata"; |
| 7 | + static NSString* const kRNLinkKitVersionConstant = @"version"; |
| 8 | + |
| 9 | ++// Tracks the module instance whose linkHandler is currently active for OAuth. |
| 10 | ++// Set when createPlaidLink succeeds, cleared whenever linkHandler is nilled. |
| 11 | ++// Lets JS forward universal-link OAuth redirects back into the SDK via |
| 12 | ++// the RCT_EXPORT_METHOD continueFromRedirectUri: below. |
| 13 | ++static RNLinksdk *sSharedInstance = nil; |
| 14 | ++ |
| 15 | + @interface RNLinksdk () |
| 16 | + @property (nonatomic, strong) id<PLKHandler> linkHandler; |
| 17 | + @property (nonatomic, strong) UIViewController* presentingViewController; |
| 18 | +@@ -92,6 +98,9 @@ RCT_EXPORT_METHOD(createPlaidLink:(NSString*)token noLoadingState:(BOOL)noLoadin |
| 19 | + } |
| 20 | + strongSelf.exitCallback = nil; |
| 21 | + strongSelf.linkHandler = nil; |
| 22 | ++ if (sSharedInstance == strongSelf) { |
| 23 | ++ sSharedInstance = nil; |
| 24 | ++ } |
| 25 | + } |
| 26 | + }; |
| 27 | + |
| 28 | +@@ -108,6 +117,9 @@ RCT_EXPORT_METHOD(createPlaidLink:(NSString*)token noLoadingState:(BOOL)noLoadin |
| 29 | + if (strongSelf.presentingViewController == nil) { |
| 30 | + // Deallocate the handler it's no longer needed. |
| 31 | + strongSelf.linkHandler = nil; |
| 32 | ++ if (sSharedInstance == strongSelf) { |
| 33 | ++ sSharedInstance = nil; |
| 34 | ++ } |
| 35 | + } |
| 36 | + } |
| 37 | + } |
| 38 | +@@ -121,6 +133,9 @@ RCT_EXPORT_METHOD(createPlaidLink:(NSString*)token noLoadingState:(BOOL)noLoadin |
| 39 | + NSError *creationError = nil; |
| 40 | + self.linkHandler = [RNPlaidHelper createWithLinkTokenConfiguration:config error:&creationError]; |
| 41 | + self.creationError = creationError; |
| 42 | ++ if (self.linkHandler) { |
| 43 | ++ sSharedInstance = self; |
| 44 | ++ } |
| 45 | + } |
| 46 | + |
| 47 | + RCT_EXPORT_METHOD(open:(BOOL)fullScreen onSuccess:(RCTResponseSenderBlock)onSuccess onExit:(RCTResponseSenderBlock)onExit) { |
| 48 | +@@ -175,6 +190,15 @@ RCT_EXPORT_METHOD(open:(BOOL)fullScreen onSuccess:(RCTResponseSenderBlock)onSucc |
| 49 | + } |
| 50 | + } |
| 51 | + |
| 52 | ++RCT_EXPORT_METHOD(continueFromRedirectUri:(NSString *)urlString) { |
| 53 | ++ NSURL *url = [NSURL URLWithString:urlString]; |
| 54 | ++ RNLinksdk *instance = sSharedInstance; |
| 55 | ++ if (url == nil || instance == nil || instance.linkHandler == nil) { |
| 56 | ++ return; |
| 57 | ++ } |
| 58 | ++ [instance.linkHandler resumeAfterTermination:url]; |
| 59 | ++} |
| 60 | ++ |
| 61 | + RCT_EXPORT_METHOD(dismiss) { |
| 62 | + [self.presentingViewController dismissViewControllerAnimated:YES |
| 63 | + completion:nil]; |
| 64 | +diff --git a/node_modules/react-native-plaid-link-sdk/src/fabric/NativePlaidLinkModuleiOS.ts b/node_modules/react-native-plaid-link-sdk/src/fabric/NativePlaidLinkModuleiOS.ts |
| 65 | +index a783aa9..a15e91f 100644 |
| 66 | +--- a/node_modules/react-native-plaid-link-sdk/src/fabric/NativePlaidLinkModuleiOS.ts |
| 67 | ++++ b/node_modules/react-native-plaid-link-sdk/src/fabric/NativePlaidLinkModuleiOS.ts |
| 68 | +@@ -12,6 +12,7 @@ export interface Spec extends TurboModule { |
| 69 | + onSuccess: (result: UnsafeObject<LinkSuccess>) => void, |
| 70 | + onExit: (error: UnsafeObject<LinkError>, result: UnsafeObject<LinkExit>) => void, |
| 71 | + ): void; |
| 72 | ++ continueFromRedirectUri(urlString: string): void; |
| 73 | + dismiss(): void; |
| 74 | + submit( |
| 75 | + phoneNumber: string | undefined, |
0 commit comments