aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Paul Beusterien <paulbeusterien@google.com>2017-07-27 11:02:39 -0700
committerGravatar GitHub <noreply@github.com>2017-07-27 11:02:39 -0700
commit0abd3444344ea134b0593fcaaf428e82cd190e12 (patch)
tree2a3edd3751d3de661fe1a12c6e5b2aa4e10bb110
parent94dd3c50ad22533f97f59988a1dc01277f29ed6d (diff)
Add clang-format options and script; apply to FirebaseCore (#151)
-rw-r--r--.clang-format7
-rw-r--r--Example/Core/App/iOS/FIRAppDelegate.h2
-rw-r--r--Example/Core/App/iOS/FIRAppDelegate.m47
-rw-r--r--Example/Core/App/iOS/FIRViewController.m14
-rw-r--r--Example/Core/App/iOS/main.m9
-rw-r--r--Example/Core/App/macOS/FIRAppDelegate.h2
-rw-r--r--Example/Core/App/macOS/FIRAppDelegate.m6
-rw-r--r--Example/Core/App/macOS/FIRViewController.h2
-rw-r--r--Example/Core/App/macOS/FIRViewController.m10
-rw-r--r--Example/Core/App/macOS/main.m4
-rw-r--r--Example/Core/Tests/FIRAppAssociationRegistrationUnitTests.m70
-rw-r--r--Example/Core/Tests/FIRAppTest.m131
-rw-r--r--Example/Core/Tests/FIRBundleUtilTest.m24
-rw-r--r--Example/Core/Tests/FIRLoggerTest.m13
-rw-r--r--Example/Core/Tests/FIROptionsTest.m35
-rw-r--r--Example/Shared/FIRSampleAppUtilities.h4
-rw-r--r--Example/Shared/FIRSampleAppUtilities.m27
-rw-r--r--Firebase/Core/FIRAnalyticsConfiguration.m2
-rw-r--r--Firebase/Core/FIRApp.m79
-rw-r--r--Firebase/Core/FIRConfiguration.m1
-rw-r--r--Firebase/Core/FIRLogger.m45
-rw-r--r--Firebase/Core/FIRNetwork.m16
-rw-r--r--Firebase/Core/FIRNetworkConstants.m2
-rw-r--r--Firebase/Core/FIRNetworkURLSession.m31
-rw-r--r--Firebase/Core/FIROptions.m28
-rw-r--r--Firebase/Core/FIRReachabilityChecker.m54
-rw-r--r--Firebase/Core/FIRURLSchemeUtil.m4
-rw-r--r--Firebase/Core/Private/FIRAppAssociationRegistration.h2
-rw-r--r--Firebase/Core/Private/FIRNetworkLoggerProtocol.h4
-rw-r--r--Firebase/Core/Private/FIRNetworkURLSession.h11
-rw-r--r--Firebase/Core/Private/FIRReachabilityChecker.h4
-rw-r--r--Firebase/Core/Public/FIRApp.h8
-rw-r--r--Firebase/Core/Public/FIRConfiguration.h1
-rw-r--r--Firebase/Core/Public/FIRCoreSwiftNameSupport.h2
-rw-r--r--Firebase/Core/Public/FIROptions.h9
-rw-r--r--Firebase/Database/.clang-format1
-rwxr-xr-xscripts/style.sh13
37 files changed, 361 insertions, 363 deletions
diff --git a/.clang-format b/.clang-format
new file mode 100644
index 0000000..220a54e
--- /dev/null
+++ b/.clang-format
@@ -0,0 +1,7 @@
+BasedOnStyle: Google
+ColumnLimit: 100
+BinPackParameters: false
+AllowAllParametersOfDeclarationOnNextLine: true
+ObjCSpaceBeforeProtocolList: true
+SpacesInContainerLiterals: true
+PointerAlignment: Right
diff --git a/Example/Core/App/iOS/FIRAppDelegate.h b/Example/Core/App/iOS/FIRAppDelegate.h
index e3fba8f..1eb5040 100644
--- a/Example/Core/App/iOS/FIRAppDelegate.h
+++ b/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
diff --git a/Example/Core/App/iOS/FIRAppDelegate.m b/Example/Core/App/iOS/FIRAppDelegate.m
index 8819126..34c2e0a 100644
--- a/Example/Core/App/iOS/FIRAppDelegate.m
+++ b/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
diff --git a/Example/Core/App/iOS/FIRViewController.m b/Example/Core/App/iOS/FIRViewController.m
index 901accf..027aabf 100644
--- a/Example/Core/App/iOS/FIRViewController.m
+++ b/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
diff --git a/Example/Core/App/iOS/main.m b/Example/Core/App/iOS/main.m
index 03b5c12..39c05a5 100644
--- a/Example/Core/App/iOS/main.m
+++ b/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]));
+ }
}
diff --git a/Example/Core/App/macOS/FIRAppDelegate.h b/Example/Core/App/macOS/FIRAppDelegate.h
index e637ef9..96400bd 100644
--- a/Example/Core/App/macOS/FIRAppDelegate.h
+++ b/Example/Core/App/macOS/FIRAppDelegate.h
@@ -18,6 +18,4 @@
@interface FIRAppDelegate : NSObject <NSApplicationDelegate>
-
@end
-
diff --git a/Example/Core/App/macOS/FIRAppDelegate.m b/Example/Core/App/macOS/FIRAppDelegate.m
index 9a363a6..1eb675e 100644
--- a/Example/Core/App/macOS/FIRAppDelegate.m
+++ b/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
diff --git a/Example/Core/App/macOS/FIRViewController.h b/Example/Core/App/macOS/FIRViewController.h
index efee5d5..72497a3 100644
--- a/Example/Core/App/macOS/FIRViewController.h
+++ b/Example/Core/App/macOS/FIRViewController.h
@@ -18,6 +18,4 @@
@interface FIRViewController : NSViewController
-
@end
-
diff --git a/Example/Core/App/macOS/FIRViewController.m b/Example/Core/App/macOS/FIRViewController.m
index 08c5bb5..616257f 100644
--- a/Example/Core/App/macOS/FIRViewController.m
+++ b/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
diff --git a/Example/Core/App/macOS/main.m b/Example/Core/App/macOS/main.m
index e8858a6..65a9352 100644
--- a/Example/Core/App/macOS/main.m
+++ b/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); }
diff --git a/Example/Core/Tests/FIRAppAssociationRegistrationUnitTests.m b/Example/Core/Tests/FIRAppAssociationRegistrationUnitTests.m
index dd6a91a..186e61b 100644
--- a/Example/Core/Tests/FIRAppAssociationRegistrationUnitTests.m
+++ b/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.
}
diff --git a/Example/Core/Tests/FIRAppTest.m b/Example/Core/Tests/FIRAppTest.m
index ab83eea..a4f6803 100644
--- a/Example/Core/Tests/FIRAppTest.m
+++ b/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],
diff --git a/Example/Core/Tests/FIRBundleUtilTest.m b/Example/Core/Tests/FIRBundleUtilTest.m
index 22863a4..7a9ddc8 100644
--- a/Example/Core/Tests/FIRBundleUtilTest.m
+++ b/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
diff --git a/Example/Core/Tests/FIRLoggerTest.m b/Example/Core/Tests/FIRLoggerTest.m
index c4d252a..a89dbb3 100644
--- a/Example/Core/Tests/FIRLoggerTest.m
+++ b/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(), ^{
diff --git a/Example/Core/Tests/FIROptionsTest.m b/Example/Core/Tests/FIROptionsTest.m
index ec3bc27..1584633 100644
--- a/Example/Core/Tests/FIROptionsTest.m
+++ b/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
diff --git a/Example/Shared/FIRSampleAppUtilities.h b/Example/Shared/FIRSampleAppUtilities.h
index 891c2b6..34da5ae 100644
--- a/Example/Shared/FIRSampleAppUtilities.h
+++ b/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
diff --git a/Example/Shared/FIRSampleAppUtilities.m b/Example/Shared/FIRSampleAppUtilities.m
index a0a4794..7a777d0 100644
--- a/Example/Shared/FIRSampleAppUtilities.m
+++ b/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];
diff --git a/Firebase/Core/FIRAnalyticsConfiguration.m b/Firebase/Core/FIRAnalyticsConfiguration.m
index cec3771..4fff0c1 100644
--- a/Firebase/Core/FIRAnalyticsConfiguration.m
+++ b/Firebase/Core/FIRAnalyticsConfiguration.m
@@ -33,7 +33,7 @@
}
[[NSNotificationCenter defaultCenter] postNotificationName:name
object:self
- userInfo:@{ name : value }];
+ userInfo:@{name : value}];
}
- (void)setMinimumSessionInterval:(NSTimeInterval)minimumSessionInterval {
diff --git a/Firebase/Core/FIRApp.m b/Firebase/Core/FIRApp.m
index 95ed174..cdfb126 100644
--- a/Firebase/Core/FIRApp.m
+++ b/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
diff --git a/Firebase/Core/FIRConfiguration.m b/Firebase/Core/FIRConfiguration.m
index 921aa48..02617ef 100644
--- a/Firebase/Core/FIRConfiguration.m
+++ b/Firebase/Core/FIRConfiguration.m
@@ -47,5 +47,4 @@ extern void FIRSetLoggerLevel(FIRLoggerLevel loggerLevel);
FIRSetLoggerLevel(loggerLevel);
}
-
@end
diff --git a/Firebase/Core/FIRLogger.m b/Firebase/Core/FIRLogger.m
index 92fc7b4..eac8dc0 100644
--- a/Firebase/Core/FIRLogger.m
+++ b/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)
diff --git a/Firebase/Core/FIRNetwork.m b/Firebase/Core/FIRNetwork.m
index 4926b2f..f1278ed 100644
--- a/Firebase/Core/FIRNetwork.m
+++ b/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)";
diff --git a/Firebase/Core/FIRNetworkConstants.m b/Firebase/Core/FIRNetworkConstants.m
index 7ba0e15..a92e0e2 100644
--- a/Firebase/Core/FIRNetworkConstants.m
+++ b/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";
diff --git a/Firebase/Core/FIRNetworkURLSession.m b/Firebase/Core/FIRNetworkURLSession.m
index 0e023e6..e27a194 100644
--- a/Firebase/Core/FIRNetworkURLSession.m
+++ b/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) {
diff --git a/Firebase/Core/FIROptions.m b/Firebase/Core/FIROptions.m
index 3395767..b2bdce8 100644
--- a/Firebase/Core/FIROptions.m
+++ b/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) {
diff --git a/Firebase/Core/FIRReachabilityChecker.m b/Firebase/Core/FIRReachabilityChecker.m
index bc21a52..34bb764 100644
--- a/Firebase/Core/FIRReachabilityChecker.m
+++ b/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];
}
diff --git a/Firebase/Core/FIRURLSchemeUtil.m b/Firebase/Core/FIRURLSchemeUtil.m
index 8dbecae..0e4fc9c 100644
--- a/Firebase/Core/FIRURLSchemeUtil.m
+++ b/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;
}
diff --git a/Firebase/Core/Private/FIRAppAssociationRegistration.h b/Firebase/Core/Private/FIRAppAssociationRegistration.h
index 3d697a7..9778988 100644
--- a/Firebase/Core/Private/FIRAppAssociationRegistration.h
+++ b/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.
diff --git a/Firebase/Core/Private/FIRNetworkLoggerProtocol.h b/Firebase/Core/Private/FIRNetworkLoggerProtocol.h
index 70cc56d..4a4315b 100644
--- a/Firebase/Core/Private/FIRNetworkLoggerProtocol.h
+++ b/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.
diff --git a/Firebase/Core/Private/FIRNetworkURLSession.h b/Firebase/Core/Private/FIRNetworkURLSession.h
index d146de2..3b60317 100644
--- a/Firebase/Core/Private/FIRNetworkURLSession.h
+++ b/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;
diff --git a/Firebase/Core/Private/FIRReachabilityChecker.h b/Firebase/Core/Private/FIRReachabilityChecker.h
index 105cd3d..afbc89b 100644
--- a/Firebase/Core/Private/FIRReachabilityChecker.h
+++ b/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);
diff --git a/Firebase/Core/Public/FIRApp.h b/Firebase/Core/Public/FIRApp.h
index 8f52e1a..712781f 100644
--- a/Firebase/Core/Public/FIRApp.h
+++ b/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
/**
diff --git a/Firebase/Core/Public/FIRConfiguration.h b/Firebase/Core/Public/FIRConfiguration.h
index 496b211..e2c85e5 100644
--- a/Firebase/Core/Public/FIRConfiguration.h
+++ b/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);
diff --git a/Firebase/Core/Public/FIRCoreSwiftNameSupport.h b/Firebase/Core/Public/FIRCoreSwiftNameSupport.h
index 55e1bcc..216c047 100644
--- a/Firebase/Core/Public/FIRCoreSwiftNameSupport.h
+++ b/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
diff --git a/Firebase/Core/Public/FIROptions.h b/Firebase/Core/Public/FIROptions.h
index 7bc2406..e7facd8 100644
--- a/Firebase/Core/Public/FIROptions.h
+++ b/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.
diff --git a/Firebase/Database/.clang-format b/Firebase/Database/.clang-format
new file mode 100644
index 0000000..39f9642
--- /dev/null
+++ b/Firebase/Database/.clang-format
@@ -0,0 +1 @@
+IndentWidth: 4
diff --git a/scripts/style.sh b/scripts/style.sh
new file mode 100755
index 0000000..48a1587
--- /dev/null
+++ b/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