Skip to content

Commit

Permalink
Merge pull request #406 from Shopify/release/2.1.0
Browse files Browse the repository at this point in the history
Shopify Mobile Buy SDK Version 2.1.0 Release
  • Loading branch information
EishanVijay authored Nov 17, 2016
2 parents 855ad27 + a17cae0 commit ee3bc3b
Show file tree
Hide file tree
Showing 150 changed files with 1,364 additions and 780 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@ xcuserdata
.ruby-version
*Sample*/Buy.framework
*-INTERNAL.*
.DS_Store

## Obj-C/Swift specific
*.hmap
*.ipa

test_shop_config.json

Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@
847612981CAB059100AB17AA /* UIImage+PaymentButton.m in Sources */ = {isa = PBXBuildFile; fileRef = 847612951CAB059100AB17AA /* UIImage+PaymentButton.m */; };
847612A11CAB05BE00AB17AA /* UIFont+Additions.m in Sources */ = {isa = PBXBuildFile; fileRef = 8476129D1CAB05BE00AB17AA /* UIFont+Additions.m */; };
847612A21CAB05BE00AB17AA /* UIImage+Additions.m in Sources */ = {isa = PBXBuildFile; fileRef = 8476129F1CAB05BE00AB17AA /* UIImage+Additions.m */; };
84A772431D81A2640018D4F5 /* Buy.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BE34379D1BC5C18400C71330 /* Buy.framework */; };
84A772441D81A2640018D4F5 /* Buy.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = BE34379D1BC5C18400C71330 /* Buy.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
84BA52EE1CB2E83C00AB1560 /* NavigationController.m in Sources */ = {isa = PBXBuildFile; fileRef = 84BA52ED1CB2E83C00AB1560 /* NavigationController.m */; };
902C9B8F1BB0729F00FC456E /* ShippingRateTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 902C9B8E1BB0729F00FC456E /* ShippingRateTableViewCell.m */; };
902C9B921BB08FF500FC456E /* SummaryItemsTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 902C9B911BB08FF500FC456E /* SummaryItemsTableViewCell.m */; };
Expand All @@ -51,8 +53,6 @@
B2C560BA1CEE36C00015AA40 /* ProductViewControllerThemeTintColorTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = B2C560B61CEE36C00015AA40 /* ProductViewControllerThemeTintColorTableViewCell.m */; };
B2C560BB1CEE36C00015AA40 /* ProductViewControllerToggleTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = B2C560B81CEE36C00015AA40 /* ProductViewControllerToggleTableViewCell.m */; };
B2C560C21CEE39180015AA40 /* UIColor+Additions.m in Sources */ = {isa = PBXBuildFile; fileRef = B2C560C11CEE39180015AA40 /* UIColor+Additions.m */; };
BE3437A21BC5C19D00C71330 /* Buy.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BE34379F1BC5C18400C71330 /* Buy.framework */; };
BE3437A31BC5C19D00C71330 /* Buy.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = BE34379F1BC5C18400C71330 /* Buy.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
BE8B82511B8CF49D00E3F871 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = BE8B82501B8CF49D00E3F871 /* main.m */; };
BE8B82541B8CF49D00E3F871 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = BE8B82531B8CF49D00E3F871 /* AppDelegate.m */; };
BE8B82571B8CF49D00E3F871 /* ProductListViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = BE8B82561B8CF49D00E3F871 /* ProductListViewController.m */; };
Expand All @@ -65,6 +65,13 @@
/* End PBXBuildFile section */

