From 8919438664f69f779f715877dd05824c2840f2e4 Mon Sep 17 00:00:00 2001 From: Claude Sutterlin Date: Thu, 2 Jul 2015 19:39:58 -0400 Subject: [PATCH] Exposing scannedImageDuration to SDK --- .../CardIOPaymentViewController.h | 7 +++++ Classes/CardIOContext.h | 2 +- Classes/CardIOContext.m | 1 + Classes/CardIOPaymentViewController.m | 2 ++ Classes/CardIOViewController.mm | 2 +- Classes/RootViewController.m | 2 ++ Classes/RootViewController.xib | 27 ++++++++++++++----- Classes/RootViewController~ipad.xib | 19 ++++++++++--- 8 files changed, 50 insertions(+), 12 deletions(-) diff --git a/CardIO_Public_API/CardIOPaymentViewController.h b/CardIO_Public_API/CardIOPaymentViewController.h index eaf8b506..320bab49 100644 --- a/CardIO_Public_API/CardIOPaymentViewController.h +++ b/CardIO_Public_API/CardIOPaymentViewController.h @@ -76,6 +76,13 @@ /// Defaults to NO. @property(nonatomic, assign, readwrite) BOOL suppressScannedCardImage; +/// After a successful scan, card.io will display an image of the card with +/// the computed card number superimposed. This property controls how long (in seconds) +/// that image will be displayed. +/// Set this to 0.0 to suppress the display entirely. +/// Defaults to 0.1. +@property(nonatomic, assign, readwrite) CGFloat scannedImageDuration; + /// Mask the card number digits as they are manually entered by the user. Defaults to NO. @property(nonatomic, assign, readwrite) BOOL maskManualEntryDigits; diff --git a/Classes/CardIOContext.h b/Classes/CardIOContext.h index 81b52bb1..fe70effe 100644 --- a/Classes/CardIOContext.h +++ b/Classes/CardIOContext.h @@ -28,7 +28,6 @@ @property(nonatomic, assign, readwrite) BOOL suppressScannedCardImage; @property(nonatomic, assign, readwrite) BOOL maskManualEntryDigits; - #if CARDIO_DEBUG @property(nonatomic, assign, readwrite) BOOL doABTesting; #endif @@ -39,6 +38,7 @@ @property(nonatomic, assign, readwrite) BOOL useCardIOLogo; @property(nonatomic, retain, readwrite) UIColor *guideColor; @property(nonatomic, assign, readwrite) BOOL allowFreelyRotatingCardGuide; +@property(nonatomic, assign, readwrite) CGFloat scannedImageDuration; @property(nonatomic, copy, readwrite) NSString *scanInstructions; @property(nonatomic, assign, readwrite) BOOL hideCardIOLogo; diff --git a/Classes/CardIOContext.m b/Classes/CardIOContext.m index b2116192..fa305ebb 100644 --- a/Classes/CardIOContext.m +++ b/Classes/CardIOContext.m @@ -37,6 +37,7 @@ - (void)set##prop_uc:(t)prop_lc { \ CONFIG_PASSTHROUGH_READWRITE(NSString *, languageOrLocale, LanguageOrLocale) CONFIG_PASSTHROUGH_READWRITE(BOOL, useCardIOLogo, UseCardIOLogo) CONFIG_PASSTHROUGH_READWRITE(UIColor *, guideColor, GuideColor) +CONFIG_PASSTHROUGH_READWRITE(CGFloat, scannedImageDuration, ScannedImageDuration) CONFIG_PASSTHROUGH_READWRITE(BOOL, allowFreelyRotatingCardGuide, AllowFreelyRotatingCardGuide) CONFIG_PASSTHROUGH_READWRITE(NSString *, scanInstructions, ScanInstructions) diff --git a/Classes/CardIOPaymentViewController.m b/Classes/CardIOPaymentViewController.m index b6bd5d80..52dbbcfe 100644 --- a/Classes/CardIOPaymentViewController.m +++ b/Classes/CardIOPaymentViewController.m @@ -77,6 +77,7 @@ - (id)initWithPaymentDelegate:(id)aDelegate if((self = [super initWithRootViewController:viewController])) { _context = context; + _context.scannedImageDuration = 0.1; _currentViewControllerIsDataEntry = [viewController isKindOfClass:[CardIODataEntryViewController class]]; _initialInterfaceOrientationForViewcontroller = [UIApplication sharedApplication].statusBarOrientation; #if USE_CAMERA || SIMULATE_CAMERA @@ -389,6 +390,7 @@ - (void)set##prop_uc:(t)prop_lc { \ CONTEXT_PASSTHROUGH_READWRITE(BOOL, suppressScanConfirmation, SuppressScanConfirmation) CONTEXT_PASSTHROUGH_READWRITE(BOOL, suppressScannedCardImage, SuppressScannedCardImage) CONTEXT_PASSTHROUGH_READWRITE(BOOL, maskManualEntryDigits, MaskManualEntryDigits) +CONTEXT_PASSTHROUGH_READWRITE(CGFloat, scannedImageDuration, ScannedImageDuration) CONTEXT_PASSTHROUGH_READWRITE(BOOL, allowFreelyRotatingCardGuide, AllowFreelyRotatingCardGuide) CONTEXT_PASSTHROUGH_GETTER(CardIOAnalytics *, scanReport) diff --git a/Classes/CardIOViewController.mm b/Classes/CardIOViewController.mm index 3e221103..cde0fac3 100644 --- a/Classes/CardIOViewController.mm +++ b/Classes/CardIOViewController.mm @@ -98,7 +98,7 @@ - (void)viewDidLoad { self.cardIOView.useCardIOLogo = self.context.useCardIOLogo; self.cardIOView.hideCardIOLogo = self.context.hideCardIOLogo; self.cardIOView.guideColor = self.context.guideColor; - self.cardIOView.scannedImageDuration = ((CGFloat) 0.1f); + self.cardIOView.scannedImageDuration = self.context.scannedImageDuration; self.cardIOView.allowFreelyRotatingCardGuide = self.context.allowFreelyRotatingCardGuide; self.cardIOView.scanInstructions = self.context.scanInstructions; diff --git a/Classes/RootViewController.m b/Classes/RootViewController.m index 306d43f2..7af1be23 100644 --- a/Classes/RootViewController.m +++ b/Classes/RootViewController.m @@ -36,6 +36,7 @@ @interface RootViewController () @property(nonatomic, strong, readwrite) IBOutlet UISwitch *useCardIOLogoSwitch; @property(nonatomic, strong, readwrite) IBOutlet UISwitch *doABTestingSwitch; @property(nonatomic, strong, readwrite) IBOutlet UISegmentedControl *modalPresentationStyleSegment; +@property(nonatomic, strong, readwrite) IBOutlet UITextField *scannedImageDurationField; @property(nonatomic, strong, readwrite) IBOutlet CardIOView *hideableCardIOView; @property(nonatomic, strong, readwrite) IBOutlet UIButton *languageButton; @@ -81,6 +82,7 @@ - (IBAction)scan { paymentVC.disableManualEntryButtons = self.disableManualEntrySwitch.on; paymentVC.useCardIOLogo = self.useCardIOLogoSwitch.on; paymentVC.allowFreelyRotatingCardGuide = NO; + paymentVC.scannedImageDuration = [self.scannedImageDurationField.text floatValue]; #if CARDIO_DEBUG paymentVC.doABTesting = self.doABTestingSwitch.on; #endif diff --git a/Classes/RootViewController.xib b/Classes/RootViewController.xib index f2b6605a..cf18a82b 100644 --- a/Classes/RootViewController.xib +++ b/Classes/RootViewController.xib @@ -1,8 +1,8 @@ - + - + @@ -22,6 +22,7 @@ + @@ -33,7 +34,7 @@ + + + + + + + diff --git a/Classes/RootViewController~ipad.xib b/Classes/RootViewController~ipad.xib index 823729a8..0676c57d 100644 --- a/Classes/RootViewController~ipad.xib +++ b/Classes/RootViewController~ipad.xib @@ -1,8 +1,8 @@ - + - + @@ -23,6 +23,7 @@ + @@ -209,7 +210,7 @@