Skip to content

Commit

Permalink
ASDK-436
Browse files Browse the repository at this point in the history
  • Loading branch information
Budnikov Vyacheslav committed Dec 4, 2017
1 parent ab510f5 commit 7617a88
Show file tree
Hide file tree
Showing 13 changed files with 130 additions and 57 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,9 @@ - (void)viewDidLoad
style:UIBarButtonItemStylePlain
target:self
action:@selector(cancelAction:)];


cancelButton.tintColor = self.navigationController.navigationBar.tintColor;

[self.navigationItem setLeftBarButtonItem:cancelButton];
}

Expand Down
21 changes: 20 additions & 1 deletion ASDKUI/Payment/PaymentFormStarter/ASDKDesignConfiguration.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
// See the License for the specific language governing permissions and
// limitations under the License.


#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>

Expand All @@ -36,13 +35,15 @@ typedef NS_ENUM(NSUInteger, TableViewCellType)
};

@interface ASDKDesignConfiguration : NSObject

/*!
* @discussion Настройка цветов в навигейшн баре
*
* @param navigationBarColor цвет фона
* @param navigationBarItemsTextColor цвет текста
* @param navigationBarStyle бар стайл
*/

- (void)setNavigationBarColor:(UIColor *)navigationBarColor
navigationBarItemsTextColor:(UIColor *)navigationBarItemsTextColor
navigationBarStyle:(UIBarStyle)navigationBarStyle;
Expand All @@ -63,6 +64,7 @@ typedef NS_ENUM(NSUInteger, TableViewCellType)
*
* @param title - строка, выравнивается по центу
*/

- (void)setPayButtonTitle:(NSString *)title;
- (NSString *)payButtonTitle;

Expand All @@ -77,6 +79,7 @@ typedef NS_ENUM(NSUInteger, TableViewCellType)
*
* @param title - строка с атрибутами, выравнивается по центу
*/

- (void)setPayButtonAttributedTitle:(NSAttributedString *)title;
- (NSAttributedString *)payButtonAttributedTitle;

Expand All @@ -90,6 +93,7 @@ typedef NS_ENUM(NSUInteger, TableViewCellType)
* CellProductTitle, CellProductDescription, CellAmount, CellPyamentCardRequisites,
* CellEmail, CellPayButton, (CellSecureLogos)
*/

- (void)setPayFormItems:(NSArray *)items;
- (NSArray*)payFormItems;

Expand All @@ -98,6 +102,7 @@ typedef NS_ENUM(NSUInteger, TableViewCellType)
*
* @param view - любое uivew, элемент устанавливается вертикально по центру, значание высоты берется равной высоте контента.
*/

- (void)setPaymentsSecureLogosView:(UIView *)view;
- (UIView *)paymentsSecureLogosView;

Expand All @@ -114,4 +119,18 @@ typedef NS_ENUM(NSUInteger, TableViewCellType)
- (NSString *)attachCardButtonTitle;
- (void)setAttachCardButtonTitle:(NSString *)title;

/*!
* @discussion В каком виде показыть экраны UIModalPresentationStyle, по умолчанию UIModalPresentationFullScreen
*
*/

- (UIModalPresentationStyle)modalPresentationStyle;
/*!
* @discussion В каком виде показыть экраны
*
* @param value - UIModalPresentationStyle, по умолчанию UIModalPresentationFullScreen
*/

- (void)setModalPresentationStyle:(UIModalPresentationStyle)value;

@end
16 changes: 13 additions & 3 deletions ASDKUI/Payment/PaymentFormStarter/ASDKDesignConfiguration.m
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ @interface ASDKDesignConfiguration ()
@property (nonatomic, strong) NSArray *_attachCardItems;
@property (nonatomic, strong) UIButton *_attachCardCustomButton;
@property (nonatomic, strong) NSString *_attachCardButtonTitle;
@property (nonatomic, assign) UIModalPresentationStyle _presentStyleModal;

@end

Expand All @@ -53,12 +54,12 @@ - (id)init
_navigationBarStyle = UIBarStyleDefault;
_navigationBarColor = UIColor.whiteColor;
_navigationBarItemsTextColor = UIColor.blackColor;
__presentStyleModal = UIModalPresentationFullScreen;
}

return self;
}


- (void)setNavigationBarColor:(UIColor *)navigationBarColor
navigationBarItemsTextColor:(UIColor *)navigationBarItemsTextColor
navigationBarStyle:(UIBarStyle)navigationBarStyle
Expand All @@ -68,7 +69,6 @@ - (void)setNavigationBarColor:(UIColor *)navigationBarColor
_navigationBarStyle = navigationBarStyle;
}


