BUYPaymentButton -> PaymentButton

parent c5fe5706
......@@ -47,7 +47,7 @@
902C9B921BB08FF500FC456E /* SummaryItemsTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 902C9B911BB08FF500FC456E /* SummaryItemsTableViewCell.m */; };
9079F5F41BB1AAA100CB1B35 /* CollectionListViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 9079F5F31BB1AAA100CB1B35 /* CollectionListViewController.m */; };
90A6F42D1BA8BCAC003E7C4F /* PassKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 90A6F42C1BA8BCAC003E7C4F /* PassKit.framework */; };
9A0B0C871CEC8F370037D68F /* BUYPaymentButton.m in Sources */ = {isa = PBXBuildFile; fileRef = 9A0B0C861CEC8F370037D68F /* BUYPaymentButton.m */; };
9A0B0C871CEC8F370037D68F /* PaymentButton.m in Sources */ = {isa = PBXBuildFile; fileRef = 9A0B0C861CEC8F370037D68F /* PaymentButton.m */; };
B2C560B91CEE36C00015AA40 /* ProductViewControllerThemeStyleTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = B2C560B41CEE36C00015AA40 /* ProductViewControllerThemeStyleTableViewCell.m */; };
B2C560BA1CEE36C00015AA40 /* ProductViewControllerThemeTintColorTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = B2C560B61CEE36C00015AA40 /* ProductViewControllerThemeTintColorTableViewCell.m */; };
B2C560BB1CEE36C00015AA40 /* ProductViewControllerToggleTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = B2C560B81CEE36C00015AA40 /* ProductViewControllerToggleTableViewCell.m */; };
......@@ -198,8 +198,8 @@
9079F5F21BB1AAA100CB1B35 /* CollectionListViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CollectionListViewController.h; sourceTree = "<group>"; };
9079F5F31BB1AAA100CB1B35 /* CollectionListViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CollectionListViewController.m; sourceTree = "<group>"; };
90A6F42C1BA8BCAC003E7C4F /* PassKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = PassKit.framework; path = System/Library/Frameworks/PassKit.framework; sourceTree = SDKROOT; };
9A0B0C851CEC8F370037D68F /* BUYPaymentButton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BUYPaymentButton.h; sourceTree = "<group>"; };
9A0B0C861CEC8F370037D68F /* BUYPaymentButton.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BUYPaymentButton.m; sourceTree = "<group>"; };
9A0B0C851CEC8F370037D68F /* PaymentButton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PaymentButton.h; sourceTree = "<group>"; };
9A0B0C861CEC8F370037D68F /* PaymentButton.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PaymentButton.m; sourceTree = "<group>"; };
B2C560B31CEE36C00015AA40 /* ProductViewControllerThemeStyleTableViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ProductViewControllerThemeStyleTableViewCell.h; path = "Product View/ProductViewControllerThemeStyleTableViewCell.h"; sourceTree = "<group>"; };
B2C560B41CEE36C00015AA40 /* ProductViewControllerThemeStyleTableViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = ProductViewControllerThemeStyleTableViewCell.m; path = "Product View/ProductViewControllerThemeStyleTableViewCell.m"; sourceTree = "<group>"; };
B2C560B51CEE36C00015AA40 /* ProductViewControllerThemeTintColorTableViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ProductViewControllerThemeTintColorTableViewCell.h; path = "Product View/ProductViewControllerThemeTintColorTableViewCell.h"; sourceTree = "<group>"; };
......@@ -337,8 +337,8 @@
8476128F1CAB059100AB17AA /* PaymentButton */ = {
isa = PBXGroup;
children = (
9A0B0C851CEC8F370037D68F /* BUYPaymentButton.h */,
9A0B0C861CEC8F370037D68F /* BUYPaymentButton.m */,
9A0B0C851CEC8F370037D68F /* PaymentButton.h */,
9A0B0C861CEC8F370037D68F /* PaymentButton.m */,
847612901CAB059100AB17AA /* ImageKit.h */,
847612911CAB059100AB17AA /* ImageKit.m */,
847612921CAB059100AB17AA /* UIButton+PaymentButton.h */,
......@@ -581,7 +581,7 @@
8476127B1CAB047600AB17AA /* HeaderBackgroundView.m in Sources */,
BE8B82951B8E65D700E3F871 /* PreCheckoutViewController.m in Sources */,
8476127F1CAB047600AB17AA /* OptionSelectionViewController.m in Sources */,
9A0B0C871CEC8F370037D68F /* BUYPaymentButton.m in Sources */,
9A0B0C871CEC8F370037D68F /* PaymentButton.m in Sources */,
8476127C1CAB047600AB17AA /* HeaderOverlayView.m in Sources */,
B2C560BA1CEE36C00015AA40 /* ProductViewControllerThemeTintColorTableViewCell.m in Sources */,
B2C560C21CEE39180015AA40 /* UIColor+Additions.m in Sources */,
......
//
// BUYPaymentButton.h
// PaymentButton.h
// Mobile Buy SDK
//
// Created by Shopify.
......@@ -24,20 +24,20 @@
// THE SOFTWARE.
//
typedef NS_ENUM(NSInteger, BUYPaymentButtonStyle) {
BUYPaymentButtonStyleWhite = 0,
BUYPaymentButtonStyleWhiteOutline,
BUYPaymentButtonStyleBlack
typedef NS_ENUM(NSInteger, PaymentButtonStyle) {
PaymentButtonStyleWhite = 0,
PaymentButtonStyleWhiteOutline,
PaymentButtonStyleBlack
};
typedef NS_ENUM(NSInteger, BUYPaymentButtonType) {
BUYPaymentButtonTypePlain = 0,
BUYPaymentButtonTypeBuy,
BUYPaymentButtonTypeSetup NS_ENUM_AVAILABLE_IOS(9_0)
typedef NS_ENUM(NSInteger, PaymentButtonType) {
PaymentButtonTypePlain = 0,
PaymentButtonTypeBuy,
PaymentButtonTypeSetup NS_ENUM_AVAILABLE_IOS(9_0)
};
@interface BUYPaymentButton : UIButton
@interface PaymentButton : UIButton
+ (instancetype)buttonWithType:(BUYPaymentButtonType)buttonType style:(BUYPaymentButtonStyle)buttonStyle;
+ (instancetype)buttonWithType:(PaymentButtonType)buttonType style:(PaymentButtonStyle)buttonStyle;
@end
//
// BUYPaymentButton.m
// PaymentButton.m
// Mobile Buy SDK
//
// Created by Shopify.
......@@ -25,25 +25,25 @@
//
@import PassKit;
#import "BUYPaymentButton.h"
#import "PaymentButton.h"
@interface BUYCustomPaymentButton : UIButton
@interface CustomPaymentButton : UIButton
@property (nonatomic, assign) BUYPaymentButtonType customButtonType;
@property (nonatomic, assign) BUYPaymentButtonStyle customButtonStyle;
@property (nonatomic, assign) PaymentButtonType customButtonType;
@property (nonatomic, assign) PaymentButtonStyle customButtonStyle;
- (void)buttonWithType:(BUYPaymentButtonType)customButtonType style:(BUYPaymentButtonStyle)customButtonStyle;
- (void)buttonWithType:(PaymentButtonType)customButtonType style:(PaymentButtonStyle)customButtonStyle;
@end
@implementation BUYCustomPaymentButton
@implementation CustomPaymentButton
- (void)buttonWithType:(BUYPaymentButtonType)customButtonType style:(BUYPaymentButtonStyle)customButtonStyle {
- (void)buttonWithType:(PaymentButtonType)customButtonType style:(PaymentButtonStyle)customButtonStyle {
self.customButtonType = customButtonType;
self.customButtonStyle = customButtonStyle;
self.layer.cornerRadius = 6;
self.clipsToBounds = YES;
if (self.customButtonStyle == BUYPaymentButtonStyleWhiteOutline) {
if (self.customButtonStyle == PaymentButtonStyleWhiteOutline) {
self.layer.borderColor = [[UIColor blackColor] CGColor];
self.layer.borderWidth = 1;
}
......@@ -62,7 +62,7 @@
UIColor *backgroundColor = [UIColor whiteColor];
UIColor *foregroundColor = [UIColor blackColor];
if (self.customButtonStyle == BUYPaymentButtonStyleBlack) {
if (self.customButtonStyle == PaymentButtonStyleBlack) {
backgroundColor = [UIColor blackColor];
foregroundColor = [UIColor whiteColor];
}
......@@ -78,7 +78,7 @@
[foregroundColor setFill];
switch (self.customButtonType) {
case BUYPaymentButtonTypeBuy: {
case PaymentButtonTypeBuy: {
//// Subframes
CGRect buyWithApplyPay = CGRectMake(CGRectGetMinX(frame) + (CGRectGetWidth(frame) * 0.09790f + 0.5f), CGRectGetMinY(frame) + (CGRectGetHeight(frame) * 0.25000f - 0.32f) + 0.82f, (CGRectGetWidth(frame) * 0.89055f + 0.15f) - (CGRectGetWidth(frame) * 0.09790f + 0.5f) + 0.35f, (CGRectGetHeight(frame) * 0.75414f + 0.5f) - (CGRectGetHeight(frame) * 0.25000f - 0.32f) - 0.82f);
......@@ -413,7 +413,7 @@
}
}
break;
case BUYPaymentButtonTypePlain: {
case PaymentButtonTypePlain: {
//// applePay Drawing
UIBezierPath* applePayPath = UIBezierPath.bezierPath;
[applePayPath moveToPoint: CGPointMake(CGRectGetMinX(frame) + 0.65968f * CGRectGetWidth(frame), CGRectGetMinY(frame) + 0.37344f * CGRectGetHeight(frame))];
......@@ -569,17 +569,17 @@
@end
@implementation BUYPaymentButton
@implementation PaymentButton
+ (instancetype)buttonWithType:(BUYPaymentButtonType)buttonType style:(BUYPaymentButtonStyle)buttonStyle {
+ (instancetype)buttonWithType:(PaymentButtonType)buttonType style:(PaymentButtonStyle)buttonStyle {
Class ApplePayButton = NSClassFromString(@"PKPaymentButton");
if (ApplePayButton) {
return (BUYPaymentButton*)[ApplePayButton buttonWithType:buttonType
return (PaymentButton*)[ApplePayButton buttonWithType:buttonType
style:buttonStyle];
} else {
BUYCustomPaymentButton *customPaymentButton = [BUYCustomPaymentButton buttonWithType:UIButtonTypeCustom];
CustomPaymentButton *customPaymentButton = [CustomPaymentButton buttonWithType:UIButtonTypeCustom];
[customPaymentButton buttonWithType:buttonType style:buttonStyle];
return (BUYPaymentButton*)customPaymentButton;
return (PaymentButton*)customPaymentButton;
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment