Skip to content

Commit 130d76a

Browse files
authored
[App Distribution] Remove typedefs (#6281)
Stop using typedefs for completion blocks in public APIs so that Xcode is more usable in Swift:
1 parent f33276f commit 130d76a

File tree

3 files changed

+8
-18
lines changed

3 files changed

+8
-18
lines changed

FirebaseAppDistribution/Sources/FIRAppDistribution.m

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,8 @@ - (NSError *_Nullable)mapFetchReleasesError:(NSError *)error {
247247
message:@"Failed to fetch releases for unknown reason."];
248248
}
249249

250-
- (void)fetchNewLatestRelease:(FIRAppDistributionUpdateCheckCompletion)completion {
250+
- (void)fetchNewLatestRelease:(void (^)(FIRAppDistributionRelease *_Nullable release,
251+
NSError *_Nullable error))completion {
251252
[FIRFADApiService
252253
fetchReleasesWithCompletion:^(NSArray *_Nullable releases, NSError *_Nullable error) {
253254
if (error) {
@@ -283,7 +284,8 @@ - (void)fetchNewLatestRelease:(FIRAppDistributionUpdateCheckCompletion)completio
283284
}];
284285
}
285286

286-
- (void)checkForUpdateWithCompletion:(FIRAppDistributionUpdateCheckCompletion)completion {
287+
- (void)checkForUpdateWithCompletion:(void (^)(FIRAppDistributionRelease *_Nullable release,
288+
NSError *_Nullable error))completion {
287289
FIRFADInfoLog(@"CheckForUpdateWithCompletion");
288290
if ([self isTesterSignedIn]) {
289291
[self fetchNewLatestRelease:completion];

FirebaseAppDistribution/Sources/Public/FIRAppDistribution.h

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -17,20 +17,6 @@
1717

1818
NS_ASSUME_NONNULL_BEGIN
1919

20-
/**
21-
* @related AppDistributionError
22-
*
23-
* The completion handler invoked when the new build request returns.
24-
* If the call fails we return the appropriate `error code`, described by
25-
* `AppDistributionError`.
26-
*
27-
* @param release The new release that is available to be installed.
28-
* @param error The error describing why the new build request failed.
29-
*/
30-
typedef void (^FIRAppDistributionUpdateCheckCompletion)(
31-
FIRAppDistributionRelease *_Nullable release, NSError *_Nullable error)
32-
NS_SWIFT_NAME(AppDistributionUpdateCheckCompletion);
33-
3420
/**
3521
* The Firebase App Distribution API provides methods to check for update to
3622
* the app and returns information that enables updating the app.
@@ -58,7 +44,8 @@ NS_SWIFT_NAME(AppDistribution)
5844
/**
5945
* Check to see whether a new distribution is available
6046
*/
61-
- (void)checkForUpdateWithCompletion:(FIRAppDistributionUpdateCheckCompletion)completion
47+
- (void)checkForUpdateWithCompletion:
48+
(void (^)(FIRAppDistributionRelease *_Nullable release, NSError *_Nullable error))completion
6249
NS_SWIFT_NAME(checkForUpdate(completion:));
6350

6451
/**

FirebaseAppDistribution/Tests/Unit/FIRAppDistributionTests.m

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ @interface FIRAppDistribution (PrivateUnitTesting)
3535

3636
- (instancetype)initWithApp:(FIRApp *)app appInfo:(NSDictionary *)appInfo;
3737

38-
- (void)fetchNewLatestRelease:(FIRAppDistributionUpdateCheckCompletion)completion;
38+
- (void)fetchNewLatestRelease:(void (^)(FIRAppDistributionRelease *_Nullable release,
39+
NSError *_Nullable error))completion;
3940

4041
- (NSError *)mapFetchReleasesError:(NSError *)error;
4142

0 commit comments

Comments
 (0)