- (UIColor *)navigationBarColor
{
if (_navigationBarColor)
Expand Down Expand Up @@ -267,4 +267,14 @@ - (void)setAttachCardButtonTitle:(NSString *)title
self._attachCardButtonTitle = title;
}

- (UIModalPresentationStyle)modalPresentationStyle
{
return self._presentStyleModal;
}

- (void)setModalPresentationStyle:(UIModalPresentationStyle)value
{
self._presentStyleModal = value;
}

@end
10 changes: 6 additions & 4 deletions ASDKUI/Payment/PaymentFormStarter/ASDKPaymentFormStarter.m
Original file line number Diff line number Diff line change
Expand Up @@ -168,11 +168,12 @@ - (void)presentPaymentFormFromViewController:(UIViewController *)presentingViewC
}];

vc.acquiringSdk = self.acquiringSdk;

ASDKNavigationController *nc = [[ASDKNavigationController alloc] initWithRootViewController:vc];


ASDKNavigationController *nc = [[ASDKNavigationController alloc] initWithRootViewController:vc];
[nc setModalPresentationStyle:self.designConfiguration.modalPresentationStyle];

[ASDKCardsListDataController cardsListDataControllerWithAcquiringSdk:self.acquiringSdk customerKey:customerKey];

[presentingViewController presentViewController:nc animated:YES completion:nil];
}

Expand Down Expand Up @@ -489,6 +490,7 @@ - (void)presentAttachFormFromViewController:(UIViewController *)presentingViewCo
viewController.acquiringSdk = self.acquiringSdk;

