Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reset scan view controller on rescanning (on iOS) #7

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@
.pub/

build/
example/.flutter-plugins-dependencies
59 changes: 54 additions & 5 deletions example/pubspec.lock
Original file line number Diff line number Diff line change
@@ -1,13 +1,27 @@
# Generated by pub
# See https://dart.dev/tools/pub/glossary#lockfile
packages:
archive:
dependency: transitive
description:
name: archive
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.11"
args:
dependency: transitive
description:
name: args
url: "https://pub.dartlang.org"
source: hosted
version: "1.5.2"
async:
dependency: transitive
description:
name: async
url: "https://pub.dartlang.org"
source: hosted
version: "2.3.0"
version: "2.4.0"
boolean_selector:
dependency: transitive
description:
Expand All @@ -29,13 +43,27 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.14.11"
convert:
dependency: transitive
description:
name: convert
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.1"
core_card_io:
dependency: "direct dev"
description:
path: ".."
relative: true
source: path
version: "1.0.0"
crypto:
dependency: transitive
description:
name: crypto
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.3"
cupertino_icons:
dependency: "direct main"
description:
Expand All @@ -53,20 +81,27 @@ packages:
description: flutter
source: sdk
version: "0.0.0"
image:
dependency: transitive
description:
name: image
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.4"
matcher:
dependency: transitive
description:
name: matcher
url: "https://pub.dartlang.org"
source: hosted
version: "0.12.5"
version: "0.12.6"
meta:
dependency: transitive
description:
name: meta
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.7"
version: "1.1.8"
path:
dependency: transitive
description:
Expand All @@ -81,6 +116,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.0+1"
petitparser:
dependency: transitive
description:
name: petitparser
url: "https://pub.dartlang.org"
source: hosted
version: "2.4.0"
quiver:
dependency: transitive
description:
Expand Down Expand Up @@ -134,7 +176,7 @@ packages:
name: test_api
url: "https://pub.dartlang.org"
source: hosted
version: "0.2.5"
version: "0.2.11"
typed_data:
dependency: transitive
description:
Expand All @@ -149,5 +191,12 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.8"
xml:
dependency: transitive
description:
name: xml
url: "https://pub.dartlang.org"
source: hosted
version: "3.5.0"
sdks:
dart: ">=2.2.2 <3.0.0"
dart: ">=2.4.0 <3.0.0"
4 changes: 3 additions & 1 deletion ios/Classes/CoreCardIoPlugin.m
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ - (instancetype)initWithViewController:(UIViewController *)viewController {
self = [super init];
if (self) {
_viewController = viewController;
_scanViewController = [[CardIOPaymentViewController alloc] initWithPaymentDelegate:self];
}
return self;
}
Expand All @@ -38,6 +37,7 @@ - (void)handleMethodCall:(FlutterMethodCall*)call result:(FlutterResult)result {
}

if ([@"scanCard" isEqualToString:call.method]) {
_scanViewController = [[CardIOPaymentViewController alloc] initWithPaymentDelegate:self];
_scanViewController.delegate = self;

_result = result;
Expand All @@ -64,6 +64,7 @@ - (void)handleMethodCall:(FlutterMethodCall*)call result:(FlutterResult)result {

- (void)userDidCancelPaymentViewController:(CardIOPaymentViewController *)paymentViewController {
[_scanViewController dismissViewControllerAnimated:YES completion:nil];
_scanViewController = nil;
_result([NSNull null]);
_result = nil;
_arguments = nil;
Expand Down Expand Up @@ -103,6 +104,7 @@ - (void)userDidProvideCreditCardInfo:(CardIOCreditCardInfo *)info inPaymentViewC
@"postalCode": ObjectOrNull(info.postalCode)
});
[_scanViewController dismissViewControllerAnimated:YES completion:nil];
_scanViewController = nil;
_result = nil;
_arguments = nil;
}
Expand Down