aboutsummaryrefslogtreecommitdiffhomepage
path: root/Firebase
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 /Firebase
parent94dd3c50ad22533f97f59988a1dc01277f29ed6d (diff)
Add clang-format options and script; apply to FirebaseCore (#151)
Diffstat (limited to 'Firebase')
-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
19 files changed, 148 insertions, 156 deletions
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