/* Begin PBXContainerItemProxy section */
84A772451D81A2640018D4F5 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = BE34378F1BC5C18400C71330 /* Mobile Buy SDK.xcodeproj */;
proxyType = 1;
remoteGlobalIDString = 901930E11BC5B9BC00D1134E;
remoteInfo = Buy;
};
BE34379A1BC5C18400C71330 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = BE34378F1BC5C18400C71330 /* Mobile Buy SDK.xcodeproj */;
Expand All @@ -79,13 +86,6 @@
remoteGlobalIDString = BE9A64281B503C2F0033E558;
remoteInfo = Buy;
};
BE34379E1BC5C18400C71330 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = BE34378F1BC5C18400C71330 /* Mobile Buy SDK.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 901931701BC5B9BC00D1134E;
remoteInfo = "Buy Dynamic";
};
BE3437A01BC5C18F00C71330 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = BE34378F1BC5C18400C71330 /* Mobile Buy SDK.xcodeproj */;
Expand All @@ -109,7 +109,7 @@
dstPath = "";
dstSubfolderSpec = 10;
files = (
BE3437A31BC5C19D00C71330 /* Buy.framework in Embed Frameworks */,
84A772441D81A2640018D4F5 /* Buy.framework in Embed Frameworks */,
);
name = "Embed Frameworks";
runOnlyForDeploymentPostprocessing = 0;
Expand Down Expand Up @@ -229,7 +229,7 @@
buildActionMask = 2147483647;
files = (
90A6F42D1BA8BCAC003E7C4F /* PassKit.framework in Frameworks */,
BE3437A21BC5C19D00C71330 /* Buy.framework in Frameworks */,
84A772431D81A2640018D4F5 /* Buy.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -373,9 +373,8 @@
BE3437901BC5C18400C71330 /* Products */ = {
isa = PBXGroup;
children = (
BE34379B1BC5C18400C71330 /* Mobile Buy SDK Tests.xctest */,
BE34379D1BC5C18400C71330 /* Buy.framework */,
BE34379F1BC5C18400C71330 /* Buy.framework */,
BE34379B1BC5C18400C71330 /* Mobile Buy SDK Tests.xctest */,
);
name = Products;
sourceTree = "<group>";
Expand Down Expand Up @@ -461,6 +460,7 @@
dependencies = (
BE3437A11BC5C18F00C71330 /* PBXTargetDependency */,
BE3437A51BC5C19D00C71330 /* PBXTargetDependency */,
84A772461D81A2640018D4F5 /* PBXTargetDependency */,
);
name = "Mobile Buy SDK Advanced Sample";
productName = "Mobile Buy SDK Advanced Sample";
Expand Down Expand Up @@ -525,13 +525,6 @@
remoteRef = BE34379C1BC5C18400C71330 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
BE34379F1BC5C18400C71330 /* Buy.framework */ = {
isa = PBXReferenceProxy;
fileType = wrapper.framework;
path = Buy.framework;
remoteRef = BE34379E1BC5C18400C71330 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
/* End PBXReferenceProxy section */

/* Begin PBXResourcesBuildPhase section */
Expand Down Expand Up @@ -607,6 +600,11 @@
/* End PBXSourcesBuildPhase section */

/* Begin PBXTargetDependency section */
84A772461D81A2640018D4F5 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
name = Buy;
targetProxy = 84A772451D81A2640018D4F5 /* PBXContainerItemProxy */;
};
BE3437A11BC5C18F00C71330 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
name = "Buy Dynamic";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@
*/
@property (nonatomic, readonly) UIButton *paymentButton;

@property (nonatomic) BOOL buttonsEnabled;

/**
* A view which sits above the buttons.
* Can be used to add a description or other content to the footer.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,13 +93,6 @@ - (void)layoutSubviews
[self setNeedsUpdateConstraints];
}

- (void)setButtonsEnabled:(BOOL)buttonsEnabled
{
self.actionButton.enabled = buttonsEnabled;
self.paymentButton.enabled = buttonsEnabled;
self.paymentButton.alpha = buttonsEnabled ? 1.0f : 0.5f;
}

- (void)updateConstraints
{
if (self.applePayAvailable) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,10 @@
* @param rect The rect is needed for the UICollectionView in the ProductViewHeader to setup the cell's bounds
* @param product The product to display in the product view. Only used in the initializer to
* @param theme The theme for the product view
* @param showApplePaySetup Show Apple Pay button with 'Set Up Apple Pay' text as determined by the presenter
*
* @return An instance of the ProductView
*/
- (instancetype)initWithFrame:(CGRect)rect product:(BUYProduct*)product shouldShowApplePaySetup:(BOOL)showApplePaySetup;
- (instancetype)initWithFrame:(CGRect)rect product:(BUYProduct*)product;

/**
* The BUYProductViewController is the UITableViewDelegate, so it receives the UIScrollView delegate method calls.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ @interface ProductView ()

@implementation ProductView

- (instancetype)initWithFrame:(CGRect)rect product:(BUYProduct*)product shouldShowApplePaySetup:(BOOL)showApplePaySetup
- (instancetype)initWithFrame:(CGRect)rect product:(BUYProduct*)product
{
self = [super initWithFrame:rect];
if (self) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ - (void)setShop:(BUYShop *)shop

- (void)createProductView
{
_productView = [[ProductView alloc] initWithFrame:CGRectMake(0, 0, self.preferredContentSize.width, self.preferredContentSize.height) product:self.product shouldShowApplePaySetup:self.shouldShowApplePaySetup];
_productView = [[ProductView alloc] initWithFrame:CGRectMake(0, 0, self.preferredContentSize.width, self.preferredContentSize.height) product:self.product];
_productView.translatesAutoresizingMaskIntoConstraints = NO;
[self.view addSubview:_productView];
[self.view addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|[_productView]|" options:0 metrics:nil views:NSDictionaryOfVariableBindings(_productView)]];
Expand All @@ -310,7 +310,7 @@ - (void)createProductView
_productView.productViewHeader.collectionView.dataSource = self;

_productView.layoutMargins = UIEdgeInsetsMake(self.productView.layoutMargins.top, self.productView.layoutMargins.left, self.bottomLayoutGuide.length, self.productView.layoutMargins.right);
[_productView.productViewFooter setApplePayAvailable:self.shouldShowApplePaySetup requiresSetup:self.shouldShowApplePaySetup];

[_productView.tableView reloadSections:[NSIndexSet indexSetWithIndex:0] withRowAnimation:UITableViewRowAnimationNone];

self.navigationItem.title = _product.title;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,12 @@ - (BOOL)isApplePayAvailable
}

- (BOOL)shouldShowApplePayButton {
return self.applePayPaymentProvider.available || [self canShowApplePaySetup];
return [self isApplePayAvailable] || [self canShowApplePaySetup];
}

- (BOOL)shouldShowApplePaySetup
{
return self.applePayPaymentProvider.available == NO && [self canShowApplePaySetup];
return [self isApplePayAvailable] == NO && [self canShowApplePaySetup];
}

#pragma mark - Payment
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,9 +162,7 @@ - (void)getCollectionWithSortOrder:(BUYCollectionSort)collectionSort
{
[self.collectionOperation cancel];
[[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:YES];

self.collectionOperation = [self.client getProductsPage:1 inCollection:self.collection.identifier withTags:nil sortOrder:collectionSort completion:^(NSArray<BUYProduct *> * _Nullable products, NSUInteger page, BOOL reachedEnd, NSError * _Nullable error) {

self.collectionOperation = [self.client getProductsPage:1 inCollection:self.collection.identifier withTags:nil sortOrder:collectionSort completion:^(NSArray *products, NSUInteger page, BOOL reachedEnd, NSError *error) {
[[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:NO];

if (error == nil && products) {
Expand Down
4 changes: 2 additions & 2 deletions Mobile Buy SDK Sample Apps/Advanced App - ObjC/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ The Advanced Sample App demonstrates how to perform several tasks related to cre

### Getting started

First, add your shop domain, API key and Channel ID to the `CollectionListViewController.m` macros.
First, add your shop domain, API key and App ID to the `CollectionListViewController.m` macros.

```objc
#define SHOP_DOMAIN @"<shop_domain>"
#define API_KEY @"<api_key>"
#define CHANNEL_ID @"<channel_id>"
#define APP_ID @"<app_id>"
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,6 @@
remoteGlobalIDString = 90F592EC1B0D5EFE0026B382;
remoteInfo = "Mobile Buy SDK Tests";
};
9A9C032A1CD9203600AE79BD /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 9A9C03201CD9203600AE79BD /* Mobile Buy SDK.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = BE9A64281B503C2F0033E558;
remoteInfo = "Buy Static";
};
9A9C032C1CD9203600AE79BD /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 9A9C03201CD9203600AE79BD /* Mobile Buy SDK.xcodeproj */;
Expand Down Expand Up @@ -178,9 +171,8 @@
9A9C03211CD9203600AE79BD /* Products */ = {
isa = PBXGroup;
children = (
9A9C03291CD9203600AE79BD /* Mobile Buy SDK Tests.xctest */,
9A9C032B1CD9203600AE79BD /* Buy.framework */,
9A9C032D1CD9203600AE79BD /* Buy.framework */,
9A9C03291CD9203600AE79BD /* Mobile Buy SDK Tests.xctest */,
);
name = Products;
sourceTree = "<group>";
Expand Down Expand Up @@ -227,6 +219,7 @@
TargetAttributes = {
9A9C03021CD8F9AC00AE79BD = {
CreatedOnToolsVersion = 7.3;
LastSwiftMigration = 0800;
};
};
};
Expand Down Expand Up @@ -262,13 +255,6 @@
remoteRef = 9A9C03281CD9203600AE79BD /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
9A9C032B1CD9203600AE79BD /* Buy.framework */ = {
isa = PBXReferenceProxy;
fileType = wrapper.framework;
path = Buy.framework;
remoteRef = 9A9C032A1CD9203600AE79BD /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
9A9C032D1CD9203600AE79BD /* Buy.framework */ = {
isa = PBXReferenceProxy;
fileType = wrapper.framework;
Expand Down Expand Up @@ -431,6 +417,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "com.shopify.Sample-App-Customers";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
};
name = Debug;
};
Expand All @@ -444,6 +431,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "com.shopify.Sample-App-Customers";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
};
name = Release;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,14 @@ class AccountViewController: UIViewController {
// ----------------------------------
// MARK: - Segue -
//
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
switch segue.identifier {
case .Some("loginSegue"):
self.loginViewController = segue.destinationViewController as! LoginViewController
case .some("loginSegue"):
self.loginViewController = segue.destination as! LoginViewController
self.loginViewController.delegate = self

case .Some("signupSegue"):
self.signupViewController = segue.destinationViewController as! SignupViewController
case .some("signupSegue"):
self.signupViewController = segue.destination as! SignupViewController
self.signupViewController.delegate = self

default:
Expand All @@ -60,15 +60,15 @@ class AccountViewController: UIViewController {
// ----------------------------------
// MARK: - Updates -
//
private func updateSelectedIndex(index: Int) {
self.loginContainerView.hidden = (index != 0)
self.signupContainerView.hidden = (index == 0)
private func updateSelectedIndex(_ index: Int) {
self.loginContainerView.isHidden = (index != 0)
self.signupContainerView.isHidden = (index == 0)
}

// ----------------------------------
// MARK: - UI Actions -
//
@IBAction func segmentAction(sender: UISegmentedControl) {
@IBAction func segmentAction(_ sender: UISegmentedControl) {
self.updateSelectedIndex(sender.selectedSegmentIndex)
}
}
Expand All @@ -77,17 +77,17 @@ class AccountViewController: UIViewController {
// MARK: - AuthenticationDelegate -
//
extension AccountViewController: AuthenticationDelegate {
func authenticationDidSucceedForCustomer(customer: BUYCustomer, withToken token: String) {
func authenticationDidSucceedForCustomer(_ customer: BUYCustomer, withToken token: String) {

if let orders = self.storyboard?.instantiateViewControllerWithIdentifier("ordersViewController") as? OrdersViewController {
if let orders = self.storyboard?.instantiateViewController(withIdentifier: "ordersViewController") as? OrdersViewController {
orders.customer = customer
self.navigationController?.pushViewController(orders, animated: true)
}
}

func authenticationDidFailWithError(error: NSError?) {
let alert = UIAlertController(title: "Error", message: error?.localizedDescription, preferredStyle: .Alert)
alert.addAction(UIAlertAction(title: "OK", style: .Cancel, handler: nil))
self.presentViewController(alert, animated: true, completion: nil)
func authenticationDidFailWithError(_ error: NSError?) {
let alert = UIAlertController(title: "Error", message: error?.localizedDescription, preferredStyle: .alert)
alert.addAction(UIAlertAction(title: "OK", style: .cancel, handler: nil))
self.present(alert, animated: true, completion: nil)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ class ActionCell: UITableViewCell {

var loading: Bool {
get {
return self.actionLabel.hidden
return self.actionLabel.isHidden
}
set {
self.actionLabel.hidden = newValue
self.loader.hidden = !newValue
self.actionLabel.isHidden = newValue
self.loader.isHidden = !newValue
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,13 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
let shopDomain: String = ""
let apiKey: String = ""
let appID: String = ""

private(set) var client: BUYClient!

// ----------------------------------
// MARK: - Application Launch -
//
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {

self.client = BUYClient(shopDomain: self.shopDomain, apiKey: self.apiKey, appId: self.appID)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@ import Foundation
import Buy

protocol AuthenticationDelegate: class {
func authenticationDidSucceedForCustomer(customer: BUYCustomer, withToken token: String)
func authenticationDidFailWithError(error: NSError?)
func authenticationDidSucceedForCustomer(_ customer: BUYCustomer, withToken token: String)
func authenticationDidFailWithError(_ error: NSError?)
}
Loading

0 comments on commit ee3bc3b

Please sign in to comment.