Commit b726651f by David Muzi

Fix sample app, add unit test for tags

parent 4f9f8577
......@@ -269,7 +269,7 @@ CGFloat const BUYMaxProductViewHeight = 640.0;
[self.navigationController setNavigationBarHidden:NO];
}
if (self.product.publicURL) {
if (self.URLForSharing) {
UIBarButtonItem *rightButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAction target:self action:@selector(shareLink)];
NSArray *rightButtons = [@[rightButton] arrayByAddingObjectsFromArray:self.navigationItem.rightBarButtonItems];
self.navigationItem.rightBarButtonItems = rightButtons;
......@@ -584,7 +584,8 @@ CGFloat const BUYMaxProductViewHeight = 640.0;
- (NSURL *)URLForSharing
{
return self.product.publicURL;
NSString *urlString = [NSString stringWithFormat:@"%@/products/%@",self.shop.domain, self.product.handle];
return [NSURL URLWithString:urlString];
}
- (UIImage *)ImageForSharing
......
......@@ -162,7 +162,7 @@
{
[self.collectionOperation cancel];
[[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:YES];
self.collectionOperation = [self.client getProductsPage:1 inCollection:self.collection.identifier sortOrder:collectionSort completion:^(NSArray *products, NSUInteger page, BOOL reachedEnd, NSError *error) {
self.collectionOperation = [self.client getProductsPage:1 withTags:nil inCollection:self.collection.identifier sortOrder:collectionSort completion:^(NSArray *products, NSUInteger page, BOOL reachedEnd, NSError *error) {
[[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:NO];
if (error == nil && products) {
......
......@@ -308,4 +308,21 @@
}];
}
- (void)testGettingTags
{
XCTestExpectation *expectation = [self expectationWithDescription:NSStringFromSelector(_cmd)];
[self.client getProductTagsPage:1 completion:^(NSArray *tags, NSUInteger page, BOOL end, NSError *error){
XCTAssertNil(error);
XCTAssertNotNil(tags);
[expectation fulfill];
}];
[self waitForExpectationsWithTimeout:10 handler:^(NSError *error) {
XCTAssertNil(error);
}];
}
@end
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