Skip to content

Commit

Permalink
#20 Crash tinkof-ASDK-ios when enter card number
Browse files Browse the repository at this point in the history
ASDK-452 После удаления привязанной карты больше нельзя ввести новые реквизиты
  • Loading branch information
Budnikov Vyacheslav committed Oct 1, 2018
1 parent 626d914 commit e5fc1ba
Show file tree
Hide file tree
Showing 12 changed files with 86 additions and 82 deletions.
2 changes: 1 addition & 1 deletion ASDKCore.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
Pod::Spec.new do |s|

s.name = "ASDKCore"
s.version = "1.3.13"
s.version = "1.3.14"
s.summary = "Core library that allows you to use internet acquiring from Tinkoff Bank in your app"
s.description = "Core library that allows you to use internet acquiring from Tinkoff Bank in your app!"

Expand Down
2 changes: 1 addition & 1 deletion ASDKCore/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.3.13</string>
<string>1.3.14</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
Expand Down
2 changes: 1 addition & 1 deletion ASDKUI.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "ASDKUI"
s.version = "1.3.13"
s.version = "1.3.14"
s.summary = "UI components library for internet acquiring from Tinkoff Bank"
s.description = "UI components library for internet acquiring from Tinkoff Bank!"
s.homepage = "https://www.tinkoff.ru"
Expand Down
18 changes: 10 additions & 8 deletions ASDKUI/ASDKBaseTableViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,16 @@ - (void)viewDidLoad

ASDKPaymentFormStarter *paymentFormStarter = [ASDKPaymentFormStarter instance];
ASDKDesignConfiguration *designConfiguration = paymentFormStarter.designConfiguration;
self.navigationController.navigationBar.barStyle = [designConfiguration navigationBarStyle];
[self.navigationController.navigationBar setBackgroundImage:[ASDKUtils imageFromColor:[designConfiguration navigationBarColor]] forBarMetrics:UIBarMetricsDefault];

self.navigationController.navigationBar.tintColor = [designConfiguration navigationBarItemsTextColor];
self.navigationController.navigationBar.titleTextAttributes = @{NSForegroundColorAttributeName : [designConfiguration navigationBarItemsTextColor]};

self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
if (designConfiguration)
{
self.navigationController.navigationBar.barStyle = [designConfiguration navigationBarStyle];
[self.navigationController.navigationBar setBackgroundImage:[ASDKUtils imageFromColor:[designConfiguration navigationBarColor]] forBarMetrics:UIBarMetricsDefault];

self.navigationController.navigationBar.tintColor = [designConfiguration navigationBarItemsTextColor];
self.navigationController.navigationBar.titleTextAttributes = @{NSForegroundColorAttributeName: [designConfiguration navigationBarItemsTextColor]};

self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
}
}

- (BOOL)shouldAutorotate
Expand All @@ -48,5 +51,4 @@ - (UIInterfaceOrientationMask)supportedInterfaceOrientations
return UIInterfaceOrientationMaskPortrait;
}


@end
29 changes: 11 additions & 18 deletions ASDKUI/ASDKBaseViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -22,31 +22,24 @@
#import "ASDKDesign.h"
#import "ASDKPaymentFormStarter.h"

@interface ASDKBaseViewController ()

@end

@implementation ASDKBaseViewController

- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view.


ASDKPaymentFormStarter *paymentFormStarter = [ASDKPaymentFormStarter instance];
ASDKDesignConfiguration *designConfiguration = paymentFormStarter.designConfiguration;
NSLog(@"DESIGN!!! %@",designConfiguration);
self.navigationController.navigationBar.barStyle = [designConfiguration navigationBarStyle];
[self.navigationController.navigationBar setBackgroundImage:[ASDKUtils imageFromColor:[designConfiguration navigationBarColor]] forBarMetrics:UIBarMetricsDefault];

self.navigationController.navigationBar.barTintColor = [designConfiguration navigationBarColor];
self.navigationController.navigationBar.tintColor = [designConfiguration navigationBarItemsTextColor];
self.navigationController.navigationBar.titleTextAttributes = @{NSForegroundColorAttributeName : [designConfiguration navigationBarItemsTextColor]};
}

- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
if (designConfiguration)
{
NSLog(@"DESIGN!!! %@",designConfiguration);
self.navigationController.navigationBar.barStyle = [designConfiguration navigationBarStyle];
[self.navigationController.navigationBar setBackgroundImage:[ASDKUtils imageFromColor:[designConfiguration navigationBarColor]] forBarMetrics:UIBarMetricsDefault];

self.navigationController.navigationBar.barTintColor = [designConfiguration navigationBarColor];
self.navigationController.navigationBar.tintColor = [designConfiguration navigationBarItemsTextColor];
self.navigationController.navigationBar.titleTextAttributes = @{NSForegroundColorAttributeName : [designConfiguration navigationBarItemsTextColor]};
}
}

