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
b5c0b88a
Commit
b5c0b88a
authored
May 19, 2016
by
Dima Bart
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add delay for polling handler.
parent
e1ba41a2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
3 deletions
+14
-3
BUYRequestOperation.h
...e Buy SDK/Mobile Buy SDK/Operations/BUYRequestOperation.h
+2
-0
BUYRequestOperation.m
...e Buy SDK/Mobile Buy SDK/Operations/BUYRequestOperation.m
+12
-3
No files found.
Mobile Buy SDK/Mobile Buy SDK/Operations/BUYRequestOperation.h
View file @
b5c0b88a
...
@@ -34,6 +34,8 @@ typedef BOOL (^BUYRequestOperationPollingHandler)(NSDictionary * _Nullable json,
...
@@ -34,6 +34,8 @@ typedef BOOL (^BUYRequestOperationPollingHandler)(NSDictionary * _Nullable json,
@interface
BUYRequestOperation
:
BUYOperation
@interface
BUYRequestOperation
:
BUYOperation
@property
(
assign
,
atomic
)
NSTimeInterval
pollingInterval
;
@property
(
strong
,
nonatomic
,
readonly
,
nonnull
)
NSURLSession
*
session
;
@property
(
strong
,
nonatomic
,
readonly
,
nonnull
)
NSURLSession
*
session
;
@property
(
strong
,
nonatomic
,
readonly
,
nonnull
)
NSURLRequest
*
originalRequest
;
@property
(
strong
,
nonatomic
,
readonly
,
nonnull
)
NSURLRequest
*
originalRequest
;
...
...
Mobile Buy SDK/Mobile Buy SDK/Operations/BUYRequestOperation.m
View file @
b5c0b88a
...
@@ -73,6 +73,8 @@ typedef void (^BUYRequestJSONCompletion)(NSDictionary *json, NSHTTPURLResponse *
...
@@ -73,6 +73,8 @@ typedef void (^BUYRequestJSONCompletion)(NSDictionary *json, NSHTTPURLResponse *
{
{
self
=
[
super
init
];
self
=
[
super
init
];
if
(
self
)
{
if
(
self
)
{
self
.
pollingInterval
=
0
.
3
;
_session
=
session
;
_session
=
session
;
_originalRequest
=
request
;
_originalRequest
=
request
;
_completion
=
completion
;
_completion
=
completion
;
...
@@ -144,9 +146,16 @@ typedef void (^BUYRequestJSONCompletion)(NSDictionary *json, NSHTTPURLResponse *
...
@@ -144,9 +146,16 @@ typedef void (^BUYRequestJSONCompletion)(NSDictionary *json, NSHTTPURLResponse *
* the polling process.
* the polling process.
*/
*/
if
(
self
.
pollingHandler
&&
self
.
pollingHandler
(
json
,
response
,
error
))
{
if
(
self
.
pollingHandler
&&
self
.
pollingHandler
(
json
,
response
,
error
))
{
NSURLSessionDataTask
*
task
=
[
self
requestUsingPollingIfNeeded
:
request
completion
:
completion
];
self
.
runningTask
=
task
;
dispatch_after
(
dispatch_time
(
DISPATCH_TIME_NOW
,
(
int64_t
)(
self
.
pollingInterval
*
NSEC_PER_SEC
)),
dispatch_get_main_queue
(),
^
{
[
task
resume
];
if
(
self
.
isCancelled
)
{
return
;
}
NSURLSessionDataTask
*
task
=
[
self
requestUsingPollingIfNeeded
:
request
completion
:
completion
];
self
.
runningTask
=
task
;
[
task
resume
];
});
}
else
{
}
else
{
completion
(
json
,
response
,
error
);
completion
(
json
,
response
,
error
);
...
...
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