Skip to content

Commit

Permalink
- Add cancel operation
Browse files Browse the repository at this point in the history
  • Loading branch information
alvincrisuy committed Jul 23, 2017
1 parent bc3fb4e commit 42693aa
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 7 deletions.
6 changes: 3 additions & 3 deletions CSFramework.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@

Pod::Spec.new do |s|
s.name = 'CSFramework'
s.version = '0.1.7'
s.summary = '0.1.7'
s.version = '0.1.9'
s.summary = '0.1.9'

# This description is used to generate tags and improve search results.
# * Think: What does it do? Why did you write it? What is the focus?
Expand All @@ -33,7 +33,7 @@ TODO: Add long description of the pod here.
s.source_files = 'CSFramework/Classes/**/*'

s.resource_bundles = {
'CSFramework' => ['CSFramework/Assets/*.png', 'CSFramework/Classes/*.xib']
'CSFramework' => ['CSFramework/Classes/*.xib']
}

# s.public_header_files = 'Pod/Classes/**/*.h'
Expand Down
3 changes: 2 additions & 1 deletion CSFramework/Classes/CSRequestManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ typedef NS_ENUM(NSInteger, CSHttpMethod) {
progress:(RequestProgressBlock)progressBlock
success:(RequestSuccessBlock)successBlock
failed:(RequestFailedBlock)failedBlock
authenticated:(BOOL)authenticated;
authenticated:(BOOL)authenticated
canCancelOperation:(BOOL)canCancelOperation;

// Upload Files (Array)
- (void)request:(NSString *)URLString
Expand Down
11 changes: 8 additions & 3 deletions CSFramework/Classes/CSRequestManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,15 @@ - (void)request:(NSString *)URLString
progress:(RequestProgressBlock)progressBlock
success:(RequestSuccessBlock)successBlock
failed:(RequestFailedBlock)failedBlock
authenticated:(BOOL)authenticated {

[self initializeHTTPManagerAuthenticated:authenticated];
authenticated:(BOOL)authenticated
canCancelOperation:(BOOL)canCancelOperation {

[self initializeHTTPManagerAuthenticated:authenticated];

if (canCancelOperation) {
[self.httpManager.operationQueue cancelAllOperations];
}

RequestProgressBlock requestProgressBlock = ^(NSProgress *progress) {

progressBlock(progress);
Expand Down
19 changes: 19 additions & 0 deletions Example/Pods/Pods.xcodeproj/project.pbxproj

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 42693aa

Please sign in to comment.