Skip to content

Commit

Permalink
Revert
Browse files Browse the repository at this point in the history
  • Loading branch information
RomanPodymov committed Feb 27, 2022
1 parent 9710a71 commit 35b6988
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 23 deletions.
32 changes: 17 additions & 15 deletions Sources/AnyPromise.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,13 +98,6 @@ typedef void (^PMKResolver)(id __nullable) NS_REFINED_FOR_SWIFT;
*/
- (AnyPromise * __nonnull (^ __nonnull)(id __nonnull))then NS_REFINED_FOR_SWIFT;

/**
The provided block is executed on the dispatch queue of your choice when the receiver is fulfilled.
@see then
@see thenInBackground
*/
- (AnyPromise * __nonnull(^ __nonnull)(dispatch_queue_t __nonnull, id __nonnull))thenOn NS_REFINED_FOR_SWIFT;

/**
The provided block is executed on the default queue when the receiver is fulfilled.
Expand All @@ -116,6 +109,14 @@ typedef void (^PMKResolver)(id __nullable) NS_REFINED_FOR_SWIFT;
*/
- (AnyPromise * __nonnull(^ __nonnull)(id __nonnull))thenInBackground NS_REFINED_FOR_SWIFT;

/**
The provided block is executed on the dispatch queue of your choice when the receiver is fulfilled.
@see then
@see thenInBackground
*/
- (AnyPromise * __nonnull(^ __nonnull)(dispatch_queue_t __nonnull, id __nonnull))thenOn NS_REFINED_FOR_SWIFT;

#ifndef __cplusplus
/**
The provided block is executed when the receiver is rejected.
Expand All @@ -139,30 +140,31 @@ typedef void (^PMKResolver)(id __nullable) NS_REFINED_FOR_SWIFT;
Provide a block of form `^(NSError *){}` or simply `^{}`. The parameter has type `id` to give you the freedom to choose either.
The provided block always runs on queue provided.
The provided block always runs on the global background queue.
@warning *Note* Cancellation errors are not caught.
@warning *Note* Since catch is a c++ keyword, this method is not available in Objective-C++ files. Instead use catchWithPolicy.
@see catch
@see catchInBackground
@see catchOn
*/
- (AnyPromise * __nonnull(^ __nonnull)(dispatch_queue_t __nonnull, id __nonnull))catchOn NS_REFINED_FOR_SWIFT;
- (AnyPromise * __nonnull(^ __nonnull)(id __nonnull))catchInBackground NS_REFINED_FOR_SWIFT;


/**
The provided block is executed when the receiver is rejected.
Provide a block of form `^(NSError *){}` or simply `^{}`. The parameter has type `id` to give you the freedom to choose either.
The provided block always runs on the global background queue.
The provided block always runs on queue provided.
@warning *Note* Cancellation errors are not caught.
@warning *Note* Since catch is a c++ keyword, this method is not available in Objective-C++ files. Instead use catchWithPolicy.
@see catch
@see catchOn
@see catchInBackground
*/
- (AnyPromise * __nonnull(^ __nonnull)(id __nonnull))catchInBackground NS_REFINED_FOR_SWIFT;
- (AnyPromise * __nonnull(^ __nonnull)(dispatch_queue_t __nonnull, id __nonnull))catchOn NS_REFINED_FOR_SWIFT;

/**
The provided block is executed when the receiver is resolved.
Expand Down
16 changes: 8 additions & 8 deletions Sources/AnyPromise.m
Original file line number Diff line number Diff line change
Expand Up @@ -70,31 +70,31 @@ - (id)__d {

- (AnyPromise *(^)(id))thenInBackground {
return ^(id block) {
return [self->d __thenOn:dispatch_get_global_queue(QOS_CLASS_UNSPECIFIED, 0) execute:^(id obj) {
return [self->d __thenOn:dispatch_get_global_queue(0, 0) execute:^(id obj) {
return PMKCallVariadicBlock(block, obj);
}];
};
}

- (AnyPromise *(^)(id))catch {
return ^(id block) {
return [self->d __catchOn:dispatch_get_main_queue() execute:^(id obj) {
- (AnyPromise *(^)(dispatch_queue_t, id))catchOn {
return ^(dispatch_queue_t q, id block) {
return [self->d __catchOn:q execute:^(id obj) {
return PMKCallVariadicBlock(block, obj);
}];
};
}

- (AnyPromise *(^)(dispatch_queue_t, id))catchOn {
return ^(dispatch_queue_t q, id block) {
return [self->d __catchOn:q execute:^(id obj) {
- (AnyPromise *(^)(id))catch {
return ^(id block) {
return [self->d __catchOn:dispatch_get_main_queue() execute:^(id obj) {
return PMKCallVariadicBlock(block, obj);
}];
};
}

- (AnyPromise *(^)(id))catchInBackground {
return ^(id block) {
return [self->d __catchOn:dispatch_get_global_queue(QOS_CLASS_UNSPECIFIED, 0) execute:^(id obj) {
return [self->d __catchOn:dispatch_get_global_queue(0, 0) execute:^(id obj) {
return PMKCallVariadicBlock(block, obj);
}];
};
Expand Down

0 comments on commit 35b6988

Please sign in to comment.