diff --git a/Example/Auth/Tests/FIRAuthTests.m b/Example/Auth/Tests/FIRAuthTests.m index 74720a35d41..b3c6f1b979c 100644 --- a/Example/Auth/Tests/FIRAuthTests.m +++ b/Example/Auth/Tests/FIRAuthTests.m @@ -365,20 +365,6 @@ - (void)testLifeCycle { XCTAssertNil(auth); } -/** @fn testGetUID - @brief Verifies that FIRApp's getUIDImplementation is correctly set by FIRAuth. - */ -- (void)testGetUID { - // TODO: Remove this test once Firestore, Database, and Storage move over to the new Auth interop - // library. - FIRApp *app = [FIRApp defaultApp]; - XCTAssertNotNil(app.getUIDImplementation); - [[FIRAuth auth] signOut:NULL]; - XCTAssertNil(app.getUIDImplementation()); - [self waitForSignIn]; - XCTAssertEqualObjects(app.getUIDImplementation(), kLocalID); -} - #pragma mark - Server API Tests /** @fn testFetchProvidersForEmailSuccess @@ -2283,8 +2269,8 @@ - (void)mockSecureTokenResponseWithError:(nullable NSError *)error { */ - (void)enableAutoTokenRefresh { XCTestExpectation *expectation = [self expectationWithDescription:@"autoTokenRefreshcallback"]; - [[FIRAuth auth].app getTokenForcingRefresh:NO withCallback:^(NSString *_Nullable token, - NSError *_Nullable error) { + [[FIRAuth auth] getTokenForcingRefresh:NO withCallback:^(NSString *_Nullable token, + NSError *_Nullable error) { [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:kExpectationTimeout handler:nil]; diff --git a/Example/Core/Tests/FIRAppTest.m b/Example/Core/Tests/FIRAppTest.m index bd98036d97d..d913c34b2db 100644 --- a/Example/Core/Tests/FIRAppTest.m +++ b/Example/Core/Tests/FIRAppTest.m @@ -267,59 +267,6 @@ - (void)testErrorForSubspecConfigurationFailure { XCTAssert([error.description containsString:@"Configuration failed for"]); } -- (void)testGetTokenWithCallback { - [FIRApp configure]; - FIRApp *app = [FIRApp defaultApp]; - - __block BOOL getTokenImplementationWasCalled = NO; - __block BOOL getTokenCallbackWasCalled = NO; - __block BOOL passedRefreshValue = NO; - - [app getTokenForcingRefresh:YES - withCallback:^(NSString *_Nullable token, NSError *_Nullable error) { - getTokenCallbackWasCalled = YES; - }]; - - XCTAssert(getTokenCallbackWasCalled, - @"The callback should be invoked by the base implementation when no block for " - "'getTokenImplementation' has been specified."); - - getTokenCallbackWasCalled = NO; - - app.getTokenImplementation = ^(BOOL refresh, FIRTokenCallback callback) { - getTokenImplementationWasCalled = YES; - passedRefreshValue = refresh; - callback(nil, nil); - }; - [app getTokenForcingRefresh:YES - withCallback:^(NSString *_Nullable token, NSError *_Nullable error) { - 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."); - 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."); - - getTokenImplementationWasCalled = NO; - getTokenCallbackWasCalled = NO; - passedRefreshValue = NO; - - [app getTokenForcingRefresh:NO - withCallback:^(NSString *_Nullable token, NSError *_Nullable error) { - getTokenCallbackWasCalled = YES; - }]; - - XCTAssertFalse(passedRefreshValue, - @"The value for the 'refresh' parameter wasn't passed to the " - "'getTokenImplementation' block correctly."); -} - - (void)testOptionsLocking { FIROptions *options = [[FIROptions alloc] initWithGoogleAppID:kGoogleAppID GCMSenderID:kGCMSenderID]; @@ -754,16 +701,6 @@ - (void)testAnalyticsNotSetByGlobalDataCollectionSwitch { #pragma mark - Internal Methods -// TODO: Remove this test once the `getUIDImplementation` block doesn't need to be set in Core. -- (void)testAuthGetUID { - [FIRApp configure]; - - [FIRApp defaultApp].getUIDImplementation = ^NSString * { - return @"highlander"; - }; - XCTAssertEqual([[FIRApp defaultApp] getUID], @"highlander"); -} - - (void)testIsDefaultAppConfigured { // Ensure it's false before anything is configured. XCTAssertFalse([FIRApp isDefaultAppConfigured]); diff --git a/Firebase/Auth/Source/FIRAuth.m b/Firebase/Auth/Source/FIRAuth.m index d634b489138..0697026ed57 100644 --- a/Firebase/Auth/Source/FIRAuth.m +++ b/Firebase/Auth/Source/FIRAuth.m @@ -22,7 +22,6 @@ #import #endif -#import #import #import #import @@ -229,9 +228,9 @@ + (FIRActionCodeOperation)actionCodeOperationForRequestType:(NSString *)requestT #pragma mark - FIRAuth #if TARGET_OS_IOS -@interface FIRAuth () +@interface FIRAuth () #else -@interface FIRAuth () +@interface FIRAuth () #endif /** @property firebaseAppId @@ -344,23 +343,6 @@ - (instancetype)initWithApp:(FIRApp *)app { self = [self initWithAPIKey:app.options.APIKey appName:app.name]; if (self) { _app = app; - __weak FIRAuth *weakSelf = self; - - // TODO: Remove this block once Firestore, Database, and Storage move to the new interop API. - app.getTokenImplementation = ^(BOOL forceRefresh, FIRTokenCallback callback) { - // In the meantime, redirect call to the interop method that provides this functionality. - __weak FIRAuth *weakSelf = self; - [weakSelf getTokenForcingRefresh:forceRefresh withCallback:callback]; - }; - - // TODO: Remove this block once Firestore, Database, and Storage move to the new interop API. - app.getUIDImplementation = ^NSString *_Nullable() { - __block NSString *uid; - dispatch_sync(FIRAuthGlobalWorkQueue(), ^{ - uid = [weakSelf getUserID]; - }); - return uid; - }; #if TARGET_OS_IOS _authURLPresenter = [[FIRAuthURLPresenter alloc] init]; #endif diff --git a/Firebase/Auth/Source/FIRAuth_Internal.h b/Firebase/Auth/Source/FIRAuth_Internal.h index 519ece3effe..d4184f14c79 100644 --- a/Firebase/Auth/Source/FIRAuth_Internal.h +++ b/Firebase/Auth/Source/FIRAuth_Internal.h @@ -18,6 +18,8 @@ #import "FIRAuth.h" +#import + @class FIRAuthRequestConfiguration; #if TARGET_OS_IOS @@ -29,7 +31,7 @@ NS_ASSUME_NONNULL_BEGIN -@interface FIRAuth () +@interface FIRAuth () /** @property requestConfiguration @brief The configuration object comprising of paramters needed to make a request to Firebase diff --git a/Firebase/Core/FIRApp.m b/Firebase/Core/FIRApp.m index 3b352fa7d18..29570a89192 100644 --- a/Firebase/Core/FIRApp.m +++ b/Firebase/Core/FIRApp.m @@ -281,15 +281,6 @@ - (instancetype)initInstanceWithName:(NSString *)name options:(FIROptions *)opti return self; } -- (void)getTokenForcingRefresh:(BOOL)forceRefresh withCallback:(FIRTokenCallback)callback { - if (!_getTokenImplementation) { - callback(nil, nil); - return; - } - - _getTokenImplementation(forceRefresh, callback); -} - - (BOOL)configureCore { [self checkExpectedBundleID]; if (![self isAppIDValid]) { @@ -538,15 +529,6 @@ - (void)checkExpectedBundleID { } } -// TODO: Remove once SDKs transition to Auth interop library. -- (nullable NSString *)getUID { - if (!_getUIDImplementation) { - FIRLogWarning(kFIRLoggerCore, @"I-COR000025", @"FIRAuth getUID implementation wasn't set."); - return nil; - } - return _getUIDImplementation(); -} - #pragma mark - private - App ID Validation /** diff --git a/Firebase/Core/Private/FIRAppInternal.h b/Firebase/Core/Private/FIRAppInternal.h index e1aa65d0ba1..67cb33bc4c0 100644 --- a/Firebase/Core/Private/FIRAppInternal.h +++ b/Firebase/Core/Private/FIRAppInternal.h @@ -109,24 +109,6 @@ extern NSString *const FIRAuthStateDidChangeInternalNotificationAppKey; */ extern NSString *const FIRAuthStateDidChangeInternalNotificationUIDKey; -/** @typedef FIRTokenCallback - @brief The type of block which gets called when a token is ready. - */ -typedef void (^FIRTokenCallback)(NSString *_Nullable token, NSError *_Nullable error); - -/** @typedef FIRAppGetTokenImplementation - @brief The type of block which can provide an implementation for the @c getTokenWithCallback: - method. - @param forceRefresh Forces the token to be refreshed. - @param callback The block which should be invoked when the async call completes. - */ -typedef void (^FIRAppGetTokenImplementation)(BOOL forceRefresh, FIRTokenCallback callback); - -/** @typedef FIRAppGetUID - @brief The type of block which can provide an implementation for the @c getUID method. - */ -typedef NSString *_Nullable (^FIRAppGetUIDImplementation)(void); - @interface FIRApp () /** @@ -134,17 +116,6 @@ typedef NSString *_Nullable (^FIRAppGetUIDImplementation)(void); */ @property(nonatomic, readonly) BOOL isDefaultApp; -/** @property getTokenImplementation - @brief Gets or sets the block to use for the implementation of - @c getTokenForcingRefresh:withCallback: - */ -@property(nonatomic, copy) FIRAppGetTokenImplementation getTokenImplementation; - -/** @property getUIDImplementation - @brief Gets or sets the block to use for the implementation of @c getUID. - */ -@property(nonatomic, copy) FIRAppGetUIDImplementation getUIDImplementation; - /* * The container of interop SDKs for this app. */ @@ -204,19 +175,6 @@ typedef NSString *_Nullable (^FIRAppGetUIDImplementation)(void); */ - (instancetype)initInstanceWithName:(NSString *)name options:(FIROptions *)options; -/** @fn getTokenForcingRefresh:withCallback: - @brief Retrieves the Firebase authentication token, possibly refreshing it. - @param forceRefresh Forces a token refresh. Useful if the token becomes invalid for some reason - other than an expiration. - @param callback The block to invoke when the token is available. - */ -- (void)getTokenForcingRefresh:(BOOL)forceRefresh withCallback:(FIRTokenCallback)callback; - -/** - * Expose the UID of the current user for Firestore. - */ -- (nullable NSString *)getUID; - @end NS_ASSUME_NONNULL_END