From 79f663d5eaaa4b7f9fe46d176c82660d38e4be8a Mon Sep 17 00:00:00 2001 From: Ryan Wilson Date: Wed, 11 Jul 2018 17:40:25 -0400 Subject: Add Auth interoperability library. (#1501) * Add Auth interoperability library. This allows other SDKs to retrieve the user ID and fetch a new Auth token in a type-safe way through the Core container. * Remove unnecessary import. * Add missing copyright. * Resolve comments. - Remove unnecessary umbrella header. - Move to version 1.0. - Add tvOS support for app lifecycle changes. * Move public interop headers to private. * Add public_header_files too. * Moved headers back into public. * Shorten Interoperability and Interoperable to Interop. * Add AuthInterop to travis linting. * Fixed tag format in AuthInterop.podspec. * Add AuthInterop path to Firestore Podfile. --- Example/Auth/Tests/FIRAuthTests.m | 25 +++++++++++++++++++++++++ Example/Core/Tests/FIRAppTest.m | 1 + Example/Podfile | 1 + 3 files changed, 27 insertions(+) (limited to 'Example') diff --git a/Example/Auth/Tests/FIRAuthTests.m b/Example/Auth/Tests/FIRAuthTests.m index 6a047a4..c008bab 100644 --- a/Example/Auth/Tests/FIRAuthTests.m +++ b/Example/Auth/Tests/FIRAuthTests.m @@ -18,7 +18,11 @@ #import +#import +#import #import +#import +#import #import "FIRAdditionalUserInfo.h" #import "FIRAuth_Internal.h" @@ -221,6 +225,10 @@ static const NSTimeInterval kExpectationTimeout = 2; */ static const NSTimeInterval kWaitInterval = .5; +/** Category for FIRAuth to expose FIRComponentRegistrant conformance. */ +@interface FIRAuth () +@end + /** @class FIRAuthTests @brief Tests for @c FIRAuth. */ @@ -362,6 +370,8 @@ static const NSTimeInterval kWaitInterval = .5; @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]; @@ -2221,6 +2231,21 @@ static const NSTimeInterval kWaitInterval = .5; } #endif +#pragma mark - Interoperability Tests + +/** @fn testComponentsBeingRegistered + @brief Tests that Auth provides the necessary components for interoperability with other SDKs. + */ +- (void)testComponentsBeingRegistered { + // Verify that the components are registered properly. Check the count, because any time a new + // component is added it should be added to the test suite as well. + NSArray *components = [FIRAuth componentsToRegister]; + XCTAssertTrue(components.count == 1); + + FIRComponent *component = [components firstObject]; + XCTAssert(component.protocol == @protocol(FIRAuthInterop)); +} + #pragma mark - Helpers /** @fn mockSecureTokenResponseWithError: diff --git a/Example/Core/Tests/FIRAppTest.m b/Example/Core/Tests/FIRAppTest.m index 656f046..d88ed66 100644 --- a/Example/Core/Tests/FIRAppTest.m +++ b/Example/Core/Tests/FIRAppTest.m @@ -754,6 +754,7 @@ NSString *const kFIRTestAppName2 = @"test-app-name-2"; #pragma mark - Internal Methods +// TODO: Remove this test once the `getUIDImplementation` block doesn't need to be set in Core. - (void)testAuthGetUID { [FIRApp configure]; diff --git a/Example/Podfile b/Example/Podfile index dc3acd0..373471f 100644 --- a/Example/Podfile +++ b/Example/Podfile @@ -4,6 +4,7 @@ use_frameworks! +pod 'FirebaseAuthInterop', :path => '../' pod 'FirebaseCore', :path => '../' pod 'GoogleUtilities', :path => '../' -- cgit v1.2.3