ASDKNavigationController *nc = [[ASDKNavigationController alloc] initWithRootViewController:viewController];
[nc setModalPresentationStyle:self.designConfiguration.modalPresentationStyle];
[ASDKCardsListDataController cardsListDataControllerWithAcquiringSdk:self.acquiringSdk customerKey:customerKey];
[presentingViewController presentViewController:nc animated:YES completion:nil];
}
Expand Down
20 changes: 13 additions & 7 deletions ASDKUI/Payment/PaymentViewController/ASDKExternalCardsCell.xib
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="11201" systemVersion="15G1004" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="13529" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11161"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13527"/>
<capability name="Constraints to layout margins" minToolsVersion="6.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
Expand All @@ -13,26 +16,29 @@
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="4GX-vJ-qAB" id="Smq-15-Mc1">
<frame key="frameInset" width="320" height="43"/>
<rect key="frame" x="0.0" y="0.0" width="320" height="43.5"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" misplaced="YES" text="Сохраненная карта" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="g10-s9-o9I">
<frame key="frameInset" minX="15" minY="11" width="156" height="21"/>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Сохраненная карта" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="g10-s9-o9I">
<rect key="frame" x="16" y="11" width="155" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<nil key="highlightedColor"/>
</label>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="ZZ3-Hy-MC0">
<rect key="frame" x="8" y="3" width="304" height="10"/>
<constraints>
<constraint firstAttribute="height" constant="10" id="ayr-9l-8yg"/>
</constraints>
</imageView>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="tfb-Dw-Ceg">
<rect key="frame" x="8" y="31" width="304" height="10"/>
<constraints>
<constraint firstAttribute="height" constant="10" id="TXC-oi-jfB"/>
</constraints>
</imageView>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="4pw-kr-B4d">
<rect key="frame" x="234" y="8" width="63" height="28"/>
<fontDescription key="fontDescription" type="system" pointSize="13"/>
<state key="normal" title="Изменить">
<color key="titleColor" red="0.070588235289999995" green="0.54901960780000003" blue="0.76470588240000004" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
Expand All @@ -45,9 +51,9 @@
<constraint firstAttribute="trailingMargin" secondItem="ZZ3-Hy-MC0" secondAttribute="trailing" constant="-8" id="9Gg-5J-soS"/>
<constraint firstAttribute="trailingMargin" secondItem="tfb-Dw-Ceg" secondAttribute="trailing" constant="-8" id="KET-7N-KJA"/>
<constraint firstItem="4pw-kr-B4d" firstAttribute="centerY" secondItem="Smq-15-Mc1" secondAttribute="centerY" id="Okq-ar-p7I"/>
<constraint firstItem="g10-s9-o9I" firstAttribute="leading" secondItem="Smq-15-Mc1" secondAttribute="leadingMargin" id="QXY-1R-j3a"/>
<constraint firstAttribute="trailingMargin" secondItem="4pw-kr-B4d" secondAttribute="trailing" constant="7" id="VlI-SZ-G1p"/>
<constraint firstItem="ZZ3-Hy-MC0" firstAttribute="leading" secondItem="Smq-15-Mc1" secondAttribute="leadingMargin" constant="-8" id="WRN-Yf-jxs"/>
<constraint firstItem="g10-s9-o9I" firstAttribute="leading" secondItem="Smq-15-Mc1" secondAttribute="leading" constant="15" id="jiO-7E-K6G"/>
<constraint firstAttribute="bottomMargin" secondItem="tfb-Dw-Ceg" secondAttribute="bottom" constant="-8" id="keL-Vj-ADT"/>
<constraint firstItem="g10-s9-o9I" firstAttribute="centerY" secondItem="Smq-15-Mc1" secondAttribute="centerY" id="r0y-wt-K1W"/>
<constraint firstItem="4pw-kr-B4d" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="g10-s9-o9I" secondAttribute="trailing" constant="8" id="yyt-Gb-a12"/>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="13196" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="13529" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13173"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13527"/>
<capability name="Constraints to layout margins" minToolsVersion="6.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
Expand All @@ -19,25 +20,25 @@
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" verticalCompressionResistancePriority="751" text="" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="g8v-5p-6hW">
<rect key="frame" x="15" y="15" width="290" height="0.0"/>
<rect key="frame" x="16" y="15" width="288" height="0.0"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" text="" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="2px-Fb-mwC">
<rect key="frame" x="15" y="15" width="290" height="0.0"/>
<rect key="frame" x="16" y="15" width="288" height="0.0"/>
<fontDescription key="fontDescription" type="system" pointSize="13"/>
<color key="textColor" red="0.66666666666666663" green="0.66666666666666663" blue="0.66666666666666663" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<constraints>
<constraint firstItem="g8v-5p-6hW" firstAttribute="top" secondItem="w19-FM-9TP" secondAttribute="top" constant="15" id="7gf-f8-768"/>
<constraint firstAttribute="trailing" secondItem="g8v-5p-6hW" secondAttribute="trailing" constant="15" id="MZn-nx-Al7"/>
<constraint firstItem="2px-Fb-mwC" firstAttribute="leading" secondItem="w19-FM-9TP" secondAttribute="leading" constant="15" id="PEO-gx-q6S"/>
<constraint firstAttribute="trailing" secondItem="2px-Fb-mwC" secondAttribute="trailing" constant="15" id="Pqn-OK-Cm6"/>
<constraint firstAttribute="trailingMargin" secondItem="g8v-5p-6hW" secondAttribute="trailing" id="I0j-nZ-qar"/>
<constraint firstItem="g8v-5p-6hW" firstAttribute="leading" secondItem="w19-FM-9TP" secondAttribute="leadingMargin" id="J2e-bU-8nB"/>
<constraint firstAttribute="trailingMargin" secondItem="2px-Fb-mwC" secondAttribute="trailing" id="RfU-9t-SP4"/>
<constraint firstItem="2px-Fb-mwC" firstAttribute="top" secondItem="g8v-5p-6hW" secondAttribute="bottom" id="Xyc-Kj-kOV"/>
<constraint firstItem="g8v-5p-6hW" firstAttribute="leading" secondItem="w19-FM-9TP" secondAttribute="leading" constant="15" id="vCa-3j-Cvs"/>
<constraint firstItem="2px-Fb-mwC" firstAttribute="leading" secondItem="w19-FM-9TP" secondAttribute="leadingMargin" id="q4Z-tM-wzs"/>
</constraints>
</tableViewCellContentView>
<color key="backgroundColor" red="0.93725490199999995" green="0.93725490199999995" blue="0.95686274510000002" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1232,11 +1232,12 @@ - (void)openCardsList
cardsListController.selectedCard = self.selectedCard;

ASDKNavigationController *nc = [[ASDKNavigationController alloc] initWithRootViewController:cardsListController];

ASDKPaymentFormStarter *paymentFormStarter = [ASDKPaymentFormStarter instance];
ASDKDesignConfiguration *designConfiguration = paymentFormStarter.designConfiguration;
[nc setModalPresentationStyle:designConfiguration.modalPresentationStyle];
[self presentViewController:nc animated:YES completion:nil];
}


#pragma mark - Validation

- (BOOL)validateForm
Expand Down
Loading

0 comments on commit 7617a88

Please sign in to comment.