[D] Delete Firebase
This commit is contained in:
@@ -1,8 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: bb828252b0c03402195eddf5b753b753
|
|
||||||
folderAsset: yes
|
|
||||||
DefaultImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 8a00bee9339ea48e0830369bd74bfd59
|
|
||||||
folderAsset: yes
|
|
||||||
DefaultImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
@@ -1,95 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
||||||
<plist version="1.0">
|
|
||||||
<dict>
|
|
||||||
<key>AvailableLibraries</key>
|
|
||||||
<array>
|
|
||||||
<dict>
|
|
||||||
<key>LibraryIdentifier</key>
|
|
||||||
<string>ios-arm64_x86_64-maccatalyst</string>
|
|
||||||
<key>LibraryPath</key>
|
|
||||||
<string>FBLPromises.framework</string>
|
|
||||||
<key>SupportedArchitectures</key>
|
|
||||||
<array>
|
|
||||||
<string>arm64</string>
|
|
||||||
<string>x86_64</string>
|
|
||||||
</array>
|
|
||||||
<key>SupportedPlatform</key>
|
|
||||||
<string>ios</string>
|
|
||||||
<key>SupportedPlatformVariant</key>
|
|
||||||
<string>maccatalyst</string>
|
|
||||||
</dict>
|
|
||||||
<dict>
|
|
||||||
<key>LibraryIdentifier</key>
|
|
||||||
<string>tvos-arm64</string>
|
|
||||||
<key>LibraryPath</key>
|
|
||||||
<string>FBLPromises.framework</string>
|
|
||||||
<key>SupportedArchitectures</key>
|
|
||||||
<array>
|
|
||||||
<string>arm64</string>
|
|
||||||
</array>
|
|
||||||
<key>SupportedPlatform</key>
|
|
||||||
<string>tvos</string>
|
|
||||||
</dict>
|
|
||||||
<dict>
|
|
||||||
<key>LibraryIdentifier</key>
|
|
||||||
<string>tvos-arm64_x86_64-simulator</string>
|
|
||||||
<key>LibraryPath</key>
|
|
||||||
<string>FBLPromises.framework</string>
|
|
||||||
<key>SupportedArchitectures</key>
|
|
||||||
<array>
|
|
||||||
<string>arm64</string>
|
|
||||||
<string>x86_64</string>
|
|
||||||
</array>
|
|
||||||
<key>SupportedPlatform</key>
|
|
||||||
<string>tvos</string>
|
|
||||||
<key>SupportedPlatformVariant</key>
|
|
||||||
<string>simulator</string>
|
|
||||||
</dict>
|
|
||||||
<dict>
|
|
||||||
<key>LibraryIdentifier</key>
|
|
||||||
<string>ios-arm64</string>
|
|
||||||
<key>LibraryPath</key>
|
|
||||||
<string>FBLPromises.framework</string>
|
|
||||||
<key>SupportedArchitectures</key>
|
|
||||||
<array>
|
|
||||||
<string>arm64</string>
|
|
||||||
</array>
|
|
||||||
<key>SupportedPlatform</key>
|
|
||||||
<string>ios</string>
|
|
||||||
</dict>
|
|
||||||
<dict>
|
|
||||||
<key>LibraryIdentifier</key>
|
|
||||||
<string>ios-arm64_x86_64-simulator</string>
|
|
||||||
<key>LibraryPath</key>
|
|
||||||
<string>FBLPromises.framework</string>
|
|
||||||
<key>SupportedArchitectures</key>
|
|
||||||
<array>
|
|
||||||
<string>arm64</string>
|
|
||||||
<string>x86_64</string>
|
|
||||||
</array>
|
|
||||||
<key>SupportedPlatform</key>
|
|
||||||
<string>ios</string>
|
|
||||||
<key>SupportedPlatformVariant</key>
|
|
||||||
<string>simulator</string>
|
|
||||||
</dict>
|
|
||||||
<dict>
|
|
||||||
<key>LibraryIdentifier</key>
|
|
||||||
<string>macos-arm64_x86_64</string>
|
|
||||||
<key>LibraryPath</key>
|
|
||||||
<string>FBLPromises.framework</string>
|
|
||||||
<key>SupportedArchitectures</key>
|
|
||||||
<array>
|
|
||||||
<string>arm64</string>
|
|
||||||
<string>x86_64</string>
|
|
||||||
</array>
|
|
||||||
<key>SupportedPlatform</key>
|
|
||||||
<string>macos</string>
|
|
||||||
</dict>
|
|
||||||
</array>
|
|
||||||
<key>CFBundlePackageType</key>
|
|
||||||
<string>XFWK</string>
|
|
||||||
<key>XCFrameworkFormatVersion</key>
|
|
||||||
<string>1.0</string>
|
|
||||||
</dict>
|
|
||||||
</plist>
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 16bc59efb03b9489098596f7708c8451
|
|
||||||
DefaultImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 1a0333d2a273d4f9eab6a908a290f76d
|
|
||||||
folderAsset: yes
|
|
||||||
DefaultImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
@@ -1,69 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: bac269deb2a7347b6afddf1044a9d0fc
|
|
||||||
folderAsset: yes
|
|
||||||
PluginImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
serializedVersion: 2
|
|
||||||
iconMap: {}
|
|
||||||
executionOrder: {}
|
|
||||||
defineConstraints: []
|
|
||||||
isPreloaded: 0
|
|
||||||
isOverridable: 1
|
|
||||||
isExplicitlyReferenced: 0
|
|
||||||
validateReferences: 1
|
|
||||||
platformData:
|
|
||||||
- first:
|
|
||||||
: Any
|
|
||||||
second:
|
|
||||||
enabled: 0
|
|
||||||
settings:
|
|
||||||
Exclude Android: 1
|
|
||||||
Exclude Editor: 1
|
|
||||||
Exclude Linux64: 1
|
|
||||||
Exclude OSXUniversal: 1
|
|
||||||
Exclude Win: 1
|
|
||||||
Exclude Win64: 1
|
|
||||||
Exclude iOS: 0
|
|
||||||
- first:
|
|
||||||
Any:
|
|
||||||
second:
|
|
||||||
enabled: 0
|
|
||||||
settings: {}
|
|
||||||
- first:
|
|
||||||
Editor: Editor
|
|
||||||
second:
|
|
||||||
enabled: 0
|
|
||||||
settings:
|
|
||||||
DefaultValueInitialized: true
|
|
||||||
- first:
|
|
||||||
Standalone: Linux64
|
|
||||||
second:
|
|
||||||
enabled: 0
|
|
||||||
settings:
|
|
||||||
CPU: None
|
|
||||||
- first:
|
|
||||||
Standalone: OSXUniversal
|
|
||||||
second:
|
|
||||||
enabled: 0
|
|
||||||
settings:
|
|
||||||
CPU: None
|
|
||||||
- first:
|
|
||||||
Standalone: Win
|
|
||||||
second:
|
|
||||||
enabled: 0
|
|
||||||
settings:
|
|
||||||
CPU: None
|
|
||||||
- first:
|
|
||||||
Standalone: Win64
|
|
||||||
second:
|
|
||||||
enabled: 0
|
|
||||||
settings:
|
|
||||||
CPU: None
|
|
||||||
- first:
|
|
||||||
iPhone: iOS
|
|
||||||
second:
|
|
||||||
enabled: 1
|
|
||||||
settings: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
Binary file not shown.
@@ -1,7 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: e6e417a2beb5a4054bf147b697405b65
|
|
||||||
DefaultImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 6328df818a3d4444d87917af5977c658
|
|
||||||
folderAsset: yes
|
|
||||||
DefaultImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
Binary file not shown.
@@ -1,7 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 0e314e40315c0458bb053e27a6e2fa73
|
|
||||||
DefaultImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
||||||
<plist version="1.0">
|
|
||||||
<dict>
|
|
||||||
<key>NSPrivacyAccessedAPITypes</key>
|
|
||||||
<array/>
|
|
||||||
<key>NSPrivacyCollectedDataTypes</key>
|
|
||||||
<array/>
|
|
||||||
<key>NSPrivacyTracking</key>
|
|
||||||
<false/>
|
|
||||||
<key>NSPrivacyTrackingDomains</key>
|
|
||||||
<array/>
|
|
||||||
</dict>
|
|
||||||
</plist>
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 3deab5345117b42cd8d7d849ec16e52d
|
|
||||||
DefaultImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: e8e9bfaa54e53448fb1a6da68931476e
|
|
||||||
folderAsset: yes
|
|
||||||
DefaultImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
@@ -1,63 +0,0 @@
|
|||||||
/**
|
|
||||||
Copyright 2018 Google Inc. All rights reserved.
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at:
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#import "FBLPromise.h"
|
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_BEGIN
|
|
||||||
|
|
||||||
@interface FBLPromise<Value>(AllAdditions)
|
|
||||||
|
|
||||||
/**
|
|
||||||
Wait until all of the given promises are fulfilled.
|
|
||||||
If one of the given promises is rejected, then the returned promise is rejected with same error.
|
|
||||||
If any other arbitrary value or `NSError` appears in the array instead of `FBLPromise`,
|
|
||||||
it's implicitly considered a pre-fulfilled or pre-rejected `FBLPromise` correspondingly.
|
|
||||||
Promises resolved with `nil` become `NSNull` instances in the resulting array.
|
|
||||||
|
|
||||||
@param promises Promises to wait for.
|
|
||||||
@return Promise of an array containing the values of input promises in the same order.
|
|
||||||
*/
|
|
||||||
+ (FBLPromise<NSArray *> *)all:(NSArray *)promises NS_SWIFT_UNAVAILABLE("");
|
|
||||||
|
|
||||||
/**
|
|
||||||
Wait until all of the given promises are fulfilled.
|
|
||||||
If one of the given promises is rejected, then the returned promise is rejected with same error.
|
|
||||||
If any other arbitrary value or `NSError` appears in the array instead of `FBLPromise`,
|
|
||||||
it's implicitly considered a pre-fulfilled or pre-rejected FBLPromise correspondingly.
|
|
||||||
Promises resolved with `nil` become `NSNull` instances in the resulting array.
|
|
||||||
|
|
||||||
@param queue A queue to dispatch on.
|
|
||||||
@param promises Promises to wait for.
|
|
||||||
@return Promise of an array containing the values of input promises in the same order.
|
|
||||||
*/
|
|
||||||
+ (FBLPromise<NSArray *> *)onQueue:(dispatch_queue_t)queue
|
|
||||||
all:(NSArray *)promises NS_REFINED_FOR_SWIFT;
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
||||||
/**
|
|
||||||
Convenience dot-syntax wrappers for `FBLPromise` `all` operators.
|
|
||||||
Usage: FBLPromise.all(@[ ... ])
|
|
||||||
*/
|
|
||||||
@interface FBLPromise<Value>(DotSyntax_AllAdditions)
|
|
||||||
|
|
||||||
+ (FBLPromise<NSArray *> * (^)(NSArray *))all FBL_PROMISES_DOT_SYNTAX NS_SWIFT_UNAVAILABLE("");
|
|
||||||
+ (FBLPromise<NSArray *> * (^)(dispatch_queue_t, NSArray *))allOn FBL_PROMISES_DOT_SYNTAX
|
|
||||||
NS_SWIFT_UNAVAILABLE("");
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_END
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 203718a0c71844588948dfc690418a9c
|
|
||||||
DefaultImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
@@ -1,54 +0,0 @@
|
|||||||
/**
|
|
||||||
Copyright 2018 Google Inc. All rights reserved.
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at:
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#import "FBLPromise.h"
|
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_BEGIN
|
|
||||||
|
|
||||||
@interface FBLPromise<Value>(AlwaysAdditions)
|
|
||||||
|
|
||||||
typedef void (^FBLPromiseAlwaysWorkBlock)(void) NS_SWIFT_UNAVAILABLE("");
|
|
||||||
|
|
||||||
/**
|
|
||||||
@param work A block that always executes, no matter if the receiver is rejected or fulfilled.
|
|
||||||
@return A new pending promise to be resolved with same resolution as the receiver.
|
|
||||||
*/
|
|
||||||
- (FBLPromise *)always:(FBLPromiseAlwaysWorkBlock)work NS_SWIFT_UNAVAILABLE("");
|
|
||||||
|
|
||||||
/**
|
|
||||||
@param queue A queue to dispatch on.
|
|
||||||
@param work A block that always executes, no matter if the receiver is rejected or fulfilled.
|
|
||||||
@return A new pending promise to be resolved with same resolution as the receiver.
|
|
||||||
*/
|
|
||||||
- (FBLPromise *)onQueue:(dispatch_queue_t)queue
|
|
||||||
always:(FBLPromiseAlwaysWorkBlock)work NS_REFINED_FOR_SWIFT;
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
||||||
/**
|
|
||||||
Convenience dot-syntax wrappers for `FBLPromise` `always` operators.
|
|
||||||
Usage: promise.always(^{...})
|
|
||||||
*/
|
|
||||||
@interface FBLPromise<Value>(DotSyntax_AlwaysAdditions)
|
|
||||||
|
|
||||||
- (FBLPromise* (^)(FBLPromiseAlwaysWorkBlock))always FBL_PROMISES_DOT_SYNTAX
|
|
||||||
NS_SWIFT_UNAVAILABLE("");
|
|
||||||
- (FBLPromise* (^)(dispatch_queue_t, FBLPromiseAlwaysWorkBlock))alwaysOn FBL_PROMISES_DOT_SYNTAX
|
|
||||||
NS_SWIFT_UNAVAILABLE("");
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_END
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 1400e34b354f14312a91a79b4fc46811
|
|
||||||
DefaultImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
@@ -1,69 +0,0 @@
|
|||||||
/**
|
|
||||||
Copyright 2018 Google Inc. All rights reserved.
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at:
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#import "FBLPromise.h"
|
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_BEGIN
|
|
||||||
|
|
||||||
@interface FBLPromise<Value>(AnyAdditions)
|
|
||||||
|
|
||||||
/**
|
|
||||||
Waits until all of the given promises are either fulfilled or rejected.
|
|
||||||
If all promises are rejected, then the returned promise is rejected with same error
|
|
||||||
as the last one rejected.
|
|
||||||
If at least one of the promises is fulfilled, the resulting promise is fulfilled with an array of
|
|
||||||
values or `NSErrors`, matching the original order of fulfilled or rejected promises respectively.
|
|
||||||
If any other arbitrary value or `NSError` appears in the array instead of `FBLPromise`,
|
|
||||||
it's implicitly considered a pre-fulfilled or pre-rejected `FBLPromise` correspondingly.
|
|
||||||
Promises resolved with `nil` become `NSNull` instances in the resulting array.
|
|
||||||
|
|
||||||
@param promises Promises to wait for.
|
|
||||||
@return Promise of array containing the values or `NSError`s of input promises in the same order.
|
|
||||||
*/
|
|
||||||
+ (FBLPromise<NSArray *> *)any:(NSArray *)promises NS_SWIFT_UNAVAILABLE("");
|
|
||||||
|
|
||||||
/**
|
|
||||||
Waits until all of the given promises are either fulfilled or rejected.
|
|
||||||
If all promises are rejected, then the returned promise is rejected with same error
|
|
||||||
as the last one rejected.
|
|
||||||
If at least one of the promises is fulfilled, the resulting promise is fulfilled with an array of
|
|
||||||
values or `NSError`s, matching the original order of fulfilled or rejected promises respectively.
|
|
||||||
If any other arbitrary value or `NSError` appears in the array instead of `FBLPromise`,
|
|
||||||
it's implicitly considered a pre-fulfilled or pre-rejected `FBLPromise` correspondingly.
|
|
||||||
Promises resolved with `nil` become `NSNull` instances in the resulting array.
|
|
||||||
|
|
||||||
@param queue A queue to dispatch on.
|
|
||||||
@param promises Promises to wait for.
|
|
||||||
@return Promise of array containing the values or `NSError`s of input promises in the same order.
|
|
||||||
*/
|
|
||||||
+ (FBLPromise<NSArray *> *)onQueue:(dispatch_queue_t)queue
|
|
||||||
any:(NSArray *)promises NS_REFINED_FOR_SWIFT;
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
||||||
/**
|
|
||||||
Convenience dot-syntax wrappers for `FBLPromise` `any` operators.
|
|
||||||
Usage: FBLPromise.any(@[ ... ])
|
|
||||||
*/
|
|
||||||
@interface FBLPromise<Value>(DotSyntax_AnyAdditions)
|
|
||||||
|
|
||||||
+ (FBLPromise<NSArray *> * (^)(NSArray *))any FBL_PROMISES_DOT_SYNTAX NS_SWIFT_UNAVAILABLE("");
|
|
||||||
+ (FBLPromise<NSArray *> * (^)(dispatch_queue_t, NSArray *))anyOn FBL_PROMISES_DOT_SYNTAX
|
|
||||||
NS_SWIFT_UNAVAILABLE("");
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_END
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: b3d57fb83fd8e4f2abf7e08deaea9880
|
|
||||||
DefaultImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
@@ -1,60 +0,0 @@
|
|||||||
/**
|
|
||||||
Copyright 2018 Google Inc. All rights reserved.
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at:
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#import "FBLPromise.h"
|
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_BEGIN
|
|
||||||
|
|
||||||
@interface FBLPromise<Value>(AsyncAdditions)
|
|
||||||
|
|
||||||
typedef void (^FBLPromiseFulfillBlock)(Value __nullable value) NS_SWIFT_UNAVAILABLE("");
|
|
||||||
typedef void (^FBLPromiseRejectBlock)(NSError *error) NS_SWIFT_UNAVAILABLE("");
|
|
||||||
typedef void (^FBLPromiseAsyncWorkBlock)(FBLPromiseFulfillBlock fulfill,
|
|
||||||
FBLPromiseRejectBlock reject) NS_SWIFT_UNAVAILABLE("");
|
|
||||||
|
|
||||||
/**
|
|
||||||
Creates a pending promise and executes `work` block asynchronously.
|
|
||||||
|
|
||||||
@param work A block to perform any operations needed to resolve the promise.
|
|
||||||
@return A new pending promise.
|
|
||||||
*/
|
|
||||||
+ (instancetype)async:(FBLPromiseAsyncWorkBlock)work NS_SWIFT_UNAVAILABLE("");
|
|
||||||
|
|
||||||
/**
|
|
||||||
Creates a pending promise and executes `work` block asynchronously on the given queue.
|
|
||||||
|
|
||||||
@param queue A queue to invoke the `work` block on.
|
|
||||||
@param work A block to perform any operations needed to resolve the promise.
|
|
||||||
@return A new pending promise.
|
|
||||||
*/
|
|
||||||
+ (instancetype)onQueue:(dispatch_queue_t)queue
|
|
||||||
async:(FBLPromiseAsyncWorkBlock)work NS_REFINED_FOR_SWIFT;
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
||||||
/**
|
|
||||||
Convenience dot-syntax wrappers for `FBLPromise` `async` operators.
|
|
||||||
Usage: FBLPromise.async(^(FBLPromiseFulfillBlock fulfill, FBLPromiseRejectBlock reject) { ... })
|
|
||||||
*/
|
|
||||||
@interface FBLPromise<Value>(DotSyntax_AsyncAdditions)
|
|
||||||
|
|
||||||
+ (FBLPromise* (^)(FBLPromiseAsyncWorkBlock))async FBL_PROMISES_DOT_SYNTAX NS_SWIFT_UNAVAILABLE("");
|
|
||||||
+ (FBLPromise* (^)(dispatch_queue_t, FBLPromiseAsyncWorkBlock))asyncOn FBL_PROMISES_DOT_SYNTAX
|
|
||||||
NS_SWIFT_UNAVAILABLE("");
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_END
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 307e0d9f42baf434a8cf8663f176797f
|
|
||||||
DefaultImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
@@ -1,32 +0,0 @@
|
|||||||
/**
|
|
||||||
Copyright 2018 Google Inc. All rights reserved.
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at:
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#import "FBLPromise.h"
|
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_BEGIN
|
|
||||||
|
|
||||||
/**
|
|
||||||
Waits for promise resolution. The current thread blocks until the promise is resolved.
|
|
||||||
|
|
||||||
@param promise Promise to wait for.
|
|
||||||
@param error Error the promise was rejected with, or `nil` if the promise was fulfilled.
|
|
||||||
@return Value the promise was fulfilled with. If the promise was rejected, the return value
|
|
||||||
is always `nil`, but the error out arg is not.
|
|
||||||
*/
|
|
||||||
FOUNDATION_EXTERN id __nullable FBLPromiseAwait(FBLPromise *promise,
|
|
||||||
NSError **error) NS_REFINED_FOR_SWIFT;
|
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_END
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 7e4ad20e72d7d46798e3f47d23ad3c35
|
|
||||||
DefaultImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
@@ -1,59 +0,0 @@
|
|||||||
/**
|
|
||||||
Copyright 2018 Google Inc. All rights reserved.
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at:
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#import "FBLPromise.h"
|
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_BEGIN
|
|
||||||
|
|
||||||
@interface FBLPromise<Value>(CatchAdditions)
|
|
||||||
|
|
||||||
typedef void (^FBLPromiseCatchWorkBlock)(NSError *error) NS_SWIFT_UNAVAILABLE("");
|
|
||||||
|
|
||||||
/**
|
|
||||||
Creates a pending promise which eventually gets resolved with same resolution as the receiver.
|
|
||||||
If receiver is rejected, then `reject` block is executed asynchronously.
|
|
||||||
|
|
||||||
@param reject A block to handle the error that receiver was rejected with.
|
|
||||||
@return A new pending promise.
|
|
||||||
*/
|
|
||||||
- (FBLPromise *)catch:(FBLPromiseCatchWorkBlock)reject NS_SWIFT_UNAVAILABLE("");
|
|
||||||
|
|
||||||
/**
|
|
||||||
Creates a pending promise which eventually gets resolved with same resolution as the receiver.
|
|
||||||
If receiver is rejected, then `reject` block is executed asynchronously on the given queue.
|
|
||||||
|
|
||||||
@param queue A queue to invoke the `reject` block on.
|
|
||||||
@param reject A block to handle the error that receiver was rejected with.
|
|
||||||
@return A new pending promise.
|
|
||||||
*/
|
|
||||||
- (FBLPromise *)onQueue:(dispatch_queue_t)queue
|
|
||||||
catch:(FBLPromiseCatchWorkBlock)reject NS_REFINED_FOR_SWIFT;
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
||||||
/**
|
|
||||||
Convenience dot-syntax wrappers for `FBLPromise` `catch` operators.
|
|
||||||
Usage: promise.catch(^(NSError *error) { ... })
|
|
||||||
*/
|
|
||||||
@interface FBLPromise<Value>(DotSyntax_CatchAdditions)
|
|
||||||
|
|
||||||
- (FBLPromise* (^)(FBLPromiseCatchWorkBlock))catch FBL_PROMISES_DOT_SYNTAX NS_SWIFT_UNAVAILABLE("");
|
|
||||||
- (FBLPromise* (^)(dispatch_queue_t, FBLPromiseCatchWorkBlock))catchOn FBL_PROMISES_DOT_SYNTAX
|
|
||||||
NS_SWIFT_UNAVAILABLE("");
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_END
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: ffe4ca61ad77b49e0ad6a0bce997190f
|
|
||||||
DefaultImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
@@ -1,59 +0,0 @@
|
|||||||
/**
|
|
||||||
Copyright 2018 Google Inc. All rights reserved.
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at:
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#import "FBLPromise.h"
|
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_BEGIN
|
|
||||||
|
|
||||||
@interface FBLPromise<Value>(DelayAdditions)
|
|
||||||
|
|
||||||
/**
|
|
||||||
Creates a new pending promise that fulfills with the same value as `self` after the `delay`, or
|
|
||||||
rejects with the same error immediately.
|
|
||||||
|
|
||||||
@param interval Time to wait in seconds.
|
|
||||||
@return A new pending promise that fulfills at least `delay` seconds later than `self`, or rejects
|
|
||||||
with the same error immediately.
|
|
||||||
*/
|
|
||||||
- (FBLPromise *)delay:(NSTimeInterval)interval NS_SWIFT_UNAVAILABLE("");
|
|
||||||
|
|
||||||
/**
|
|
||||||
Creates a new pending promise that fulfills with the same value as `self` after the `delay`, or
|
|
||||||
rejects with the same error immediately.
|
|
||||||
|
|
||||||
@param queue A queue to dispatch on.
|
|
||||||
@param interval Time to wait in seconds.
|
|
||||||
@return A new pending promise that fulfills at least `delay` seconds later than `self`, or rejects
|
|
||||||
with the same error immediately.
|
|
||||||
*/
|
|
||||||
- (FBLPromise *)onQueue:(dispatch_queue_t)queue
|
|
||||||
delay:(NSTimeInterval)interval NS_REFINED_FOR_SWIFT;
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
||||||
/**
|
|
||||||
Convenience dot-syntax wrappers for `FBLPromise` `delay` operators.
|
|
||||||
Usage: promise.delay(...)
|
|
||||||
*/
|
|
||||||
@interface FBLPromise<Value>(DotSyntax_DelayAdditions)
|
|
||||||
|
|
||||||
- (FBLPromise * (^)(NSTimeInterval))delay FBL_PROMISES_DOT_SYNTAX NS_SWIFT_UNAVAILABLE("");
|
|
||||||
- (FBLPromise * (^)(dispatch_queue_t, NSTimeInterval))delayOn FBL_PROMISES_DOT_SYNTAX
|
|
||||||
NS_SWIFT_UNAVAILABLE("");
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_END
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: aa277d742e0e94a238e8e125cea8e940
|
|
||||||
DefaultImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
@@ -1,55 +0,0 @@
|
|||||||
/**
|
|
||||||
Copyright 2018 Google Inc. All rights reserved.
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at:
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#import "FBLPromise.h"
|
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_BEGIN
|
|
||||||
|
|
||||||
@interface FBLPromise<Value>(DoAdditions)
|
|
||||||
|
|
||||||
typedef id __nullable (^FBLPromiseDoWorkBlock)(void) NS_SWIFT_UNAVAILABLE("");
|
|
||||||
|
|
||||||
/**
|
|
||||||
Creates a pending promise and executes `work` block asynchronously.
|
|
||||||
|
|
||||||
@param work A block that returns a value or an error used to resolve the promise.
|
|
||||||
@return A new pending promise.
|
|
||||||
*/
|
|
||||||
+ (instancetype)do:(FBLPromiseDoWorkBlock)work NS_SWIFT_UNAVAILABLE("");
|
|
||||||
|
|
||||||
/**
|
|
||||||
Creates a pending promise and executes `work` block asynchronously on the given queue.
|
|
||||||
|
|
||||||
@param queue A queue to invoke the `work` block on.
|
|
||||||
@param work A block that returns a value or an error used to resolve the promise.
|
|
||||||
@return A new pending promise.
|
|
||||||
*/
|
|
||||||
+ (instancetype)onQueue:(dispatch_queue_t)queue do:(FBLPromiseDoWorkBlock)work NS_REFINED_FOR_SWIFT;
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
||||||
/**
|
|
||||||
Convenience dot-syntax wrappers for `FBLPromise` `do` operators.
|
|
||||||
Usage: FBLPromise.doOn(queue, ^(NSError *error) { ... })
|
|
||||||
*/
|
|
||||||
@interface FBLPromise<Value>(DotSyntax_DoAdditions)
|
|
||||||
|
|
||||||
+ (FBLPromise * (^)(dispatch_queue_t, FBLPromiseDoWorkBlock))doOn FBL_PROMISES_DOT_SYNTAX
|
|
||||||
NS_SWIFT_UNAVAILABLE("");
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_END
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: e48996a9357374a77a75d23c97fb5c0c
|
|
||||||
DefaultImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
@@ -1,62 +0,0 @@
|
|||||||
/**
|
|
||||||
Copyright 2018 Google Inc. All rights reserved.
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at:
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#import "FBLPromise.h"
|
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_BEGIN
|
|
||||||
|
|
||||||
@interface FBLPromise<Value>(RaceAdditions)
|
|
||||||
|
|
||||||
/**
|
|
||||||
Wait until any of the given promises are fulfilled.
|
|
||||||
If one of the promises is rejected, then the returned promise is rejected with same error.
|
|
||||||
If any other arbitrary value or `NSError` appears in the array instead of `FBLPromise`,
|
|
||||||
it's implicitly considered a pre-fulfilled or pre-rejected `FBLPromise` correspondingly.
|
|
||||||
|
|
||||||
@param promises Promises to wait for.
|
|
||||||
@return A new pending promise to be resolved with the same resolution as the first promise, among
|
|
||||||
the given ones, which was resolved.
|
|
||||||
*/
|
|
||||||
+ (instancetype)race:(NSArray *)promises NS_SWIFT_UNAVAILABLE("");
|
|
||||||
|
|
||||||
/**
|
|
||||||
Wait until any of the given promises are fulfilled.
|
|
||||||
If one of the promises is rejected, then the returned promise is rejected with same error.
|
|
||||||
If any other arbitrary value or `NSError` appears in the array instead of `FBLPromise`,
|
|
||||||
it's implicitly considered a pre-fulfilled or pre-rejected `FBLPromise` correspondingly.
|
|
||||||
|
|
||||||
@param queue A queue to dispatch on.
|
|
||||||
@param promises Promises to wait for.
|
|
||||||
@return A new pending promise to be resolved with the same resolution as the first promise, among
|
|
||||||
the given ones, which was resolved.
|
|
||||||
*/
|
|
||||||
+ (instancetype)onQueue:(dispatch_queue_t)queue race:(NSArray *)promises NS_REFINED_FOR_SWIFT;
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
||||||
/**
|
|
||||||
Convenience dot-syntax wrappers for `FBLPromise` `race` operators.
|
|
||||||
Usage: FBLPromise.race(@[ ... ])
|
|
||||||
*/
|
|
||||||
@interface FBLPromise<Value>(DotSyntax_RaceAdditions)
|
|
||||||
|
|
||||||
+ (FBLPromise * (^)(NSArray *))race FBL_PROMISES_DOT_SYNTAX NS_SWIFT_UNAVAILABLE("");
|
|
||||||
+ (FBLPromise * (^)(dispatch_queue_t, NSArray *))raceOn FBL_PROMISES_DOT_SYNTAX
|
|
||||||
NS_SWIFT_UNAVAILABLE("");
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_END
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: c025dc5120ced4423add47e866d49aee
|
|
||||||
DefaultImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
@@ -1,60 +0,0 @@
|
|||||||
/**
|
|
||||||
Copyright 2018 Google Inc. All rights reserved.
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at:
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#import "FBLPromise.h"
|
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_BEGIN
|
|
||||||
|
|
||||||
@interface FBLPromise<Value>(RecoverAdditions)
|
|
||||||
|
|
||||||
typedef id __nullable (^FBLPromiseRecoverWorkBlock)(NSError *error) NS_SWIFT_UNAVAILABLE("");
|
|
||||||
|
|
||||||
/**
|
|
||||||
Provides a new promise to recover in case the receiver gets rejected.
|
|
||||||
|
|
||||||
@param recovery A block to handle the error that the receiver was rejected with.
|
|
||||||
@return A new pending promise to use instead of the rejected one that gets resolved with resolution
|
|
||||||
returned from `recovery` block.
|
|
||||||
*/
|
|
||||||
- (FBLPromise *)recover:(FBLPromiseRecoverWorkBlock)recovery NS_SWIFT_UNAVAILABLE("");
|
|
||||||
|
|
||||||
/**
|
|
||||||
Provides a new promise to recover in case the receiver gets rejected.
|
|
||||||
|
|
||||||
@param queue A queue to dispatch on.
|
|
||||||
@param recovery A block to handle the error that the receiver was rejected with.
|
|
||||||
@return A new pending promise to use instead of the rejected one that gets resolved with resolution
|
|
||||||
returned from `recovery` block.
|
|
||||||
*/
|
|
||||||
- (FBLPromise *)onQueue:(dispatch_queue_t)queue
|
|
||||||
recover:(FBLPromiseRecoverWorkBlock)recovery NS_REFINED_FOR_SWIFT;
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
||||||
/**
|
|
||||||
Convenience dot-syntax wrappers for `FBLPromise` `recover` operators.
|
|
||||||
Usage: promise.recover(^id(NSError *error) {...})
|
|
||||||
*/
|
|
||||||
@interface FBLPromise<Value>(DotSyntax_RecoverAdditions)
|
|
||||||
|
|
||||||
- (FBLPromise * (^)(FBLPromiseRecoverWorkBlock))recover FBL_PROMISES_DOT_SYNTAX
|
|
||||||
NS_SWIFT_UNAVAILABLE("");
|
|
||||||
- (FBLPromise * (^)(dispatch_queue_t, FBLPromiseRecoverWorkBlock))recoverOn FBL_PROMISES_DOT_SYNTAX
|
|
||||||
NS_SWIFT_UNAVAILABLE("");
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_END
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 3ee9ce20d2bfe4cb98281496ba06c049
|
|
||||||
DefaultImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
@@ -1,71 +0,0 @@
|
|||||||
/**
|
|
||||||
Copyright 2018 Google Inc. All rights reserved.
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at:
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#import "FBLPromise.h"
|
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_BEGIN
|
|
||||||
|
|
||||||
@interface FBLPromise<Value>(ReduceAdditions)
|
|
||||||
|
|
||||||
typedef id __nullable (^FBLPromiseReducerBlock)(Value __nullable partial, id next)
|
|
||||||
NS_SWIFT_UNAVAILABLE("");
|
|
||||||
|
|
||||||
/**
|
|
||||||
Sequentially reduces a collection of values to a single promise using a given combining block
|
|
||||||
and the value `self` resolves with as initial value.
|
|
||||||
|
|
||||||
@param items An array of values to process in order.
|
|
||||||
@param reducer A block to combine an accumulating value and an element of the sequence into
|
|
||||||
the new accumulating value or a promise resolved with it, to be used in the next
|
|
||||||
call of the `reducer` or returned to the caller.
|
|
||||||
@return A new pending promise returned from the last `reducer` invocation.
|
|
||||||
Or `self` if `items` is empty.
|
|
||||||
*/
|
|
||||||
- (FBLPromise *)reduce:(NSArray *)items
|
|
||||||
combine:(FBLPromiseReducerBlock)reducer NS_SWIFT_UNAVAILABLE("");
|
|
||||||
|
|
||||||
/**
|
|
||||||
Sequentially reduces a collection of values to a single promise using a given combining block
|
|
||||||
and the value `self` resolves with as initial value.
|
|
||||||
|
|
||||||
@param queue A queue to dispatch on.
|
|
||||||
@param items An array of values to process in order.
|
|
||||||
@param reducer A block to combine an accumulating value and an element of the sequence into
|
|
||||||
the new accumulating value or a promise resolved with it, to be used in the next
|
|
||||||
call of the `reducer` or returned to the caller.
|
|
||||||
@return A new pending promise returned from the last `reducer` invocation.
|
|
||||||
Or `self` if `items` is empty.
|
|
||||||
*/
|
|
||||||
- (FBLPromise *)onQueue:(dispatch_queue_t)queue
|
|
||||||
reduce:(NSArray *)items
|
|
||||||
combine:(FBLPromiseReducerBlock)reducer NS_SWIFT_UNAVAILABLE("");
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
||||||
/**
|
|
||||||
Convenience dot-syntax wrappers for `FBLPromise` `reduce` operators.
|
|
||||||
Usage: promise.reduce(values, ^id(id partial, id next) { ... })
|
|
||||||
*/
|
|
||||||
@interface FBLPromise<Value>(DotSyntax_ReduceAdditions)
|
|
||||||
|
|
||||||
- (FBLPromise * (^)(NSArray *, FBLPromiseReducerBlock))reduce FBL_PROMISES_DOT_SYNTAX
|
|
||||||
NS_SWIFT_UNAVAILABLE("");
|
|
||||||
- (FBLPromise * (^)(dispatch_queue_t, NSArray *, FBLPromiseReducerBlock))reduceOn
|
|
||||||
FBL_PROMISES_DOT_SYNTAX NS_SWIFT_UNAVAILABLE("");
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_END
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 71721c6a3ffa240e0a4ee5b72c14f86e
|
|
||||||
DefaultImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
@@ -1,165 +0,0 @@
|
|||||||
/**
|
|
||||||
Copyright 2018 Google Inc. All rights reserved.
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at:
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#import "FBLPromise.h"
|
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_BEGIN
|
|
||||||
|
|
||||||
/** The default number of retry attempts is 1. */
|
|
||||||
FOUNDATION_EXTERN NSInteger const FBLPromiseRetryDefaultAttemptsCount NS_REFINED_FOR_SWIFT;
|
|
||||||
|
|
||||||
/** The default delay interval before making a retry attempt is 1.0 second. */
|
|
||||||
FOUNDATION_EXTERN NSTimeInterval const FBLPromiseRetryDefaultDelayInterval NS_REFINED_FOR_SWIFT;
|
|
||||||
|
|
||||||
@interface FBLPromise<Value>(RetryAdditions)
|
|
||||||
|
|
||||||
typedef id __nullable (^FBLPromiseRetryWorkBlock)(void) NS_SWIFT_UNAVAILABLE("");
|
|
||||||
typedef BOOL (^FBLPromiseRetryPredicateBlock)(NSInteger, NSError *) NS_SWIFT_UNAVAILABLE("");
|
|
||||||
|
|
||||||
/**
|
|
||||||
Creates a pending promise that fulfills with the same value as the promise returned from `work`
|
|
||||||
block, which executes asynchronously, or rejects with the same error after all retry attempts have
|
|
||||||
been exhausted. Defaults to `FBLPromiseRetryDefaultAttemptsCount` attempt(s) on rejection where the
|
|
||||||
`work` block is retried after a delay of `FBLPromiseRetryDefaultDelayInterval` second(s).
|
|
||||||
|
|
||||||
@param work A block that executes asynchronously on the default queue and returns a value or an
|
|
||||||
error used to resolve the promise.
|
|
||||||
@return A new pending promise that fulfills with the same value as the promise returned from `work`
|
|
||||||
block, or rejects with the same error after all retry attempts have been exhausted.
|
|
||||||
*/
|
|
||||||
+ (instancetype)retry:(FBLPromiseRetryWorkBlock)work NS_SWIFT_UNAVAILABLE("");
|
|
||||||
|
|
||||||
/**
|
|
||||||
Creates a pending promise that fulfills with the same value as the promise returned from `work`
|
|
||||||
block, which executes asynchronously on the given `queue`, or rejects with the same error after all
|
|
||||||
retry attempts have been exhausted. Defaults to `FBLPromiseRetryDefaultAttemptsCount` attempt(s) on
|
|
||||||
rejection where the `work` block is retried on the given `queue` after a delay of
|
|
||||||
`FBLPromiseRetryDefaultDelayInterval` second(s).
|
|
||||||
|
|
||||||
@param queue A queue to invoke the `work` block on.
|
|
||||||
@param work A block that executes asynchronously on the given `queue` and returns a value or an
|
|
||||||
error used to resolve the promise.
|
|
||||||
@return A new pending promise that fulfills with the same value as the promise returned from `work`
|
|
||||||
block, or rejects with the same error after all retry attempts have been exhausted.
|
|
||||||
*/
|
|
||||||
+ (instancetype)onQueue:(dispatch_queue_t)queue
|
|
||||||
retry:(FBLPromiseRetryWorkBlock)work NS_SWIFT_UNAVAILABLE("");
|
|
||||||
|
|
||||||
/**
|
|
||||||
Creates a pending promise that fulfills with the same value as the promise returned from `work`
|
|
||||||
block, which executes asynchronously, or rejects with the same error after all retry attempts have
|
|
||||||
been exhausted.
|
|
||||||
|
|
||||||
@param count Max number of retry attempts. The `work` block will be executed once if the specified
|
|
||||||
count is less than or equal to zero.
|
|
||||||
@param work A block that executes asynchronously on the default queue and returns a value or an
|
|
||||||
error used to resolve the promise.
|
|
||||||
@return A new pending promise that fulfills with the same value as the promise returned from `work`
|
|
||||||
block, or rejects with the same error after all retry attempts have been exhausted.
|
|
||||||
*/
|
|
||||||
+ (instancetype)attempts:(NSInteger)count
|
|
||||||
retry:(FBLPromiseRetryWorkBlock)work NS_SWIFT_UNAVAILABLE("");
|
|
||||||
|
|
||||||
/**
|
|
||||||
Creates a pending promise that fulfills with the same value as the promise returned from `work`
|
|
||||||
block, which executes asynchronously on the given `queue`, or rejects with the same error after all
|
|
||||||
retry attempts have been exhausted.
|
|
||||||
|
|
||||||
@param queue A queue to invoke the `work` block on.
|
|
||||||
@param count Max number of retry attempts. The `work` block will be executed once if the specified
|
|
||||||
count is less than or equal to zero.
|
|
||||||
@param work A block that executes asynchronously on the given `queue` and returns a value or an
|
|
||||||
error used to resolve the promise.
|
|
||||||
@return A new pending promise that fulfills with the same value as the promise returned from `work`
|
|
||||||
block, or rejects with the same error after all retry attempts have been exhausted.
|
|
||||||
*/
|
|
||||||
+ (instancetype)onQueue:(dispatch_queue_t)queue
|
|
||||||
attempts:(NSInteger)count
|
|
||||||
retry:(FBLPromiseRetryWorkBlock)work NS_SWIFT_UNAVAILABLE("");
|
|
||||||
|
|
||||||
/**
|
|
||||||
Creates a pending promise that fulfills with the same value as the promise returned from `work`
|
|
||||||
block, which executes asynchronously, or rejects with the same error after all retry attempts have
|
|
||||||
been exhausted. On rejection, the `work` block is retried after the given delay `interval` and will
|
|
||||||
continue to retry until the number of specified attempts have been exhausted or will bail early if
|
|
||||||
the given condition is not met.
|
|
||||||
|
|
||||||
@param count Max number of retry attempts. The `work` block will be executed once if the specified
|
|
||||||
count is less than or equal to zero.
|
|
||||||
@param interval Time to wait before the next retry attempt.
|
|
||||||
@param predicate Condition to check before the next retry attempt. The predicate block provides the
|
|
||||||
the number of remaining retry attempts and the error that the promise was rejected
|
|
||||||
with.
|
|
||||||
@param work A block that executes asynchronously on the default queue and returns a value or an
|
|
||||||
error used to resolve the promise.
|
|
||||||
@return A new pending promise that fulfills with the same value as the promise returned from `work`
|
|
||||||
block, or rejects with the same error after all retry attempts have been exhausted or if
|
|
||||||
the given condition is not met.
|
|
||||||
*/
|
|
||||||
+ (instancetype)attempts:(NSInteger)count
|
|
||||||
delay:(NSTimeInterval)interval
|
|
||||||
condition:(nullable FBLPromiseRetryPredicateBlock)predicate
|
|
||||||
retry:(FBLPromiseRetryWorkBlock)work NS_SWIFT_UNAVAILABLE("");
|
|
||||||
|
|
||||||
/**
|
|
||||||
Creates a pending promise that fulfills with the same value as the promise returned from `work`
|
|
||||||
block, which executes asynchronously on the given `queue`, or rejects with the same error after all
|
|
||||||
retry attempts have been exhausted. On rejection, the `work` block is retried after the given
|
|
||||||
delay `interval` and will continue to retry until the number of specified attempts have been
|
|
||||||
exhausted or will bail early if the given condition is not met.
|
|
||||||
|
|
||||||
@param queue A queue to invoke the `work` block on.
|
|
||||||
@param count Max number of retry attempts. The `work` block will be executed once if the specified
|
|
||||||
count is less than or equal to zero.
|
|
||||||
@param interval Time to wait before the next retry attempt.
|
|
||||||
@param predicate Condition to check before the next retry attempt. The predicate block provides the
|
|
||||||
the number of remaining retry attempts and the error that the promise was rejected
|
|
||||||
with.
|
|
||||||
@param work A block that executes asynchronously on the given `queue` and returns a value or an
|
|
||||||
error used to resolve the promise.
|
|
||||||
@return A new pending promise that fulfills with the same value as the promise returned from `work`
|
|
||||||
block, or rejects with the same error after all retry attempts have been exhausted or if
|
|
||||||
the given condition is not met.
|
|
||||||
*/
|
|
||||||
+ (instancetype)onQueue:(dispatch_queue_t)queue
|
|
||||||
attempts:(NSInteger)count
|
|
||||||
delay:(NSTimeInterval)interval
|
|
||||||
condition:(nullable FBLPromiseRetryPredicateBlock)predicate
|
|
||||||
retry:(FBLPromiseRetryWorkBlock)work NS_REFINED_FOR_SWIFT;
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
||||||
/**
|
|
||||||
Convenience dot-syntax wrappers for `FBLPromise+Retry` operators.
|
|
||||||
Usage: FBLPromise.retry(^id { ... })
|
|
||||||
*/
|
|
||||||
@interface FBLPromise<Value>(DotSyntax_RetryAdditions)
|
|
||||||
|
|
||||||
+ (FBLPromise * (^)(FBLPromiseRetryWorkBlock))retry FBL_PROMISES_DOT_SYNTAX
|
|
||||||
NS_SWIFT_UNAVAILABLE("");
|
|
||||||
+ (FBLPromise * (^)(dispatch_queue_t, FBLPromiseRetryWorkBlock))retryOn FBL_PROMISES_DOT_SYNTAX
|
|
||||||
NS_SWIFT_UNAVAILABLE("");
|
|
||||||
+ (FBLPromise * (^)(NSInteger, NSTimeInterval, FBLPromiseRetryPredicateBlock __nullable,
|
|
||||||
FBLPromiseRetryWorkBlock))retryAgain FBL_PROMISES_DOT_SYNTAX
|
|
||||||
NS_SWIFT_UNAVAILABLE("");
|
|
||||||
+ (FBLPromise * (^)(dispatch_queue_t, NSInteger, NSTimeInterval,
|
|
||||||
FBLPromiseRetryPredicateBlock __nullable,
|
|
||||||
FBLPromiseRetryWorkBlock))retryAgainOn FBL_PROMISES_DOT_SYNTAX
|
|
||||||
NS_SWIFT_UNAVAILABLE("");
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_END
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 5d722b432c1c94234ac1c1a91fc7b3e5
|
|
||||||
DefaultImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
@@ -1,57 +0,0 @@
|
|||||||
/**
|
|
||||||
Copyright 2018 Google Inc. All rights reserved.
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at:
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#import "FBLPromise.h"
|
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_BEGIN
|
|
||||||
|
|
||||||
/**
|
|
||||||
Waits for all scheduled promises blocks.
|
|
||||||
|
|
||||||
@param timeout Maximum time to wait.
|
|
||||||
@return YES if all promises blocks have completed before the timeout and NO otherwise.
|
|
||||||
*/
|
|
||||||
FOUNDATION_EXTERN BOOL FBLWaitForPromisesWithTimeout(NSTimeInterval timeout) NS_REFINED_FOR_SWIFT;
|
|
||||||
|
|
||||||
@interface FBLPromise<Value>(TestingAdditions)
|
|
||||||
|
|
||||||
/**
|
|
||||||
Dispatch group for promises that is typically used to wait for all scheduled blocks.
|
|
||||||
*/
|
|
||||||
@property(class, nonatomic, readonly) dispatch_group_t dispatchGroup NS_REFINED_FOR_SWIFT;
|
|
||||||
|
|
||||||
/**
|
|
||||||
Properties to get the current state of the promise.
|
|
||||||
*/
|
|
||||||
@property(nonatomic, readonly) BOOL isPending NS_REFINED_FOR_SWIFT;
|
|
||||||
@property(nonatomic, readonly) BOOL isFulfilled NS_REFINED_FOR_SWIFT;
|
|
||||||
@property(nonatomic, readonly) BOOL isRejected NS_REFINED_FOR_SWIFT;
|
|
||||||
|
|
||||||
/**
|
|
||||||
Value the promise was fulfilled with.
|
|
||||||
Can be nil if the promise is still pending, was resolved with nil or after it has been rejected.
|
|
||||||
*/
|
|
||||||
@property(nonatomic, readonly, nullable) Value value NS_REFINED_FOR_SWIFT;
|
|
||||||
|
|
||||||
/**
|
|
||||||
Error the promise was rejected with.
|
|
||||||
Can be nil if the promise is still pending or after it has been fulfilled.
|
|
||||||
*/
|
|
||||||
@property(nonatomic, readonly, nullable) NSError *error NS_REFINED_FOR_SWIFT;
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_END
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: c8d9c394a5e9e472496720db8b44b8a4
|
|
||||||
DefaultImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
@@ -1,63 +0,0 @@
|
|||||||
/**
|
|
||||||
Copyright 2018 Google Inc. All rights reserved.
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at:
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#import "FBLPromise.h"
|
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_BEGIN
|
|
||||||
|
|
||||||
@interface FBLPromise<Value>(ThenAdditions)
|
|
||||||
|
|
||||||
typedef id __nullable (^FBLPromiseThenWorkBlock)(Value __nullable value) NS_SWIFT_UNAVAILABLE("");
|
|
||||||
|
|
||||||
/**
|
|
||||||
Creates a pending promise which eventually gets resolved with resolution returned from `work`
|
|
||||||
block: either value, error or another promise. The `work` block is executed asynchronously only
|
|
||||||
when the receiver is fulfilled. If receiver is rejected, the returned promise is also rejected with
|
|
||||||
the same error.
|
|
||||||
|
|
||||||
@param work A block to handle the value that receiver was fulfilled with.
|
|
||||||
@return A new pending promise to be resolved with resolution returned from the `work` block.
|
|
||||||
*/
|
|
||||||
- (FBLPromise *)then:(FBLPromiseThenWorkBlock)work NS_SWIFT_UNAVAILABLE("");
|
|
||||||
|
|
||||||
/**
|
|
||||||
Creates a pending promise which eventually gets resolved with resolution returned from `work`
|
|
||||||
block: either value, error or another promise. The `work` block is executed asynchronously when the
|
|
||||||
receiver is fulfilled. If receiver is rejected, the returned promise is also rejected with the same
|
|
||||||
error.
|
|
||||||
|
|
||||||
@param queue A queue to invoke the `work` block on.
|
|
||||||
@param work A block to handle the value that receiver was fulfilled with.
|
|
||||||
@return A new pending promise to be resolved with resolution returned from the `work` block.
|
|
||||||
*/
|
|
||||||
- (FBLPromise *)onQueue:(dispatch_queue_t)queue
|
|
||||||
then:(FBLPromiseThenWorkBlock)work NS_REFINED_FOR_SWIFT;
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
||||||
/**
|
|
||||||
Convenience dot-syntax wrappers for `FBLPromise` `then` operators.
|
|
||||||
Usage: promise.then(^id(id value) { ... })
|
|
||||||
*/
|
|
||||||
@interface FBLPromise<Value>(DotSyntax_ThenAdditions)
|
|
||||||
|
|
||||||
- (FBLPromise* (^)(FBLPromiseThenWorkBlock))then FBL_PROMISES_DOT_SYNTAX NS_SWIFT_UNAVAILABLE("");
|
|
||||||
- (FBLPromise* (^)(dispatch_queue_t, FBLPromiseThenWorkBlock))thenOn FBL_PROMISES_DOT_SYNTAX
|
|
||||||
NS_SWIFT_UNAVAILABLE("");
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_END
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: dc636b476e16843b499c3f191a61c573
|
|
||||||
DefaultImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
@@ -1,57 +0,0 @@
|
|||||||
/**
|
|
||||||
Copyright 2018 Google Inc. All rights reserved.
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at:
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#import "FBLPromise.h"
|
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_BEGIN
|
|
||||||
|
|
||||||
@interface FBLPromise<Value>(TimeoutAdditions)
|
|
||||||
|
|
||||||
/**
|
|
||||||
Waits for a promise with the specified `timeout`.
|
|
||||||
|
|
||||||
@param interval Time to wait in seconds.
|
|
||||||
@return A new pending promise that gets either resolved with same resolution as the receiver or
|
|
||||||
rejected with `FBLPromiseErrorCodeTimedOut` error code in `FBLPromiseErrorDomain`.
|
|
||||||
*/
|
|
||||||
- (FBLPromise *)timeout:(NSTimeInterval)interval NS_SWIFT_UNAVAILABLE("");
|
|
||||||
|
|
||||||
/**
|
|
||||||
Waits for a promise with the specified `timeout`.
|
|
||||||
|
|
||||||
@param queue A queue to dispatch on.
|
|
||||||
@param interval Time to wait in seconds.
|
|
||||||
@return A new pending promise that gets either resolved with same resolution as the receiver or
|
|
||||||
rejected with `FBLPromiseErrorCodeTimedOut` error code in `FBLPromiseErrorDomain`.
|
|
||||||
*/
|
|
||||||
- (FBLPromise *)onQueue:(dispatch_queue_t)queue
|
|
||||||
timeout:(NSTimeInterval)interval NS_REFINED_FOR_SWIFT;
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
||||||
/**
|
|
||||||
Convenience dot-syntax wrappers for `FBLPromise` `timeout` operators.
|
|
||||||
Usage: promise.timeout(...)
|
|
||||||
*/
|
|
||||||
@interface FBLPromise<Value>(DotSyntax_TimeoutAdditions)
|
|
||||||
|
|
||||||
- (FBLPromise* (^)(NSTimeInterval))timeout FBL_PROMISES_DOT_SYNTAX NS_SWIFT_UNAVAILABLE("");
|
|
||||||
- (FBLPromise* (^)(dispatch_queue_t, NSTimeInterval))timeoutOn FBL_PROMISES_DOT_SYNTAX
|
|
||||||
NS_SWIFT_UNAVAILABLE("");
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_END
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 5dadee2be320e4a8ca85d33b2f1173cb
|
|
||||||
DefaultImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
@@ -1,60 +0,0 @@
|
|||||||
/**
|
|
||||||
Copyright 2018 Google Inc. All rights reserved.
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at:
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#import "FBLPromise.h"
|
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_BEGIN
|
|
||||||
|
|
||||||
@interface FBLPromise<Value>(ValidateAdditions)
|
|
||||||
|
|
||||||
typedef BOOL (^FBLPromiseValidateWorkBlock)(Value __nullable value) NS_SWIFT_UNAVAILABLE("");
|
|
||||||
|
|
||||||
/**
|
|
||||||
Validates a fulfilled value or rejects the value if it can not be validated.
|
|
||||||
|
|
||||||
@param predicate An expression to validate.
|
|
||||||
@return A new pending promise that gets either resolved with same resolution as the receiver or
|
|
||||||
rejected with `FBLPromiseErrorCodeValidationFailure` error code in `FBLPromiseErrorDomain`.
|
|
||||||
*/
|
|
||||||
- (FBLPromise *)validate:(FBLPromiseValidateWorkBlock)predicate NS_SWIFT_UNAVAILABLE("");
|
|
||||||
|
|
||||||
/**
|
|
||||||
Validates a fulfilled value or rejects the value if it can not be validated.
|
|
||||||
|
|
||||||
@param queue A queue to dispatch on.
|
|
||||||
@param predicate An expression to validate.
|
|
||||||
@return A new pending promise that gets either resolved with same resolution as the receiver or
|
|
||||||
rejected with `FBLPromiseErrorCodeValidationFailure` error code in `FBLPromiseErrorDomain`.
|
|
||||||
*/
|
|
||||||
- (FBLPromise *)onQueue:(dispatch_queue_t)queue
|
|
||||||
validate:(FBLPromiseValidateWorkBlock)predicate NS_REFINED_FOR_SWIFT;
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
||||||
/**
|
|
||||||
Convenience dot-syntax wrappers for `FBLPromise` `validate` operators.
|
|
||||||
Usage: promise.validate(^BOOL(id value) { ... })
|
|
||||||
*/
|
|
||||||
@interface FBLPromise<Value>(DotSyntax_ValidateAdditions)
|
|
||||||
|
|
||||||
- (FBLPromise * (^)(FBLPromiseValidateWorkBlock))validate FBL_PROMISES_DOT_SYNTAX
|
|
||||||
NS_SWIFT_UNAVAILABLE("");
|
|
||||||
- (FBLPromise * (^)(dispatch_queue_t, FBLPromiseValidateWorkBlock))validateOn
|
|
||||||
FBL_PROMISES_DOT_SYNTAX NS_SWIFT_UNAVAILABLE("");
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_END
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 6151b2c36dab84067b333a14bd243abe
|
|
||||||
DefaultImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
@@ -1,316 +0,0 @@
|
|||||||
/**
|
|
||||||
Copyright 2018 Google Inc. All rights reserved.
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at:
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#import "FBLPromise.h"
|
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_BEGIN
|
|
||||||
|
|
||||||
/**
|
|
||||||
Different types of completion handlers available to be wrapped with promise.
|
|
||||||
*/
|
|
||||||
typedef void (^FBLPromiseCompletion)(void) NS_SWIFT_UNAVAILABLE("");
|
|
||||||
typedef void (^FBLPromiseObjectCompletion)(id __nullable) NS_SWIFT_UNAVAILABLE("");
|
|
||||||
typedef void (^FBLPromiseErrorCompletion)(NSError* __nullable) NS_SWIFT_UNAVAILABLE("");
|
|
||||||
typedef void (^FBLPromiseObjectOrErrorCompletion)(id __nullable, NSError* __nullable)
|
|
||||||
NS_SWIFT_UNAVAILABLE("");
|
|
||||||
typedef void (^FBLPromiseErrorOrObjectCompletion)(NSError* __nullable, id __nullable)
|
|
||||||
NS_SWIFT_UNAVAILABLE("");
|
|
||||||
typedef void (^FBLPromise2ObjectsOrErrorCompletion)(id __nullable, id __nullable,
|
|
||||||
NSError* __nullable) NS_SWIFT_UNAVAILABLE("");
|
|
||||||
typedef void (^FBLPromiseBoolCompletion)(BOOL) NS_SWIFT_UNAVAILABLE("");
|
|
||||||
typedef void (^FBLPromiseBoolOrErrorCompletion)(BOOL, NSError* __nullable) NS_SWIFT_UNAVAILABLE("");
|
|
||||||
typedef void (^FBLPromiseIntegerCompletion)(NSInteger) NS_SWIFT_UNAVAILABLE("");
|
|
||||||
typedef void (^FBLPromiseIntegerOrErrorCompletion)(NSInteger, NSError* __nullable)
|
|
||||||
NS_SWIFT_UNAVAILABLE("");
|
|
||||||
typedef void (^FBLPromiseDoubleCompletion)(double) NS_SWIFT_UNAVAILABLE("");
|
|
||||||
typedef void (^FBLPromiseDoubleOrErrorCompletion)(double, NSError* __nullable)
|
|
||||||
NS_SWIFT_UNAVAILABLE("");
|
|
||||||
|
|
||||||
/**
|
|
||||||
Provides an easy way to convert methods that use common callback patterns into promises.
|
|
||||||
*/
|
|
||||||
@interface FBLPromise<Value>(WrapAdditions)
|
|
||||||
|
|
||||||
/**
|
|
||||||
@param work A block to perform any operations needed to resolve the promise.
|
|
||||||
@returns A promise that resolves with `nil` when completion handler is invoked.
|
|
||||||
*/
|
|
||||||
+ (instancetype)wrapCompletion:(void (^)(FBLPromiseCompletion handler))work
|
|
||||||
NS_SWIFT_UNAVAILABLE("");
|
|
||||||
|
|
||||||
/**
|
|
||||||
@param queue A queue to invoke the `work` block on.
|
|
||||||
@param work A block to perform any operations needed to resolve the promise.
|
|
||||||
@returns A promise that resolves with `nil` when completion handler is invoked.
|
|
||||||
*/
|
|
||||||
+ (instancetype)onQueue:(dispatch_queue_t)queue
|
|
||||||
wrapCompletion:(void (^)(FBLPromiseCompletion handler))work NS_SWIFT_UNAVAILABLE("");
|
|
||||||
|
|
||||||
/**
|
|
||||||
@param work A block to perform any operations needed to resolve the promise.
|
|
||||||
@returns A promise that resolves with an object provided by completion handler.
|
|
||||||
*/
|
|
||||||
+ (instancetype)wrapObjectCompletion:(void (^)(FBLPromiseObjectCompletion handler))work
|
|
||||||
NS_SWIFT_UNAVAILABLE("");
|
|
||||||
|
|
||||||
/**
|
|
||||||
@param queue A queue to invoke the `work` block on.
|
|
||||||
@param work A block to perform any operations needed to resolve the promise.
|
|
||||||
@returns A promise that resolves with an object provided by completion handler.
|
|
||||||
*/
|
|
||||||
+ (instancetype)onQueue:(dispatch_queue_t)queue
|
|
||||||
wrapObjectCompletion:(void (^)(FBLPromiseObjectCompletion handler))work
|
|
||||||
NS_SWIFT_UNAVAILABLE("");
|
|
||||||
|
|
||||||
/**
|
|
||||||
@param work A block to perform any operations needed to resolve the promise.
|
|
||||||
@returns A promise that resolves with an error provided by completion handler.
|
|
||||||
If error is `nil`, fulfills with `nil`, otherwise rejects with the error.
|
|
||||||
*/
|
|
||||||
+ (instancetype)wrapErrorCompletion:(void (^)(FBLPromiseErrorCompletion handler))work
|
|
||||||
NS_SWIFT_UNAVAILABLE("");
|
|
||||||
|
|
||||||
/**
|
|
||||||
@param queue A queue to invoke the `work` block on.
|
|
||||||
@param work A block to perform any operations needed to resolve the promise.
|
|
||||||
@returns A promise that resolves with an error provided by completion handler.
|
|
||||||
If error is `nil`, fulfills with `nil`, otherwise rejects with the error.
|
|
||||||
*/
|
|
||||||
+ (instancetype)onQueue:(dispatch_queue_t)queue
|
|
||||||
wrapErrorCompletion:(void (^)(FBLPromiseErrorCompletion handler))work NS_SWIFT_UNAVAILABLE("");
|
|
||||||
|
|
||||||
/**
|
|
||||||
@param work A block to perform any operations needed to resolve the promise.
|
|
||||||
@returns A promise that resolves with an object provided by completion handler if error is `nil`.
|
|
||||||
Otherwise, rejects with the error.
|
|
||||||
*/
|
|
||||||
+ (instancetype)wrapObjectOrErrorCompletion:
|
|
||||||
(void (^)(FBLPromiseObjectOrErrorCompletion handler))work NS_SWIFT_UNAVAILABLE("");
|
|
||||||
|
|
||||||
/**
|
|
||||||
@param queue A queue to invoke the `work` block on.
|
|
||||||
@param work A block to perform any operations needed to resolve the promise.
|
|
||||||
@returns A promise that resolves with an object provided by completion handler if error is `nil`.
|
|
||||||
Otherwise, rejects with the error.
|
|
||||||
*/
|
|
||||||
+ (instancetype)onQueue:(dispatch_queue_t)queue
|
|
||||||
wrapObjectOrErrorCompletion:(void (^)(FBLPromiseObjectOrErrorCompletion handler))work
|
|
||||||
NS_SWIFT_UNAVAILABLE("");
|
|
||||||
|
|
||||||
/**
|
|
||||||
@param work A block to perform any operations needed to resolve the promise.
|
|
||||||
@returns A promise that resolves with an error or object provided by completion handler. If error
|
|
||||||
is not `nil`, rejects with the error.
|
|
||||||
*/
|
|
||||||
+ (instancetype)wrapErrorOrObjectCompletion:
|
|
||||||
(void (^)(FBLPromiseErrorOrObjectCompletion handler))work NS_SWIFT_UNAVAILABLE("");
|
|
||||||
|
|
||||||
/**
|
|
||||||
@param queue A queue to invoke the `work` block on.
|
|
||||||
@param work A block to perform any operations needed to resolve the promise.
|
|
||||||
@returns A promise that resolves with an error or object provided by completion handler. If error
|
|
||||||
is not `nil`, rejects with the error.
|
|
||||||
*/
|
|
||||||
+ (instancetype)onQueue:(dispatch_queue_t)queue
|
|
||||||
wrapErrorOrObjectCompletion:(void (^)(FBLPromiseErrorOrObjectCompletion handler))work
|
|
||||||
NS_SWIFT_UNAVAILABLE("");
|
|
||||||
|
|
||||||
/**
|
|
||||||
@param work A block to perform any operations needed to resolve the promise.
|
|
||||||
@returns A promise that resolves with an array of objects provided by completion handler in order
|
|
||||||
if error is `nil`. Otherwise, rejects with the error.
|
|
||||||
*/
|
|
||||||
+ (FBLPromise<NSArray*>*)wrap2ObjectsOrErrorCompletion:
|
|
||||||
(void (^)(FBLPromise2ObjectsOrErrorCompletion handler))work NS_SWIFT_UNAVAILABLE("");
|
|
||||||
|
|
||||||
/**
|
|
||||||
@param queue A queue to invoke the `work` block on.
|
|
||||||
@param work A block to perform any operations needed to resolve the promise.
|
|
||||||
@returns A promise that resolves with an array of objects provided by completion handler in order
|
|
||||||
if error is `nil`. Otherwise, rejects with the error.
|
|
||||||
*/
|
|
||||||
+ (FBLPromise<NSArray*>*)onQueue:(dispatch_queue_t)queue
|
|
||||||
wrap2ObjectsOrErrorCompletion:(void (^)(FBLPromise2ObjectsOrErrorCompletion handler))work
|
|
||||||
NS_SWIFT_UNAVAILABLE("");
|
|
||||||
|
|
||||||
/**
|
|
||||||
@param work A block to perform any operations needed to resolve the promise.
|
|
||||||
@returns A promise that resolves with an `NSNumber` wrapping YES/NO.
|
|
||||||
*/
|
|
||||||
+ (FBLPromise<NSNumber*>*)wrapBoolCompletion:(void (^)(FBLPromiseBoolCompletion handler))work
|
|
||||||
NS_SWIFT_UNAVAILABLE("");
|
|
||||||
|
|
||||||
/**
|
|
||||||
@param queue A queue to invoke the `work` block on.
|
|
||||||
@param work A block to perform any operations needed to resolve the promise.
|
|
||||||
@returns A promise that resolves with an `NSNumber` wrapping YES/NO.
|
|
||||||
*/
|
|
||||||
+ (FBLPromise<NSNumber*>*)onQueue:(dispatch_queue_t)queue
|
|
||||||
wrapBoolCompletion:(void (^)(FBLPromiseBoolCompletion handler))work
|
|
||||||
NS_SWIFT_UNAVAILABLE("");
|
|
||||||
|
|
||||||
/**
|
|
||||||
@param work A block to perform any operations needed to resolve the promise.
|
|
||||||
@returns A promise that resolves with an `NSNumber` wrapping YES/NO when error is `nil`.
|
|
||||||
Otherwise rejects with the error.
|
|
||||||
*/
|
|
||||||
+ (FBLPromise<NSNumber*>*)wrapBoolOrErrorCompletion:
|
|
||||||
(void (^)(FBLPromiseBoolOrErrorCompletion handler))work NS_SWIFT_UNAVAILABLE("");
|
|
||||||
|
|
||||||
/**
|
|
||||||
@param queue A queue to invoke the `work` block on.
|
|
||||||
@param work A block to perform any operations needed to resolve the promise.
|
|
||||||
@returns A promise that resolves with an `NSNumber` wrapping YES/NO when error is `nil`.
|
|
||||||
Otherwise rejects with the error.
|
|
||||||
*/
|
|
||||||
+ (FBLPromise<NSNumber*>*)onQueue:(dispatch_queue_t)queue
|
|
||||||
wrapBoolOrErrorCompletion:(void (^)(FBLPromiseBoolOrErrorCompletion handler))work
|
|
||||||
NS_SWIFT_UNAVAILABLE("");
|
|
||||||
|
|
||||||
/**
|
|
||||||
@param work A block to perform any operations needed to resolve the promise.
|
|
||||||
@returns A promise that resolves with an `NSNumber` wrapping an integer.
|
|
||||||
*/
|
|
||||||
+ (FBLPromise<NSNumber*>*)wrapIntegerCompletion:(void (^)(FBLPromiseIntegerCompletion handler))work
|
|
||||||
NS_SWIFT_UNAVAILABLE("");
|
|
||||||
|
|
||||||
/**
|
|
||||||
@param queue A queue to invoke the `work` block on.
|
|
||||||
@param work A block to perform any operations needed to resolve the promise.
|
|
||||||
@returns A promise that resolves with an `NSNumber` wrapping an integer.
|
|
||||||
*/
|
|
||||||
+ (FBLPromise<NSNumber*>*)onQueue:(dispatch_queue_t)queue
|
|
||||||
wrapIntegerCompletion:(void (^)(FBLPromiseIntegerCompletion handler))work
|
|
||||||
NS_SWIFT_UNAVAILABLE("");
|
|
||||||
|
|
||||||
/**
|
|
||||||
@param work A block to perform any operations needed to resolve the promise.
|
|
||||||
@returns A promise that resolves with an `NSNumber` wrapping an integer when error is `nil`.
|
|
||||||
Otherwise rejects with the error.
|
|
||||||
*/
|
|
||||||
+ (FBLPromise<NSNumber*>*)wrapIntegerOrErrorCompletion:
|
|
||||||
(void (^)(FBLPromiseIntegerOrErrorCompletion handler))work NS_SWIFT_UNAVAILABLE("");
|
|
||||||
|
|
||||||
/**
|
|
||||||
@param queue A queue to invoke the `work` block on.
|
|
||||||
@param work A block to perform any operations needed to resolve the promise.
|
|
||||||
@returns A promise that resolves with an `NSNumber` wrapping an integer when error is `nil`.
|
|
||||||
Otherwise rejects with the error.
|
|
||||||
*/
|
|
||||||
+ (FBLPromise<NSNumber*>*)onQueue:(dispatch_queue_t)queue
|
|
||||||
wrapIntegerOrErrorCompletion:(void (^)(FBLPromiseIntegerOrErrorCompletion handler))work
|
|
||||||
NS_SWIFT_UNAVAILABLE("");
|
|
||||||
|
|
||||||
/**
|
|
||||||
@param work A block to perform any operations needed to resolve the promise.
|
|
||||||
@returns A promise that resolves with an `NSNumber` wrapping a double.
|
|
||||||
*/
|
|
||||||
+ (FBLPromise<NSNumber*>*)wrapDoubleCompletion:(void (^)(FBLPromiseDoubleCompletion handler))work
|
|
||||||
NS_SWIFT_UNAVAILABLE("");
|
|
||||||
|
|
||||||
/**
|
|
||||||
@param queue A queue to invoke the `work` block on.
|
|
||||||
@param work A block to perform any operations needed to resolve the promise.
|
|
||||||
@returns A promise that resolves with an `NSNumber` wrapping a double.
|
|
||||||
*/
|
|
||||||
+ (FBLPromise<NSNumber*>*)onQueue:(dispatch_queue_t)queue
|
|
||||||
wrapDoubleCompletion:(void (^)(FBLPromiseDoubleCompletion handler))work
|
|
||||||
NS_SWIFT_UNAVAILABLE("");
|
|
||||||
|
|
||||||
/**
|
|
||||||
@param work A block to perform any operations needed to resolve the promise.
|
|
||||||
@returns A promise that resolves with an `NSNumber` wrapping a double when error is `nil`.
|
|
||||||
Otherwise rejects with the error.
|
|
||||||
*/
|
|
||||||
+ (FBLPromise<NSNumber*>*)wrapDoubleOrErrorCompletion:
|
|
||||||
(void (^)(FBLPromiseDoubleOrErrorCompletion handler))work NS_SWIFT_UNAVAILABLE("");
|
|
||||||
|
|
||||||
/**
|
|
||||||
@param queue A queue to invoke the `work` block on.
|
|
||||||
@param work A block to perform any operations needed to resolve the promise.
|
|
||||||
@returns A promise that resolves with an `NSNumber` wrapping a double when error is `nil`.
|
|
||||||
Otherwise rejects with the error.
|
|
||||||
*/
|
|
||||||
+ (FBLPromise<NSNumber*>*)onQueue:(dispatch_queue_t)queue
|
|
||||||
wrapDoubleOrErrorCompletion:(void (^)(FBLPromiseDoubleOrErrorCompletion handler))work
|
|
||||||
NS_SWIFT_UNAVAILABLE("");
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
||||||
/**
|
|
||||||
Convenience dot-syntax wrappers for `FBLPromise` `wrap` operators.
|
|
||||||
Usage: FBLPromise.wrapCompletion(^(FBLPromiseCompletion handler) {...})
|
|
||||||
*/
|
|
||||||
@interface FBLPromise<Value>(DotSyntax_WrapAdditions)
|
|
||||||
|
|
||||||
+ (FBLPromise* (^)(void (^)(FBLPromiseCompletion)))wrapCompletion FBL_PROMISES_DOT_SYNTAX
|
|
||||||
NS_SWIFT_UNAVAILABLE("");
|
|
||||||
+ (FBLPromise* (^)(dispatch_queue_t, void (^)(FBLPromiseCompletion)))wrapCompletionOn
|
|
||||||
FBL_PROMISES_DOT_SYNTAX NS_SWIFT_UNAVAILABLE("");
|
|
||||||
+ (FBLPromise* (^)(void (^)(FBLPromiseObjectCompletion)))wrapObjectCompletion
|
|
||||||
FBL_PROMISES_DOT_SYNTAX NS_SWIFT_UNAVAILABLE("");
|
|
||||||
+ (FBLPromise* (^)(dispatch_queue_t, void (^)(FBLPromiseObjectCompletion)))wrapObjectCompletionOn
|
|
||||||
FBL_PROMISES_DOT_SYNTAX NS_SWIFT_UNAVAILABLE("");
|
|
||||||
+ (FBLPromise* (^)(void (^)(FBLPromiseErrorCompletion)))wrapErrorCompletion FBL_PROMISES_DOT_SYNTAX
|
|
||||||
NS_SWIFT_UNAVAILABLE("");
|
|
||||||
+ (FBLPromise* (^)(dispatch_queue_t, void (^)(FBLPromiseErrorCompletion)))wrapErrorCompletionOn
|
|
||||||
FBL_PROMISES_DOT_SYNTAX NS_SWIFT_UNAVAILABLE("");
|
|
||||||
+ (FBLPromise* (^)(void (^)(FBLPromiseObjectOrErrorCompletion)))wrapObjectOrErrorCompletion
|
|
||||||
FBL_PROMISES_DOT_SYNTAX NS_SWIFT_UNAVAILABLE("");
|
|
||||||
+ (FBLPromise* (^)(dispatch_queue_t,
|
|
||||||
void (^)(FBLPromiseObjectOrErrorCompletion)))wrapObjectOrErrorCompletionOn
|
|
||||||
FBL_PROMISES_DOT_SYNTAX NS_SWIFT_UNAVAILABLE("");
|
|
||||||
+ (FBLPromise* (^)(void (^)(FBLPromiseErrorOrObjectCompletion)))wrapErrorOrObjectCompletion
|
|
||||||
FBL_PROMISES_DOT_SYNTAX NS_SWIFT_UNAVAILABLE("");
|
|
||||||
+ (FBLPromise* (^)(dispatch_queue_t,
|
|
||||||
void (^)(FBLPromiseErrorOrObjectCompletion)))wrapErrorOrObjectCompletionOn
|
|
||||||
FBL_PROMISES_DOT_SYNTAX NS_SWIFT_UNAVAILABLE("");
|
|
||||||
+ (FBLPromise<NSArray*>* (^)(void (^)(FBLPromise2ObjectsOrErrorCompletion)))
|
|
||||||
wrap2ObjectsOrErrorCompletion FBL_PROMISES_DOT_SYNTAX NS_SWIFT_UNAVAILABLE("");
|
|
||||||
+ (FBLPromise<NSArray*>* (^)(dispatch_queue_t, void (^)(FBLPromise2ObjectsOrErrorCompletion)))
|
|
||||||
wrap2ObjectsOrErrorCompletionOn FBL_PROMISES_DOT_SYNTAX NS_SWIFT_UNAVAILABLE("");
|
|
||||||
+ (FBLPromise<NSNumber*>* (^)(void (^)(FBLPromiseBoolCompletion)))wrapBoolCompletion
|
|
||||||
FBL_PROMISES_DOT_SYNTAX NS_SWIFT_UNAVAILABLE("");
|
|
||||||
+ (FBLPromise<NSNumber*>* (^)(dispatch_queue_t,
|
|
||||||
void (^)(FBLPromiseBoolCompletion)))wrapBoolCompletionOn
|
|
||||||
FBL_PROMISES_DOT_SYNTAX NS_SWIFT_UNAVAILABLE("");
|
|
||||||
+ (FBLPromise<NSNumber*>* (^)(void (^)(FBLPromiseBoolOrErrorCompletion)))wrapBoolOrErrorCompletion
|
|
||||||
FBL_PROMISES_DOT_SYNTAX NS_SWIFT_UNAVAILABLE("");
|
|
||||||
+ (FBLPromise<NSNumber*>* (^)(dispatch_queue_t,
|
|
||||||
void (^)(FBLPromiseBoolOrErrorCompletion)))wrapBoolOrErrorCompletionOn
|
|
||||||
FBL_PROMISES_DOT_SYNTAX NS_SWIFT_UNAVAILABLE("");
|
|
||||||
+ (FBLPromise<NSNumber*>* (^)(void (^)(FBLPromiseIntegerCompletion)))wrapIntegerCompletion
|
|
||||||
FBL_PROMISES_DOT_SYNTAX NS_SWIFT_UNAVAILABLE("");
|
|
||||||
+ (FBLPromise<NSNumber*>* (^)(dispatch_queue_t,
|
|
||||||
void (^)(FBLPromiseIntegerCompletion)))wrapIntegerCompletionOn
|
|
||||||
FBL_PROMISES_DOT_SYNTAX NS_SWIFT_UNAVAILABLE("");
|
|
||||||
+ (FBLPromise<NSNumber*>* (^)(void (^)(FBLPromiseIntegerOrErrorCompletion)))
|
|
||||||
wrapIntegerOrErrorCompletion FBL_PROMISES_DOT_SYNTAX NS_SWIFT_UNAVAILABLE("");
|
|
||||||
+ (FBLPromise<NSNumber*>* (^)(dispatch_queue_t, void (^)(FBLPromiseIntegerOrErrorCompletion)))
|
|
||||||
wrapIntegerOrErrorCompletionOn FBL_PROMISES_DOT_SYNTAX NS_SWIFT_UNAVAILABLE("");
|
|
||||||
+ (FBLPromise<NSNumber*>* (^)(void (^)(FBLPromiseDoubleCompletion)))wrapDoubleCompletion
|
|
||||||
FBL_PROMISES_DOT_SYNTAX NS_SWIFT_UNAVAILABLE("");
|
|
||||||
+ (FBLPromise<NSNumber*>* (^)(dispatch_queue_t,
|
|
||||||
void (^)(FBLPromiseDoubleCompletion)))wrapDoubleCompletionOn
|
|
||||||
FBL_PROMISES_DOT_SYNTAX NS_SWIFT_UNAVAILABLE("");
|
|
||||||
+ (FBLPromise<NSNumber*>* (^)(void (^)(FBLPromiseDoubleOrErrorCompletion)))
|
|
||||||
wrapDoubleOrErrorCompletion FBL_PROMISES_DOT_SYNTAX NS_SWIFT_UNAVAILABLE("");
|
|
||||||
+ (FBLPromise<NSNumber*>* (^)(dispatch_queue_t, void (^)(FBLPromiseDoubleOrErrorCompletion)))
|
|
||||||
wrapDoubleOrErrorCompletionOn FBL_PROMISES_DOT_SYNTAX NS_SWIFT_UNAVAILABLE("");
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_END
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 0c7d59f71e5314e46a95ac5486e23933
|
|
||||||
DefaultImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
@@ -1,93 +0,0 @@
|
|||||||
/**
|
|
||||||
Copyright 2018 Google Inc. All rights reserved.
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at:
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#import "FBLPromiseError.h"
|
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_BEGIN
|
|
||||||
|
|
||||||
/**
|
|
||||||
Promises synchronization construct in Objective-C.
|
|
||||||
*/
|
|
||||||
@interface FBLPromise<__covariant Value> : NSObject
|
|
||||||
|
|
||||||
/**
|
|
||||||
Default dispatch queue used for `FBLPromise`, which is `main` if a queue is not specified.
|
|
||||||
*/
|
|
||||||
@property(class) dispatch_queue_t defaultDispatchQueue NS_REFINED_FOR_SWIFT;
|
|
||||||
|
|
||||||
/**
|
|
||||||
Creates a pending promise.
|
|
||||||
*/
|
|
||||||
+ (instancetype)pendingPromise NS_REFINED_FOR_SWIFT;
|
|
||||||
|
|
||||||
/**
|
|
||||||
Creates a resolved promise.
|
|
||||||
|
|
||||||
@param resolution An object to resolve the promise with: either a value or an error.
|
|
||||||
@return A new resolved promise.
|
|
||||||
*/
|
|
||||||
+ (instancetype)resolvedWith:(nullable id)resolution NS_REFINED_FOR_SWIFT;
|
|
||||||
|
|
||||||
/**
|
|
||||||
Synchronously fulfills the promise with a value.
|
|
||||||
|
|
||||||
@param value An arbitrary value to fulfill the promise with, including `nil`.
|
|
||||||
*/
|
|
||||||
- (void)fulfill:(nullable Value)value NS_REFINED_FOR_SWIFT;
|
|
||||||
|
|
||||||
/**
|
|
||||||
Synchronously rejects the promise with an error.
|
|
||||||
|
|
||||||
@param error An error to reject the promise with.
|
|
||||||
*/
|
|
||||||
- (void)reject:(NSError *)error NS_REFINED_FOR_SWIFT;
|
|
||||||
|
|
||||||
+ (instancetype)new NS_UNAVAILABLE;
|
|
||||||
- (instancetype)init NS_UNAVAILABLE;
|
|
||||||
@end
|
|
||||||
|
|
||||||
@interface FBLPromise<Value>()
|
|
||||||
|
|
||||||
/**
|
|
||||||
Adds an object to the set of pending objects to keep strongly while the promise is pending.
|
|
||||||
Used by the Swift wrappers to keep them alive until the underlying ObjC promise is resolved.
|
|
||||||
|
|
||||||
@param object An object to add.
|
|
||||||
*/
|
|
||||||
- (void)addPendingObject:(id)object NS_REFINED_FOR_SWIFT;
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
||||||
#ifdef FBL_PROMISES_DOT_SYNTAX_IS_DEPRECATED
|
|
||||||
#define FBL_PROMISES_DOT_SYNTAX __attribute__((deprecated))
|
|
||||||
#else
|
|
||||||
#define FBL_PROMISES_DOT_SYNTAX
|
|
||||||
#endif
|
|
||||||
|
|
||||||
@interface FBLPromise<Value>(DotSyntaxAdditions)
|
|
||||||
|
|
||||||
/**
|
|
||||||
Convenience dot-syntax wrappers for FBLPromise.
|
|
||||||
Usage: FBLPromise.pending()
|
|
||||||
FBLPromise.resolved(value)
|
|
||||||
|
|
||||||
*/
|
|
||||||
+ (FBLPromise * (^)(void))pending FBL_PROMISES_DOT_SYNTAX NS_SWIFT_UNAVAILABLE("");
|
|
||||||
+ (FBLPromise * (^)(id __nullable))resolved FBL_PROMISES_DOT_SYNTAX NS_SWIFT_UNAVAILABLE("");
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_END
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: dd47898dec4f4471181704ec8a45ee6d
|
|
||||||
DefaultImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
@@ -1,43 +0,0 @@
|
|||||||
/**
|
|
||||||
Copyright 2018 Google Inc. All rights reserved.
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at:
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#import <Foundation/Foundation.h>
|
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_BEGIN
|
|
||||||
|
|
||||||
FOUNDATION_EXTERN NSErrorDomain const FBLPromiseErrorDomain NS_REFINED_FOR_SWIFT;
|
|
||||||
|
|
||||||
/**
|
|
||||||
Possible error codes in `FBLPromiseErrorDomain`.
|
|
||||||
*/
|
|
||||||
typedef NS_ENUM(NSInteger, FBLPromiseErrorCode) {
|
|
||||||
/** Promise failed to resolve in time. */
|
|
||||||
FBLPromiseErrorCodeTimedOut = 1,
|
|
||||||
/** Validation predicate returned false. */
|
|
||||||
FBLPromiseErrorCodeValidationFailure = 2,
|
|
||||||
} NS_REFINED_FOR_SWIFT;
|
|
||||||
|
|
||||||
NS_INLINE BOOL FBLPromiseErrorIsTimedOut(NSError *error) NS_SWIFT_UNAVAILABLE("") {
|
|
||||||
return error.domain == FBLPromiseErrorDomain &&
|
|
||||||
error.code == FBLPromiseErrorCodeTimedOut;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_INLINE BOOL FBLPromiseErrorIsValidationFailure(NSError *error) NS_SWIFT_UNAVAILABLE("") {
|
|
||||||
return error.domain == FBLPromiseErrorDomain &&
|
|
||||||
error.code == FBLPromiseErrorCodeValidationFailure;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_END
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 9b0b198d8256c427f982ca2efab2dbb8
|
|
||||||
DefaultImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
@@ -1,32 +0,0 @@
|
|||||||
/**
|
|
||||||
Copyright 2018 Google Inc. All rights reserved.
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at:
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#import "FBLPromise+All.h"
|
|
||||||
#import "FBLPromise+Always.h"
|
|
||||||
#import "FBLPromise+Any.h"
|
|
||||||
#import "FBLPromise+Async.h"
|
|
||||||
#import "FBLPromise+Await.h"
|
|
||||||
#import "FBLPromise+Catch.h"
|
|
||||||
#import "FBLPromise+Delay.h"
|
|
||||||
#import "FBLPromise+Do.h"
|
|
||||||
#import "FBLPromise+Race.h"
|
|
||||||
#import "FBLPromise+Recover.h"
|
|
||||||
#import "FBLPromise+Reduce.h"
|
|
||||||
#import "FBLPromise+Retry.h"
|
|
||||||
#import "FBLPromise+Then.h"
|
|
||||||
#import "FBLPromise+Timeout.h"
|
|
||||||
#import "FBLPromise+Validate.h"
|
|
||||||
#import "FBLPromise+Wrap.h"
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: fe7ef421eed5543f4b96ed4d830cf0e5
|
|
||||||
DefaultImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
@@ -1,36 +0,0 @@
|
|||||||
#ifdef __OBJC__
|
|
||||||
#import <UIKit/UIKit.h>
|
|
||||||
#else
|
|
||||||
#ifndef FOUNDATION_EXPORT
|
|
||||||
#if defined(__cplusplus)
|
|
||||||
#define FOUNDATION_EXPORT extern "C"
|
|
||||||
#else
|
|
||||||
#define FOUNDATION_EXPORT extern
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#import "FBLPromise+All.h"
|
|
||||||
#import "FBLPromise+Always.h"
|
|
||||||
#import "FBLPromise+Any.h"
|
|
||||||
#import "FBLPromise+Async.h"
|
|
||||||
#import "FBLPromise+Await.h"
|
|
||||||
#import "FBLPromise+Catch.h"
|
|
||||||
#import "FBLPromise+Delay.h"
|
|
||||||
#import "FBLPromise+Do.h"
|
|
||||||
#import "FBLPromise+Race.h"
|
|
||||||
#import "FBLPromise+Recover.h"
|
|
||||||
#import "FBLPromise+Reduce.h"
|
|
||||||
#import "FBLPromise+Retry.h"
|
|
||||||
#import "FBLPromise+Testing.h"
|
|
||||||
#import "FBLPromise+Then.h"
|
|
||||||
#import "FBLPromise+Timeout.h"
|
|
||||||
#import "FBLPromise+Validate.h"
|
|
||||||
#import "FBLPromise+Wrap.h"
|
|
||||||
#import "FBLPromise.h"
|
|
||||||
#import "FBLPromiseError.h"
|
|
||||||
#import "FBLPromises.h"
|
|
||||||
|
|
||||||
FOUNDATION_EXPORT double FBLPromisesVersionNumber;
|
|
||||||
FOUNDATION_EXPORT const unsigned char FBLPromisesVersionString[];
|
|
||||||
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 31f856a66cb3647fbb1ed41be4101b47
|
|
||||||
DefaultImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
@@ -1,57 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
||||||
<plist version="1.0">
|
|
||||||
<dict>
|
|
||||||
<key>BuildMachineOSBuild</key>
|
|
||||||
<string>21H1015</string>
|
|
||||||
<key>CFBundleDevelopmentRegion</key>
|
|
||||||
<string>en</string>
|
|
||||||
<key>CFBundleExecutable</key>
|
|
||||||
<string>FBLPromises</string>
|
|
||||||
<key>CFBundleIdentifier</key>
|
|
||||||
<string>org.cocoapods.FBLPromises</string>
|
|
||||||
<key>CFBundleInfoDictionaryVersion</key>
|
|
||||||
<string>6.0</string>
|
|
||||||
<key>CFBundleName</key>
|
|
||||||
<string>FBLPromises</string>
|
|
||||||
<key>CFBundlePackageType</key>
|
|
||||||
<string>FMWK</string>
|
|
||||||
<key>CFBundleShortVersionString</key>
|
|
||||||
<string>2.4.0</string>
|
|
||||||
<key>CFBundleSignature</key>
|
|
||||||
<string>????</string>
|
|
||||||
<key>CFBundleSupportedPlatforms</key>
|
|
||||||
<array>
|
|
||||||
<string>iPhoneOS</string>
|
|
||||||
</array>
|
|
||||||
<key>CFBundleVersion</key>
|
|
||||||
<string>1</string>
|
|
||||||
<key>DTCompiler</key>
|
|
||||||
<string>com.apple.compilers.llvm.clang.1_0</string>
|
|
||||||
<key>DTPlatformBuild</key>
|
|
||||||
<string>20B71</string>
|
|
||||||
<key>DTPlatformName</key>
|
|
||||||
<string>iphoneos</string>
|
|
||||||
<key>DTPlatformVersion</key>
|
|
||||||
<string>16.1</string>
|
|
||||||
<key>DTSDKBuild</key>
|
|
||||||
<string>20B71</string>
|
|
||||||
<key>DTSDKName</key>
|
|
||||||
<string>iphoneos16.1</string>
|
|
||||||
<key>DTXcode</key>
|
|
||||||
<string>1410</string>
|
|
||||||
<key>DTXcodeBuild</key>
|
|
||||||
<string>14B47b</string>
|
|
||||||
<key>MinimumOSVersion</key>
|
|
||||||
<string>100.0</string>
|
|
||||||
<key>UIDeviceFamily</key>
|
|
||||||
<array>
|
|
||||||
<integer>1</integer>
|
|
||||||
<integer>2</integer>
|
|
||||||
</array>
|
|
||||||
<key>UIRequiredDeviceCapabilities</key>
|
|
||||||
<array>
|
|
||||||
<string>arm64</string>
|
|
||||||
</array>
|
|
||||||
</dict>
|
|
||||||
</plist>
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 4c031dd12c6b44e4b8a240a819f64359
|
|
||||||
DefaultImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: d013fe5555ed0492092ed9b4f2c87301
|
|
||||||
folderAsset: yes
|
|
||||||
DefaultImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
framework module PromisesObjC {
|
|
||||||
umbrella header "PromisesObjC-umbrella.h"
|
|
||||||
export *
|
|
||||||
module * { export * }
|
|
||||||
}
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: efe540b576fed4653bba57ad847678e4
|
|
||||||
DefaultImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: e2c2468f1b886498ba9fe8081e629f49
|
|
||||||
folderAsset: yes
|
|
||||||
DefaultImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
@@ -1,81 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: c4668fbd1c57f494f912a33f0dd30bc5
|
|
||||||
PluginImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
serializedVersion: 2
|
|
||||||
iconMap: {}
|
|
||||||
executionOrder: {}
|
|
||||||
defineConstraints: []
|
|
||||||
isPreloaded: 0
|
|
||||||
isOverridable: 1
|
|
||||||
isExplicitlyReferenced: 0
|
|
||||||
validateReferences: 1
|
|
||||||
platformData:
|
|
||||||
- first:
|
|
||||||
: Any
|
|
||||||
second:
|
|
||||||
enabled: 0
|
|
||||||
settings:
|
|
||||||
Exclude Android: 1
|
|
||||||
Exclude Editor: 1
|
|
||||||
Exclude Linux64: 1
|
|
||||||
Exclude OSXUniversal: 1
|
|
||||||
Exclude Win: 1
|
|
||||||
Exclude Win64: 1
|
|
||||||
Exclude iOS: 1
|
|
||||||
- first:
|
|
||||||
Android: Android
|
|
||||||
second:
|
|
||||||
enabled: 0
|
|
||||||
settings:
|
|
||||||
AndroidSharedLibraryType: Executable
|
|
||||||
CPU: ARMv7
|
|
||||||
- first:
|
|
||||||
Any:
|
|
||||||
second:
|
|
||||||
enabled: 0
|
|
||||||
settings: {}
|
|
||||||
- first:
|
|
||||||
Editor: Editor
|
|
||||||
second:
|
|
||||||
enabled: 0
|
|
||||||
settings:
|
|
||||||
CPU: AnyCPU
|
|
||||||
DefaultValueInitialized: true
|
|
||||||
OS: AnyOS
|
|
||||||
- first:
|
|
||||||
Standalone: Linux64
|
|
||||||
second:
|
|
||||||
enabled: 0
|
|
||||||
settings:
|
|
||||||
CPU: None
|
|
||||||
- first:
|
|
||||||
Standalone: OSXUniversal
|
|
||||||
second:
|
|
||||||
enabled: 0
|
|
||||||
settings:
|
|
||||||
CPU: None
|
|
||||||
- first:
|
|
||||||
Standalone: Win
|
|
||||||
second:
|
|
||||||
enabled: 0
|
|
||||||
settings:
|
|
||||||
CPU: None
|
|
||||||
- first:
|
|
||||||
Standalone: Win64
|
|
||||||
second:
|
|
||||||
enabled: 0
|
|
||||||
settings:
|
|
||||||
CPU: None
|
|
||||||
- first:
|
|
||||||
iPhone: iOS
|
|
||||||
second:
|
|
||||||
enabled: 0
|
|
||||||
settings:
|
|
||||||
AddToEmbeddedBinaries: false
|
|
||||||
CPU: AnyCPU
|
|
||||||
CompileFlags:
|
|
||||||
FrameworkDependencies:
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
Binary file not shown.
@@ -1,7 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 808a57fa6370f4bcfa90c1be1d452a8d
|
|
||||||
DefaultImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 03ccdaaeb2aef4426877f960d727c5d1
|
|
||||||
folderAsset: yes
|
|
||||||
DefaultImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 8dae28586373347c4b61127473c94f30
|
|
||||||
folderAsset: yes
|
|
||||||
DefaultImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
@@ -1,50 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
||||||
<plist version="1.0">
|
|
||||||
<dict>
|
|
||||||
<key>BuildMachineOSBuild</key>
|
|
||||||
<string>21H1015</string>
|
|
||||||
<key>CFBundleDevelopmentRegion</key>
|
|
||||||
<string>en</string>
|
|
||||||
<key>CFBundleIdentifier</key>
|
|
||||||
<string>org.cocoapods.FBLPromises-Privacy</string>
|
|
||||||
<key>CFBundleInfoDictionaryVersion</key>
|
|
||||||
<string>6.0</string>
|
|
||||||
<key>CFBundleName</key>
|
|
||||||
<string>FBLPromises_Privacy</string>
|
|
||||||
<key>CFBundlePackageType</key>
|
|
||||||
<string>BNDL</string>
|
|
||||||
<key>CFBundleShortVersionString</key>
|
|
||||||
<string>2.4.0</string>
|
|
||||||
<key>CFBundleSignature</key>
|
|
||||||
<string>????</string>
|
|
||||||
<key>CFBundleSupportedPlatforms</key>
|
|
||||||
<array>
|
|
||||||
<string>MacOSX</string>
|
|
||||||
</array>
|
|
||||||
<key>CFBundleVersion</key>
|
|
||||||
<string>1</string>
|
|
||||||
<key>DTCompiler</key>
|
|
||||||
<string>com.apple.compilers.llvm.clang.1_0</string>
|
|
||||||
<key>DTPlatformBuild</key>
|
|
||||||
<string>14B47b</string>
|
|
||||||
<key>DTPlatformName</key>
|
|
||||||
<string>macosx</string>
|
|
||||||
<key>DTPlatformVersion</key>
|
|
||||||
<string>13.0</string>
|
|
||||||
<key>DTSDKBuild</key>
|
|
||||||
<string>22A372</string>
|
|
||||||
<key>DTSDKName</key>
|
|
||||||
<string>macosx13.0</string>
|
|
||||||
<key>DTXcode</key>
|
|
||||||
<string>1410</string>
|
|
||||||
<key>DTXcodeBuild</key>
|
|
||||||
<string>14B47b</string>
|
|
||||||
<key>LSMinimumSystemVersion</key>
|
|
||||||
<string>10.15</string>
|
|
||||||
<key>UIDeviceFamily</key>
|
|
||||||
<array>
|
|
||||||
<integer>2</integer>
|
|
||||||
</array>
|
|
||||||
</dict>
|
|
||||||
</plist>
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 38f0563bb10994c808d4b4b82249da7d
|
|
||||||
DefaultImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: d7427081f3990495d89238b6b8c00fd6
|
|
||||||
folderAsset: yes
|
|
||||||
DefaultImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
||||||
<plist version="1.0">
|
|
||||||
<dict>
|
|
||||||
<key>NSPrivacyAccessedAPITypes</key>
|
|
||||||
<array/>
|
|
||||||
<key>NSPrivacyCollectedDataTypes</key>
|
|
||||||
<array/>
|
|
||||||
<key>NSPrivacyTracking</key>
|
|
||||||
<false/>
|
|
||||||
<key>NSPrivacyTrackingDomains</key>
|
|
||||||
<array/>
|
|
||||||
</dict>
|
|
||||||
</plist>
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 091e064965d0a45598de0dd2899fe264
|
|
||||||
DefaultImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 9157bcbf0c4b640f58a082110f2c55d5
|
|
||||||
folderAsset: yes
|
|
||||||
DefaultImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
@@ -1,63 +0,0 @@
|
|||||||
/**
|
|
||||||
Copyright 2018 Google Inc. All rights reserved.
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at:
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#import "FBLPromise.h"
|
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_BEGIN
|
|
||||||
|
|
||||||
@interface FBLPromise<Value>(AllAdditions)
|
|
||||||
|
|
||||||
/**
|
|
||||||
Wait until all of the given promises are fulfilled.
|
|
||||||
If one of the given promises is rejected, then the returned promise is rejected with same error.
|
|
||||||
If any other arbitrary value or `NSError` appears in the array instead of `FBLPromise`,
|
|
||||||
it's implicitly considered a pre-fulfilled or pre-rejected `FBLPromise` correspondingly.
|
|
||||||
Promises resolved with `nil` become `NSNull` instances in the resulting array.
|
|
||||||
|
|
||||||
@param promises Promises to wait for.
|
|
||||||
@return Promise of an array containing the values of input promises in the same order.
|
|
||||||
*/
|
|
||||||
+ (FBLPromise<NSArray *> *)all:(NSArray *)promises NS_SWIFT_UNAVAILABLE("");
|
|
||||||
|
|
||||||
/**
|
|
||||||
Wait until all of the given promises are fulfilled.
|
|
||||||
If one of the given promises is rejected, then the returned promise is rejected with same error.
|
|
||||||
If any other arbitrary value or `NSError` appears in the array instead of `FBLPromise`,
|
|
||||||
it's implicitly considered a pre-fulfilled or pre-rejected FBLPromise correspondingly.
|
|
||||||
Promises resolved with `nil` become `NSNull` instances in the resulting array.
|
|
||||||
|
|
||||||
@param queue A queue to dispatch on.
|
|
||||||
@param promises Promises to wait for.
|
|
||||||
@return Promise of an array containing the values of input promises in the same order.
|
|
||||||
*/
|
|
||||||
+ (FBLPromise<NSArray *> *)onQueue:(dispatch_queue_t)queue
|
|
||||||
all:(NSArray *)promises NS_REFINED_FOR_SWIFT;
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
||||||
/**
|
|
||||||
Convenience dot-syntax wrappers for `FBLPromise` `all` operators.
|
|
||||||
Usage: FBLPromise.all(@[ ... ])
|
|
||||||
*/
|
|
||||||
@interface FBLPromise<Value>(DotSyntax_AllAdditions)
|
|
||||||
|
|
||||||
+ (FBLPromise<NSArray *> * (^)(NSArray *))all FBL_PROMISES_DOT_SYNTAX NS_SWIFT_UNAVAILABLE("");
|
|
||||||
+ (FBLPromise<NSArray *> * (^)(dispatch_queue_t, NSArray *))allOn FBL_PROMISES_DOT_SYNTAX
|
|
||||||
NS_SWIFT_UNAVAILABLE("");
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_END
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 92bed004a4e3f49bca2d82dc43e956d7
|
|
||||||
DefaultImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
@@ -1,54 +0,0 @@
|
|||||||
/**
|
|
||||||
Copyright 2018 Google Inc. All rights reserved.
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at:
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#import "FBLPromise.h"
|
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_BEGIN
|
|
||||||
|
|
||||||
@interface FBLPromise<Value>(AlwaysAdditions)
|
|
||||||
|
|
||||||
typedef void (^FBLPromiseAlwaysWorkBlock)(void) NS_SWIFT_UNAVAILABLE("");
|
|
||||||
|
|
||||||
/**
|
|
||||||
@param work A block that always executes, no matter if the receiver is rejected or fulfilled.
|
|
||||||
@return A new pending promise to be resolved with same resolution as the receiver.
|
|
||||||
*/
|
|
||||||
- (FBLPromise *)always:(FBLPromiseAlwaysWorkBlock)work NS_SWIFT_UNAVAILABLE("");
|
|
||||||
|
|
||||||
/**
|
|
||||||
@param queue A queue to dispatch on.
|
|
||||||
@param work A block that always executes, no matter if the receiver is rejected or fulfilled.
|
|
||||||
@return A new pending promise to be resolved with same resolution as the receiver.
|
|
||||||
*/
|
|
||||||
- (FBLPromise *)onQueue:(dispatch_queue_t)queue
|
|
||||||
always:(FBLPromiseAlwaysWorkBlock)work NS_REFINED_FOR_SWIFT;
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
||||||
/**
|
|
||||||
Convenience dot-syntax wrappers for `FBLPromise` `always` operators.
|
|
||||||
Usage: promise.always(^{...})
|
|
||||||
*/
|
|
||||||
@interface FBLPromise<Value>(DotSyntax_AlwaysAdditions)
|
|
||||||
|
|
||||||
- (FBLPromise* (^)(FBLPromiseAlwaysWorkBlock))always FBL_PROMISES_DOT_SYNTAX
|
|
||||||
NS_SWIFT_UNAVAILABLE("");
|
|
||||||
- (FBLPromise* (^)(dispatch_queue_t, FBLPromiseAlwaysWorkBlock))alwaysOn FBL_PROMISES_DOT_SYNTAX
|
|
||||||
NS_SWIFT_UNAVAILABLE("");
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_END
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 308f4100035a546d692ea26a9bb173db
|
|
||||||
DefaultImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
@@ -1,69 +0,0 @@
|
|||||||
/**
|
|
||||||
Copyright 2018 Google Inc. All rights reserved.
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at:
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#import "FBLPromise.h"
|
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_BEGIN
|
|
||||||
|
|
||||||
@interface FBLPromise<Value>(AnyAdditions)
|
|
||||||
|
|
||||||
/**
|
|
||||||
Waits until all of the given promises are either fulfilled or rejected.
|
|
||||||
If all promises are rejected, then the returned promise is rejected with same error
|
|
||||||
as the last one rejected.
|
|
||||||
If at least one of the promises is fulfilled, the resulting promise is fulfilled with an array of
|
|
||||||
values or `NSErrors`, matching the original order of fulfilled or rejected promises respectively.
|
|
||||||
If any other arbitrary value or `NSError` appears in the array instead of `FBLPromise`,
|
|
||||||
it's implicitly considered a pre-fulfilled or pre-rejected `FBLPromise` correspondingly.
|
|
||||||
Promises resolved with `nil` become `NSNull` instances in the resulting array.
|
|
||||||
|
|
||||||
@param promises Promises to wait for.
|
|
||||||
@return Promise of array containing the values or `NSError`s of input promises in the same order.
|
|
||||||
*/
|
|
||||||
+ (FBLPromise<NSArray *> *)any:(NSArray *)promises NS_SWIFT_UNAVAILABLE("");
|
|
||||||
|
|
||||||
/**
|
|
||||||
Waits until all of the given promises are either fulfilled or rejected.
|
|
||||||
If all promises are rejected, then the returned promise is rejected with same error
|
|
||||||
as the last one rejected.
|
|
||||||
If at least one of the promises is fulfilled, the resulting promise is fulfilled with an array of
|
|
||||||
values or `NSError`s, matching the original order of fulfilled or rejected promises respectively.
|
|
||||||
If any other arbitrary value or `NSError` appears in the array instead of `FBLPromise`,
|
|
||||||
it's implicitly considered a pre-fulfilled or pre-rejected `FBLPromise` correspondingly.
|
|
||||||
Promises resolved with `nil` become `NSNull` instances in the resulting array.
|
|
||||||
|
|
||||||
@param queue A queue to dispatch on.
|
|
||||||
@param promises Promises to wait for.
|
|
||||||
@return Promise of array containing the values or `NSError`s of input promises in the same order.
|
|
||||||
*/
|
|
||||||
+ (FBLPromise<NSArray *> *)onQueue:(dispatch_queue_t)queue
|
|
||||||
any:(NSArray *)promises NS_REFINED_FOR_SWIFT;
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
||||||
/**
|
|
||||||
Convenience dot-syntax wrappers for `FBLPromise` `any` operators.
|
|
||||||
Usage: FBLPromise.any(@[ ... ])
|
|
||||||
*/
|
|
||||||
@interface FBLPromise<Value>(DotSyntax_AnyAdditions)
|
|
||||||
|
|
||||||
+ (FBLPromise<NSArray *> * (^)(NSArray *))any FBL_PROMISES_DOT_SYNTAX NS_SWIFT_UNAVAILABLE("");
|
|
||||||
+ (FBLPromise<NSArray *> * (^)(dispatch_queue_t, NSArray *))anyOn FBL_PROMISES_DOT_SYNTAX
|
|
||||||
NS_SWIFT_UNAVAILABLE("");
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_END
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: ff3e16d2be2f04561af34c1f3f0027ab
|
|
||||||
DefaultImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
@@ -1,60 +0,0 @@
|
|||||||
/**
|
|
||||||
Copyright 2018 Google Inc. All rights reserved.
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at:
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#import "FBLPromise.h"
|
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_BEGIN
|
|
||||||
|
|
||||||
@interface FBLPromise<Value>(AsyncAdditions)
|
|
||||||
|
|
||||||
typedef void (^FBLPromiseFulfillBlock)(Value __nullable value) NS_SWIFT_UNAVAILABLE("");
|
|
||||||
typedef void (^FBLPromiseRejectBlock)(NSError *error) NS_SWIFT_UNAVAILABLE("");
|
|
||||||
typedef void (^FBLPromiseAsyncWorkBlock)(FBLPromiseFulfillBlock fulfill,
|
|
||||||
FBLPromiseRejectBlock reject) NS_SWIFT_UNAVAILABLE("");
|
|
||||||
|
|
||||||
/**
|
|
||||||
Creates a pending promise and executes `work` block asynchronously.
|
|
||||||
|
|
||||||
@param work A block to perform any operations needed to resolve the promise.
|
|
||||||
@return A new pending promise.
|
|
||||||
*/
|
|
||||||
+ (instancetype)async:(FBLPromiseAsyncWorkBlock)work NS_SWIFT_UNAVAILABLE("");
|
|
||||||
|
|
||||||
/**
|
|
||||||
Creates a pending promise and executes `work` block asynchronously on the given queue.
|
|
||||||
|
|
||||||
@param queue A queue to invoke the `work` block on.
|
|
||||||
@param work A block to perform any operations needed to resolve the promise.
|
|
||||||
@return A new pending promise.
|
|
||||||
*/
|
|
||||||
+ (instancetype)onQueue:(dispatch_queue_t)queue
|
|
||||||
async:(FBLPromiseAsyncWorkBlock)work NS_REFINED_FOR_SWIFT;
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
||||||
/**
|
|
||||||
Convenience dot-syntax wrappers for `FBLPromise` `async` operators.
|
|
||||||
Usage: FBLPromise.async(^(FBLPromiseFulfillBlock fulfill, FBLPromiseRejectBlock reject) { ... })
|
|
||||||
*/
|
|
||||||
@interface FBLPromise<Value>(DotSyntax_AsyncAdditions)
|
|
||||||
|
|
||||||
+ (FBLPromise* (^)(FBLPromiseAsyncWorkBlock))async FBL_PROMISES_DOT_SYNTAX NS_SWIFT_UNAVAILABLE("");
|
|
||||||
+ (FBLPromise* (^)(dispatch_queue_t, FBLPromiseAsyncWorkBlock))asyncOn FBL_PROMISES_DOT_SYNTAX
|
|
||||||
NS_SWIFT_UNAVAILABLE("");
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_END
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 1e233bb3aba5f472e83f2566389f58cf
|
|
||||||
DefaultImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
@@ -1,32 +0,0 @@
|
|||||||
/**
|
|
||||||
Copyright 2018 Google Inc. All rights reserved.
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at:
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#import "FBLPromise.h"
|
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_BEGIN
|
|
||||||
|
|
||||||
/**
|
|
||||||
Waits for promise resolution. The current thread blocks until the promise is resolved.
|
|
||||||
|
|
||||||
@param promise Promise to wait for.
|
|
||||||
@param error Error the promise was rejected with, or `nil` if the promise was fulfilled.
|
|
||||||
@return Value the promise was fulfilled with. If the promise was rejected, the return value
|
|
||||||
is always `nil`, but the error out arg is not.
|
|
||||||
*/
|
|
||||||
FOUNDATION_EXTERN id __nullable FBLPromiseAwait(FBLPromise *promise,
|
|
||||||
NSError **error) NS_REFINED_FOR_SWIFT;
|
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_END
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 20157a095f90248b3b0ec216b8bc6ddd
|
|
||||||
DefaultImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
@@ -1,59 +0,0 @@
|
|||||||
/**
|
|
||||||
Copyright 2018 Google Inc. All rights reserved.
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at:
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#import "FBLPromise.h"
|
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_BEGIN
|
|
||||||
|
|
||||||
@interface FBLPromise<Value>(CatchAdditions)
|
|
||||||
|
|
||||||
typedef void (^FBLPromiseCatchWorkBlock)(NSError *error) NS_SWIFT_UNAVAILABLE("");
|
|
||||||
|
|
||||||
/**
|
|
||||||
Creates a pending promise which eventually gets resolved with same resolution as the receiver.
|
|
||||||
If receiver is rejected, then `reject` block is executed asynchronously.
|
|
||||||
|
|
||||||
@param reject A block to handle the error that receiver was rejected with.
|
|
||||||
@return A new pending promise.
|
|
||||||
*/
|
|
||||||
- (FBLPromise *)catch:(FBLPromiseCatchWorkBlock)reject NS_SWIFT_UNAVAILABLE("");
|
|
||||||
|
|
||||||
/**
|
|
||||||
Creates a pending promise which eventually gets resolved with same resolution as the receiver.
|
|
||||||
If receiver is rejected, then `reject` block is executed asynchronously on the given queue.
|
|
||||||
|
|
||||||
@param queue A queue to invoke the `reject` block on.
|
|
||||||
@param reject A block to handle the error that receiver was rejected with.
|
|
||||||
@return A new pending promise.
|
|
||||||
*/
|
|
||||||
- (FBLPromise *)onQueue:(dispatch_queue_t)queue
|
|
||||||
catch:(FBLPromiseCatchWorkBlock)reject NS_REFINED_FOR_SWIFT;
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
||||||
/**
|
|
||||||
Convenience dot-syntax wrappers for `FBLPromise` `catch` operators.
|
|
||||||
Usage: promise.catch(^(NSError *error) { ... })
|
|
||||||
*/
|
|
||||||
@interface FBLPromise<Value>(DotSyntax_CatchAdditions)
|
|
||||||
|
|
||||||
- (FBLPromise* (^)(FBLPromiseCatchWorkBlock))catch FBL_PROMISES_DOT_SYNTAX NS_SWIFT_UNAVAILABLE("");
|
|
||||||
- (FBLPromise* (^)(dispatch_queue_t, FBLPromiseCatchWorkBlock))catchOn FBL_PROMISES_DOT_SYNTAX
|
|
||||||
NS_SWIFT_UNAVAILABLE("");
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_END
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 304d74574a0a24afdb22a5b64f69d981
|
|
||||||
DefaultImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
@@ -1,59 +0,0 @@
|
|||||||
/**
|
|
||||||
Copyright 2018 Google Inc. All rights reserved.
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at:
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#import "FBLPromise.h"
|
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_BEGIN
|
|
||||||
|
|
||||||
@interface FBLPromise<Value>(DelayAdditions)
|
|
||||||
|
|
||||||
/**
|
|
||||||
Creates a new pending promise that fulfills with the same value as `self` after the `delay`, or
|
|
||||||
rejects with the same error immediately.
|
|
||||||
|
|
||||||
@param interval Time to wait in seconds.
|
|
||||||
@return A new pending promise that fulfills at least `delay` seconds later than `self`, or rejects
|
|
||||||
with the same error immediately.
|
|
||||||
*/
|
|
||||||
- (FBLPromise *)delay:(NSTimeInterval)interval NS_SWIFT_UNAVAILABLE("");
|
|
||||||
|
|
||||||
/**
|
|
||||||
Creates a new pending promise that fulfills with the same value as `self` after the `delay`, or
|
|
||||||
rejects with the same error immediately.
|
|
||||||
|
|
||||||
@param queue A queue to dispatch on.
|
|
||||||
@param interval Time to wait in seconds.
|
|
||||||
@return A new pending promise that fulfills at least `delay` seconds later than `self`, or rejects
|
|
||||||
with the same error immediately.
|
|
||||||
*/
|
|
||||||
- (FBLPromise *)onQueue:(dispatch_queue_t)queue
|
|
||||||
delay:(NSTimeInterval)interval NS_REFINED_FOR_SWIFT;
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
||||||
/**
|
|
||||||
Convenience dot-syntax wrappers for `FBLPromise` `delay` operators.
|
|
||||||
Usage: promise.delay(...)
|
|
||||||
*/
|
|
||||||
@interface FBLPromise<Value>(DotSyntax_DelayAdditions)
|
|
||||||
|
|
||||||
- (FBLPromise * (^)(NSTimeInterval))delay FBL_PROMISES_DOT_SYNTAX NS_SWIFT_UNAVAILABLE("");
|
|
||||||
- (FBLPromise * (^)(dispatch_queue_t, NSTimeInterval))delayOn FBL_PROMISES_DOT_SYNTAX
|
|
||||||
NS_SWIFT_UNAVAILABLE("");
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_END
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 07760d3eaa5334aca9169f05342b4923
|
|
||||||
DefaultImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
@@ -1,55 +0,0 @@
|
|||||||
/**
|
|
||||||
Copyright 2018 Google Inc. All rights reserved.
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at:
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#import "FBLPromise.h"
|
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_BEGIN
|
|
||||||
|
|
||||||
@interface FBLPromise<Value>(DoAdditions)
|
|
||||||
|
|
||||||
typedef id __nullable (^FBLPromiseDoWorkBlock)(void) NS_SWIFT_UNAVAILABLE("");
|
|
||||||
|
|
||||||
/**
|
|
||||||
Creates a pending promise and executes `work` block asynchronously.
|
|
||||||
|
|
||||||
@param work A block that returns a value or an error used to resolve the promise.
|
|
||||||
@return A new pending promise.
|
|
||||||
*/
|
|
||||||
+ (instancetype)do:(FBLPromiseDoWorkBlock)work NS_SWIFT_UNAVAILABLE("");
|
|
||||||
|
|
||||||
/**
|
|
||||||
Creates a pending promise and executes `work` block asynchronously on the given queue.
|
|
||||||
|
|
||||||
@param queue A queue to invoke the `work` block on.
|
|
||||||
@param work A block that returns a value or an error used to resolve the promise.
|
|
||||||
@return A new pending promise.
|
|
||||||
*/
|
|
||||||
+ (instancetype)onQueue:(dispatch_queue_t)queue do:(FBLPromiseDoWorkBlock)work NS_REFINED_FOR_SWIFT;
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
||||||
/**
|
|
||||||
Convenience dot-syntax wrappers for `FBLPromise` `do` operators.
|
|
||||||
Usage: FBLPromise.doOn(queue, ^(NSError *error) { ... })
|
|
||||||
*/
|
|
||||||
@interface FBLPromise<Value>(DotSyntax_DoAdditions)
|
|
||||||
|
|
||||||
+ (FBLPromise * (^)(dispatch_queue_t, FBLPromiseDoWorkBlock))doOn FBL_PROMISES_DOT_SYNTAX
|
|
||||||
NS_SWIFT_UNAVAILABLE("");
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_END
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: a55114da4f6414e62a4ffb730fb6b90f
|
|
||||||
DefaultImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
@@ -1,62 +0,0 @@
|
|||||||
/**
|
|
||||||
Copyright 2018 Google Inc. All rights reserved.
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at:
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#import "FBLPromise.h"
|
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_BEGIN
|
|
||||||
|
|
||||||
@interface FBLPromise<Value>(RaceAdditions)
|
|
||||||
|
|
||||||
/**
|
|
||||||
Wait until any of the given promises are fulfilled.
|
|
||||||
If one of the promises is rejected, then the returned promise is rejected with same error.
|
|
||||||
If any other arbitrary value or `NSError` appears in the array instead of `FBLPromise`,
|
|
||||||
it's implicitly considered a pre-fulfilled or pre-rejected `FBLPromise` correspondingly.
|
|
||||||
|
|
||||||
@param promises Promises to wait for.
|
|
||||||
@return A new pending promise to be resolved with the same resolution as the first promise, among
|
|
||||||
the given ones, which was resolved.
|
|
||||||
*/
|
|
||||||
+ (instancetype)race:(NSArray *)promises NS_SWIFT_UNAVAILABLE("");
|
|
||||||
|
|
||||||
/**
|
|
||||||
Wait until any of the given promises are fulfilled.
|
|
||||||
If one of the promises is rejected, then the returned promise is rejected with same error.
|
|
||||||
If any other arbitrary value or `NSError` appears in the array instead of `FBLPromise`,
|
|
||||||
it's implicitly considered a pre-fulfilled or pre-rejected `FBLPromise` correspondingly.
|
|
||||||
|
|
||||||
@param queue A queue to dispatch on.
|
|
||||||
@param promises Promises to wait for.
|
|
||||||
@return A new pending promise to be resolved with the same resolution as the first promise, among
|
|
||||||
the given ones, which was resolved.
|
|
||||||
*/
|
|
||||||
+ (instancetype)onQueue:(dispatch_queue_t)queue race:(NSArray *)promises NS_REFINED_FOR_SWIFT;
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
||||||
/**
|
|
||||||
Convenience dot-syntax wrappers for `FBLPromise` `race` operators.
|
|
||||||
Usage: FBLPromise.race(@[ ... ])
|
|
||||||
*/
|
|
||||||
@interface FBLPromise<Value>(DotSyntax_RaceAdditions)
|
|
||||||
|
|
||||||
+ (FBLPromise * (^)(NSArray *))race FBL_PROMISES_DOT_SYNTAX NS_SWIFT_UNAVAILABLE("");
|
|
||||||
+ (FBLPromise * (^)(dispatch_queue_t, NSArray *))raceOn FBL_PROMISES_DOT_SYNTAX
|
|
||||||
NS_SWIFT_UNAVAILABLE("");
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_END
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: e79472a24478049b697d3a3f641ba321
|
|
||||||
DefaultImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
@@ -1,60 +0,0 @@
|
|||||||
/**
|
|
||||||
Copyright 2018 Google Inc. All rights reserved.
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at:
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#import "FBLPromise.h"
|
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_BEGIN
|
|
||||||
|
|
||||||
@interface FBLPromise<Value>(RecoverAdditions)
|
|
||||||
|
|
||||||
typedef id __nullable (^FBLPromiseRecoverWorkBlock)(NSError *error) NS_SWIFT_UNAVAILABLE("");
|
|
||||||
|
|
||||||
/**
|
|
||||||
Provides a new promise to recover in case the receiver gets rejected.
|
|
||||||
|
|
||||||
@param recovery A block to handle the error that the receiver was rejected with.
|
|
||||||
@return A new pending promise to use instead of the rejected one that gets resolved with resolution
|
|
||||||
returned from `recovery` block.
|
|
||||||
*/
|
|
||||||
- (FBLPromise *)recover:(FBLPromiseRecoverWorkBlock)recovery NS_SWIFT_UNAVAILABLE("");
|
|
||||||
|
|
||||||
/**
|
|
||||||
Provides a new promise to recover in case the receiver gets rejected.
|
|
||||||
|
|
||||||
@param queue A queue to dispatch on.
|
|
||||||
@param recovery A block to handle the error that the receiver was rejected with.
|
|
||||||
@return A new pending promise to use instead of the rejected one that gets resolved with resolution
|
|
||||||
returned from `recovery` block.
|
|
||||||
*/
|
|
||||||
- (FBLPromise *)onQueue:(dispatch_queue_t)queue
|
|
||||||
recover:(FBLPromiseRecoverWorkBlock)recovery NS_REFINED_FOR_SWIFT;
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
||||||
/**
|
|
||||||
Convenience dot-syntax wrappers for `FBLPromise` `recover` operators.
|
|
||||||
Usage: promise.recover(^id(NSError *error) {...})
|
|
||||||
*/
|
|
||||||
@interface FBLPromise<Value>(DotSyntax_RecoverAdditions)
|
|
||||||
|
|
||||||
- (FBLPromise * (^)(FBLPromiseRecoverWorkBlock))recover FBL_PROMISES_DOT_SYNTAX
|
|
||||||
NS_SWIFT_UNAVAILABLE("");
|
|
||||||
- (FBLPromise * (^)(dispatch_queue_t, FBLPromiseRecoverWorkBlock))recoverOn FBL_PROMISES_DOT_SYNTAX
|
|
||||||
NS_SWIFT_UNAVAILABLE("");
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_END
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 0b8b71d402a9b4f36b80a51ae556e349
|
|
||||||
DefaultImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
@@ -1,71 +0,0 @@
|
|||||||
/**
|
|
||||||
Copyright 2018 Google Inc. All rights reserved.
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at:
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#import "FBLPromise.h"
|
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_BEGIN
|
|
||||||
|
|
||||||
@interface FBLPromise<Value>(ReduceAdditions)
|
|
||||||
|
|
||||||
typedef id __nullable (^FBLPromiseReducerBlock)(Value __nullable partial, id next)
|
|
||||||
NS_SWIFT_UNAVAILABLE("");
|
|
||||||
|
|
||||||
/**
|
|
||||||
Sequentially reduces a collection of values to a single promise using a given combining block
|
|
||||||
and the value `self` resolves with as initial value.
|
|
||||||
|
|
||||||
@param items An array of values to process in order.
|
|
||||||
@param reducer A block to combine an accumulating value and an element of the sequence into
|
|
||||||
the new accumulating value or a promise resolved with it, to be used in the next
|
|
||||||
call of the `reducer` or returned to the caller.
|
|
||||||
@return A new pending promise returned from the last `reducer` invocation.
|
|
||||||
Or `self` if `items` is empty.
|
|
||||||
*/
|
|
||||||
- (FBLPromise *)reduce:(NSArray *)items
|
|
||||||
combine:(FBLPromiseReducerBlock)reducer NS_SWIFT_UNAVAILABLE("");
|
|
||||||
|
|
||||||
/**
|
|
||||||
Sequentially reduces a collection of values to a single promise using a given combining block
|
|
||||||
and the value `self` resolves with as initial value.
|
|
||||||
|
|
||||||
@param queue A queue to dispatch on.
|
|
||||||
@param items An array of values to process in order.
|
|
||||||
@param reducer A block to combine an accumulating value and an element of the sequence into
|
|
||||||
the new accumulating value or a promise resolved with it, to be used in the next
|
|
||||||
call of the `reducer` or returned to the caller.
|
|
||||||
@return A new pending promise returned from the last `reducer` invocation.
|
|
||||||
Or `self` if `items` is empty.
|
|
||||||
*/
|
|
||||||
- (FBLPromise *)onQueue:(dispatch_queue_t)queue
|
|
||||||
reduce:(NSArray *)items
|
|
||||||
combine:(FBLPromiseReducerBlock)reducer NS_SWIFT_UNAVAILABLE("");
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
||||||
/**
|
|
||||||
Convenience dot-syntax wrappers for `FBLPromise` `reduce` operators.
|
|
||||||
Usage: promise.reduce(values, ^id(id partial, id next) { ... })
|
|
||||||
*/
|
|
||||||
@interface FBLPromise<Value>(DotSyntax_ReduceAdditions)
|
|
||||||
|
|
||||||
- (FBLPromise * (^)(NSArray *, FBLPromiseReducerBlock))reduce FBL_PROMISES_DOT_SYNTAX
|
|
||||||
NS_SWIFT_UNAVAILABLE("");
|
|
||||||
- (FBLPromise * (^)(dispatch_queue_t, NSArray *, FBLPromiseReducerBlock))reduceOn
|
|
||||||
FBL_PROMISES_DOT_SYNTAX NS_SWIFT_UNAVAILABLE("");
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_END
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 427a4c333e53f4b219b42ff6aba1c904
|
|
||||||
DefaultImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
@@ -1,165 +0,0 @@
|
|||||||
/**
|
|
||||||
Copyright 2018 Google Inc. All rights reserved.
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at:
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#import "FBLPromise.h"
|
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_BEGIN
|
|
||||||
|
|
||||||
/** The default number of retry attempts is 1. */
|
|
||||||
FOUNDATION_EXTERN NSInteger const FBLPromiseRetryDefaultAttemptsCount NS_REFINED_FOR_SWIFT;
|
|
||||||
|
|
||||||
/** The default delay interval before making a retry attempt is 1.0 second. */
|
|
||||||
FOUNDATION_EXTERN NSTimeInterval const FBLPromiseRetryDefaultDelayInterval NS_REFINED_FOR_SWIFT;
|
|
||||||
|
|
||||||
@interface FBLPromise<Value>(RetryAdditions)
|
|
||||||
|
|
||||||
typedef id __nullable (^FBLPromiseRetryWorkBlock)(void) NS_SWIFT_UNAVAILABLE("");
|
|
||||||
typedef BOOL (^FBLPromiseRetryPredicateBlock)(NSInteger, NSError *) NS_SWIFT_UNAVAILABLE("");
|
|
||||||
|
|
||||||
/**
|
|
||||||
Creates a pending promise that fulfills with the same value as the promise returned from `work`
|
|
||||||
block, which executes asynchronously, or rejects with the same error after all retry attempts have
|
|
||||||
been exhausted. Defaults to `FBLPromiseRetryDefaultAttemptsCount` attempt(s) on rejection where the
|
|
||||||
`work` block is retried after a delay of `FBLPromiseRetryDefaultDelayInterval` second(s).
|
|
||||||
|
|
||||||
@param work A block that executes asynchronously on the default queue and returns a value or an
|
|
||||||
error used to resolve the promise.
|
|
||||||
@return A new pending promise that fulfills with the same value as the promise returned from `work`
|
|
||||||
block, or rejects with the same error after all retry attempts have been exhausted.
|
|
||||||
*/
|
|
||||||
+ (instancetype)retry:(FBLPromiseRetryWorkBlock)work NS_SWIFT_UNAVAILABLE("");
|
|
||||||
|
|
||||||
/**
|
|
||||||
Creates a pending promise that fulfills with the same value as the promise returned from `work`
|
|
||||||
block, which executes asynchronously on the given `queue`, or rejects with the same error after all
|
|
||||||
retry attempts have been exhausted. Defaults to `FBLPromiseRetryDefaultAttemptsCount` attempt(s) on
|
|
||||||
rejection where the `work` block is retried on the given `queue` after a delay of
|
|
||||||
`FBLPromiseRetryDefaultDelayInterval` second(s).
|
|
||||||
|
|
||||||
@param queue A queue to invoke the `work` block on.
|
|
||||||
@param work A block that executes asynchronously on the given `queue` and returns a value or an
|
|
||||||
error used to resolve the promise.
|
|
||||||
@return A new pending promise that fulfills with the same value as the promise returned from `work`
|
|
||||||
block, or rejects with the same error after all retry attempts have been exhausted.
|
|
||||||
*/
|
|
||||||
+ (instancetype)onQueue:(dispatch_queue_t)queue
|
|
||||||
retry:(FBLPromiseRetryWorkBlock)work NS_SWIFT_UNAVAILABLE("");
|
|
||||||
|
|
||||||
/**
|
|
||||||
Creates a pending promise that fulfills with the same value as the promise returned from `work`
|
|
||||||
block, which executes asynchronously, or rejects with the same error after all retry attempts have
|
|
||||||
been exhausted.
|
|
||||||
|
|
||||||
@param count Max number of retry attempts. The `work` block will be executed once if the specified
|
|
||||||
count is less than or equal to zero.
|
|
||||||
@param work A block that executes asynchronously on the default queue and returns a value or an
|
|
||||||
error used to resolve the promise.
|
|
||||||
@return A new pending promise that fulfills with the same value as the promise returned from `work`
|
|
||||||
block, or rejects with the same error after all retry attempts have been exhausted.
|
|
||||||
*/
|
|
||||||
+ (instancetype)attempts:(NSInteger)count
|
|
||||||
retry:(FBLPromiseRetryWorkBlock)work NS_SWIFT_UNAVAILABLE("");
|
|
||||||
|
|
||||||
/**
|
|
||||||
Creates a pending promise that fulfills with the same value as the promise returned from `work`
|
|
||||||
block, which executes asynchronously on the given `queue`, or rejects with the same error after all
|
|
||||||
retry attempts have been exhausted.
|
|
||||||
|
|
||||||
@param queue A queue to invoke the `work` block on.
|
|
||||||
@param count Max number of retry attempts. The `work` block will be executed once if the specified
|
|
||||||
count is less than or equal to zero.
|
|
||||||
@param work A block that executes asynchronously on the given `queue` and returns a value or an
|
|
||||||
error used to resolve the promise.
|
|
||||||
@return A new pending promise that fulfills with the same value as the promise returned from `work`
|
|
||||||
block, or rejects with the same error after all retry attempts have been exhausted.
|
|
||||||
*/
|
|
||||||
+ (instancetype)onQueue:(dispatch_queue_t)queue
|
|
||||||
attempts:(NSInteger)count
|
|
||||||
retry:(FBLPromiseRetryWorkBlock)work NS_SWIFT_UNAVAILABLE("");
|
|
||||||
|
|
||||||
/**
|
|
||||||
Creates a pending promise that fulfills with the same value as the promise returned from `work`
|
|
||||||
block, which executes asynchronously, or rejects with the same error after all retry attempts have
|
|
||||||
been exhausted. On rejection, the `work` block is retried after the given delay `interval` and will
|
|
||||||
continue to retry until the number of specified attempts have been exhausted or will bail early if
|
|
||||||
the given condition is not met.
|
|
||||||
|
|
||||||
@param count Max number of retry attempts. The `work` block will be executed once if the specified
|
|
||||||
count is less than or equal to zero.
|
|
||||||
@param interval Time to wait before the next retry attempt.
|
|
||||||
@param predicate Condition to check before the next retry attempt. The predicate block provides the
|
|
||||||
the number of remaining retry attempts and the error that the promise was rejected
|
|
||||||
with.
|
|
||||||
@param work A block that executes asynchronously on the default queue and returns a value or an
|
|
||||||
error used to resolve the promise.
|
|
||||||
@return A new pending promise that fulfills with the same value as the promise returned from `work`
|
|
||||||
block, or rejects with the same error after all retry attempts have been exhausted or if
|
|
||||||
the given condition is not met.
|
|
||||||
*/
|
|
||||||
+ (instancetype)attempts:(NSInteger)count
|
|
||||||
delay:(NSTimeInterval)interval
|
|
||||||
condition:(nullable FBLPromiseRetryPredicateBlock)predicate
|
|
||||||
retry:(FBLPromiseRetryWorkBlock)work NS_SWIFT_UNAVAILABLE("");
|
|
||||||
|
|
||||||
/**
|
|
||||||
Creates a pending promise that fulfills with the same value as the promise returned from `work`
|
|
||||||
block, which executes asynchronously on the given `queue`, or rejects with the same error after all
|
|
||||||
retry attempts have been exhausted. On rejection, the `work` block is retried after the given
|
|
||||||
delay `interval` and will continue to retry until the number of specified attempts have been
|
|
||||||
exhausted or will bail early if the given condition is not met.
|
|
||||||
|
|
||||||
@param queue A queue to invoke the `work` block on.
|
|
||||||
@param count Max number of retry attempts. The `work` block will be executed once if the specified
|
|
||||||
count is less than or equal to zero.
|
|
||||||
@param interval Time to wait before the next retry attempt.
|
|
||||||
@param predicate Condition to check before the next retry attempt. The predicate block provides the
|
|
||||||
the number of remaining retry attempts and the error that the promise was rejected
|
|
||||||
with.
|
|
||||||
@param work A block that executes asynchronously on the given `queue` and returns a value or an
|
|
||||||
error used to resolve the promise.
|
|
||||||
@return A new pending promise that fulfills with the same value as the promise returned from `work`
|
|
||||||
block, or rejects with the same error after all retry attempts have been exhausted or if
|
|
||||||
the given condition is not met.
|
|
||||||
*/
|
|
||||||
+ (instancetype)onQueue:(dispatch_queue_t)queue
|
|
||||||
attempts:(NSInteger)count
|
|
||||||
delay:(NSTimeInterval)interval
|
|
||||||
condition:(nullable FBLPromiseRetryPredicateBlock)predicate
|
|
||||||
retry:(FBLPromiseRetryWorkBlock)work NS_REFINED_FOR_SWIFT;
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
||||||
/**
|
|
||||||
Convenience dot-syntax wrappers for `FBLPromise+Retry` operators.
|
|
||||||
Usage: FBLPromise.retry(^id { ... })
|
|
||||||
*/
|
|
||||||
@interface FBLPromise<Value>(DotSyntax_RetryAdditions)
|
|
||||||
|
|
||||||
+ (FBLPromise * (^)(FBLPromiseRetryWorkBlock))retry FBL_PROMISES_DOT_SYNTAX
|
|
||||||
NS_SWIFT_UNAVAILABLE("");
|
|
||||||
+ (FBLPromise * (^)(dispatch_queue_t, FBLPromiseRetryWorkBlock))retryOn FBL_PROMISES_DOT_SYNTAX
|
|
||||||
NS_SWIFT_UNAVAILABLE("");
|
|
||||||
+ (FBLPromise * (^)(NSInteger, NSTimeInterval, FBLPromiseRetryPredicateBlock __nullable,
|
|
||||||
FBLPromiseRetryWorkBlock))retryAgain FBL_PROMISES_DOT_SYNTAX
|
|
||||||
NS_SWIFT_UNAVAILABLE("");
|
|
||||||
+ (FBLPromise * (^)(dispatch_queue_t, NSInteger, NSTimeInterval,
|
|
||||||
FBLPromiseRetryPredicateBlock __nullable,
|
|
||||||
FBLPromiseRetryWorkBlock))retryAgainOn FBL_PROMISES_DOT_SYNTAX
|
|
||||||
NS_SWIFT_UNAVAILABLE("");
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_END
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 4834fad054d8d4e398ae4c75d3c00bd6
|
|
||||||
DefaultImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
@@ -1,57 +0,0 @@
|
|||||||
/**
|
|
||||||
Copyright 2018 Google Inc. All rights reserved.
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at:
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#import "FBLPromise.h"
|
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_BEGIN
|
|
||||||
|
|
||||||
/**
|
|
||||||
Waits for all scheduled promises blocks.
|
|
||||||
|
|
||||||
@param timeout Maximum time to wait.
|
|
||||||
@return YES if all promises blocks have completed before the timeout and NO otherwise.
|
|
||||||
*/
|
|
||||||
FOUNDATION_EXTERN BOOL FBLWaitForPromisesWithTimeout(NSTimeInterval timeout) NS_REFINED_FOR_SWIFT;
|
|
||||||
|
|
||||||
@interface FBLPromise<Value>(TestingAdditions)
|
|
||||||
|
|
||||||
/**
|
|
||||||
Dispatch group for promises that is typically used to wait for all scheduled blocks.
|
|
||||||
*/
|
|
||||||
@property(class, nonatomic, readonly) dispatch_group_t dispatchGroup NS_REFINED_FOR_SWIFT;
|
|
||||||
|
|
||||||
/**
|
|
||||||
Properties to get the current state of the promise.
|
|
||||||
*/
|
|
||||||
@property(nonatomic, readonly) BOOL isPending NS_REFINED_FOR_SWIFT;
|
|
||||||
@property(nonatomic, readonly) BOOL isFulfilled NS_REFINED_FOR_SWIFT;
|
|
||||||
@property(nonatomic, readonly) BOOL isRejected NS_REFINED_FOR_SWIFT;
|
|
||||||
|
|
||||||
/**
|
|
||||||
Value the promise was fulfilled with.
|
|
||||||
Can be nil if the promise is still pending, was resolved with nil or after it has been rejected.
|
|
||||||
*/
|
|
||||||
@property(nonatomic, readonly, nullable) Value value NS_REFINED_FOR_SWIFT;
|
|
||||||
|
|
||||||
/**
|
|
||||||
Error the promise was rejected with.
|
|
||||||
Can be nil if the promise is still pending or after it has been fulfilled.
|
|
||||||
*/
|
|
||||||
@property(nonatomic, readonly, nullable) NSError *error NS_REFINED_FOR_SWIFT;
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_END
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 09b748ad0acca4c008e0c06f0cf57f9e
|
|
||||||
DefaultImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
@@ -1,63 +0,0 @@
|
|||||||
/**
|
|
||||||
Copyright 2018 Google Inc. All rights reserved.
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at:
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#import "FBLPromise.h"
|
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_BEGIN
|
|
||||||
|
|
||||||
@interface FBLPromise<Value>(ThenAdditions)
|
|
||||||
|
|
||||||
typedef id __nullable (^FBLPromiseThenWorkBlock)(Value __nullable value) NS_SWIFT_UNAVAILABLE("");
|
|
||||||
|
|
||||||
/**
|
|
||||||
Creates a pending promise which eventually gets resolved with resolution returned from `work`
|
|
||||||
block: either value, error or another promise. The `work` block is executed asynchronously only
|
|
||||||
when the receiver is fulfilled. If receiver is rejected, the returned promise is also rejected with
|
|
||||||
the same error.
|
|
||||||
|
|
||||||
@param work A block to handle the value that receiver was fulfilled with.
|
|
||||||
@return A new pending promise to be resolved with resolution returned from the `work` block.
|
|
||||||
*/
|
|
||||||
- (FBLPromise *)then:(FBLPromiseThenWorkBlock)work NS_SWIFT_UNAVAILABLE("");
|
|
||||||
|
|
||||||
/**
|
|
||||||
Creates a pending promise which eventually gets resolved with resolution returned from `work`
|
|
||||||
block: either value, error or another promise. The `work` block is executed asynchronously when the
|
|
||||||
receiver is fulfilled. If receiver is rejected, the returned promise is also rejected with the same
|
|
||||||
error.
|
|
||||||
|
|
||||||
@param queue A queue to invoke the `work` block on.
|
|
||||||
@param work A block to handle the value that receiver was fulfilled with.
|
|
||||||
@return A new pending promise to be resolved with resolution returned from the `work` block.
|
|
||||||
*/
|
|
||||||
- (FBLPromise *)onQueue:(dispatch_queue_t)queue
|
|
||||||
then:(FBLPromiseThenWorkBlock)work NS_REFINED_FOR_SWIFT;
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
||||||
/**
|
|
||||||
Convenience dot-syntax wrappers for `FBLPromise` `then` operators.
|
|
||||||
Usage: promise.then(^id(id value) { ... })
|
|
||||||
*/
|
|
||||||
@interface FBLPromise<Value>(DotSyntax_ThenAdditions)
|
|
||||||
|
|
||||||
- (FBLPromise* (^)(FBLPromiseThenWorkBlock))then FBL_PROMISES_DOT_SYNTAX NS_SWIFT_UNAVAILABLE("");
|
|
||||||
- (FBLPromise* (^)(dispatch_queue_t, FBLPromiseThenWorkBlock))thenOn FBL_PROMISES_DOT_SYNTAX
|
|
||||||
NS_SWIFT_UNAVAILABLE("");
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_END
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user