Bläddra i källkod

Add clang-format options and script; apply to FirebaseCore (#151)

Paul Beusterien 8 år sedan
förälder
incheckning
0abd344434
37 ändrade filer med 361 tillägg och 363 borttagningar
  1. 7 0
      .clang-format
  2. 1 1
      Example/Core/App/iOS/FIRAppDelegate.h
  3. 25 22
      Example/Core/App/iOS/FIRAppDelegate.m
  4. 6 8
      Example/Core/App/iOS/FIRViewController.m
  5. 4 5
      Example/Core/App/iOS/main.m
  6. 0 2
      Example/Core/App/macOS/FIRAppDelegate.h
  7. 2 4
      Example/Core/App/macOS/FIRAppDelegate.m
  8. 0 2
      Example/Core/App/macOS/FIRViewController.h
  9. 4 6
      Example/Core/App/macOS/FIRViewController.m
  10. 1 3
      Example/Core/App/macOS/main.m
  11. 36 34
      Example/Core/Tests/FIRAppAssociationRegistrationUnitTests.m
  12. 65 66
      Example/Core/Tests/FIRAppTest.m
  13. 11 13
      Example/Core/Tests/FIRBundleUtilTest.m
  14. 5 8
      Example/Core/Tests/FIRLoggerTest.m
  15. 17 18
      Example/Core/Tests/FIROptionsTest.m
  16. 2 2
      Example/Shared/FIRSampleAppUtilities.h
  17. 14 13
      Example/Shared/FIRSampleAppUtilities.m
  18. 1 1
      Firebase/Core/FIRAnalyticsConfiguration.m
  19. 38 41
      Firebase/Core/FIRApp.m
  20. 0 1
      Firebase/Core/FIRConfiguration.m
  21. 21 24
      Firebase/Core/FIRLogger.m
  22. 8 8
      Firebase/Core/FIRNetwork.m
  23. 1 1
      Firebase/Core/FIRNetworkConstants.m
  24. 13 18
      Firebase/Core/FIRNetworkURLSession.m
  25. 14 14
      Firebase/Core/FIROptions.m
  26. 27 27
      Firebase/Core/FIRReachabilityChecker.m
  27. 2 2
      Firebase/Core/FIRURLSchemeUtil.m
  28. 1 1
      Firebase/Core/Private/FIRAppAssociationRegistration.h
  29. 2 2
      Firebase/Core/Private/FIRNetworkLoggerProtocol.h
  30. 7 4
      Firebase/Core/Private/FIRNetworkURLSession.h
  31. 2 2
      Firebase/Core/Private/FIRReachabilityChecker.h
  32. 4 4
      Firebase/Core/Public/FIRApp.h
  33. 0 1
      Firebase/Core/Public/FIRConfiguration.h
  34. 1 1
      Firebase/Core/Public/FIRCoreSwiftNameSupport.h
  35. 5 4
      Firebase/Core/Public/FIROptions.h
  36. 1 0
      Firebase/Database/.clang-format
  37. 13 0
      scripts/style.sh

+ 7 - 0
.clang-format

@@ -0,0 +1,7 @@
+BasedOnStyle: Google
+ColumnLimit: 100
+BinPackParameters: false
+AllowAllParametersOfDeclarationOnNextLine: true
+ObjCSpaceBeforeProtocolList: true
+SpacesInContainerLiterals: true
+PointerAlignment: Right

+ 1 - 1
Example/Core/App/iOS/FIRAppDelegate.h

@@ -18,6 +18,6 @@
 
 @interface FIRAppDelegate : UIResponder <UIApplicationDelegate>
 
-@property (strong, nonatomic) UIWindow *window;
+@property(strong, nonatomic) UIWindow *window;
 
 @end

+ 25 - 22
Example/Core/App/iOS/FIRAppDelegate.m

@@ -12,43 +12,46 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-#import "FIRAppDelegate.h"
-
 @import FirebaseCommunity;
+#import "FIRAppDelegate.h"
 
 @implementation FIRAppDelegate
 
-- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
-{
+- (BOOL)application:(UIApplication *)application
+    didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
   [FIRApp configure];
-    return YES;
+  return YES;
 }
 
-- (void)applicationWillResignActive:(UIApplication *)application
-{
-    // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
-    // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
+- (void)applicationWillResignActive:(UIApplication *)application {
+  // Sent when the application is about to move from active to inactive state. This can occur for
+  // certain types of temporary interruptions (such as an incoming phone call or SMS message) or
+  // when the user quits the application and it begins the transition to the background state.
+  // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame
+  // rates. Games should use this method to pause the game.
 }
 
-- (void)applicationDidEnterBackground:(UIApplication *)application
-{
-    // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
-    // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
+- (void)applicationDidEnterBackground:(UIApplication *)application {
+  // Use this method to release shared resources, save user data, invalidate timers, and store
+  // enough application state information to restore your application to its current state in case
+  // it is terminated later.
+  // If your application supports background execution, this method is called instead of
+  // applicationWillTerminate: when the user quits.
 }
 
-- (void)applicationWillEnterForeground:(UIApplication *)application
-{
-    // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
+- (void)applicationWillEnterForeground:(UIApplication *)application {
+  // Called as part of the transition from the background to the inactive state; here you can undo
+  // many of the changes made on entering the background.
 }
 
-- (void)applicationDidBecomeActive:(UIApplication *)application
-{
-    // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
+- (void)applicationDidBecomeActive:(UIApplication *)application {
+  // Restart any tasks that were paused (or not yet started) while the application was inactive. If
+  // the application was previously in the background, optionally refresh the user interface.
 }
 
-- (void)applicationWillTerminate:(UIApplication *)application
-{
-    // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
+- (void)applicationWillTerminate:(UIApplication *)application {
+  // Called when the application is about to terminate. Save data if appropriate. See also
+  // applicationDidEnterBackground:.
 }
 
 @end

+ 6 - 8
Example/Core/App/iOS/FIRViewController.m

@@ -20,16 +20,14 @@
 
 @implementation FIRViewController
 
-- (void)viewDidLoad
-{
-    [super viewDidLoad];
-	// Do any additional setup after loading the view, typically from a nib.
+- (void)viewDidLoad {
+  [super viewDidLoad];
+  // Do any additional setup after loading the view, typically from a nib.
 }
 
-- (void)didReceiveMemoryWarning
-{
-    [super didReceiveMemoryWarning];
-    // Dispose of any resources that can be recreated.
+- (void)didReceiveMemoryWarning {
+  [super didReceiveMemoryWarning];
+  // Dispose of any resources that can be recreated.
 }
 
 @end

+ 4 - 5
Example/Core/App/iOS/main.m

@@ -15,9 +15,8 @@
 @import UIKit;
 #import "FIRAppDelegate.h"
 
-int main(int argc, char * argv[])
-{
-    @autoreleasepool {
-        return UIApplicationMain(argc, argv, nil, NSStringFromClass([FIRAppDelegate class]));
-    }
+int main(int argc, char* argv[]) {
+  @autoreleasepool {
+    return UIApplicationMain(argc, argv, nil, NSStringFromClass([FIRAppDelegate class]));
+  }
 }

+ 0 - 2
Example/Core/App/macOS/FIRAppDelegate.h

@@ -18,6 +18,4 @@
 
 @interface FIRAppDelegate : NSObject <NSApplicationDelegate>
 
-
 @end
-

+ 2 - 4
Example/Core/App/macOS/FIRAppDelegate.m

@@ -23,13 +23,11 @@
 @implementation FIRAppDelegate
 
 - (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
-    // Insert code here to initialize your application
+  // Insert code here to initialize your application
 }
 
-
 - (void)applicationWillTerminate:(NSNotification *)aNotification {
-    // Insert code here to tear down your application
+  // Insert code here to tear down your application
 }
 
-
 @end

+ 0 - 2
Example/Core/App/macOS/FIRViewController.h

@@ -18,6 +18,4 @@
 
 @interface FIRViewController : NSViewController
 
-
 @end
-

+ 4 - 6
Example/Core/App/macOS/FIRViewController.m

@@ -19,17 +19,15 @@
 @implementation FIRViewController
 
 - (void)viewDidLoad {
-    [super viewDidLoad];
+  [super viewDidLoad];
 
-    // Do any additional setup after loading the view.
+  // Do any additional setup after loading the view.
 }
 
-
 - (void)setRepresentedObject:(id)representedObject {
-    [super setRepresentedObject:representedObject];
+  [super setRepresentedObject:representedObject];
 
-    // Update the view, if already loaded.
+  // Update the view, if already loaded.
 }
 
-
 @end

+ 1 - 3
Example/Core/App/macOS/main.m

@@ -16,6 +16,4 @@
 
 #import <Cocoa/Cocoa.h>
 
-int main(int argc, const char * argv[]) {
-    return NSApplicationMain(argc, argv);
-}
+int main(int argc, const char* argv[]) { return NSApplicationMain(argc, argv); }

+ 36 - 34
Example/Core/Tests/FIRAppAssociationRegistrationUnitTests.m

@@ -34,9 +34,7 @@ static NSString *kKey2 = @"key2";
 /** @var gCreateNewObject
     @brief A block that returns a new object everytime it is called.
  */
-static id _Nullable (^gCreateNewObject)() = ^id _Nullable() {
-  return [[NSObject alloc] init];
-};
+static id _Nullable (^gCreateNewObject)() = ^id _Nullable() { return [[NSObject alloc] init]; };
 
 /** @class FIRAppAssociationRegistrationTests
     @brief Tests for @c FIRAppAssociationRegistration
@@ -52,8 +50,8 @@ static id _Nullable (^gCreateNewObject)() = ^id _Nullable() {
   id result = [FIRAppAssociationRegistration registeredObjectWithHost:host
                                                                   key:kKey
                                                         creationBlock:^id _Nullable() {
-    return obj;
-  }];
+                                                          return obj;
+                                                        }];
   XCTAssertEqual(obj, result);
 }
 
@@ -62,8 +60,8 @@ static id _Nullable (^gCreateNewObject)() = ^id _Nullable() {
   id obj = [FIRAppAssociationRegistration registeredObjectWithHost:host
                                                                key:kKey
                                                      creationBlock:^id _Nullable() {
-    return nil;
-  }];
+                                                       return nil;
+                                                     }];
   XCTAssertNil(obj);
 }
 
@@ -76,10 +74,10 @@ static id _Nullable (^gCreateNewObject)() = ^id _Nullable() {
     [FIRAppAssociationRegistration registeredObjectWithHost:host
                                                         key:kKey
                                               creationBlock:^id _Nullable() {
-      id obj = gCreateNewObject();
-      weakObj = obj;
-      return obj;
-    }];
+                                                id obj = gCreateNewObject();
+                                                weakObj = obj;
+                                                return obj;
+                                              }];
     // Verify that neither the host nor the object is released yet, i.e., the host owns the object
     // because nothing else retains the object.
     XCTAssertNotNil(weakHost);
@@ -139,14 +137,15 @@ static id _Nullable (^gCreateNewObject)() = ^id _Nullable() {
 
 - (void)testReentrySameHostSameKey {
   id host = gCreateNewObject();
-  XCTAssertThrows([FIRAppAssociationRegistration registeredObjectWithHost:host
-                                                                key:kKey
-                                                      creationBlock:^id _Nullable() {
-    [FIRAppAssociationRegistration registeredObjectWithHost:host
-                                                        key:kKey
-                                              creationBlock:gCreateNewObject];
-    return gCreateNewObject();
-  }]);
+  XCTAssertThrows([FIRAppAssociationRegistration
+      registeredObjectWithHost:host
+                           key:kKey
+                 creationBlock:^id _Nullable() {
+                   [FIRAppAssociationRegistration registeredObjectWithHost:host
+                                                                       key:kKey
+                                                             creationBlock:gCreateNewObject];
+                   return gCreateNewObject();
+                 }]);
 }
 
 - (void)testReentrySameHostDifferentKey {
@@ -154,11 +153,12 @@ static id _Nullable (^gCreateNewObject)() = ^id _Nullable() {
   [FIRAppAssociationRegistration registeredObjectWithHost:host
                                                       key:kKey1
                                             creationBlock:^id _Nullable() {
-    [FIRAppAssociationRegistration registeredObjectWithHost:host
-                                                        key:kKey2
-                                              creationBlock:gCreateNewObject];
-    return gCreateNewObject();
-  }];
+                                              [FIRAppAssociationRegistration
+                                                  registeredObjectWithHost:host
+                                                                       key:kKey2
+                                                             creationBlock:gCreateNewObject];
+                                              return gCreateNewObject();
+                                            }];
   // Expect no exception raised.
 }
 
@@ -168,11 +168,12 @@ static id _Nullable (^gCreateNewObject)() = ^id _Nullable() {
   [FIRAppAssociationRegistration registeredObjectWithHost:host1
                                                       key:kKey
                                             creationBlock:^id _Nullable() {
-    [FIRAppAssociationRegistration registeredObjectWithHost:host2
-                                                        key:kKey
-                                              creationBlock:gCreateNewObject];
-    return gCreateNewObject();
-  }];
+                                              [FIRAppAssociationRegistration
+                                                  registeredObjectWithHost:host2
+                                                                       key:kKey
+                                                             creationBlock:gCreateNewObject];
+                                              return gCreateNewObject();
+                                            }];
   // Expect no exception raised.
 }
 
@@ -182,11 +183,12 @@ static id _Nullable (^gCreateNewObject)() = ^id _Nullable() {
   [FIRAppAssociationRegistration registeredObjectWithHost:host1
                                                       key:kKey1
                                             creationBlock:^id _Nullable() {
-    [FIRAppAssociationRegistration registeredObjectWithHost:host2
-                                                        key:kKey2
-                                              creationBlock:gCreateNewObject];
-    return gCreateNewObject();
-  }];
+                                              [FIRAppAssociationRegistration
+                                                  registeredObjectWithHost:host2
+                                                                       key:kKey2
+                                                             creationBlock:gCreateNewObject];
+                                              return gCreateNewObject();
+                                            }];
   // Expect no exception raised.
 }
 

+ 65 - 66
Example/Core/Tests/FIRAppTest.m

@@ -12,9 +12,10 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
+#import "FIRTestCase.h"
+
 #import "FirebaseCommunity/FIRAppInternal.h"
 #import "FirebaseCommunity/FIROptionsInternal.h"
-#import "FIRTestCase.h"
 
 NSString *const kFIRTestAppName1 = @"test_app_name_1";
 NSString *const kFIRTestAppName2 = @"test-app-name-2";
@@ -43,7 +44,6 @@ NSString *const kFIRTestAppName2 = @"test-app-name-2";
 
 @end
 
-
 @interface FIRAppTest : FIRTestCase
 
 @property(nonatomic) id appClassMock;
@@ -73,8 +73,8 @@ NSString *const kFIRTestAppName2 = @"test-app-name-2";
 }
 
 - (void)testConfigure {
-  NSDictionary *expectedUserInfo = [self expectedUserInfoWithAppName:kFIRDefaultAppName
-                                                        isDefaultApp:YES];
+  NSDictionary *expectedUserInfo =
+      [self expectedUserInfoWithAppName:kFIRDefaultAppName isDefaultApp:YES];
   OCMExpect([self.notificationCenterMock postNotificationName:kFIRAppReadyToConfigureSDKNotification
                                                        object:[FIRApp class]
                                                      userInfo:expectedUserInfo]);
@@ -99,8 +99,8 @@ NSString *const kFIRTestAppName2 = @"test-app-name-2";
   XCTAssertThrows([FIRApp configureWithOptions:nil]);
   XCTAssertTrue([FIRApp allApps].count == 0);
 
-  NSDictionary *expectedUserInfo = [self expectedUserInfoWithAppName:kFIRDefaultAppName
-                                                        isDefaultApp:YES];
+  NSDictionary *expectedUserInfo =
+      [self expectedUserInfoWithAppName:kFIRDefaultAppName isDefaultApp:YES];
   OCMExpect([self.notificationCenterMock postNotificationName:kFIRAppReadyToConfigureSDKNotification
                                                        object:[FIRApp class]
                                                      userInfo:expectedUserInfo]);
@@ -128,8 +128,8 @@ NSString *const kFIRTestAppName2 = @"test-app-name-2";
                                                   storageBucket:nil
                                               deepLinkURLScheme:nil];
 
-  NSDictionary *expectedUserInfo = [self expectedUserInfoWithAppName:kFIRDefaultAppName
-                                                        isDefaultApp:YES];
+  NSDictionary *expectedUserInfo =
+      [self expectedUserInfoWithAppName:kFIRDefaultAppName isDefaultApp:YES];
   OCMExpect([self.notificationCenterMock postNotificationName:kFIRAppReadyToConfigureSDKNotification
                                                        object:[FIRApp class]
                                                      userInfo:expectedUserInfo]);
@@ -149,12 +149,12 @@ NSString *const kFIRTestAppName2 = @"test-app-name-2";
   XCTAssertThrows([FIRApp configureWithName:nil options:[FIROptions defaultOptions]]);
   XCTAssertThrows([FIRApp configureWithName:kFIRTestAppName1 options:nil]);
   XCTAssertThrows([FIRApp configureWithName:@"" options:[FIROptions defaultOptions]]);
-  XCTAssertThrows([FIRApp configureWithName:kFIRDefaultAppName
-                                    options:[FIROptions defaultOptions]]);
+  XCTAssertThrows(
+      [FIRApp configureWithName:kFIRDefaultAppName options:[FIROptions defaultOptions]]);
   XCTAssertTrue([FIRApp allApps].count == 0);
 
-  NSDictionary *expectedUserInfo = [self expectedUserInfoWithAppName:kFIRTestAppName1
-                                                        isDefaultApp:NO];
+  NSDictionary *expectedUserInfo =
+      [self expectedUserInfoWithAppName:kFIRTestAppName1 isDefaultApp:NO];
   OCMExpect([self.notificationCenterMock postNotificationName:kFIRAppReadyToConfigureSDKNotification
                                                        object:[FIRApp class]
                                                      userInfo:expectedUserInfo]);
@@ -176,8 +176,8 @@ NSString *const kFIRTestAppName2 = @"test-app-name-2";
   FIROptions *newOptions = [options copy];
   newOptions.deepLinkURLScheme = kDeepLinkURLScheme;
 
-  NSDictionary *expectedUserInfo1 = [self expectedUserInfoWithAppName:kFIRTestAppName1
-                                                        isDefaultApp:NO];
+  NSDictionary *expectedUserInfo1 =
+      [self expectedUserInfoWithAppName:kFIRTestAppName1 isDefaultApp:NO];
   OCMExpect([self.notificationCenterMock postNotificationName:kFIRAppReadyToConfigureSDKNotification
                                                        object:[FIRApp class]
                                                      userInfo:expectedUserInfo1]);
@@ -197,8 +197,8 @@ NSString *const kFIRTestAppName2 = @"test-app-name-2";
                                                             storageBucket:nil
                                                         deepLinkURLScheme:nil];
 
-  NSDictionary *expectedUserInfo2 = [self expectedUserInfoWithAppName:kFIRTestAppName2
-                                                         isDefaultApp:NO];
+  NSDictionary *expectedUserInfo2 =
+      [self expectedUserInfoWithAppName:kFIRTestAppName2 isDefaultApp:NO];
   OCMExpect([self.notificationCenterMock postNotificationName:kFIRAppReadyToConfigureSDKNotification
                                                        object:[FIRApp class]
                                                      userInfo:expectedUserInfo2]);
@@ -275,12 +275,12 @@ NSString *const kFIRTestAppName2 = @"test-app-name-2";
 
   [app getTokenForcingRefresh:YES
                  withCallback:^(NSString *_Nullable token, NSError *_Nullable error) {
-    getTokenCallbackWasCalled = YES;
-  }];
+                   getTokenCallbackWasCalled = YES;
+                 }];
 
   XCTAssert(getTokenCallbackWasCalled,
             @"The callback should be invoked by the base implementation when no block for "
-            "'getTokenImplementation' has been specified.");
+             "'getTokenImplementation' has been specified.");
 
   getTokenCallbackWasCalled = NO;
 
@@ -291,18 +291,18 @@ NSString *const kFIRTestAppName2 = @"test-app-name-2";
   };
   [app getTokenForcingRefresh:YES
                  withCallback:^(NSString *_Nullable token, NSError *_Nullable error) {
-    getTokenCallbackWasCalled = YES;
-  }];
+                   getTokenCallbackWasCalled = YES;
+                 }];
 
   XCTAssert(getTokenImplementationWasCalled,
             @"The 'getTokenImplementation' block was never called.");
   XCTAssert(passedRefreshValue,
             @"The value for the 'refresh' parameter wasn't passed to the 'getTokenImplementation' "
-            "block correctly.");
+             "block correctly.");
   XCTAssert(getTokenCallbackWasCalled,
             @"The 'getTokenImplementation' should have invoked the callback. This could be an "
-            "error in this test, or the callback parameter may not have been passed to the "
-            "implementation correctly.");
+             "error in this test, or the callback parameter may not have been passed to the "
+             "implementation correctly.");
 
   getTokenImplementationWasCalled = NO;
   getTokenCallbackWasCalled = NO;
@@ -310,12 +310,11 @@ NSString *const kFIRTestAppName2 = @"test-app-name-2";
 
   [app getTokenForcingRefresh:NO
                  withCallback:^(NSString *_Nullable token, NSError *_Nullable error) {
-    getTokenCallbackWasCalled = YES;
-  }];
+                   getTokenCallbackWasCalled = YES;
+                 }];
 
-  XCTAssertFalse(passedRefreshValue,
-                 @"The value for the 'refresh' parameter wasn't passed to the "
-                 "'getTokenImplementation' block correctly.");
+  XCTAssertFalse(passedRefreshValue, @"The value for the 'refresh' parameter wasn't passed to the "
+                                      "'getTokenImplementation' block correctly.");
 }
 
 - (void)testModifyingOptionsThrows {
@@ -338,8 +337,8 @@ NSString *const kFIRTestAppName2 = @"test-app-name-2";
 }
 
 - (void)testOptionsLocking {
-  FIROptions *options = [[FIROptions alloc] initWithGoogleAppID:kGoogleAppID
-                                                    GCMSenderID:kGCMSenderID];
+  FIROptions *options =
+      [[FIROptions alloc] initWithGoogleAppID:kGoogleAppID GCMSenderID:kGCMSenderID];
   options.projectID = kProjectID;
   options.databaseURL = kDatabaseURL;
 
@@ -484,14 +483,14 @@ NSString *const kFIRTestAppName2 = @"test-app-name-2";
   XCTAssertFalse([FIRApp validateAppIDFormat:@"01:1337:ios:deadbeef" withVersion:kGoodVersionV1]);
   XCTAssertFalse([FIRApp validateAppIDFormat:@"10:1337:ios:deadbeef" withVersion:kGoodVersionV1]);
   XCTAssertFalse([FIRApp validateAppIDFormat:@"11:1337:ios:deadbeef" withVersion:kGoodVersionV1]);
-  XCTAssertFalse([FIRApp validateAppIDFormat:@"21:1337:ios:5e18052ab54fbfec"
-                                 withVersion:kGoodVersionV2]);
-  XCTAssertFalse([FIRApp validateAppIDFormat:@"22:1337:ios:5e18052ab54fbfec"
-                                 withVersion:kGoodVersionV2]);
-  XCTAssertFalse([FIRApp validateAppIDFormat:@"02:1337:ios:5e18052ab54fbfec"
-                                 withVersion:kGoodVersionV2]);
-  XCTAssertFalse([FIRApp validateAppIDFormat:@"20:1337:ios:5e18052ab54fbfec"
-                                 withVersion:kGoodVersionV2]);
+  XCTAssertFalse(
+      [FIRApp validateAppIDFormat:@"21:1337:ios:5e18052ab54fbfec" withVersion:kGoodVersionV2]);
+  XCTAssertFalse(
+      [FIRApp validateAppIDFormat:@"22:1337:ios:5e18052ab54fbfec" withVersion:kGoodVersionV2]);
+  XCTAssertFalse(
+      [FIRApp validateAppIDFormat:@"02:1337:ios:5e18052ab54fbfec" withVersion:kGoodVersionV2]);
+  XCTAssertFalse(
+      [FIRApp validateAppIDFormat:@"20:1337:ios:5e18052ab54fbfec" withVersion:kGoodVersionV2]);
 
   // Extra fields.
   XCTAssertFalse([FIRApp validateAppIDFormat:@"ab:1:1337:ios:deadbeef" withVersion:kGoodVersionV1]);
@@ -532,31 +531,31 @@ NSString *const kFIRTestAppName2 = @"test-app-name-2";
   XCTAssertFalse([FIRApp validateAppIDFingerprint:kGoodAppIDV1 withVersion:kGoodAppIDV1]);
 
   // Versions digits that may make a partial match.
-  XCTAssertFalse([FIRApp validateAppIDFingerprint:@"01:1337:ios:deadbeef"
-                                      withVersion:kGoodVersionV1]);
-  XCTAssertFalse([FIRApp validateAppIDFingerprint:@"10:1337:ios:deadbeef"
-                                      withVersion:kGoodVersionV1]);
-  XCTAssertFalse([FIRApp validateAppIDFingerprint:@"11:1337:ios:deadbeef"
-                                      withVersion:kGoodVersionV1]);
-  XCTAssertFalse([FIRApp validateAppIDFingerprint:@"21:1337:ios:5e18052ab54fbfec"
-                                      withVersion:kGoodVersionV2]);
-  XCTAssertFalse([FIRApp validateAppIDFingerprint:@"22:1337:ios:5e18052ab54fbfec"
-                                      withVersion:kGoodVersionV2]);
-  XCTAssertFalse([FIRApp validateAppIDFingerprint:@"02:1337:ios:5e18052ab54fbfec"
-                                      withVersion:kGoodVersionV2]);
-  XCTAssertFalse([FIRApp validateAppIDFingerprint:@"20:1337:ios:5e18052ab54fbfec"
-                                      withVersion:kGoodVersionV2]);
+  XCTAssertFalse(
+      [FIRApp validateAppIDFingerprint:@"01:1337:ios:deadbeef" withVersion:kGoodVersionV1]);
+  XCTAssertFalse(
+      [FIRApp validateAppIDFingerprint:@"10:1337:ios:deadbeef" withVersion:kGoodVersionV1]);
+  XCTAssertFalse(
+      [FIRApp validateAppIDFingerprint:@"11:1337:ios:deadbeef" withVersion:kGoodVersionV1]);
+  XCTAssertFalse(
+      [FIRApp validateAppIDFingerprint:@"21:1337:ios:5e18052ab54fbfec" withVersion:kGoodVersionV2]);
+  XCTAssertFalse(
+      [FIRApp validateAppIDFingerprint:@"22:1337:ios:5e18052ab54fbfec" withVersion:kGoodVersionV2]);
+  XCTAssertFalse(
+      [FIRApp validateAppIDFingerprint:@"02:1337:ios:5e18052ab54fbfec" withVersion:kGoodVersionV2]);
+  XCTAssertFalse(
+      [FIRApp validateAppIDFingerprint:@"20:1337:ios:5e18052ab54fbfec" withVersion:kGoodVersionV2]);
   // Extra fields.
-  XCTAssertFalse([FIRApp validateAppIDFingerprint:@"ab:1:1337:ios:deadbeef"
-                                      withVersion:kGoodVersionV1]);
-  XCTAssertFalse([FIRApp validateAppIDFingerprint:@"1:ab:1337:ios:deadbeef"
-                                      withVersion:kGoodVersionV1]);
-  XCTAssertFalse([FIRApp validateAppIDFingerprint:@"1:1337:ab:ios:deadbeef"
-                                      withVersion:kGoodVersionV1]);
-  XCTAssertFalse([FIRApp validateAppIDFingerprint:@"1:1337:ios:ab:deadbeef"
-                                      withVersion:kGoodVersionV1]);
-  XCTAssertFalse([FIRApp validateAppIDFingerprint:@"1:1337:ios:deadbeef:ab"
-                                      withVersion:kGoodVersionV1]);
+  XCTAssertFalse(
+      [FIRApp validateAppIDFingerprint:@"ab:1:1337:ios:deadbeef" withVersion:kGoodVersionV1]);
+  XCTAssertFalse(
+      [FIRApp validateAppIDFingerprint:@"1:ab:1337:ios:deadbeef" withVersion:kGoodVersionV1]);
+  XCTAssertFalse(
+      [FIRApp validateAppIDFingerprint:@"1:1337:ab:ios:deadbeef" withVersion:kGoodVersionV1]);
+  XCTAssertFalse(
+      [FIRApp validateAppIDFingerprint:@"1:1337:ios:ab:deadbeef" withVersion:kGoodVersionV1]);
+  XCTAssertFalse(
+      [FIRApp validateAppIDFingerprint:@"1:1337:ios:deadbeef:ab" withVersion:kGoodVersionV1]);
 }
 
 #pragma mark - Internal Methods
@@ -564,7 +563,7 @@ NSString *const kFIRTestAppName2 = @"test-app-name-2";
 - (void)testAuthGetUID {
   [FIRApp configure];
 
-  [FIRApp defaultApp].getUIDImplementation = ^NSString *{ return @"highlander"; };
+  [FIRApp defaultApp].getUIDImplementation = ^NSString * { return @"highlander"; };
   XCTAssertEqual([[FIRApp defaultApp] getUID], @"highlander");
 }
 
@@ -583,8 +582,8 @@ NSString *const kFIRTestAppName2 = @"test-app-name-2";
 
 #pragma mark - private
 
-- (NSDictionary <NSString *, NSObject *> *)expectedUserInfoWithAppName:(NSString *)name
-                                                          isDefaultApp:(BOOL)isDefaultApp {
+- (NSDictionary<NSString *, NSObject *> *)expectedUserInfoWithAppName:(NSString *)name
+                                                         isDefaultApp:(BOOL)isDefaultApp {
   return @{
     kFIRAppNameKey : name,
     kFIRAppIsDefaultAppKey : [NSNumber numberWithBool:isDefaultApp],

+ 11 - 13
Example/Core/Tests/FIRBundleUtilTest.m

@@ -12,10 +12,10 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-#import "FirebaseCommunity/FIRBundleUtil.h"
-
 #import "FIRTestCase.h"
 
+#import "FirebaseCommunity/FIRBundleUtil.h"
+
 static NSString *const kResultPath = @"resultPath";
 static NSString *const kResourceName = @"resourceName";
 static NSString *const kFileType = @"fileType";
@@ -43,11 +43,10 @@ static NSString *const kFileType = @"fileType";
 
 - (void)testFindOptionsDictionaryPath {
   [OCMStub([self.mockBundle pathForResource:kResourceName ofType:kFileType]) andReturn:kResultPath];
-  XCTAssertEqualObjects(
-      [FIRBundleUtil optionsDictionaryPathWithResourceName:kResourceName
-                                               andFileType:kFileType
-                                                 inBundles:@[ self.mockBundle ]],
-      kResultPath);
+  XCTAssertEqualObjects([FIRBundleUtil optionsDictionaryPathWithResourceName:kResourceName
+                                                                 andFileType:kFileType
+                                                                   inBundles:@[ self.mockBundle ]],
+                        kResultPath);
 }
 
 - (void)testFindOptionsDictionaryPath_notFound {
@@ -61,11 +60,10 @@ static NSString *const kFileType = @"fileType";
   [OCMStub([self.mockBundle pathForResource:kResourceName ofType:kFileType]) andReturn:kResultPath];
 
   NSArray *bundles = @[ mockBundleEmpty, self.mockBundle ];
-  XCTAssertEqualObjects(
-      [FIRBundleUtil optionsDictionaryPathWithResourceName:kResourceName
-                                               andFileType:kFileType
-                                                 inBundles:bundles],
-      kResultPath);
+  XCTAssertEqualObjects([FIRBundleUtil optionsDictionaryPathWithResourceName:kResourceName
+                                                                 andFileType:kFileType
+                                                                   inBundles:bundles],
+                        kResultPath);
 }
 
 - (void)testBundleIdentifierExistsInBundles {
@@ -80,7 +78,7 @@ static NSString *const kFileType = @"fileType";
 }
 
 - (void)testBundleIdentifierExistsInBundles_emptyBundlesArray {
-  XCTAssertFalse([FIRBundleUtil hasBundleIdentifier:@"com.google.test" inBundles:@[ ]]);
+  XCTAssertFalse([FIRBundleUtil hasBundleIdentifier:@"com.google.test" inBundles:@[]]);
 }
 
 @end

+ 5 - 8
Example/Core/Tests/FIRLoggerTest.m

@@ -12,9 +12,10 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-#import "FirebaseCommunity/FIRLogger.h"
 #import "FIRTestCase.h"
 
+#import "FirebaseCommunity/FIRLogger.h"
+
 #import <asl.h>
 
 // The following constants are exposed from FIRLogger for unit tests.
@@ -155,7 +156,6 @@ static NSString *const kMessageCode = @"I-COR000001";
   XCTAssertThrows(FIRLogError(kFIRLoggerCore, @"A-APP000001", @"Message."));
 }
 
-
 - (void)testLoggerInterface {
   XCTAssertNoThrow(FIRLogError(kFIRLoggerCore, kMessageCode, @"Message."));
   XCTAssertNoThrow(FIRLogError(kFIRLoggerCore, kMessageCode, @"Configure %@.", @"blah"));
@@ -173,12 +173,11 @@ static NSString *const kMessageCode = @"I-COR000001";
   XCTAssertNoThrow(FIRLogDebug(kFIRLoggerCore, kMessageCode, @"Configure %@.", @"blah"));
 }
 
-
 // asl_set_filter does not perform as expected in unit test environment with simulator. The
 // following test only checks whether the logs have been sent to system with the default settings in
 // the unit test environment.
 - (void)testSystemLogWithDefaultStatus {
-#if !(BUG128) // Disable until https://github.com/firebase/firebase-ios-sdk/issues/128 is fixed
+#if !(BUG128)  // Disable until https://github.com/firebase/firebase-ios-sdk/issues/128 is fixed
   // Test fails on device and iOS 9 simulators - b/38130372
   return;
 #else
@@ -225,16 +224,14 @@ static NSString *const kMessageCode = @"I-COR000001";
   XCTAssertEqual(FIRLoggerLevelDebug, ASL_LEVEL_DEBUG);
 }
 
-
 // Helper functions.
 - (BOOL)logExists {
   [self drainFIRClientQueue];
-  NSString *correctMsg = [NSString stringWithFormat:@"%@[%@] %@", kFIRLoggerCore, kMessageCode,
-      self.randomLogString];
+  NSString *correctMsg =
+      [NSString stringWithFormat:@"%@[%@] %@", kFIRLoggerCore, kMessageCode, self.randomLogString];
   return [self messageWasLogged:correctMsg];
 }
 
-
 - (void)drainFIRClientQueue {
   dispatch_semaphore_t workerSemaphore = dispatch_semaphore_create(0);
   dispatch_async(getFIRClientQueue(), ^{

+ 17 - 18
Example/Core/Tests/FIROptionsTest.m

@@ -12,12 +12,12 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
+#import "FIRTestCase.h"
+
 #import "FirebaseCommunity/FIRAppInternal.h"
 #import "FirebaseCommunity/FIRBundleUtil.h"
 #import "FirebaseCommunity/FIROptionsInternal.h"
 
-#import "FIRTestCase.h"
-
 extern NSString *const kFIRIsMeasurementEnabled;
 extern NSString *const kFIRIsAnalyticsCollectionEnabled;
 extern NSString *const kFIRIsAnalyticsCollectionDeactivated;
@@ -42,8 +42,7 @@ extern NSString *const kFIRLibraryVersionID;
 
 - (void)testInit {
   NSDictionary *optionsDictionary = [FIROptions defaultOptionsDictionary];
-  FIROptions *options =
-      [[FIROptions alloc] initInternalWithOptionsDictionary:optionsDictionary];
+  FIROptions *options = [[FIROptions alloc] initInternalWithOptionsDictionary:optionsDictionary];
   [self assertOptionsMatchDefaults:options andProjectID:YES];
   XCTAssertNil(options.deepLinkURLScheme);
   XCTAssertTrue(options.usingOptionsFromDefaultPlist);
@@ -95,8 +94,8 @@ extern NSString *const kFIRLibraryVersionID;
   XCTAssertEqualObjects(options.deepLinkURLScheme, kDeepLinkURLScheme);
   XCTAssertFalse(options.usingOptionsFromDefaultPlist);
 
-  FIROptions *options2 = [[FIROptions alloc] initWithGoogleAppID:kGoogleAppID
-                                                     GCMSenderID:kGCMSenderID];
+  FIROptions *options2 =
+      [[FIROptions alloc] initWithGoogleAppID:kGoogleAppID GCMSenderID:kGCMSenderID];
   options2.androidClientID = kAndroidClientID;
   options2.APIKey = kAPIKey;
   options2.bundleID = kBundleID;
@@ -112,15 +111,15 @@ extern NSString *const kFIRLibraryVersionID;
 
   // nil GoogleAppID should throw an exception
   XCTAssertThrows([[FIROptions alloc] initWithGoogleAppID:nil
-                                           bundleID:kBundleID
-                                        GCMSenderID:kGCMSenderID
-                                             APIKey:kCustomizedAPIKey
-                                           clientID:nil
-                                         trackingID:nil
-                                    androidClientID:nil
-                                        databaseURL:nil
-                                      storageBucket:nil
-                                  deepLinkURLScheme:nil]);
+                                                 bundleID:kBundleID
+                                              GCMSenderID:kGCMSenderID
+                                                   APIKey:kCustomizedAPIKey
+                                                 clientID:nil
+                                               trackingID:nil
+                                          androidClientID:nil
+                                              databaseURL:nil
+                                            storageBucket:nil
+                                        deepLinkURLScheme:nil]);
 }
 
 - (void)testinitWithContentsOfFile {
@@ -159,8 +158,8 @@ extern NSString *const kFIRLibraryVersionID;
 
 - (void)testCopyingProperties {
   NSMutableString *mutableString;
-  FIROptions *options = [[FIROptions alloc] initWithGoogleAppID:kGoogleAppID
-                                                    GCMSenderID:kGCMSenderID];
+  FIROptions *options =
+      [[FIROptions alloc] initWithGoogleAppID:kGoogleAppID GCMSenderID:kGCMSenderID];
   mutableString = [[NSMutableString alloc] initWithString:@"1"];
   options.APIKey = mutableString;
   [mutableString appendString:@"2"];
@@ -322,7 +321,7 @@ extern NSString *const kFIRLibraryVersionID;
   options = [[FIROptions alloc] initInternalWithOptionsDictionary:optionsDictionary];
   mainDictionary = @{ kFIRIsAnalyticsCollectionDeactivated : @NO };
   OCMExpect([mainBundleMock infoDictionary]).andReturn(mainDictionary);
-  expectedAnalyticsOptions =  @{
+  expectedAnalyticsOptions = @{
     kFIRIsAnalyticsCollectionDeactivated : @NO,  // override
     kFIRIsAnalyticsCollectionEnabled : @YES,
     kFIRIsMeasurementEnabled : @YES

+ 2 - 2
Example/Shared/FIRSampleAppUtilities.h

@@ -20,7 +20,7 @@ NS_SWIFT_NAME(SampleAppUtilities)
 @interface FIRSampleAppUtilities : NSObject
 
 + (BOOL)appContainsRealServiceInfoPlist;
-+ (void)presentAlertForInvalidServiceInfoPlistFromViewController:(UIViewController *)
-      viewController NS_SWIFT_NAME(presentAlertForInvalidServiceInfoPlistFrom(_:));
++ (void)presentAlertForInvalidServiceInfoPlistFromViewController:(UIViewController *)viewController
+    NS_SWIFT_NAME(presentAlertForInvalidServiceInfoPlistFrom(_:));
 
 @end

+ 14 - 13
Example/Shared/FIRSampleAppUtilities.m

@@ -55,8 +55,8 @@ NSString *const kInvalidPlistAlertMessage = @"This sample app needs to be update
     return NO;
   }
 
-  NSString *plistFilePath = [bundle pathForResource:kServiceInfoFileName
-                                             ofType:kServiceInfoFileType];
+  NSString *plistFilePath =
+      [bundle pathForResource:kServiceInfoFileName ofType:kServiceInfoFileType];
   if (!plistFilePath.length) {
     return NO;
   }
@@ -78,24 +78,25 @@ NSString *const kInvalidPlistAlertMessage = @"This sample app needs to be update
   return YES;
 }
 
-+ (void)presentAlertForInvalidServiceInfoPlistFromViewController:(UIViewController *)
-      viewController {
++ (void)presentAlertForInvalidServiceInfoPlistFromViewController:
+    (UIViewController *)viewController {
   NSString *message = [NSString stringWithFormat:kInvalidPlistAlertMessage, kGithubRepoURLString];
   UIAlertController *alertController =
       [UIAlertController alertControllerWithTitle:kInvalidPlistAlertTitle
                                           message:message
                                    preferredStyle:UIAlertControllerStyleAlert];
-  UIAlertAction *viewReadmeAction =
-      [UIAlertAction actionWithTitle:@"View Github"
-                               style:UIAlertActionStyleDefault
-                             handler:^(UIAlertAction * _Nonnull action) {
-        NSURL *githubURL = [NSURL URLWithString:kGithubRepoURLString];
-        [FIRSampleAppUtilities navigateToURL:githubURL fromViewController:viewController];
-
-      }];
+  UIAlertAction *viewReadmeAction = [UIAlertAction
+      actionWithTitle:@"View Github"
+                style:UIAlertActionStyleDefault
+              handler:^(UIAlertAction *_Nonnull action) {
+                NSURL *githubURL = [NSURL URLWithString:kGithubRepoURLString];
+                [FIRSampleAppUtilities navigateToURL:githubURL fromViewController:viewController];
+
+              }];
   [alertController addAction:viewReadmeAction];
 
-  UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:@"Close" style:UIAlertActionStyleCancel handler:nil];
+  UIAlertAction *cancelAction =
+      [UIAlertAction actionWithTitle:@"Close" style:UIAlertActionStyleCancel handler:nil];
   [alertController addAction:cancelAction];
 
   [viewController presentViewController:alertController animated:YES completion:nil];

+ 1 - 1
Firebase/Core/FIRAnalyticsConfiguration.m

@@ -33,7 +33,7 @@
   }
   [[NSNotificationCenter defaultCenter] postNotificationName:name
                                                       object:self
-                                                    userInfo:@{ name : value }];
+                                                    userInfo:@{name : value}];
 }
 
 - (void)setMinimumSessionInterval:(NSTimeInterval)minimumSessionInterval {

+ 38 - 41
Firebase/Core/FIRApp.m

@@ -15,9 +15,9 @@
 #include <sys/utsname.h>
 
 #import "FIRApp.h"
+#import "FIRConfiguration.h"
 #import "Private/FIRAppInternal.h"
 #import "Private/FIRBundleUtil.h"
-#import "FIRConfiguration.h"
 #import "Private/FIRLogger.h"
 #import "Private/FIROptionsInternal.h"
 
@@ -109,8 +109,9 @@ static FIRApp *sDefaultApp;
                       kFIRAppDiagnosticsConfigurationTypeKey : @(FIRConfigTypeCore),
                       kFIRAppDiagnosticsErrorKey : [FIRApp errorForMissingOptions]
                     }];
-    [NSException raise:kFirebaseCoreErrorDomain format:@"Please check there is a valid "
-                                                       @"GoogleService-Info.plist in the project."];
+    [NSException raise:kFirebaseCoreErrorDomain
+                format:@"Please check there is a valid "
+                       @"GoogleService-Info.plist in the project."];
   }
   [FIRApp configureDefaultAppWithOptions:options sendingNotifications:NO];
 }
@@ -150,13 +151,12 @@ static FIRApp *sDefaultApp;
   NSString *lowerCaseName = [name lowercaseString];
   for (NSInteger charIndex = 0; charIndex < lowerCaseName.length; charIndex++) {
     char character = [lowerCaseName characterAtIndex:charIndex];
-     if (!((character >= 'a' && character <= 'z')
-           || (character >= '0' && character <= '9')
-           || character == '_'
-           || character == '-'))  {
-       [NSException raise:kFirebaseCoreErrorDomain format:@"App name should only contain Letters, "
-                                                      @"Numbers, Underscores, and Dashes."];
-     }
+    if (!((character >= 'a' && character <= 'z') || (character >= '0' && character <= '9') ||
+          character == '_' || character == '-')) {
+      [NSException raise:kFirebaseCoreErrorDomain
+                  format:@"App name should only contain Letters, "
+                         @"Numbers, Underscores, and Dashes."];
+    }
   }
 
   if (sAllApps && sAllApps[name]) {
@@ -179,7 +179,8 @@ static FIRApp *sDefaultApp;
   if (sDefaultApp) {
     return sDefaultApp;
   }
-  FIRLogError(kFIRLoggerCore, @"I-COR000003", @"The default Firebase app has not yet been "
+  FIRLogError(kFIRLoggerCore, @"I-COR000003",
+              @"The default Firebase app has not yet been "
               @"configured. Add `[FIRApp configure];` (`FirebaseApp.configure()` in Swift) to your "
               @"application initialization. Read more: https://goo.gl/ctyzm8.");
   return nil;
@@ -224,9 +225,7 @@ static FIRApp *sDefaultApp;
         sDefaultApp = nil;
       }
       if (!self.alreadySentDeleteNotification) {
-        NSDictionary *appInfoDict = @ {
-          kFIRAppNameKey : self.name
-        };
+        NSDictionary *appInfoDict = @{kFIRAppNameKey : self.name};
         [[NSNotificationCenter defaultCenter] postNotificationName:kFIRAppDeleteNotification
                                                             object:[self class]
                                                           userInfo:appInfoDict];
@@ -299,7 +298,8 @@ static FIRApp *sDefaultApp;
   }
 
   if (NSClassFromString(@"FIRAppIndexing") != nil) {
-    FIRLogDebug(kFIRLoggerCore, @"I-COR000024", @"Firebase App Indexing on iOS is deprecated. "
+    FIRLogDebug(kFIRLoggerCore, @"I-COR000024",
+                @"Firebase App Indexing on iOS is deprecated. "
                 @"You don't need to take any action at this time. Learn more about Firebase App "
                 @"Indexing at https://firebase.google.com/docs/app-indexing/.");
   }
@@ -336,7 +336,7 @@ static FIRApp *sDefaultApp;
 
 + (void)sendNotificationsToSDKs:(FIRApp *)app {
   NSNumber *isDefaultApp = [NSNumber numberWithBool:(app == sDefaultApp)];
-  NSDictionary *appInfoDict = @ {
+  NSDictionary *appInfoDict = @{
     kFIRAppNameKey : app.name,
     kFIRAppIsDefaultAppKey : isDefaultApp,
     kFIRGoogleAppIDKey : app.options.googleAppID
@@ -362,20 +362,17 @@ static FIRApp *sDefaultApp;
                                                     reason:(NSString *)reason {
   NSString *description =
       [NSString stringWithFormat:@"Configuration failed for service %@.", service];
-  NSDictionary *errorDict = @{
-    NSLocalizedDescriptionKey : description,
-    NSLocalizedFailureReasonErrorKey : reason
-  };
+  NSDictionary *errorDict =
+      @{NSLocalizedDescriptionKey : description, NSLocalizedFailureReasonErrorKey : reason};
   return FIRCreateError(domain, code, errorDict);
 }
 
 + (NSError *)errorForInvalidAppID {
   NSDictionary *errorDict = @{
-      NSLocalizedDescriptionKey :
-      @"Unable to validate Google App ID",
-      NSLocalizedRecoverySuggestionErrorKey :
-      @"Check formatting and location of GoogleService-Info.plist or GoogleAppID set in the "
-      @"customized options."
+    NSLocalizedDescriptionKey : @"Unable to validate Google App ID",
+    NSLocalizedRecoverySuggestionErrorKey :
+        @"Check formatting and location of GoogleService-Info.plist or GoogleAppID set in the "
+        @"customized options."
   };
   return FIRCreateError(kFirebaseCoreErrorDomain, FIRErrorCodeInvalidAppID, errorDict);
 }
@@ -391,14 +388,15 @@ static FIRApp *sDefaultApp;
   // backward compatibility.
   if (expectedBundleID != nil &&
       ![FIRBundleUtil hasBundleIdentifier:expectedBundleID inBundles:bundles]) {
-    FIRLogInfo(kFIRLoggerCore, @"I-COR000008", @"The project's Bundle ID is inconsistent with "
-                @"either the Bundle ID in '%@.%@', or the Bundle ID in the options if you are "
-                @"using a customized options. To ensure that everything can be configured "
-                @"correctly, you may need to make the Bundle IDs consistent. To continue with this "
-                @"plist file, you may change your app's bundle identifier to '%@'. Or you can "
-                @"download a new configuration file that matches your bundle identifier from %@ "
-                @"and replace the current one.", kServiceInfoFileName, kServiceInfoFileType,
-                expectedBundleID, kPlistURL);
+    FIRLogInfo(kFIRLoggerCore, @"I-COR000008",
+               @"The project's Bundle ID is inconsistent with "
+               @"either the Bundle ID in '%@.%@', or the Bundle ID in the options if you are "
+               @"using a customized options. To ensure that everything can be configured "
+               @"correctly, you may need to make the Bundle IDs consistent. To continue with this "
+               @"plist file, you may change your app's bundle identifier to '%@'. Or you can "
+               @"download a new configuration file that matches your bundle identifier from %@ "
+               @"and replace the current one.",
+               kServiceInfoFileName, kServiceInfoFileType, expectedBundleID, kPlistURL);
   }
 }
 
@@ -421,16 +419,16 @@ static FIRApp *sDefaultApp;
 - (BOOL)isAppIDValid {
   NSString *appID = _options.googleAppID;
   BOOL isValid = [FIRApp validateAppID:appID];
-  if (!isValid){
+  if (!isValid) {
     NSString *expectedBundleID = [self expectedBundleID];
-    FIRLogError(kFIRLoggerCore, @"I-COR000009", @"The GOOGLE_APP_ID either in the plist file "
+    FIRLogError(kFIRLoggerCore, @"I-COR000009",
+                @"The GOOGLE_APP_ID either in the plist file "
                 @"'%@.%@' or the one set in the customized options is invalid. If you are using "
                 @"the plist file, use the iOS version of bundle identifier to download the file, "
                 @"and do not manually edit the GOOGLE_APP_ID. You may change your app's bundle "
                 @"identifier to '%@'. Or you can download a new configuration file that matches "
                 @"your bundle identifier from %@ and replace the current one.",
                 kServiceInfoFileName, kServiceInfoFileType, expectedBundleID, kPlistURL);
-
   };
   return isValid;
 }
@@ -583,7 +581,7 @@ static FIRApp *sDefaultApp;
 
 - (void)sendLogsWithServiceName:(NSString *)serviceName
                         version:(NSString *)version
-                          error:(NSError *)error{
+                          error:(NSError *)error {
   NSMutableDictionary *userInfo = [[NSMutableDictionary alloc] initWithDictionary:@{
     kFIRAppDiagnosticsConfigurationTypeKey : @(FIRConfigTypeSDK),
     kFIRAppDiagnosticsSDKNameKey : serviceName,
@@ -593,10 +591,9 @@ static FIRApp *sDefaultApp;
   if (error) {
     userInfo[kFIRAppDiagnosticsErrorKey] = error;
   }
-  [[NSNotificationCenter defaultCenter]
-      postNotificationName:kFIRAppDiagnosticsNotification
-                    object:nil
-                  userInfo:userInfo];
+  [[NSNotificationCenter defaultCenter] postNotificationName:kFIRAppDiagnosticsNotification
+                                                      object:nil
+                                                    userInfo:userInfo];
 }
 
 @end

+ 0 - 1
Firebase/Core/FIRConfiguration.m

@@ -47,5 +47,4 @@ extern void FIRSetLoggerLevel(FIRLoggerLevel loggerLevel);
   FIRSetLoggerLevel(loggerLevel);
 }
 
-
 @end

+ 21 - 24
Firebase/Core/FIRLogger.m

@@ -20,9 +20,9 @@
 #include <asl.h>
 #include <assert.h>
 #include <stdbool.h>
+#include <sys/sysctl.h>
 #include <sys/types.h>
 #include <unistd.h>
-#include <sys/sysctl.h>
 
 FIRLoggerService kFIRLoggerABTesting = @"[Firebase/ABTesting]";
 FIRLoggerService kFIRLoggerAdMob = @"[Firebase/AdMob]";
@@ -90,10 +90,10 @@ void FIRLoggerInitializeASL() {
     NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
     BOOL debugMode = [userDefaults boolForKey:kFIRPersistedDebugModeKey];
 
-    if ([arguments containsObject:kFIRDisableDebugModeApplicationArgument]) { // Default mode
+    if ([arguments containsObject:kFIRDisableDebugModeApplicationArgument]) {  // Default mode
       [userDefaults removeObjectForKey:kFIRPersistedDebugModeKey];
-    } else if ([arguments containsObject:kFIREnableDebugModeApplicationArgument]
-               || debugMode) { // Debug mode
+    } else if ([arguments containsObject:kFIREnableDebugModeApplicationArgument] ||
+               debugMode) {  // Debug mode
       [userDefaults setBool:YES forKey:kFIRPersistedDebugModeKey];
       asl_set_filter(sFIRLoggerClient, ASL_FILTER_MASK_UPTO(ASL_LEVEL_DEBUG));
       sFIRLoggerDebugMode = YES;
@@ -105,8 +105,8 @@ void FIRLoggerInitializeASL() {
     }
 
     // Need to call asl_add_output_file so that the logs can appear in Xcode's console view. Set
-    // the ASL filter mask for this output file up to debug level so that all messages are viewable
-    // in the console.
+    // the ASL filter mask for this output file up to debug level so that all messages are
+    // viewable in the console.
     asl_add_output_file(sFIRLoggerClient, STDERR_FILENO, kFIRLoggerCustomASLMessageFormat,
                         ASL_TIME_FMT_LCL, ASL_FILTER_MASK_UPTO(ASL_LEVEL_DEBUG), ASL_ENCODE_SAFE);
 
@@ -166,21 +166,18 @@ void FIRResetLogger() {
   [[NSUserDefaults standardUserDefaults] removeObjectForKey:kFIRPersistedDebugModeKey];
 }
 
-aslclient getFIRLoggerClient() {
-  return sFIRLoggerClient;
-}
+aslclient getFIRLoggerClient() { return sFIRLoggerClient; }
 
-dispatch_queue_t getFIRClientQueue() {
-  return sFIRClientQueue;
-}
+dispatch_queue_t getFIRClientQueue() { return sFIRClientQueue; }
 
-BOOL getFIRLoggerDebugMode() {
-  return sFIRLoggerDebugMode;
-}
+BOOL getFIRLoggerDebugMode() { return sFIRLoggerDebugMode; }
 #endif
 
-void FIRLogBasic(FIRLoggerLevel level, FIRLoggerService service, NSString *messageCode,
-                 NSString *message, va_list args_ptr) {
+void FIRLogBasic(FIRLoggerLevel level,
+                 FIRLoggerService service,
+                 NSString *messageCode,
+                 NSString *message,
+                 va_list args_ptr) {
   FIRLoggerInitializeASL();
   BOOL canLog = level <= sFIRLoggerMaximumLevel;
 
@@ -215,13 +212,13 @@ void FIRLogBasic(FIRLoggerLevel level, FIRLoggerService service, NSString *messa
  * Calling FIRLogDebug(kFIRLoggerCore, @"I-COR000001", @"Configure succeed.") shows:
  * yyyy-mm-dd hh:mm:ss.SSS sender[PID] <Debug> [Firebase/Core][I-COR000001] Configure succeed.
  */
-#define FIR_LOGGING_FUNCTION(level) \
-void FIRLog##level(FIRLoggerService service, NSString *messageCode, NSString *message, ...) { \
-  va_list args_ptr; \
-  va_start(args_ptr, message); \
-  FIRLogBasic(FIRLoggerLevel##level, service, messageCode, message, args_ptr); \
-  va_end(args_ptr); \
-}
+#define FIR_LOGGING_FUNCTION(level)                                                             \
+  void FIRLog##level(FIRLoggerService service, NSString *messageCode, NSString *message, ...) { \
+    va_list args_ptr;                                                                           \
+    va_start(args_ptr, message);                                                                \
+    FIRLogBasic(FIRLoggerLevel##level, service, messageCode, message, args_ptr);                \
+    va_end(args_ptr);                                                                           \
+  }
 
 FIR_LOGGING_FUNCTION(Error)
 FIR_LOGGING_FUNCTION(Warning)

+ 8 - 8
Firebase/Core/FIRNetwork.m

@@ -15,10 +15,10 @@
 #import "Private/FIRNetwork.h"
 #import "Private/FIRNetworkMessageCode.h"
 
+#import "Private/FIRLogger.h"
 #import "Private/FIRMutableDictionary.h"
 #import "Private/FIRNetworkConstants.h"
 #import "Private/FIRReachabilityChecker.h"
-#import "Private/FIRLogger.h"
 
 #import <GoogleToolboxForMac/GTMNSData+zlib.h>
 
@@ -46,7 +46,7 @@ static NSString *const kFIRNetworkPOSTRequestMethod = @"POST";
 /// Default constant string as a prefix for network logger.
 static NSString *const kFIRNetworkLogTag = @"Firebase/Network";
 
-@interface FIRNetwork ()<FIRReachabilityDelegate, FIRNetworkLoggerDelegate>
+@interface FIRNetwork () <FIRReachabilityDelegate, FIRNetworkLoggerDelegate>
 @end
 
 @implementation FIRNetwork {
@@ -65,10 +65,9 @@ static NSString *const kFIRNetworkLogTag = @"Firebase/Network";
   self = [super init];
   if (self) {
     // Setup reachability.
-    _reachability =
-        [[FIRReachabilityChecker alloc] initWithReachabilityDelegate:self
-                                                      loggerDelegate:self
-                                                            withHost:reachabilityHost];
+    _reachability = [[FIRReachabilityChecker alloc] initWithReachabilityDelegate:self
+                                                                  loggerDelegate:self
+                                                                        withHost:reachabilityHost];
     if (![_reachability start]) {
       return nil;
     }
@@ -169,7 +168,7 @@ static NSString *const kFIRNetworkLogTag = @"Firebase/Network";
   }
 
   [self firNetwork_logWithLevel:kFIRNetworkLogLevelDebug
-                       messageCode:kFIRNetworkMessageCodeNetwork000
+                    messageCode:kFIRNetworkMessageCodeNetwork000
                         message:@"Uploading data. Host"
                         context:url];
   _requests[requestID] = fetcher;
@@ -362,7 +361,8 @@ static NSString *FIRLogLevelDescriptionFromLogLevel(FIRNetworkLogLevel logLevel)
 }
 
 /// Returns a formatted string to be used for console logging.
-static NSString *FIRStringWithLogMessage(NSString *message, FIRNetworkLogLevel logLevel,
+static NSString *FIRStringWithLogMessage(NSString *message,
+                                         FIRNetworkLogLevel logLevel,
                                          NSArray *contexts) {
   if (!message) {
     message = @"(Message was nil)";

+ 1 - 1
Firebase/Core/FIRNetworkConstants.m

@@ -21,7 +21,7 @@ NSString *const kFIRNetworkBackgroundSessionConfigIDPrefix =
 NSString *const kFIRNetworkApplicationSupportSubdirectory = @"Firebase/Network";
 NSString *const kFIRNetworkTempDirectoryName = @"FIRNetworkTemporaryDirectory";
 const NSTimeInterval kFIRNetworkTempFolderExpireTime = 60 * 60;  // 1 hour
-const NSTimeInterval kFIRNetworkTimeOutInterval = 60;  // 1 minute.
+const NSTimeInterval kFIRNetworkTimeOutInterval = 60;            // 1 minute.
 NSString *const kFIRNetworkReachabilityHost = @"app-measurement.com";
 NSString *const kFIRNetworkErrorContext = @"Context";
 

+ 13 - 18
Firebase/Core/FIRNetworkURLSession.m

@@ -16,10 +16,10 @@
 
 #import "Private/FIRNetworkURLSession.h"
 
+#import "Private/FIRLogger.h"
 #import "Private/FIRMutableDictionary.h"
 #import "Private/FIRNetworkConstants.h"
 #import "Private/FIRNetworkMessageCode.h"
-#import "Private/FIRLogger.h"
 
 @implementation FIRNetworkURLSession {
   /// The handler to be called when the request completes or error has occurs.
@@ -54,8 +54,7 @@
         NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, YES);
     NSString *applicationSupportDirectory = paths.firstObject;
     NSArray *tempPathComponents = @[
-      applicationSupportDirectory,
-      kFIRNetworkApplicationSupportSubdirectory,
+      applicationSupportDirectory, kFIRNetworkApplicationSupportSubdirectory,
       kFIRNetworkTempDirectoryName
     ];
     _networkDirectoryURL = [NSURL fileURLWithPathComponents:tempPathComponents];
@@ -432,18 +431,16 @@
 
 /// Creates a background session configuration with the session ID using the supported method.
 - (NSURLSessionConfiguration *)backgroundSessionConfigWithSessionID:(NSString *)sessionID {
-  #if (TARGET_OS_OSX && defined(MAC_OS_X_VERSION_10_10) &&          \
-      MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_10) ||   \
-      (TARGET_OS_IOS && defined(__IPHONE_8_0) &&                    \
-      __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_8_0)
+#if (TARGET_OS_OSX && defined(MAC_OS_X_VERSION_10_10) &&         \
+     MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_10) || \
+    (TARGET_OS_IOS && defined(__IPHONE_8_0) && __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_8_0)
 
   // iOS 8/10.10 builds require the new backgroundSessionConfiguration method name.
   return [NSURLSessionConfiguration backgroundSessionConfigurationWithIdentifier:sessionID];
 
-  #elif (TARGET_OS_OSX && defined(MAC_OS_X_VERSION_10_10) &&        \
-        MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_10) ||  \
-        (TARGET_OS_IOS && defined(__IPHONE_8_0) &&                  \
-        __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_8_0)
+#elif (TARGET_OS_OSX && defined(MAC_OS_X_VERSION_10_10) &&        \
+       MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_10) || \
+    (TARGET_OS_IOS && defined(__IPHONE_8_0) && __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_8_0)
 
   // Do a runtime check to avoid a deprecation warning about using
   // +backgroundSessionConfiguration: on iOS 8.
@@ -456,10 +453,10 @@
     return [NSURLSessionConfiguration backgroundSessionConfiguration:sessionID];
   }
 
-  #else
+#else
   // Building with an SDK earlier than iOS 8/OS X 10.10.
   return [NSURLSessionConfiguration backgroundSessionConfiguration:sessionID];
-  #endif
+#endif
 }
 
 - (void)maybeRemoveTempFilesAtURL:(NSURL *)folderURL expiringTime:(NSTimeInterval)staleTime {
@@ -623,10 +620,8 @@
                     newRequest:(NSURLRequest *)request
              completionHandler:(void (^)(NSURLRequest *))completionHandler {
   NSArray *nonAllowedRedirectionCodes = @[
-    @(kFIRNetworkHTTPStatusCodeFound),
-    @(kFIRNetworkHTTPStatusCodeMovedPermanently),
-    @(kFIRNetworkHTTPStatusCodeMovedTemporarily),
-    @(kFIRNetworkHTTPStatusCodeMultipleChoices)
+    @(kFIRNetworkHTTPStatusCodeFound), @(kFIRNetworkHTTPStatusCodeMovedPermanently),
+    @(kFIRNetworkHTTPStatusCodeMovedTemporarily), @(kFIRNetworkHTTPStatusCodeMultipleChoices)
   ];
 
   // Allow those not in the non allowed list to be followed.
@@ -655,7 +650,7 @@
     [_loggerDelegate firNetwork_logWithLevel:kFIRNetworkLogLevelError
                                  messageCode:kFIRNetworkMessageCodeURLSession017
                                      message:@"Encounter network error. Code, error"
-                                    contexts:@[@(error.code), error]];
+                                    contexts:@[ @(error.code), error ]];
   }
 
   if (handler) {

+ 14 - 14
Firebase/Core/FIROptions.m

@@ -39,11 +39,10 @@ NSString *const kFIRIsAnalyticsEnabled = @"IS_ANALYTICS_ENABLED";
 NSString *const kFIRIsSignInEnabled = @"IS_SIGNIN_ENABLED";
 
 // Library version ID.
-NSString *const kFIRLibraryVersionID =
-    @"4"     // Major version (one or more digits)
-    @"00"    // Minor version (exactly 2 digits)
-    @"04"    // Build number (exactly 2 digits)
-    @"000";  // Fixed "000"
+NSString *const kFIRLibraryVersionID = @"4"     // Major version (one or more digits)
+                                       @"00"    // Minor version (exactly 2 digits)
+                                       @"04"    // Build number (exactly 2 digits)
+                                       @"000";  // Fixed "000"
 // Plist file name.
 NSString *const kServiceInfoFileName = @"GoogleService-Info";
 // Plist file type.
@@ -90,8 +89,7 @@ static NSDictionary *sDefaultOptionsDictionary = nil;
     return nil;
   }
 
-  sDefaultOptions =
-      [[FIROptions alloc] initInternalWithOptionsDictionary:defaultOptionsDictionary];
+  sDefaultOptions = [[FIROptions alloc] initInternalWithOptionsDictionary:defaultOptionsDictionary];
   return sDefaultOptions;
 }
 
@@ -108,7 +106,8 @@ static NSDictionary *sDefaultOptionsDictionary = nil;
   sDefaultOptionsDictionary = [NSDictionary dictionaryWithContentsOfFile:plistFilePath];
   if (sDefaultOptionsDictionary == nil) {
     FIRLogError(kFIRLoggerCore, @"I-COR000011", @"The configuration file is not a dictionary: "
-                @"'%@.%@'.", kServiceInfoFileName, kServiceInfoFileType);
+                                                @"'%@.%@'.",
+                kServiceInfoFileName, kServiceInfoFileType);
   }
   return sDefaultOptionsDictionary;
 }
@@ -205,7 +204,8 @@ static NSDictionary *sDefaultOptionsDictionary = nil;
     _optionsDictionary = [[NSDictionary dictionaryWithContentsOfFile:plistPath] mutableCopy];
     if (_optionsDictionary == nil) {
       FIRLogError(kFIRLoggerCore, @"I-COR000014", @"The configuration file at %@ does not exist or "
-                  @"is not a well-formed plist file.", plistPath);
+                                                  @"is not a well-formed plist file.",
+                  plistPath);
       return nil;
     }
     // TODO: Do we want to validate the dictionary here? It says we do that already in
@@ -214,8 +214,7 @@ static NSDictionary *sDefaultOptionsDictionary = nil;
   return self;
 }
 
-- (instancetype)initWithGoogleAppID:(NSString *)googleAppID
-                        GCMSenderID:(NSString *)GCMSenderID {
+- (instancetype)initWithGoogleAppID:(NSString *)googleAppID GCMSenderID:(NSString *)GCMSenderID {
   self = [super init];
   if (self) {
     NSMutableDictionary *mutableOptionsDict = [NSMutableDictionary dictionary];
@@ -369,9 +368,10 @@ static NSDictionary *sDefaultOptionsDictionary = nil;
   dispatch_once(&_createAnalyticsOptionsDictionaryOnce, ^{
     NSMutableDictionary *tempAnalyticsOptions = [[NSMutableDictionary alloc] init];
     NSDictionary *mainInfoDictionary = [NSBundle mainBundle].infoDictionary;
-    NSArray *measurementKeys = @[ kFIRIsMeasurementEnabled,
-                                  kFIRIsAnalyticsCollectionEnabled,
-                                  kFIRIsAnalyticsCollectionDeactivated ];
+    NSArray *measurementKeys = @[
+      kFIRIsMeasurementEnabled, kFIRIsAnalyticsCollectionEnabled,
+      kFIRIsAnalyticsCollectionDeactivated
+    ];
     for (NSString *key in measurementKeys) {
       id value = mainInfoDictionary[key] ?: self.optionsDictionary[key] ?: nil;
       if (!value) {

+ 27 - 27
Firebase/Core/FIRReachabilityChecker.m

@@ -14,15 +14,16 @@
 
 #import <Foundation/Foundation.h>
 
-#import "Private/FIRReachabilityChecker.h"
 #import "Private/FIRReachabilityChecker+Internal.h"
+#import "Private/FIRReachabilityChecker.h"
 
+#import "Private/FIRLogger.h"
 #import "Private/FIRNetwork.h"
 #import "Private/FIRNetworkMessageCode.h"
-#import "Private/FIRLogger.h"
 
 static void ReachabilityCallback(SCNetworkReachabilityRef reachability,
-                                 SCNetworkReachabilityFlags flags, void *info);
+                                 SCNetworkReachabilityFlags flags,
+                                 void *info);
 
 static const struct FIRReachabilityApi kFIRDefaultReachabilityApi = {
     SCNetworkReachabilityCreateWithName,
@@ -78,11 +79,10 @@ static NSString *const kFIRReachabilityDisconnectedStatus = @"Disconnected";
 - (void)setReachabilityDelegate:(id<FIRReachabilityDelegate>)reachabilityDelegate {
   if (reachabilityDelegate &&
       (![(NSObject *)reachabilityDelegate conformsToProtocol:@protocol(FIRReachabilityDelegate)])) {
-    FIRLogError(
-        kFIRLoggerCore,
-        [NSString stringWithFormat:@"I-NET%06ld",
-        (long)kFIRNetworkMessageCodeReachabilityChecker005],
-        @"Reachability delegate doesn't conform to Reachability protocol.");
+    FIRLogError(kFIRLoggerCore,
+                [NSString stringWithFormat:@"I-NET%06ld",
+                                           (long)kFIRNetworkMessageCodeReachabilityChecker005],
+                @"Reachability delegate doesn't conform to Reachability protocol.");
     return;
   }
   reachabilityDelegate_ = reachabilityDelegate;
@@ -91,11 +91,10 @@ static NSString *const kFIRReachabilityDisconnectedStatus = @"Disconnected";
 - (void)setLoggerDelegate:(id<FIRNetworkLoggerDelegate>)loggerDelegate {
   if (loggerDelegate &&
       (![(NSObject *)loggerDelegate conformsToProtocol:@protocol(FIRNetworkLoggerDelegate)])) {
-    FIRLogError(
-        kFIRLoggerCore,
-        [NSString stringWithFormat:@"I-NET%06ld",
-        (long)kFIRNetworkMessageCodeReachabilityChecker006],
-        @"Reachability delegate doesn't conform to Logger protocol.");
+    FIRLogError(kFIRLoggerCore,
+                [NSString stringWithFormat:@"I-NET%06ld",
+                                           (long)kFIRNetworkMessageCodeReachabilityChecker006],
+                @"Reachability delegate doesn't conform to Logger protocol.");
     return;
   }
   loggerDelegate_ = loggerDelegate;
@@ -137,11 +136,11 @@ static NSString *const kFIRReachabilityDisconnectedStatus = @"Disconnected";
       return NO;
     }
     SCNetworkReachabilityContext context = {
-        0, /* version */
+        0,                       /* version */
         (__bridge void *)(self), /* info (passed as last parameter to reachability callback) */
-        NULL, /* retain */
-        NULL, /* release */
-        NULL /* copyDescription */
+        NULL,                    /* retain */
+        NULL,                    /* release */
+        NULL                     /* copyDescription */
     };
     if (!reachabilityApi_->setCallbackFn(reachability_, ReachabilityCallback, &context) ||
         !reachabilityApi_->scheduleWithRunLoopFn(reachability_, CFRunLoopGetMain(),
@@ -176,24 +175,24 @@ static NSString *const kFIRReachabilityDisconnectedStatus = @"Disconnected";
   if (flags & kSCNetworkReachabilityFlagsReachable) {
     // Reachable flag is set. Check further flags.
     if (!(flags & kSCNetworkReachabilityFlagsConnectionRequired)) {
-      // Connection required flag is not set, so we have connectivity.
-      #if TARGET_OS_IOS
+// Connection required flag is not set, so we have connectivity.
+#if TARGET_OS_IOS
       status = (flags & kSCNetworkReachabilityFlagsIsWWAN) ? kFIRReachabilityViaCellular
                                                            : kFIRReachabilityViaWifi;
-      #elif TARGET_OS_OSX
+#elif TARGET_OS_OSX
       status = kFIRReachabilityViaWifi;
-      #endif
+#endif
     } else if ((flags & (kSCNetworkReachabilityFlagsConnectionOnDemand |
                          kSCNetworkReachabilityFlagsConnectionOnTraffic)) &&
                !(flags & kSCNetworkReachabilityFlagsInterventionRequired)) {
-      // If the connection on demand or connection on traffic flag is set, and user intervention
-      // is not required, we have connectivity.
-      #if TARGET_OS_IOS
+// If the connection on demand or connection on traffic flag is set, and user intervention
+// is not required, we have connectivity.
+#if TARGET_OS_IOS
       status = (flags & kSCNetworkReachabilityFlagsIsWWAN) ? kFIRReachabilityViaCellular
                                                            : kFIRReachabilityViaWifi;
-      #elif TARGET_OS_OSX
+#elif TARGET_OS_OSX
       status = kFIRReachabilityViaWifi;
-      #endif
+#endif
     }
   }
   return status;
@@ -222,7 +221,8 @@ static NSString *const kFIRReachabilityDisconnectedStatus = @"Disconnected";
 @end
 
 static void ReachabilityCallback(SCNetworkReachabilityRef reachability,
-                                 SCNetworkReachabilityFlags flags, void *info) {
+                                 SCNetworkReachabilityFlags flags,
+                                 void *info) {
   FIRReachabilityChecker *checker = (__bridge FIRReachabilityChecker *)info;
   [checker reachabilityFlagsChanged:flags];
 }

+ 2 - 2
Firebase/Core/FIRURLSchemeUtil.m

@@ -19,7 +19,7 @@
  * Regular expression to match the URL scheme for Google sign-in.
  */
 static NSString *const kFIRGoogleSignInURLSchemePattern =
-@"^com\\.googleusercontent\\.apps\\.\\d+-\\w+$";
+    @"^com\\.googleusercontent\\.apps\\.\\d+-\\w+$";
 
 BOOL fir_areURLSchemesValidForGoogleSignIn(NSArray *urlSchemes) {
   BOOL hasReversedClientID = NO;
@@ -37,7 +37,7 @@ BOOL fir_areURLSchemesValidForGoogleSignIn(NSArray *urlSchemes) {
   }
   if (!hasReversedClientID) {
     FIRLogInfo(kFIRLoggerCore, @"I-COR000021", @"A reversed client ID should be added as a URL "
-              @"scheme to enable Google sign-in.");
+                                               @"scheme to enable Google sign-in.");
   }
   return NO;
 }

+ 1 - 1
Firebase/Core/Private/FIRAppAssociationRegistration.h

@@ -23,7 +23,7 @@ NS_ASSUME_NONNULL_BEGIN
         registered for any given host/key pair, and the object shall be created on-the-fly when
         asked for.
  */
-@interface FIRAppAssociationRegistration<ObjectType> : NSObject
+@interface FIRAppAssociationRegistration <ObjectType> : NSObject
 
 /** @fn registeredObjectWithHost:key:creationBlock:
     @brief Retrieves the registered object with a particular host and key.

+ 2 - 2
Firebase/Core/Private/FIRNetworkLoggerProtocol.h

@@ -16,8 +16,8 @@
 
 @import Foundation;
 
-#import "FIRNetworkMessageCode.h"
 #import "FIRLoggerLevel.h"
+#import "FIRNetworkMessageCode.h"
 
 /// The log levels used by FIRNetworkLogger.
 typedef NS_ENUM(NSInteger, FIRNetworkLogLevel) {
@@ -27,7 +27,7 @@ typedef NS_ENUM(NSInteger, FIRNetworkLogLevel) {
   kFIRNetworkLogLevelDebug = FIRLoggerLevelDebug,
 };
 
-@protocol FIRNetworkLoggerDelegate<NSObject>
+@protocol FIRNetworkLoggerDelegate <NSObject>
 
 @required
 /// Tells the delegate to log a message with an array of contexts and the log level.

+ 7 - 4
Firebase/Core/Private/FIRNetworkURLSession.h

@@ -18,15 +18,18 @@
 
 #import "FIRNetworkLoggerProtocol.h"
 
-typedef void (^FIRNetworkCompletionHandler)(NSHTTPURLResponse *response, NSData *data,
+typedef void (^FIRNetworkCompletionHandler)(NSHTTPURLResponse *response,
+                                            NSData *data,
                                             NSError *error);
-typedef void (^FIRNetworkURLSessionCompletionHandler)(NSHTTPURLResponse *response, NSData *data,
-                                                      NSString *sessionID, NSError *error);
+typedef void (^FIRNetworkURLSessionCompletionHandler)(NSHTTPURLResponse *response,
+                                                      NSData *data,
+                                                      NSString *sessionID,
+                                                      NSError *error);
 typedef void (^FIRNetworkSystemCompletionHandler)(void);
 
 /// The protocol that uses NSURLSession for iOS >= 7.0 to handle requests and responses.
 @interface FIRNetworkURLSession
-    : NSObject<NSURLSessionDelegate, NSURLSessionTaskDelegate, NSURLSessionDownloadDelegate>
+    : NSObject <NSURLSessionDelegate, NSURLSessionTaskDelegate, NSURLSessionDownloadDelegate>
 
 /// Indicates whether the background network is enabled. Default value is NO.
 @property(nonatomic, getter=isBackgroundNetworkEnabled) BOOL backgroundNetworkEnabled;

+ 2 - 2
Firebase/Core/Private/FIRReachabilityChecker.h

@@ -21,8 +21,8 @@
 typedef enum {
   kFIRReachabilityUnknown,  ///< Have not yet checked or been notified whether host is reachable.
   kFIRReachabilityNotReachable,  ///< Host is not reachable.
-  kFIRReachabilityViaWifi,  ///< Host is reachable via Wifi.
-  kFIRReachabilityViaCellular,  ///< Host is reachable via cellular.
+  kFIRReachabilityViaWifi,       ///< Host is reachable via Wifi.
+  kFIRReachabilityViaCellular,   ///< Host is reachable via cellular.
 } FIRReachabilityStatus;
 
 const NSString *FIRReachabilityStatusString(FIRReachabilityStatus status);

+ 4 - 4
Firebase/Core/Public/FIRApp.h

@@ -75,8 +75,8 @@ FIR_SWIFT_NAME(FirebaseApp)
                Letters, Numbers and Underscore.
  * @param options The Firebase application options used to configure the services.
  */
-+ (void)configureWithName:(NSString *)name options:(FIROptions *)options
-    FIR_SWIFT_NAME(configure(name:options:));
++ (void)configureWithName:(NSString *)name
+                  options:(FIROptions *)options FIR_SWIFT_NAME(configure(name:options:));
 
 /**
  * Returns the default app, or nil if the default app does not exist.
@@ -94,13 +94,13 @@ FIR_SWIFT_NAME(FirebaseApp)
  * Returns the set of all extant FIRApp instances, or nil if there are no FIRApp instances. This
  * method is thread safe.
  */
-@property(class, readonly, nullable) NSDictionary <NSString *, FIRApp *> *allApps;
+@property(class, readonly, nullable) NSDictionary<NSString *, FIRApp *> *allApps;
 #else
 /**
  * Returns the set of all extant FIRApp instances, or nil if there are no FIRApp instances. This
  * method is thread safe.
  */
-+ (nullable NSDictionary <NSString *, FIRApp *> *)allApps FIR_SWIFT_NAME(allApps());
++ (nullable NSDictionary<NSString *, FIRApp *> *)allApps FIR_SWIFT_NAME(allApps());
 #endif  // defined(__IPHONE_10_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_10_0
 
 /**

+ 0 - 1
Firebase/Core/Public/FIRConfiguration.h

@@ -48,7 +48,6 @@ NS_ASSUME_NONNULL_BEGIN
 FIR_SWIFT_NAME(FirebaseConfiguration)
 @interface FIRConfiguration : NSObject
 
-
 #if defined(__IPHONE_10_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_10_0
 /** Returns the shared configuration object. */
 @property(class, nonatomic, readonly) FIRConfiguration *sharedInstance FIR_SWIFT_NAME(shared);

+ 1 - 1
Firebase/Core/Public/FIRCoreSwiftNameSupport.h

@@ -24,6 +24,6 @@
 #define FIR_SWIFT_NAME(X) NS_SWIFT_NAME(X)
 #else
 #define FIR_SWIFT_NAME(X)  // Intentionally blank.
-#endif  // #ifdef __IPHONE_9_3
+#endif                     // #ifdef __IPHONE_9_3
 
 #endif  // FIR_SWIFT_NAME

+ 5 - 4
Firebase/Core/Public/FIROptions.h

@@ -24,7 +24,7 @@ NS_ASSUME_NONNULL_BEGIN
  * This class provides constant fields of Google APIs.
  */
 FIR_SWIFT_NAME(FirebaseOptions)
-@interface FIROptions : NSObject<NSCopying>
+@interface FIROptions : NSObject <NSCopying>
 
 /**
  * Returns the default options.
@@ -105,9 +105,10 @@ FIR_SWIFT_NAME(FirebaseOptions)
                         databaseURL:(NSString *)databaseURL
                       storageBucket:(NSString *)storageBucket
                   deepLinkURLScheme:(NSString *)deepLinkURLScheme
-    DEPRECATED_MSG_ATTRIBUTE("Use `-[[FIROptions alloc] initWithGoogleAppID:GCMSenderID:]` "
-                             "(`FirebaseOptions(googleAppID:gcmSenderID:)` in Swift)` and property "
-                             "setters instead.");
+    DEPRECATED_MSG_ATTRIBUTE(
+        "Use `-[[FIROptions alloc] initWithGoogleAppID:GCMSenderID:]` "
+        "(`FirebaseOptions(googleAppID:gcmSenderID:)` in Swift)` and property "
+        "setters instead.");
 
 /**
  * Initializes a customized instance of FIROptions from the file at the given plist file path.

+ 1 - 0
Firebase/Database/.clang-format

@@ -0,0 +1 @@
+IndentWidth: 4

+ 13 - 0
scripts/style.sh

@@ -0,0 +1,13 @@
+#!/bin/bash
+find . \
+    -name 'third_party' -prune -o \
+    -name 'Auth' -prune -o \
+    -name 'AuthSamples' -prune -o \
+    -name 'Database' -prune -o \
+    -name 'FirebaseCommunity.h' -prune -o \
+    -name 'Messaging' -prune -o \
+    -name 'Storage' -prune -o \
+    -name 'Pods' -prune -o \
+    -name '*.[mh]' \
+    -not -name '*.pbobjc.*' \
+    -print0 | xargs -0 clang-format -style=file -i