Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
shopify_iossdk
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
cemarose
shopify_iossdk
Commits
8ba3ccc7
Commit
8ba3ccc7
authored
9 years ago
by
Dima Bart
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add nullability annotations and missing asserts.
parent
4c5d7c92
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
25 deletions
+37
-25
BUYClient.h
Mobile Buy SDK/Mobile Buy SDK/Data/BUYClient.h
+27
-25
BUYClient.m
Mobile Buy SDK/Mobile Buy SDK/Data/BUYClient.m
+10
-0
No files found.
Mobile Buy SDK/Mobile Buy SDK/Data/BUYClient.h
View file @
8ba3ccc7
This diff is collapsed.
Click to expand it.
Mobile Buy SDK/Mobile Buy SDK/Data/BUYClient.m
View file @
8ba3ccc7
...
...
@@ -160,6 +160,8 @@ NSString *const BUYClientCustomerAccessToken = @"X-Shopify-Customer-Access-Token
-
(
NSURLSessionDataTask
*
)
getProductById
:
(
NSString
*
)
productId
completion
:
(
BUYDataProductBlock
)
block
;
{
NSAssert
(
productId
,
@"Failed to get product by ID. Product ID must not be nil."
);
return
[
self
getProductsByIds
:@[
productId
]
completion
:
^
(
NSArray
*
products
,
NSError
*
error
)
{
if
(
products
.
count
>
0
)
{
block
(
products
[
0
],
error
);
...
...
@@ -174,6 +176,8 @@ NSString *const BUYClientCustomerAccessToken = @"X-Shopify-Customer-Access-Token
-
(
NSURLSessionDataTask
*
)
getProductsByIds
:
(
NSArray
*
)
productIds
completion
:
(
BUYDataProductsBlock
)
block
{
NSAssert
(
productIds
,
@"Failed to get product by IDs. Product IDs array must not be nil."
);
NSURLComponents
*
components
=
[
self
URLComponentsForChannelsAppendingPath
:
kBUYClientPathProductPublications
queryItems
:@{
@"product_ids"
:
[
productIds
componentsJoinedByString
:
@","
]
...
...
@@ -320,6 +324,8 @@ NSString *const BUYClientCustomerAccessToken = @"X-Shopify-Customer-Access-Token
-
(
NSURLSessionDataTask
*
)
createCheckout
:
(
BUYCheckout
*
)
checkout
completion
:
(
BUYDataCheckoutBlock
)
block
{
NSAssert
(
checkout
,
@"Failed to create checkout. Invalid checkout object."
);
// Inject channel and marketing attributions
[
self
configureCheckout
:
checkout
];
...
...
@@ -329,6 +335,7 @@ NSString *const BUYClientCustomerAccessToken = @"X-Shopify-Customer-Access-Token
-
(
NSURLSessionDataTask
*
)
createCheckoutWithCartToken
:
(
NSString
*
)
cartToken
completion
:
(
BUYDataCheckoutBlock
)
block
{
NSAssert
(
cartToken
,
@"Failed to create checkout. Invalid cart token"
);
BUYCheckout
*
checkout
=
[
self
.
modelManager
checkoutwithCartToken
:
cartToken
];
[
self
configureCheckout
:
checkout
];
...
...
@@ -350,6 +357,7 @@ NSString *const BUYClientCustomerAccessToken = @"X-Shopify-Customer-Access-Token
-
(
NSURLSessionDataTask
*
)
applyGiftCardWithCode
:
(
NSString
*
)
giftCardCode
toCheckout
:
(
BUYCheckout
*
)
checkout
completion
:
(
BUYDataCheckoutBlock
)
block
{
BUYAssertCheckout
(
checkout
);
NSAssert
(
giftCardCode
.
length
>
0
,
@"Failed to apply gift card code. Invalid gift card code."
);
BUYGiftCard
*
giftCard
=
[
self
.
modelManager
giftCardWithCode
:
giftCardCode
];
...
...
@@ -367,6 +375,7 @@ NSString *const BUYClientCustomerAccessToken = @"X-Shopify-Customer-Access-Token
-
(
NSURLSessionDataTask
*
)
removeGiftCard
:
(
BUYGiftCard
*
)
giftCard
fromCheckout
:
(
BUYCheckout
*
)
checkout
completion
:
(
BUYDataCheckoutBlock
)
block
{
BUYAssertCheckout
(
checkout
);
NSAssert
(
giftCard
.
identifier
,
@"Failed to remove gift card. Gift card must have a valid identifier."
);
NSURLComponents
*
components
=
[
self
URLComponentsForCheckoutsAppendingPath
:[
NSString
stringWithFormat
:
@"gift_cards/%@"
,
giftCard
.
identifier
]
...
...
@@ -399,6 +408,7 @@ NSString *const BUYClientCustomerAccessToken = @"X-Shopify-Customer-Access-Token
-
(
NSURLSessionDataTask
*
)
getCheckout
:
(
BUYCheckout
*
)
checkout
completion
:
(
BUYDataCheckoutBlock
)
block
{
BUYAssertCheckout
(
checkout
);
NSURLComponents
*
components
=
[
self
URLComponentsForCheckoutsAppendingPath
:
nil
checkoutToken
:
checkout
.
token
queryItems
:
nil
];
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment