From 4525f7b09c104df68de38c554312b480d90de945 Mon Sep 17 00:00:00 2001 From: Amir Hardon Date: Mon, 19 Nov 2018 16:30:39 -0800 Subject: [PATCH] Reconfigure Cirrus to use clang 7 (#905) clang-format 5.0 formats ObjC files differently than newer versions, which results in the CI failing the format check for PRs formatted locally with a recent clang version. The latest clang version available on the Ubuntu repositories for the Cirrus machines is 7, upgrading to that seems to be consistent with what I locally get with clang-format 8.0. This PR also reformats all files with the new clang style. --- .cirrus.yml | 6 +- .../ios/Classes/CloudFirestorePlugin.h | 2 +- .../ios/Classes/CloudFirestorePlugin.m | 33 ++++--- .../ios/Classes/CloudFunctionsPlugin.h | 2 +- .../ios/Classes/CloudFunctionsPlugin.m | 5 +- .../firebase_admob/ios/Classes/FLTMobileAd.h | 4 +- .../ios/Classes/FLTRequestFactory.m | 4 +- .../ios/Classes/FLTRewardedVideoAdWrapper.m | 2 +- .../ios/Classes/FirebaseAdMobPlugin.h | 5 +- .../ios/Classes/FirebaseAdMobPlugin.m | 7 +- .../ios/Classes/FirebaseAnalyticsPlugin.h | 2 +- .../ios/Classes/FirebaseAuthPlugin.h | 2 +- .../ios/Classes/FirebaseAuthPlugin.m | 97 ++++++++++--------- .../ios/Classes/FirebaseCorePlugin.h | 2 +- .../ios/Classes/FirebaseDatabasePlugin.h | 2 +- .../ios/Classes/FirebaseDatabasePlugin.m | 94 +++++++++--------- .../ios/Classes/FirebaseDynamicLinksPlugin.h | 2 +- .../ios/Classes/FirebaseDynamicLinksPlugin.m | 4 +- .../ios/Classes/FirebaseMessagingPlugin.h | 2 +- .../ios/Classes/FirebaseMessagingPlugin.m | 2 +- .../ios/Classes/FaceDetector.m | 40 ++++---- .../ios/Classes/FirebaseMlVisionPlugin.h | 12 +-- .../ios/Classes/TextRecognizer.m | 2 +- .../ios/Classes/FirebasePerformancePlugin.h | 2 +- .../ios/Classes/FirebaseRemoteConfigPlugin.h | 2 +- .../ios/Classes/FirebaseRemoteConfigPlugin.m | 5 +- .../ios/Classes/FirebaseStoragePlugin.h | 2 +- .../ios/Classes/FirebaseStoragePlugin.m | 2 +- 28 files changed, 177 insertions(+), 169 deletions(-) mode change 100755 => 100644 packages/firebase_analytics/ios/Classes/FirebaseAnalyticsPlugin.h diff --git a/.cirrus.yml b/.cirrus.yml index efab9e79143e..00beb3c37cf6 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -14,10 +14,10 @@ task: - name: test+format install_script: - wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add - - - sudo apt-add-repository "deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-5.0 main" + - sudo apt-add-repository "deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-7 main" - sudo apt-get update - - sudo apt-get install -y --allow-unauthenticated clang-format-5.0 - format_script: ./script/incremental_build.sh format --travis --clang-format=clang-format-5.0 + - sudo apt-get install -y --allow-unauthenticated clang-format-7 + format_script: ./script/incremental_build.sh format --travis --clang-format=clang-format-7 test_script: ./script/incremental_build.sh test - name: analyze script: ./script/incremental_build.sh analyze diff --git a/packages/cloud_firestore/ios/Classes/CloudFirestorePlugin.h b/packages/cloud_firestore/ios/Classes/CloudFirestorePlugin.h index 156faca7c01e..3a9035a10fd9 100644 --- a/packages/cloud_firestore/ios/Classes/CloudFirestorePlugin.h +++ b/packages/cloud_firestore/ios/Classes/CloudFirestorePlugin.h @@ -4,5 +4,5 @@ #import -@interface FLTCloudFirestorePlugin : NSObject +@interface FLTCloudFirestorePlugin : NSObject @end diff --git a/packages/cloud_firestore/ios/Classes/CloudFirestorePlugin.m b/packages/cloud_firestore/ios/Classes/CloudFirestorePlugin.m index e9fa73a40a1f..3d93972b5ddd 100644 --- a/packages/cloud_firestore/ios/Classes/CloudFirestorePlugin.m +++ b/packages/cloud_firestore/ios/Classes/CloudFirestorePlugin.m @@ -295,27 +295,28 @@ - (void)handleMethodCall:(FlutterMethodCall *)call result:(FlutterResult)result result(error.flutterError); }; if ([@"Firestore#runTransaction" isEqualToString:call.method]) { - [getFirestore(call.arguments) runTransactionWithBlock:^id(FIRTransaction *transaction, - NSError **pError) { - NSNumber *transactionId = call.arguments[@"transactionId"]; - NSNumber *transactionTimeout = call.arguments[@"transactionTimeout"]; + [getFirestore(call.arguments) + runTransactionWithBlock:^id(FIRTransaction *transaction, NSError **pError) { + NSNumber *transactionId = call.arguments[@"transactionId"]; + NSNumber *transactionTimeout = call.arguments[@"transactionTimeout"]; - self->transactions[transactionId] = transaction; + self->transactions[transactionId] = transaction; - dispatch_semaphore_t semaphore = dispatch_semaphore_create(0); + dispatch_semaphore_t semaphore = dispatch_semaphore_create(0); - [self.channel invokeMethod:@"DoTransaction" - arguments:call.arguments - result:^(id doTransactionResult) { - self->transactionResults[transactionId] = doTransactionResult; - dispatch_semaphore_signal(semaphore); - }]; + [self.channel invokeMethod:@"DoTransaction" + arguments:call.arguments + result:^(id doTransactionResult) { + self->transactionResults[transactionId] = doTransactionResult; + dispatch_semaphore_signal(semaphore); + }]; - dispatch_semaphore_wait( - semaphore, dispatch_time(DISPATCH_TIME_NOW, [transactionTimeout integerValue] * 1000000)); + dispatch_semaphore_wait( + semaphore, + dispatch_time(DISPATCH_TIME_NOW, [transactionTimeout integerValue] * 1000000)); - return self->transactionResults[transactionId]; - } + return self->transactionResults[transactionId]; + } completion:^(id transactionResult, NSError *error) { if (error != nil) { result([FlutterError errorWithCode:[NSString stringWithFormat:@"%ld", error.code] diff --git a/packages/cloud_functions/ios/Classes/CloudFunctionsPlugin.h b/packages/cloud_functions/ios/Classes/CloudFunctionsPlugin.h index efcd30337887..568c14a5a5ce 100644 --- a/packages/cloud_functions/ios/Classes/CloudFunctionsPlugin.h +++ b/packages/cloud_functions/ios/Classes/CloudFunctionsPlugin.h @@ -1,4 +1,4 @@ #import -@interface CloudFunctionsPlugin : NSObject +@interface CloudFunctionsPlugin : NSObject @end diff --git a/packages/cloud_functions/ios/Classes/CloudFunctionsPlugin.m b/packages/cloud_functions/ios/Classes/CloudFunctionsPlugin.m index fd04d7c71888..701c5efb3466 100644 --- a/packages/cloud_functions/ios/Classes/CloudFunctionsPlugin.m +++ b/packages/cloud_functions/ios/Classes/CloudFunctionsPlugin.m @@ -56,8 +56,9 @@ - (void)handleMethodCall:(FlutterMethodCall *)call result:(FlutterResult)result message:@"Firebase function failed with exception." details:details]; } else { - flutterError = - [FlutterError errorWithCode:nil message:error.localizedDescription details:nil]; + flutterError = [FlutterError errorWithCode:nil + message:error.localizedDescription + details:nil]; } result(flutterError); } else { diff --git a/packages/firebase_admob/ios/Classes/FLTMobileAd.h b/packages/firebase_admob/ios/Classes/FLTMobileAd.h index f62069b70fb1..24d23e04ed7a 100644 --- a/packages/firebase_admob/ios/Classes/FLTMobileAd.h +++ b/packages/firebase_admob/ios/Classes/FLTMobileAd.h @@ -23,12 +23,12 @@ typedef enum : NSUInteger { - (void)dispose; @end -@interface FLTBannerAd : FLTMobileAd +@interface FLTBannerAd : FLTMobileAd + (instancetype)withId:(NSNumber *)mobileAdId adSize:(GADAdSize)adSize channel:(FlutterMethodChannel *)channel; @end -@interface FLTInterstitialAd : FLTMobileAd +@interface FLTInterstitialAd : FLTMobileAd + (instancetype)withId:(NSNumber *)mobileAdId channel:(FlutterMethodChannel *)channel; @end diff --git a/packages/firebase_admob/ios/Classes/FLTRequestFactory.m b/packages/firebase_admob/ios/Classes/FLTRequestFactory.m index d72ec0a5cbaa..1b2e7f8e29e1 100644 --- a/packages/firebase_admob/ios/Classes/FLTRequestFactory.m +++ b/packages/firebase_admob/ios/Classes/FLTRequestFactory.m @@ -121,8 +121,8 @@ - (GADRequest *)createRequest { request.requestAgent = requestAgent; } - NSNumber *nonPersonalizedAds = - [self targetingInfoBoolForKey:@"nonPersonalizedAds" info:_targetingInfo]; + NSNumber *nonPersonalizedAds = [self targetingInfoBoolForKey:@"nonPersonalizedAds" + info:_targetingInfo]; if (nonPersonalizedAds != nil && [nonPersonalizedAds boolValue]) { GADExtras *extras = [[GADExtras alloc] init]; extras.additionalParameters = @{@"npa" : @"1"}; diff --git a/packages/firebase_admob/ios/Classes/FLTRewardedVideoAdWrapper.m b/packages/firebase_admob/ios/Classes/FLTRewardedVideoAdWrapper.m index b2f1a11149c3..c05345eb92af 100644 --- a/packages/firebase_admob/ios/Classes/FLTRewardedVideoAdWrapper.m +++ b/packages/firebase_admob/ios/Classes/FLTRewardedVideoAdWrapper.m @@ -8,7 +8,7 @@ static NSDictionary *rewardedStatusToString = nil; -@interface FLTRewardedVideoAdWrapper () +@interface FLTRewardedVideoAdWrapper () @end @implementation FLTRewardedVideoAdWrapper diff --git a/packages/firebase_admob/ios/Classes/FirebaseAdMobPlugin.h b/packages/firebase_admob/ios/Classes/FirebaseAdMobPlugin.h index 6b67219f34e4..e09cedc6bbcb 100644 --- a/packages/firebase_admob/ios/Classes/FirebaseAdMobPlugin.h +++ b/packages/firebase_admob/ios/Classes/FirebaseAdMobPlugin.h @@ -4,8 +4,7 @@ #import -#define FLTLogWarning(format, ...) \ - NSLog((@"FirebaseAdMobPlugin " format), ##__VA_ARGS__) +#define FLTLogWarning(format, ...) NSLog((@"FirebaseAdMobPlugin " format), ##__VA_ARGS__) -@interface FLTFirebaseAdMobPlugin : NSObject +@interface FLTFirebaseAdMobPlugin : NSObject @end diff --git a/packages/firebase_admob/ios/Classes/FirebaseAdMobPlugin.m b/packages/firebase_admob/ios/Classes/FirebaseAdMobPlugin.m index 7ea2ebdcba22..999ae420c4fb 100644 --- a/packages/firebase_admob/ios/Classes/FirebaseAdMobPlugin.m +++ b/packages/firebase_admob/ios/Classes/FirebaseAdMobPlugin.m @@ -271,10 +271,9 @@ - (void)handleMethodCall:(FlutterMethodCall *)call result:(FlutterResult)result NSNumber *mobileAdId = (NSNumber *)call.arguments[@"id"]; if (mobileAdId == nil) { - NSString *message = - @"FirebaseAdMobPlugin method calls for banners and " - @"interstitials must specify an " - @"integer mobile ad id"; + NSString *message = @"FirebaseAdMobPlugin method calls for banners and " + @"interstitials must specify an " + @"integer mobile ad id"; result([FlutterError errorWithCode:@"no_id" message:message details:nil]); return; } diff --git a/packages/firebase_analytics/ios/Classes/FirebaseAnalyticsPlugin.h b/packages/firebase_analytics/ios/Classes/FirebaseAnalyticsPlugin.h old mode 100755 new mode 100644 index 00fb731c36b2..0ddf1f57a7de --- a/packages/firebase_analytics/ios/Classes/FirebaseAnalyticsPlugin.h +++ b/packages/firebase_analytics/ios/Classes/FirebaseAnalyticsPlugin.h @@ -4,5 +4,5 @@ #import -@interface FLTFirebaseAnalyticsPlugin : NSObject +@interface FLTFirebaseAnalyticsPlugin : NSObject @end diff --git a/packages/firebase_auth/ios/Classes/FirebaseAuthPlugin.h b/packages/firebase_auth/ios/Classes/FirebaseAuthPlugin.h index 7d1a3e38ddf7..1383a169fa81 100644 --- a/packages/firebase_auth/ios/Classes/FirebaseAuthPlugin.h +++ b/packages/firebase_auth/ios/Classes/FirebaseAuthPlugin.h @@ -4,5 +4,5 @@ #import -@interface FLTFirebaseAuthPlugin : NSObject +@interface FLTFirebaseAuthPlugin : NSObject @end diff --git a/packages/firebase_auth/ios/Classes/FirebaseAuthPlugin.m b/packages/firebase_auth/ios/Classes/FirebaseAuthPlugin.m index af07425d06ac..0ae2d2307269 100644 --- a/packages/firebase_auth/ios/Classes/FirebaseAuthPlugin.m +++ b/packages/firebase_auth/ios/Classes/FirebaseAuthPlugin.m @@ -79,8 +79,8 @@ - (void)handleMethodCall:(FlutterMethodCall *)call result:(FlutterResult)result } else if ([@"signInWithGoogle" isEqualToString:call.method]) { NSString *idToken = call.arguments[@"idToken"]; NSString *accessToken = call.arguments[@"accessToken"]; - FIRAuthCredential *credential = - [FIRGoogleAuthProvider credentialWithIDToken:idToken accessToken:accessToken]; + FIRAuthCredential *credential = [FIRGoogleAuthProvider credentialWithIDToken:idToken + accessToken:accessToken]; [[self getAuth:call.arguments] signInWithCredential:credential completion:^(FIRUser *user, NSError *error) { [self sendResult:result forUser:user error:error]; @@ -95,8 +95,8 @@ - (void)handleMethodCall:(FlutterMethodCall *)call result:(FlutterResult)result } else if ([@"signInWithTwitter" isEqualToString:call.method]) { NSString *authToken = call.arguments[@"authToken"]; NSString *authTokenSecret = call.arguments[@"authTokenSecret"]; - FIRAuthCredential *credential = - [FIRTwitterAuthProvider credentialWithToken:authToken secret:authTokenSecret]; + FIRAuthCredential *credential = [FIRTwitterAuthProvider credentialWithToken:authToken + secret:authTokenSecret]; [[self getAuth:call.arguments] signInWithCredential:credential completion:^(FIRUser *user, NSError *error) { [self sendResult:result forUser:user error:error]; @@ -139,11 +139,12 @@ - (void)handleMethodCall:(FlutterMethodCall *)call result:(FlutterResult)result }]; } else if ([@"sendPasswordResetEmail" isEqualToString:call.method]) { NSString *email = call.arguments[@"email"]; - [[self getAuth:call.arguments] - sendPasswordResetWithEmail:email - completion:^(NSError *error) { - [self sendResult:result forUser:nil error:error]; - }]; + [[self getAuth:call.arguments] sendPasswordResetWithEmail:email + completion:^(NSError *error) { + [self sendResult:result + forUser:nil + error:error]; + }]; } else if ([@"signInWithEmailAndPassword" isEqualToString:call.method]) { NSString *email = call.arguments[@"email"]; NSString *password = call.arguments[@"password"]; @@ -171,49 +172,54 @@ - (void)handleMethodCall:(FlutterMethodCall *)call result:(FlutterResult)result } else if ([@"linkWithEmailAndPassword" isEqualToString:call.method]) { NSString *email = call.arguments[@"email"]; NSString *password = call.arguments[@"password"]; - FIRAuthCredential *credential = - [FIREmailAuthProvider credentialWithEmail:email password:password]; - [[self getAuth:call.arguments].currentUser - linkWithCredential:credential - completion:^(FIRUser *user, NSError *error) { - [self sendResult:result forUser:user error:error]; - }]; + FIRAuthCredential *credential = [FIREmailAuthProvider credentialWithEmail:email + password:password]; + [[self getAuth:call.arguments].currentUser linkWithCredential:credential + completion:^(FIRUser *user, NSError *error) { + [self sendResult:result + forUser:user + error:error]; + }]; } else if ([@"linkWithGoogleCredential" isEqualToString:call.method]) { NSString *idToken = call.arguments[@"idToken"]; NSString *accessToken = call.arguments[@"accessToken"]; - FIRAuthCredential *credential = - [FIRGoogleAuthProvider credentialWithIDToken:idToken accessToken:accessToken]; - [[self getAuth:call.arguments].currentUser - linkWithCredential:credential - completion:^(FIRUser *user, NSError *error) { - [self sendResult:result forUser:user error:error]; - }]; + FIRAuthCredential *credential = [FIRGoogleAuthProvider credentialWithIDToken:idToken + accessToken:accessToken]; + [[self getAuth:call.arguments].currentUser linkWithCredential:credential + completion:^(FIRUser *user, NSError *error) { + [self sendResult:result + forUser:user + error:error]; + }]; } else if ([@"linkWithFacebookCredential" isEqualToString:call.method]) { NSString *accessToken = call.arguments[@"accessToken"]; FIRAuthCredential *credential = [FIRFacebookAuthProvider credentialWithAccessToken:accessToken]; - [[self getAuth:call.arguments].currentUser - linkWithCredential:credential - completion:^(FIRUser *user, NSError *error) { - [self sendResult:result forUser:user error:error]; - }]; + [[self getAuth:call.arguments].currentUser linkWithCredential:credential + completion:^(FIRUser *user, NSError *error) { + [self sendResult:result + forUser:user + error:error]; + }]; } else if ([@"linkWithTwitterCredential" isEqualToString:call.method]) { NSString *authToken = call.arguments[@"authToken"]; NSString *authTokenSecret = call.arguments[@"authTokenSecret"]; - FIRAuthCredential *credential = - [FIRTwitterAuthProvider credentialWithToken:authToken secret:authTokenSecret]; - [[self getAuth:call.arguments].currentUser - linkWithCredential:credential - completion:^(FIRUser *user, NSError *error) { - [self sendResult:result forUser:user error:error]; - }]; + FIRAuthCredential *credential = [FIRTwitterAuthProvider credentialWithToken:authToken + secret:authTokenSecret]; + [[self getAuth:call.arguments].currentUser linkWithCredential:credential + completion:^(FIRUser *user, NSError *error) { + [self sendResult:result + forUser:user + error:error]; + }]; } else if ([@"linkWithGithubCredential" isEqualToString:call.method]) { NSString *token = call.arguments[@"token"]; FIRAuthCredential *credential = [FIRGitHubAuthProvider credentialWithToken:token]; - [[self getAuth:call.arguments].currentUser - linkWithCredential:credential - completion:^(FIRUser *user, NSError *error) { - [self sendResult:result forUser:user error:error]; - }]; + [[self getAuth:call.arguments].currentUser linkWithCredential:credential + completion:^(FIRUser *user, NSError *error) { + [self sendResult:result + forUser:user + error:error]; + }]; } else if ([@"updateEmail" isEqualToString:call.method]) { NSString *email = call.arguments[@"email"]; [[self getAuth:call.arguments].currentUser updateEmail:email @@ -222,11 +228,12 @@ - (void)handleMethodCall:(FlutterMethodCall *)call result:(FlutterResult)result }]; } else if ([@"updatePassword" isEqualToString:call.method]) { NSString *password = call.arguments[@"password"]; - [[self getAuth:call.arguments].currentUser - updatePassword:password - completion:^(NSError *error) { - [self sendResult:result forUser:nil error:error]; - }]; + [[self getAuth:call.arguments].currentUser updatePassword:password + completion:^(NSError *error) { + [self sendResult:result + forUser:nil + error:error]; + }]; } else if ([@"updateProfile" isEqualToString:call.method]) { FIRUserProfileChangeRequest *changeRequest = [[self getAuth:call.arguments].currentUser profileChangeRequest]; diff --git a/packages/firebase_core/ios/Classes/FirebaseCorePlugin.h b/packages/firebase_core/ios/Classes/FirebaseCorePlugin.h index f3ca94f5e6d4..42a71d29f641 100644 --- a/packages/firebase_core/ios/Classes/FirebaseCorePlugin.h +++ b/packages/firebase_core/ios/Classes/FirebaseCorePlugin.h @@ -4,5 +4,5 @@ #import -@interface FLTFirebaseCorePlugin : NSObject +@interface FLTFirebaseCorePlugin : NSObject @end diff --git a/packages/firebase_database/ios/Classes/FirebaseDatabasePlugin.h b/packages/firebase_database/ios/Classes/FirebaseDatabasePlugin.h index dd817362bcf5..adc9034e88f2 100644 --- a/packages/firebase_database/ios/Classes/FirebaseDatabasePlugin.h +++ b/packages/firebase_database/ios/Classes/FirebaseDatabasePlugin.h @@ -4,7 +4,7 @@ #import -@interface FLTFirebaseDatabasePlugin : NSObject +@interface FLTFirebaseDatabasePlugin : NSObject @property(nonatomic) NSMutableDictionary *updatedSnapshots; diff --git a/packages/firebase_database/ios/Classes/FirebaseDatabasePlugin.m b/packages/firebase_database/ios/Classes/FirebaseDatabasePlugin.m index 7f7710f47f8c..98df29c8de51 100644 --- a/packages/firebase_database/ios/Classes/FirebaseDatabasePlugin.m +++ b/packages/firebase_database/ios/Classes/FirebaseDatabasePlugin.m @@ -221,58 +221,60 @@ - (void)handleMethodCall:(FlutterMethodCall *)call result:(FlutterResult)result [getReference(database, call.arguments) setPriority:call.arguments[@"priority"] withCompletionBlock:defaultCompletionBlock]; } else if ([@"DatabaseReference#runTransaction" isEqualToString:call.method]) { - [getReference(database, call.arguments) runTransactionBlock:^FIRTransactionResult *_Nonnull( - FIRMutableData *_Nonnull currentData) { - // Create semaphore to allow native side to wait while snapshot - // updates occur on the Dart side. - dispatch_semaphore_t semaphore = dispatch_semaphore_create(0); + [getReference(database, call.arguments) + runTransactionBlock:^FIRTransactionResult *_Nonnull(FIRMutableData *_Nonnull currentData) { + // Create semaphore to allow native side to wait while snapshot + // updates occur on the Dart side. + dispatch_semaphore_t semaphore = dispatch_semaphore_create(0); - NSObject *snapshot = - @{@"key" : currentData.key ?: [NSNull null], @"value" : currentData.value}; + NSObject *snapshot = + @{@"key" : currentData.key ?: [NSNull null], @"value" : currentData.value}; - __block bool shouldAbort = false; + __block bool shouldAbort = false; - [self.channel invokeMethod:@"DoTransaction" - arguments:@{ - @"transactionKey" : call.arguments[@"transactionKey"], - @"snapshot" : snapshot - } - result:^(id _Nullable result) { - if ([result isKindOfClass:[FlutterError class]]) { - FlutterError *flutterError = ((FlutterError *)result); - NSLog(@"Error code: %@", flutterError.code); - NSLog(@"Error message: %@", flutterError.message); - NSLog(@"Error details: %@", flutterError.details); - shouldAbort = true; - } else if ([result isEqual:FlutterMethodNotImplemented]) { - NSLog(@"DoTransaction not implemented on the Dart side."); - shouldAbort = true; - } else { - [self.updatedSnapshots setObject:result - forKey:call.arguments[@"transactionKey"]]; - } - dispatch_semaphore_signal(semaphore); - }]; + [self.channel invokeMethod:@"DoTransaction" + arguments:@{ + @"transactionKey" : call.arguments[@"transactionKey"], + @"snapshot" : snapshot + } + result:^(id _Nullable result) { + if ([result isKindOfClass:[FlutterError class]]) { + FlutterError *flutterError = ((FlutterError *)result); + NSLog(@"Error code: %@", flutterError.code); + NSLog(@"Error message: %@", flutterError.message); + NSLog(@"Error details: %@", flutterError.details); + shouldAbort = true; + } else if ([result isEqual:FlutterMethodNotImplemented]) { + NSLog(@"DoTransaction not implemented on the Dart side."); + shouldAbort = true; + } else { + [self.updatedSnapshots + setObject:result + forKey:call.arguments[@"transactionKey"]]; + } + dispatch_semaphore_signal(semaphore); + }]; - // Wait while Dart side updates the snapshot. Incoming transactionTimeout is in milliseconds - // so converting to nanoseconds for use with dispatch_semaphore_wait. - long result = dispatch_semaphore_wait( - semaphore, dispatch_time(DISPATCH_TIME_NOW, - [call.arguments[@"transactionTimeout"] integerValue] * 1000000)); + // Wait while Dart side updates the snapshot. Incoming transactionTimeout is in + // milliseconds so converting to nanoseconds for use with dispatch_semaphore_wait. + long result = dispatch_semaphore_wait( + semaphore, + dispatch_time(DISPATCH_TIME_NOW, + [call.arguments[@"transactionTimeout"] integerValue] * 1000000)); - if (result == 0 && !shouldAbort) { - // Set FIRMutableData value to value returned from the Dart side. - currentData.value = - [self.updatedSnapshots objectForKey:call.arguments[@"transactionKey"]][@"value"]; - } else { - if (result != 0) { - NSLog(@"Transaction at %@ timed out.", [getReference(database, call.arguments) URL]); - } - return [FIRTransactionResult abort]; - } + if (result == 0 && !shouldAbort) { + // Set FIRMutableData value to value returned from the Dart side. + currentData.value = + [self.updatedSnapshots objectForKey:call.arguments[@"transactionKey"]][@"value"]; + } else { + if (result != 0) { + NSLog(@"Transaction at %@ timed out.", [getReference(database, call.arguments) URL]); + } + return [FIRTransactionResult abort]; + } - return [FIRTransactionResult successWithValue:currentData]; - } + return [FIRTransactionResult successWithValue:currentData]; + } andCompletionBlock:^(NSError *_Nullable error, BOOL committed, FIRDataSnapshot *_Nullable snapshot) { // Invoke transaction completion on the Dart side. diff --git a/packages/firebase_dynamic_links/ios/Classes/FirebaseDynamicLinksPlugin.h b/packages/firebase_dynamic_links/ios/Classes/FirebaseDynamicLinksPlugin.h index 1129b9aa3883..25f4c1d8b8ca 100644 --- a/packages/firebase_dynamic_links/ios/Classes/FirebaseDynamicLinksPlugin.h +++ b/packages/firebase_dynamic_links/ios/Classes/FirebaseDynamicLinksPlugin.h @@ -1,4 +1,4 @@ #import -@interface FLTFirebaseDynamicLinksPlugin : NSObject +@interface FLTFirebaseDynamicLinksPlugin : NSObject @end diff --git a/packages/firebase_dynamic_links/ios/Classes/FirebaseDynamicLinksPlugin.m b/packages/firebase_dynamic_links/ios/Classes/FirebaseDynamicLinksPlugin.m index 43f49972348d..4169e790b58e 100644 --- a/packages/firebase_dynamic_links/ios/Classes/FirebaseDynamicLinksPlugin.m +++ b/packages/firebase_dynamic_links/ios/Classes/FirebaseDynamicLinksPlugin.m @@ -147,8 +147,8 @@ - (FIRDynamicLinkComponents *)setupParameters:(NSDictionary *)arguments { NSURL *link = [NSURL URLWithString:arguments[@"link"]]; NSString *domain = arguments[@"domain"]; - FIRDynamicLinkComponents *components = - [FIRDynamicLinkComponents componentsWithLink:link domain:domain]; + FIRDynamicLinkComponents *components = [FIRDynamicLinkComponents componentsWithLink:link + domain:domain]; if (![arguments[@"androidParameters"] isEqual:[NSNull null]]) { NSDictionary *params = arguments[@"androidParameters"]; diff --git a/packages/firebase_messaging/ios/Classes/FirebaseMessagingPlugin.h b/packages/firebase_messaging/ios/Classes/FirebaseMessagingPlugin.h index 93d1bdd927db..492be15a4ea6 100644 --- a/packages/firebase_messaging/ios/Classes/FirebaseMessagingPlugin.h +++ b/packages/firebase_messaging/ios/Classes/FirebaseMessagingPlugin.h @@ -4,5 +4,5 @@ #import -@interface FLTFirebaseMessagingPlugin : NSObject +@interface FLTFirebaseMessagingPlugin : NSObject @end diff --git a/packages/firebase_messaging/ios/Classes/FirebaseMessagingPlugin.m b/packages/firebase_messaging/ios/Classes/FirebaseMessagingPlugin.m index 60addf3870c6..fa50efc5579d 100644 --- a/packages/firebase_messaging/ios/Classes/FirebaseMessagingPlugin.m +++ b/packages/firebase_messaging/ios/Classes/FirebaseMessagingPlugin.m @@ -7,7 +7,7 @@ #import "Firebase/Firebase.h" #if defined(__IPHONE_10_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_10_0 -@interface FLTFirebaseMessagingPlugin () +@interface FLTFirebaseMessagingPlugin () @end #endif diff --git a/packages/firebase_ml_vision/ios/Classes/FaceDetector.m b/packages/firebase_ml_vision/ios/Classes/FaceDetector.m index ed8ab7f0e5c9..602aaddf606e 100644 --- a/packages/firebase_ml_vision/ios/Classes/FaceDetector.m +++ b/packages/firebase_ml_vision/ios/Classes/FaceDetector.m @@ -42,26 +42,26 @@ + (void)handleDetection:(FIRVisionImage *)image @"rightEyeOpenProbability" : rightProb, @"trackingId" : face.hasTrackingID ? @(face.trackingID) : [NSNull null], @"landmarks" : @{ - @"bottomMouth" : - [FaceDetector getLandmarkPosition:face landmark:FIRFaceLandmarkTypeMouthBottom], - @"leftCheek" : - [FaceDetector getLandmarkPosition:face landmark:FIRFaceLandmarkTypeLeftCheek], - @"leftEar" : - [FaceDetector getLandmarkPosition:face landmark:FIRFaceLandmarkTypeLeftEar], - @"leftEye" : - [FaceDetector getLandmarkPosition:face landmark:FIRFaceLandmarkTypeLeftEye], - @"leftMouth" : - [FaceDetector getLandmarkPosition:face landmark:FIRFaceLandmarkTypeMouthLeft], - @"noseBase" : - [FaceDetector getLandmarkPosition:face landmark:FIRFaceLandmarkTypeNoseBase], - @"rightCheek" : - [FaceDetector getLandmarkPosition:face landmark:FIRFaceLandmarkTypeRightCheek], - @"rightEar" : - [FaceDetector getLandmarkPosition:face landmark:FIRFaceLandmarkTypeRightEar], - @"rightEye" : - [FaceDetector getLandmarkPosition:face landmark:FIRFaceLandmarkTypeRightEye], - @"rightMouth" : - [FaceDetector getLandmarkPosition:face landmark:FIRFaceLandmarkTypeMouthRight], + @"bottomMouth" : [FaceDetector getLandmarkPosition:face + landmark:FIRFaceLandmarkTypeMouthBottom], + @"leftCheek" : [FaceDetector getLandmarkPosition:face + landmark:FIRFaceLandmarkTypeLeftCheek], + @"leftEar" : [FaceDetector getLandmarkPosition:face + landmark:FIRFaceLandmarkTypeLeftEar], + @"leftEye" : [FaceDetector getLandmarkPosition:face + landmark:FIRFaceLandmarkTypeLeftEye], + @"leftMouth" : [FaceDetector getLandmarkPosition:face + landmark:FIRFaceLandmarkTypeMouthLeft], + @"noseBase" : [FaceDetector getLandmarkPosition:face + landmark:FIRFaceLandmarkTypeNoseBase], + @"rightCheek" : [FaceDetector getLandmarkPosition:face + landmark:FIRFaceLandmarkTypeRightCheek], + @"rightEar" : [FaceDetector getLandmarkPosition:face + landmark:FIRFaceLandmarkTypeRightEar], + @"rightEye" : [FaceDetector getLandmarkPosition:face + landmark:FIRFaceLandmarkTypeRightEye], + @"rightMouth" : [FaceDetector getLandmarkPosition:face + landmark:FIRFaceLandmarkTypeMouthRight], }, }; diff --git a/packages/firebase_ml_vision/ios/Classes/FirebaseMlVisionPlugin.h b/packages/firebase_ml_vision/ios/Classes/FirebaseMlVisionPlugin.h index 62979d0c2ed3..9a620dc45cfa 100644 --- a/packages/firebase_ml_vision/ios/Classes/FirebaseMlVisionPlugin.h +++ b/packages/firebase_ml_vision/ios/Classes/FirebaseMlVisionPlugin.h @@ -2,7 +2,7 @@ #import "Firebase/Firebase.h" -@interface FLTFirebaseMlVisionPlugin : NSObject +@interface FLTFirebaseMlVisionPlugin : NSObject + (void)handleError:(NSError *)error result:(FlutterResult)result; @end @@ -14,17 +14,17 @@ @optional @end -@interface BarcodeDetector : NSObject +@interface BarcodeDetector : NSObject @end -@interface FaceDetector : NSObject +@interface FaceDetector : NSObject @end -@interface LabelDetector : NSObject +@interface LabelDetector : NSObject @end -@interface CloudLabelDetector : NSObject +@interface CloudLabelDetector : NSObject @end -@interface TextRecognizer : NSObject +@interface TextRecognizer : NSObject @end diff --git a/packages/firebase_ml_vision/ios/Classes/TextRecognizer.m b/packages/firebase_ml_vision/ios/Classes/TextRecognizer.m index cadaa47c86e3..9b0f5567db06 100644 --- a/packages/firebase_ml_vision/ios/Classes/TextRecognizer.m +++ b/packages/firebase_ml_vision/ios/Classes/TextRecognizer.m @@ -15,7 +15,7 @@ + (void)handleDetection:(FIRVisionImage *)image [FLTFirebaseMlVisionPlugin handleError:error result:result]; return; } else if (!visionText) { - result(@{ @"text" : @"", @"blocks" : @[] }); + result(@{@"text" : @"", @"blocks" : @[]}); return; } diff --git a/packages/firebase_performance/ios/Classes/FirebasePerformancePlugin.h b/packages/firebase_performance/ios/Classes/FirebasePerformancePlugin.h index 7d3fe9130f82..d71c5351ac8d 100644 --- a/packages/firebase_performance/ios/Classes/FirebasePerformancePlugin.h +++ b/packages/firebase_performance/ios/Classes/FirebasePerformancePlugin.h @@ -1,4 +1,4 @@ #import -@interface FLTFirebasePerformancePlugin : NSObject +@interface FLTFirebasePerformancePlugin : NSObject @end diff --git a/packages/firebase_remote_config/ios/Classes/FirebaseRemoteConfigPlugin.h b/packages/firebase_remote_config/ios/Classes/FirebaseRemoteConfigPlugin.h index 43a2ff648fba..429a11c5addc 100644 --- a/packages/firebase_remote_config/ios/Classes/FirebaseRemoteConfigPlugin.h +++ b/packages/firebase_remote_config/ios/Classes/FirebaseRemoteConfigPlugin.h @@ -1,4 +1,4 @@ #import -@interface FirebaseRemoteConfigPlugin : NSObject +@interface FirebaseRemoteConfigPlugin : NSObject @end diff --git a/packages/firebase_remote_config/ios/Classes/FirebaseRemoteConfigPlugin.m b/packages/firebase_remote_config/ios/Classes/FirebaseRemoteConfigPlugin.m index a01d2c23495a..06091fab0575 100644 --- a/packages/firebase_remote_config/ios/Classes/FirebaseRemoteConfigPlugin.m +++ b/packages/firebase_remote_config/ios/Classes/FirebaseRemoteConfigPlugin.m @@ -81,9 +81,8 @@ - (void)handleMethodCall:(FlutterMethodCall *)call result:(FlutterResult)result message:errorMessage details:resultDict]; } else { - NSString *errorMessage = - @"Unable to complete fetch. Reason is unknown " - "but this could be due to lack of connectivity."; + NSString *errorMessage = @"Unable to complete fetch. Reason is unknown " + "but this could be due to lack of connectivity."; flutterError = [FlutterError errorWithCode:@"fetchFailed" message:errorMessage details:resultDict]; diff --git a/packages/firebase_storage/ios/Classes/FirebaseStoragePlugin.h b/packages/firebase_storage/ios/Classes/FirebaseStoragePlugin.h index 278fccd79781..4c7a7df05b13 100644 --- a/packages/firebase_storage/ios/Classes/FirebaseStoragePlugin.h +++ b/packages/firebase_storage/ios/Classes/FirebaseStoragePlugin.h @@ -4,5 +4,5 @@ #import -@interface FLTFirebaseStoragePlugin : NSObject +@interface FLTFirebaseStoragePlugin : NSObject @end diff --git a/packages/firebase_storage/ios/Classes/FirebaseStoragePlugin.m b/packages/firebase_storage/ios/Classes/FirebaseStoragePlugin.m index 0196ce4f44fc..8ab7620550a7 100644 --- a/packages/firebase_storage/ios/Classes/FirebaseStoragePlugin.m +++ b/packages/firebase_storage/ios/Classes/FirebaseStoragePlugin.m @@ -391,7 +391,7 @@ - (void)getDownloadUrl:(FlutterMethodCall *)call result:(FlutterResult)result { }]; } -- (void) delete:(FlutterMethodCall *)call result:(FlutterResult)result { +- (void)delete:(FlutterMethodCall *)call result:(FlutterResult)result { NSString *path = call.arguments[@"path"]; FIRStorageReference *ref = [storage.reference child:path]; [ref deleteWithCompletion:^(NSError *error) {