- (UIInterfaceOrientationMask)supportedInterfaceOrientations
Expand Down
2 changes: 1 addition & 1 deletion ASDKUI/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.3.13</string>
<string>1.3.14</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
Expand Down
25 changes: 15 additions & 10 deletions ASDKUI/Payment/ASDKAttachCardViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,12 @@ @interface ASDKAttachCardViewController () <UITextFieldDelegate>
@property (nonatomic, strong) UIView *customSecureLogo;
@property (nonatomic, assign) CGFloat keyboardHeight;

@property (nonatomic, strong) NSString *cardCheckType;
@property (nonatomic, strong) NSString *viewTitleHead;
@property (nonatomic, strong) NSString *cardTitle;
@property (nonatomic, strong) NSString *cardDescription;
@property (nonatomic, strong) NSString *preStateValueEmail;
@property (nonatomic, strong) NSString *customerKey;
@property (nonatomic, copy) NSString *cardCheckType;
@property (nonatomic, copy) NSString *viewTitleHead;
@property (nonatomic, copy) NSString *cardTitle;
@property (nonatomic, copy) NSString *cardDescription;
@property (nonatomic, copy) NSString *preStateValueEmail;
@property (nonatomic, copy) NSString *customerKey;
@property (nonatomic, strong) NSDictionary *additionalData;

