aboutsummaryrefslogtreecommitdiffhomepage
path: root/Firestore
diff options
context:
space:
mode:
authorGravatar Gil <mcg@google.com>2017-11-30 09:10:58 -0800
committerGravatar GitHub <noreply@github.com>2017-11-30 09:10:58 -0800
commit81d2f97b2e34d9124667924df2d9365f5a31d2ae (patch)
treecd8e8fbb229a52cfbf688fb4c0f6506b7b1504e1 /Firestore
parent123ce4cdea12140a5e6aa75de5627fc1dfc7e787 (diff)
Allow clang-format to find Firestore/Source/Auth (#508)
* Avoid pruning paths with find find . -path foo -path bar -path baz is horrifically inefficient; properly excluding all of FirebaseAuth without excluding Firestore/Source/Auth ends up taking 1.5 minutes on my machine. Deleting via sed is much faster. * Allow a branch name or filenames to be specified on the command line e.g. ./scripts/style.sh master formats only files changed since master. * Format Firebase/Source/Auth code * Use alternate delimeter for path regexen
Diffstat (limited to 'Firestore')
-rw-r--r--Firestore/Source/Auth/FSTCredentialsProvider.h4
-rw-r--r--Firestore/Source/Auth/FSTCredentialsProvider.m38
-rw-r--r--Firestore/Source/Auth/FSTEmptyCredentialsProvider.h2
-rw-r--r--Firestore/Source/Auth/FSTUser.h2
4 files changed, 23 insertions, 23 deletions
diff --git a/Firestore/Source/Auth/FSTCredentialsProvider.h b/Firestore/Source/Auth/FSTCredentialsProvider.h
index eb591ab..92d5fdc 100644
--- a/Firestore/Source/Auth/FSTCredentialsProvider.h
+++ b/Firestore/Source/Auth/FSTCredentialsProvider.h
@@ -66,7 +66,7 @@ typedef void (^FSTVoidUserBlock)(FSTUser *user);
#pragma mark - FSTCredentialsProvider
/** Provides methods for getting the uid and token for the current user and listen for changes. */
-@protocol FSTCredentialsProvider<NSObject>
+@protocol FSTCredentialsProvider <NSObject>
/** Requests token for the current user, optionally forcing a refreshed token to be fetched. */
- (void)getTokenForcingRefresh:(BOOL)forceRefresh completion:(FSTVoidGetTokenResultBlock)completion;
@@ -95,7 +95,7 @@ typedef void (^FSTVoidUserBlock)(FSTUser *user);
* backing our internal worker queue and the callbacks from FIRAuth will be executed on an
* arbitrary different thread.
*/
-@interface FSTFirebaseCredentialsProvider : NSObject<FSTCredentialsProvider>
+@interface FSTFirebaseCredentialsProvider : NSObject <FSTCredentialsProvider>
/**
* Initializes a new FSTFirebaseCredentialsProvider.
diff --git a/Firestore/Source/Auth/FSTCredentialsProvider.m b/Firestore/Source/Auth/FSTCredentialsProvider.m
index 821341e..7aa3671 100644
--- a/Firestore/Source/Auth/FSTCredentialsProvider.m
+++ b/Firestore/Source/Auth/FSTCredentialsProvider.m
@@ -23,10 +23,10 @@
#import <GRPCClient/GRPCCall.h>
#import "FIRFirestoreErrors.h"
+#import "Firestore/Source/Auth/FSTUser.h"
#import "Firestore/Source/Util/FSTAssert.h"
#import "Firestore/Source/Util/FSTClasses.h"
#import "Firestore/Source/Util/FSTDispatchQueue.h"
-#import "Firestore/Source/Auth/FSTUser.h"
NS_ASSUME_NONNULL_BEGIN
@@ -108,24 +108,24 @@ NS_ASSUME_NONNULL_BEGIN
// FIRFirestoreErrorCodeAborted error) if there is a user change while the request is outstanding.
int initialUserCounter = self.userCounter;
- void (^getTokenCallback)(NSString *, NSError *) = ^(NSString *_Nullable token,
- NSError *_Nullable error) {
- @synchronized(self) {
- if (initialUserCounter != self.userCounter) {
- // Cancel the request since the user changed while the request was outstanding so the
- // response is likely for a previous user (which user, we can't be sure).
- NSDictionary *errorInfo = @{ @"details" : @"getToken aborted due to user change." };
- NSError *cancelError = [NSError errorWithDomain:FIRFirestoreErrorDomain
- code:FIRFirestoreErrorCodeAborted
- userInfo:errorInfo];
- completion(nil, cancelError);
- } else {
- FSTGetTokenResult *result =
- [[FSTGetTokenResult alloc] initWithUser:self.currentUser token:token];
- completion(result, error);
- }
- };
- };
+ void (^getTokenCallback)(NSString *, NSError *) =
+ ^(NSString *_Nullable token, NSError *_Nullable error) {
+ @synchronized(self) {
+ if (initialUserCounter != self.userCounter) {
+ // Cancel the request since the user changed while the request was outstanding so the
+ // response is likely for a previous user (which user, we can't be sure).
+ NSDictionary *errorInfo = @{@"details" : @"getToken aborted due to user change."};
+ NSError *cancelError = [NSError errorWithDomain:FIRFirestoreErrorDomain
+ code:FIRFirestoreErrorCodeAborted
+ userInfo:errorInfo];
+ completion(nil, cancelError);
+ } else {
+ FSTGetTokenResult *result =
+ [[FSTGetTokenResult alloc] initWithUser:self.currentUser token:token];
+ completion(result, error);
+ }
+ };
+ };
[self.app getTokenForcingRefresh:forceRefresh withCallback:getTokenCallback];
}
diff --git a/Firestore/Source/Auth/FSTEmptyCredentialsProvider.h b/Firestore/Source/Auth/FSTEmptyCredentialsProvider.h
index 5783bcc..f805363 100644
--- a/Firestore/Source/Auth/FSTEmptyCredentialsProvider.h
+++ b/Firestore/Source/Auth/FSTEmptyCredentialsProvider.h
@@ -21,7 +21,7 @@
NS_ASSUME_NONNULL_BEGIN
/** `FSTEmptyCredentialsProvider` always yields an empty token. */
-@interface FSTEmptyCredentialsProvider : NSObject<FSTCredentialsProvider>
+@interface FSTEmptyCredentialsProvider : NSObject <FSTCredentialsProvider>
@end
diff --git a/Firestore/Source/Auth/FSTUser.h b/Firestore/Source/Auth/FSTUser.h
index 83b1962..68ecc4c 100644
--- a/Firestore/Source/Auth/FSTUser.h
+++ b/Firestore/Source/Auth/FSTUser.h
@@ -22,7 +22,7 @@ NS_ASSUME_NONNULL_BEGIN
* Simple wrapper around a nullable UID. Mostly exists to make code more readable and for use as
* a key in dictionaries (since keys cannot be nil).
*/
-@interface FSTUser : NSObject<NSCopying>
+@interface FSTUser : NSObject <NSCopying>
/** Returns an FSTUser with a nil UID. */
+ (instancetype)unauthenticatedUser;