Skip to content

Commit

Permalink
handoff fix
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgefspereira committed Apr 24, 2024
1 parent 844f569 commit 070f81f
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 3 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 3.1.8

* Updated iOS SDK to 4.7.6
* Fixed issue with handoff event.

## 3.1.7

* Updated Android SDK to 3.14.3
Expand Down
7 changes: 6 additions & 1 deletion ios/Classes/PlaidFlutterPlugin.m
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,8 @@ - (void) openWithArguments: (id _Nullable)arguments withResult:(FlutterResult)re
PLKOnExitHandler exitHandler = ^(PLKLinkExit *exit) {
__strong typeof(self) strongSelf = weakSelf;
[strongSelf close];
// No HANDOFF event for exit so we can deallocate this right away.
strongSelf->_linkHandler = nil;

NSMutableDictionary* arguments = [[NSMutableDictionary alloc] init];
[arguments setObject:kOnExitType forKey:kTypeKey];
Expand All @@ -133,6 +135,10 @@ - (void) openWithArguments: (id _Nullable)arguments withResult:(FlutterResult)re
[strongSelf sendEventWithArguments:@{kTypeKey: kOnEventType,
kNameKey: [PlaidFlutterPlugin stringForEventName: event.eventName] ?: @"",
kMetadataKey: [PlaidFlutterPlugin dictionaryFromEventMetadata: event.eventMetadata]}];
if (event.eventName.value == PLKEventNameValueHandoff) {
// This event is only received after onSuccess. So it's safe to deallocate the handler now.
strongSelf->_linkHandler = nil;
}
};

BOOL usingLinkToken = [token isKindOfClass:[NSString class]] && [token hasPrefix:kLinkTokenPrefix];
Expand Down Expand Up @@ -186,7 +192,6 @@ - (void) openWithArguments: (id _Nullable)arguments withResult:(FlutterResult)re
- (void) close {
UIViewController* rootViewController = [UIApplication sharedApplication].delegate.window.rootViewController;
[rootViewController dismissViewControllerAnimated:YES completion:nil];
_linkHandler = nil;
}

- (void) closeWithResult:(FlutterResult)result {
Expand Down
2 changes: 1 addition & 1 deletion ios/plaid_flutter.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Enables Plaid in Flutter apps.
s.source_files = 'Classes/**/*'
s.public_header_files = 'Classes/**/*.h'
s.dependency 'Flutter'
s.dependency 'Plaid', '4.7.5'
s.dependency 'Plaid', '4.7.6'
s.static_framework = true
s.ios.deployment_target = '11.0'
end
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: plaid_flutter
description: Plaid Link for Flutter. Integrates the native iOS, Android and Web SDKs.
version: 3.1.7
version: 3.1.8
homepage: https://github.com/jorgefspereira/plaid_flutter
repository: https://github.com/jorgefspereira/plaid_flutter
issue_tracker: https://github.com/jorgefspereira/plaid_flutter/issues
Expand Down

0 comments on commit 070f81f

Please sign in to comment.