@end
Expand Down Expand Up @@ -98,7 +98,7 @@ - (void)viewDidLoad
{
[super viewDidLoad];

if (self.viewTitleHead.length > 0)
if (self.viewTitleHead != nil && self.viewTitleHead.length > 0)
{
self.title = self.viewTitleHead;
}
Expand Down Expand Up @@ -840,10 +840,15 @@ - (void)manageError:(ASDKAcquringSdkError *)error
}
else
{
NSString *alertTitle = error.errorMessage ? error.errorMessage : @"Ошибка";
NSString *alertDetails = error.errorDetails ? error.errorDetails : error.userInfo[kASDKStatus];

UIAlertController *alertController = [UIAlertController alertControllerWithTitle:alertTitle message:alertDetails preferredStyle:UIAlertControllerStyleAlert];
NSString *alertMessage = error.errorMessage ? error.errorMessage : @"";

if ( alertDetails.length > 0)
{
alertMessage = [NSString stringWithFormat:@"%@ %@", alertMessage, alertDetails];
}

UIAlertController *alertController = [UIAlertController alertControllerWithTitle:LOC(@"Common.error") message:alertMessage preferredStyle:UIAlertControllerStyleAlert];

UIAlertAction *cancelAction = [UIAlertAction
actionWithTitle:LOC(@"Common.Close")
Expand Down
4 changes: 2 additions & 2 deletions ASDKUI/Payment/PaymentFormStarter/ASDKDesignConfiguration.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ typedef NS_ENUM(NSUInteger, TableViewCellType)
CellProductTitle = 1,
CellProductDescription,
CellAmount,
CellPaymentCardRequisites,
CellPaymentCardRequisites, // required field
CellEmail,
CellPayButton,
CellAttachButton,
CellSecureLogos,
CellSecureLogos, // required field
CellEmpty20px,
CellEmpty5px,
CellEmptyFlexibleSpace
Expand Down
66 changes: 33 additions & 33 deletions ASDKUI/Payment/PaymentFormStarter/ASDKDesignConfiguration.m
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,18 @@

@interface ASDKDesignConfiguration ()

@property (nonatomic, strong) UIColor *navigationBarColor;
@property (nonatomic, strong) UIColor *navigationBarItemsTextColor;
@property (nonatomic) UIBarStyle navigationBarStyle;
@property (nonatomic, strong) UIColor *_navigationBarColor;
@property (nonatomic, strong) UIColor *_navigationBarItemsTextColor;
@property (nonatomic) UIBarStyle _navigationBarStyle;

@property (nonatomic, strong) UIColor *payButtonColor;
@property (nonatomic, strong) UIColor *payButtonPressedColor;
@property (nonatomic, strong) UIColor *payButtonTextColor;
@property (nonatomic, strong) UIColor *_payButtonColor;
@property (nonatomic, strong) UIColor *_payButtonPressedColor;
@property (nonatomic, strong) UIColor *_payButtonTextColor;

@property (nonatomic, strong) NSString *_payButtonTitle;
@property (nonatomic, strong) NSAttributedString *_payButtonAttributedTitle;

@property (nonatomic, strong) UIBarButtonItem *backButton;
@property (nonatomic, strong) UIBarButtonItem *_backButton;
@property (nonatomic, strong) NSArray *_payFormItems;
@property (nonatomic, strong) UIView *_paymentsSecureLogosView;
@property (nonatomic, strong) UIButton *_customPayButton;
Expand All @@ -51,9 +51,9 @@ - (id)init
{
if (self = [super init])
{
_navigationBarStyle = UIBarStyleDefault;
_navigationBarColor = UIColor.whiteColor;
_navigationBarItemsTextColor = UIColor.blackColor;
__navigationBarStyle = UIBarStyleDefault;
__navigationBarColor = UIColor.whiteColor;
__navigationBarItemsTextColor = UIColor.blackColor;
__presentStyleModal = UIModalPresentationFullScreen;
}

Expand All @@ -64,81 +64,78 @@ - (void)setNavigationBarColor:(UIColor *)navigationBarColor
navigationBarItemsTextColor:(UIColor *)navigationBarItemsTextColor
navigationBarStyle:(UIBarStyle)navigationBarStyle
{
_navigationBarColor = navigationBarColor;
_navigationBarItemsTextColor = navigationBarItemsTextColor;
_navigationBarStyle = navigationBarStyle;
__navigationBarColor = navigationBarColor;
__navigationBarItemsTextColor = navigationBarItemsTextColor;
__navigationBarStyle = navigationBarStyle;
}

- (UIColor *)navigationBarColor
{
if (_navigationBarColor)
if (self._navigationBarColor)
{
return _navigationBarColor;
return self._navigationBarColor;
}

return [ASDKDesign colorNavigationBar];
}

- (UIColor *)navigationBarItemsTextColor
{
if (_navigationBarItemsTextColor)
if (self._navigationBarItemsTextColor)
{
return _navigationBarItemsTextColor;
return self._navigationBarItemsTextColor;
}

return [UIColor whiteColor];
}

- (UIBarStyle)navigationBarStyle
{
return _navigationBarStyle;
return self._navigationBarStyle;
}




- (void)setPayButtonColor:(UIColor *)payButtonColor payButtonPressedColor:(UIColor *)payButtonPressedColor payButtonTextColor:(UIColor *)payButtonTextColor
{
_payButtonColor = payButtonColor;
_payButtonPressedColor = payButtonPressedColor;
_payButtonTextColor = payButtonTextColor;
self._payButtonColor = payButtonColor;
self._payButtonPressedColor = payButtonPressedColor;
self._payButtonTextColor = payButtonTextColor;
}

- (void)setCustomBackButton:(UIBarButtonItem *)backButton
{
_backButton = backButton;
self._backButton = backButton;
}

- (UIBarButtonItem *)customBackButton
{
return _backButton;
return self._backButton;
}

- (UIColor *)payButtonColor
{
if (_payButtonColor)
if (self._payButtonColor)
{
return _payButtonColor;
return self._payButtonColor;
}

return [ASDKDesign colorPayButton];
}

- (UIColor *)payButtonPressedColor
{
if (_payButtonPressedColor)
if (self._payButtonPressedColor)
{
return _payButtonPressedColor;
return self._payButtonPressedColor;
}

return [ASDKDesign colorPayButtonPressed];
}

- (UIColor *)payButtonTextColor
{
if (_payButtonTextColor)
if (self._payButtonTextColor)
{
return _payButtonTextColor;
return self._payButtonTextColor;
}

return [ASDKDesign colorTextDark];
Expand Down Expand Up @@ -207,7 +204,10 @@ - (BOOL)checkCellItems:(NSArray *)items
*stop = YES;
}
}];


NSAssert([items indexOfObjectIdenticalTo:@(CellSecureLogos)] != NSNotFound, @"CellSecureLogos is required field");
NSAssert([items indexOfObjectIdenticalTo:@(CellPaymentCardRequisites)] != NSNotFound, @"CellPaymentCardRequisites is required field");

return result;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,11 @@ - (void)updateSelectedExternalCardOnStart
_shouldShowKeyboardWhenNewCardSelected = YES;
}
}
else
{
[self setSelectedCard:nil];
_shouldShowKeyboardWhenNewCardSelected = YES;
}
}
else
{
Expand Down Expand Up @@ -490,8 +495,7 @@ - (void)setSelectedCard:(ASDKCard *)selectedCard

- (IBAction)cancelAction:(id)sender
{
[self closeSelfWithCompletion:^
{
[self closeSelfWithCompletion:^{
if (self.onCancelled)
{
self.onCancelled();
Expand Down
6 changes: 3 additions & 3 deletions SampleProject/ASDKSampleApp/Source/PayController.m
Original file line number Diff line number Diff line change
Expand Up @@ -397,9 +397,9 @@ + (void)attachCard:(NSString *)cardCheckType additionalData:(NSDictionary *)data
paymentFormStarter.cardScanner = [ASDKCardIOScanner scanner];

[paymentFormStarter presentAttachFormFromViewController:viewController
formTitle:nil//@"Новая карта"
formHeader:nil//@"Сохраните данные карты"
description:nil//@"и оплачивайте, не вводя реквизиты"
formTitle:@"Новая карта"
formHeader:@"Сохраните данные карты"
description:@"и оплачивайте, не вводя реквизиты"
email:@"[email protected]"
cardCheckType:cardCheckType
customerKey:[PayController customerKey]
Expand Down
4 changes: 2 additions & 2 deletions SampleProject/ASDKSampleApp/Supporting files/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.3.13</string>
<string>1.3.14</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>65</string>
<string>66</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSAppTransportSecurity</key>
Expand Down

0 comments on commit e5fc1ba

Please sign in to comment.