From bb8198a9bbecc3c22eb76921aca18ba51cd9c71b Mon Sep 17 00:00:00 2001 From: Yerzhan Date: Tue, 11 Feb 2020 16:32:28 +0600 Subject: [PATCH] Reset scan view controller on rescanning --- .gitignore | 1 + example/pubspec.lock | 59 +++++++++++++++++++++++++++++++--- ios/Classes/CoreCardIoPlugin.m | 4 ++- 3 files changed, 58 insertions(+), 6 deletions(-) diff --git a/.gitignore b/.gitignore index e9dc58d..0db5a2f 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ .pub/ build/ +example/.flutter-plugins-dependencies diff --git a/example/pubspec.lock b/example/pubspec.lock index 526342a..829f098 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -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: @@ -29,6 +43,13 @@ 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: @@ -36,6 +57,13 @@ packages: 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: @@ -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: @@ -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: @@ -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: @@ -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" diff --git a/ios/Classes/CoreCardIoPlugin.m b/ios/Classes/CoreCardIoPlugin.m index e5ea86f..bbbf922 100644 --- a/ios/Classes/CoreCardIoPlugin.m +++ b/ios/Classes/CoreCardIoPlugin.m @@ -24,7 +24,6 @@ - (instancetype)initWithViewController:(UIViewController *)viewController { self = [super init]; if (self) { _viewController = viewController; - _scanViewController = [[CardIOPaymentViewController alloc] initWithPaymentDelegate:self]; } return self; } @@ -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; @@ -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; @@ -103,6 +104,7 @@ - (void)userDidProvideCreditCardInfo:(CardIOCreditCardInfo *)info inPaymentViewC @"postalCode": ObjectOrNull(info.postalCode) }); [_scanViewController dismissViewControllerAnimated:YES completion:nil]; + _scanViewController = nil; _result = nil; _arguments = nil; }