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
09579dce
Commit
09579dce
authored
May 17, 2016
by
Dima Bart
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Convert dispatch_queue_t to NSOperationQueue for callbacks.
parent
49f07aff
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
8 deletions
+7
-8
BUYIntegrationTest.m
Mobile Buy SDK/Mobile Buy SDK Tests/BUYIntegrationTest.m
+1
-1
BUYClient.h
Mobile Buy SDK/Mobile Buy SDK/Data/BUYClient.h
+3
-4
BUYClient.m
Mobile Buy SDK/Mobile Buy SDK/Data/BUYClient.m
+3
-3
No files found.
Mobile Buy SDK/Mobile Buy SDK Tests/BUYIntegrationTest.m
View file @
09579dce
...
@@ -1303,7 +1303,7 @@
...
@@ -1303,7 +1303,7 @@
NSString
*
apiKey
=
[
self
shouldUseMocks
]
?
BUYAPIKey_Placeholder
:
self
.
apiKey
;
NSString
*
apiKey
=
[
self
shouldUseMocks
]
?
BUYAPIKey_Placeholder
:
self
.
apiKey
;
NSString
*
appId
=
[
self
shouldUseMocks
]
?
BUYAppId_Placeholder
:
self
.
appId
;
NSString
*
appId
=
[
self
shouldUseMocks
]
?
BUYAppId_Placeholder
:
self
.
appId
;
BUYClient
*
testClient
=
[[
BUYClient
alloc
]
initWithShopDomain
:
shopDomain
apiKey
:
apiKey
appId
:
appId
];
BUYClient
*
testClient
=
[[
BUYClient
alloc
]
initWithShopDomain
:
shopDomain
apiKey
:
apiKey
appId
:
appId
];
testClient
.
queue
=
dispatch_get_global_queue
(
DISPATCH_QUEUE_PRIORITY_HIGH
,
0
)
;
testClient
.
callbackQueue
=
[
NSOperationQueue
new
]
;
[
testClient
getShop
:
^
(
BUYShop
*
shop
,
NSError
*
error
)
{
[
testClient
getShop
:
^
(
BUYShop
*
shop
,
NSError
*
error
)
{
BOOL
isMainThread
=
[
NSThread
isMainThread
];
BOOL
isMainThread
=
[
NSThread
isMainThread
];
...
...
Mobile Buy SDK/Mobile Buy SDK/Data/BUYClient.h
View file @
09579dce
...
@@ -95,15 +95,14 @@ NS_ASSUME_NONNULL_BEGIN
...
@@ -95,15 +95,14 @@ NS_ASSUME_NONNULL_BEGIN
@property
(
nonatomic
,
strong
,
nonnull
)
BUYModelManager
*
modelManager
;
@property
(
nonatomic
,
strong
,
nonnull
)
BUYModelManager
*
modelManager
;
/**
/**
* Queue
where
on which all request operation are executed
* Queue on which all request operation are executed
*/
*/
@property
(
nonatomic
,
strong
,
readonly
,
nonnull
)
NSOperationQueue
*
requestQueue
;
@property
(
nonatomic
,
strong
,
readonly
,
nonnull
)
NSOperationQueue
*
requestQueue
;
/**
/**
* Queue where callbacks will be called
* Queue on which network completion callbacks will be executed
* defaults to main queue
*/
*/
@property
(
nonatomic
,
strong
,
nonnull
)
dispatch_queue_t
q
ueue
;
@property
(
nonatomic
,
strong
,
nonnull
)
NSOperationQueue
*
callbackQ
ueue
;
/**
/**
* The page size for any paged request. This can range from 1-250. Default is 25
* The page size for any paged request. This can range from 1-250. Default is 25
...
...
Mobile Buy SDK/Mobile Buy SDK/Data/BUYClient.m
View file @
09579dce
...
@@ -58,7 +58,7 @@ static NSString * const BUYClientJSONMimeType = @"application/json";
...
@@ -58,7 +58,7 @@ static NSString * const BUYClientJSONMimeType = @"application/json";
_apiKey
=
apiKey
;
_apiKey
=
apiKey
;
_appId
=
appId
;
_appId
=
appId
;
_applicationName
=
[[
NSBundle
mainBundle
]
infoDictionary
][
@"CFBundleName"
]
?:
@""
;
_applicationName
=
[[
NSBundle
mainBundle
]
infoDictionary
][
@"CFBundleName"
]
?:
@""
;
_
queue
=
dispatch_get_main_queue
()
;
_
callbackQueue
=
[
NSOperationQueue
mainQueue
]
;
_requestQueue
=
[
NSOperationQueue
new
];
_requestQueue
=
[
NSOperationQueue
new
];
_session
=
[
self
urlSession
];
_session
=
[
self
urlSession
];
_pageSize
=
25
;
_pageSize
=
25
;
...
@@ -174,9 +174,9 @@ static NSString * const BUYClientJSONMimeType = @"application/json";
...
@@ -174,9 +174,9 @@ static NSString * const BUYClientJSONMimeType = @"application/json";
request
.
HTTPMethod
=
method
;
request
.
HTTPMethod
=
method
;
BUYRequestOperation
*
operation
=
[[
BUYRequestOperation
alloc
]
initWithSession
:
self
.
session
request
:
request
payload
:
object
completion
:^
(
NSDictionary
*
json
,
NSURLResponse
*
response
,
NSError
*
error
)
{
BUYRequestOperation
*
operation
=
[[
BUYRequestOperation
alloc
]
initWithSession
:
self
.
session
request
:
request
payload
:
object
completion
:^
(
NSDictionary
*
json
,
NSURLResponse
*
response
,
NSError
*
error
)
{
dispatch_async
(
self
.
queue
,
^
{
[
self
.
callbackQueue
addOperationWithBlock
:
^
{
completionHandler
(
json
,
response
,
error
);
completionHandler
(
json
,
response
,
error
);
}
)
;
}
]
;
}];
}];
[
self
startTask
:
operation
];
[
self
startTask
:
operation
];
...
...
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