Skip to content

Commit

Permalink
Fix FIROptions module organization
Browse files Browse the repository at this point in the history
  • Loading branch information
paulb777 committed Oct 1, 2024
1 parent bb71115 commit 47bfe02
Show file tree
Hide file tree
Showing 26 changed files with 64 additions and 42 deletions.
24 changes: 11 additions & 13 deletions FirebaseAppCheck/Tests/Unit/Core/FIRAppCheckValidatorTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,18 @@
#import <XCTest/XCTest.h>

#import "FirebaseAppCheck/Sources/Core/FIRAppCheckValidator.h"
#import "FirebaseCore/Extension/FIROptionsInternal.h"
#import "FirebaseCore/Sources/Public/FirebaseCore/FIROptions.h"

@interface FIRAppCheckValidatorTests : XCTestCase
@end

@implementation FIRAppCheckValidatorTests

- (void)test_tokenExchangeMissingFieldsInOptions_noMissingFields {
FIROptions *options = [[FIROptions alloc] initInternalWithOptionsDictionary:@{
kFIRGoogleAppID : @"TEST_GoogleAppID",
kFIRAPIKey : @"TEST_APIKey",
kFIRProjectID : @"TEST_ProjectID"
}];
FIROptions *options = [[FIROptions alloc] initWithGoogleAppID:@"TEST_GoogleAppID"
GCMSenderID:@"TEST_GCMSenderID"];
options.APIKey = @"TEST_APIKey";
options.projectID = @"TEST_ProjectID";

NSArray *missingFields = [FIRAppCheckValidator tokenExchangeMissingFieldsInOptions:options];

Expand All @@ -38,11 +37,10 @@ - (void)test_tokenExchangeMissingFieldsInOptions_noMissingFields {

- (void)test_tokenExchangeMissingFieldsInOptions_singleMissingField {
// Google App ID is empty:
FIROptions *options = [[FIROptions alloc] initInternalWithOptionsDictionary:@{
kFIRGoogleAppID : @"",
kFIRAPIKey : @"TEST_APIKey",
kFIRProjectID : @"TEST_ProjectID"
}];
FIROptions *options = [[FIROptions alloc] initWithGoogleAppID:@""
GCMSenderID:@"TEST_GCMSenderID"];
options.APIKey = @"TEST_APIKey";
options.projectID = @"TEST_ProjectID";

NSArray *missingFields = [FIRAppCheckValidator tokenExchangeMissingFieldsInOptions:options];

Expand All @@ -51,8 +49,8 @@ - (void)test_tokenExchangeMissingFieldsInOptions_singleMissingField {

- (void)test_tokenExchangeMissingFieldsInOptions_multipleMissingFields {
// Google App ID is empty, and API Key and Project ID are not set:
FIROptions *options =
[[FIROptions alloc] initInternalWithOptionsDictionary:@{kFIRGoogleAppID : @""}];
FIROptions *options = [[FIROptions alloc] initWithGoogleAppID:@""
GCMSenderID:@"TEST_GCMSenderID"];

NSArray *missingFields = [FIRAppCheckValidator tokenExchangeMissingFieldsInOptions:options];

Expand Down
4 changes: 2 additions & 2 deletions FirebaseAuth.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ supports email and password accounts, as well as several 3rd party authenticatio
s.ios.framework = 'SafariServices'
s.dependency 'FirebaseAuthInterop', '~> 11.0'
s.dependency 'FirebaseAppCheckInterop', '~> 11.0'
s.dependency 'FirebaseCore', '~> 11.0'
s.dependency 'FirebaseCoreExtension', '~> 11.0'
s.dependency 'FirebaseCore', '~> 11.4'
s.dependency 'FirebaseCoreExtension', '~> 11.4'
s.dependency 'GoogleUtilities/AppDelegateSwizzler', '~> 8.0'
s.dependency 'GoogleUtilities/Environment', '~> 8.0'
s.dependency 'GTMSessionFetcher/Core', '>= 3.4', '< 5.0'
Expand Down
4 changes: 2 additions & 2 deletions FirebaseCore/Extension/FIRLogger.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

#import <Foundation/Foundation.h>

#import <FirebaseCore/FIRLoggerLevel.h>
typedef NS_ENUM(NSInteger, FIRLoggerLevel);

NS_ASSUME_NONNULL_BEGIN

Expand Down Expand Up @@ -132,7 +132,7 @@ NS_SWIFT_NAME(FirebaseLogger)
///
/// - Parameters:
/// - level: The log level to use (defined by `FirebaseLoggerLevel` enum values).
/// - service: The service name of type `FirebaseLoggerService`.
/// - category: The service name of type `FirebaseLoggerService`.
/// - code: The message code. Starting with "I-" which means iOS, followed by a capitalized
/// three-character service identifier and a six digit integer message ID that is unique within
/// the service. An example of the message code is @"I-COR000001".
Expand Down
1 change: 0 additions & 1 deletion FirebaseCore/Extension/FirebaseCoreInternal.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,3 @@
#import "FIRHeartbeatLogger.h"
#import "FIRLibrary.h"
#import "FIRLogger.h"
#import "FIROptionsInternal.h"
3 changes: 2 additions & 1 deletion FirebaseCore/Sources/FIRApp.m
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@
#import "FirebaseCore/Extension/FIRHeartbeatLogger.h"
#import "FirebaseCore/Extension/FIRLibrary.h"
#import "FirebaseCore/Extension/FIRLogger.h"
#import "FirebaseCore/Extension/FIROptionsInternal.h"
#import "FirebaseCore/Sources/FIROptionsInternal.h"
#import "FirebaseCore/Sources/Public/FirebaseCore/FIROptions.h"
#import "FirebaseCore/Sources/Public/FirebaseCore/FIRVersion.h"

#import <GoogleUtilities/GULAppEnvironmentUtil.h>
Expand Down
3 changes: 2 additions & 1 deletion FirebaseCore/Sources/FIRComponentContainer.m
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
#import "FirebaseCore/Extension/FIRComponent.h"
#import "FirebaseCore/Extension/FIRLibrary.h"
#import "FirebaseCore/Extension/FIRLogger.h"
#import "FirebaseCore/Extension/FIROptionsInternal.h"
#import "FirebaseCore/Sources/FIROptionsInternal.h"
#import "FirebaseCore/Sources/Public/FirebaseCore/FIROptions.h"

NS_ASSUME_NONNULL_BEGIN

Expand Down
2 changes: 1 addition & 1 deletion FirebaseCore/Sources/FIROptions.m
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@

#import "FirebaseCore/Extension/FIRAppInternal.h"
#import "FirebaseCore/Extension/FIRLogger.h"
#import "FirebaseCore/Extension/FIROptionsInternal.h"
#import "FirebaseCore/Sources/FIRBundleUtil.h"
#import "FirebaseCore/Sources/FIROptionsInternal.h"
#import "FirebaseCore/Sources/Public/FirebaseCore/FIRVersion.h"

// Keys for the strings in the plist file.
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion FirebaseCore/Tests/Unit/FIRAppTest.m
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
#import "FirebaseCore/Extension/FIRAppInternal.h"
#import "FirebaseCore/Extension/FIRComponentType.h"
#import "FirebaseCore/Extension/FIRHeartbeatLogger.h"
#import "FirebaseCore/Extension/FIROptionsInternal.h"
#import "FirebaseCore/Sources/FIRAnalyticsConfiguration.h"
#import "FirebaseCore/Sources/FIROptionsInternal.h"
#import "SharedTestUtilities/FIROptionsMock.h"

NSString *const kFIRTestAppName1 = @"test_app_name_1";
Expand Down
1 change: 1 addition & 0 deletions FirebaseCore/Tests/Unit/FIRLoggerTest.m
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
// No test should include both includes.
#import <GoogleUtilities/GULLogger.h>
#import "FirebaseCore/Extension/FIRLogger.h"
#import "FirebaseCore/Sources/Public/FirebaseCore/FIRLoggerLevel.h"

#import <asl.h>

Expand Down
2 changes: 1 addition & 1 deletion FirebaseCore/Tests/Unit/FIROptionsTest.m
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
#import "FirebaseCore/Tests/Unit/FIRTestCase.h"

#import "FirebaseCore/Extension/FIRAppInternal.h"
#import "FirebaseCore/Extension/FIROptionsInternal.h"
#import "FirebaseCore/Sources/FIRBundleUtil.h"
#import "FirebaseCore/Sources/FIROptionsInternal.h"
#import "FirebaseCore/Sources/Public/FirebaseCore/FIRVersion.h"
#import "SharedTestUtilities/FIROptionsMock.h"

Expand Down
2 changes: 1 addition & 1 deletion FirebaseCrashlytics.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ Pod::Spec.new do |s|
cp -f ./Crashlytics/CrashlyticsInputFiles.xcfilelist ./CrashlyticsInputFiles.xcfilelist
PREPARE_COMMAND_END

s.dependency 'FirebaseCore', '~> 11.0'
s.dependency 'FirebaseCore', '~> 11.4'
s.dependency 'FirebaseInstallations', '~> 11.0'
s.dependency 'FirebaseSessions', '~> 11.0'
s.dependency 'FirebaseRemoteConfigInterop', '~> 11.0'
Expand Down
4 changes: 2 additions & 2 deletions FirebaseFirestore.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ Google Cloud Firestore is a NoSQL document database built for automatic scaling,
"#{s.module_name}_Privacy" => 'Firestore/Swift/Source/Resources/PrivacyInfo.xcprivacy'
}

s.dependency 'FirebaseCore', '~> 11.0'
s.dependency 'FirebaseCoreExtension', '~> 11.0'
s.dependency 'FirebaseCore', '~> 11.4'
s.dependency 'FirebaseCoreExtension', '~> 11.4'
s.dependency 'FirebaseFirestoreInternal', '11.4.0'
s.dependency 'FirebaseSharedSwift', '~> 11.0'

Expand Down
4 changes: 2 additions & 2 deletions FirebaseFunctions.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ Cloud Functions for Firebase.
'FirebaseFunctions/Sources/**/*.swift',
]

s.dependency 'FirebaseCore', '~> 11.0'
s.dependency 'FirebaseCoreExtension', '~> 11.0'
s.dependency 'FirebaseCore', '~> 11.4'
s.dependency 'FirebaseCoreExtension', '~> 11.4'
s.dependency 'FirebaseAppCheckInterop', '~> 11.0'
s.dependency 'FirebaseAuthInterop', '~> 11.0'
s.dependency 'FirebaseMessagingInterop', '~> 11.0'
Expand Down
4 changes: 2 additions & 2 deletions FirebaseMLModelDownloader.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ Pod::Spec.new do |s|
]

s.framework = 'Foundation'
s.dependency 'FirebaseCore', '~> 11.0'
s.dependency 'FirebaseCoreExtension', '~> 11.0'
s.dependency 'FirebaseCore', '~> 11.4'
s.dependency 'FirebaseCoreExtension', '~> 11.4'
s.dependency 'FirebaseInstallations', '~> 11.0'
s.dependency 'GoogleDataTransport', '~> 10.0'
s.dependency 'GoogleUtilities/UserDefaults', '~> 8.0'
Expand Down
4 changes: 2 additions & 2 deletions FirebaseSessions.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ Pod::Spec.new do |s|
base_dir + 'SourcesObjC/**/*.{c,h,m,mm}',
]

s.dependency 'FirebaseCore', '~> 11.0'
s.dependency 'FirebaseCoreExtension', '~> 11.0'
s.dependency 'FirebaseCore', '~> 11.4'
s.dependency 'FirebaseCoreExtension', '~> 11.4'
s.dependency 'FirebaseInstallations', '~> 11.0'
s.dependency 'GoogleDataTransport', '~> 10.0'
s.dependency 'GoogleUtilities/Environment', '~> 8.0'
Expand Down
4 changes: 2 additions & 2 deletions FirebaseStorage.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ Firebase Storage provides robust, secure file uploads and downloads from Firebas

s.dependency 'FirebaseAppCheckInterop', '~> 11.0'
s.dependency 'FirebaseAuthInterop', '~> 11.0'
s.dependency 'FirebaseCore', '~> 11.0'
s.dependency 'FirebaseCoreExtension', '~> 11.0'
s.dependency 'FirebaseCore', '~> 11.4'
s.dependency 'FirebaseCoreExtension', '~> 11.4'
s.dependency 'GTMSessionFetcher/Core', '>= 3.4', '< 5.0'
s.dependency 'GoogleUtilities/Environment', '~> 8.0'

Expand Down
4 changes: 2 additions & 2 deletions FirebaseVertexAI.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ the Vertex AI in Firebase SDK.

s.dependency 'FirebaseAppCheckInterop', '~> 11.2'
s.dependency 'FirebaseAuthInterop', '~> 11.2'
s.dependency 'FirebaseCore', '~> 11.2'
s.dependency 'FirebaseCoreExtension', '~> 11.2'
s.dependency 'FirebaseCore', '~> 11.4'
s.dependency 'FirebaseCoreExtension', '~> 11.4'

s.test_spec 'unit' do |unit_tests|
unit_tests_dir = 'FirebaseVertexAI/Tests/Unit/'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#include <limits>

#import "FirebaseCore/Extension/FIRAppInternal.h"
#import "FirebaseCore/Extension/FIROptionsInternal.h"
#import "FirebaseCore/Sources/Public/FirebaseCore/FIROptions.h"
#import "Firestore/Example/Tests/Util/FSTHelpers.h"
#import "Firestore/Example/Tests/Util/FSTIntegrationTestCase.h"
#import "Firestore/Source/API/FIRFirestore+Internal.h"
Expand Down
3 changes: 2 additions & 1 deletion Firestore/Example/Tests/Util/FSTIntegrationTestCase.mm
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@

#import "FirebaseCore/Extension/FIRAppInternal.h"
#import "FirebaseCore/Extension/FIRLogger.h"
#import "FirebaseCore/Extension/FIROptionsInternal.h"
#import "FirebaseCore/Sources/Public/FirebaseCore/FIRLoggerLevel.h"
#import "FirebaseCore/Sources/Public/FirebaseCore/FIROptions.h"
#import "Firestore/Example/Tests/Util/FIRFirestore+Testing.h"
#import "Firestore/Example/Tests/Util/FSTEventAccumulator.h"
#import "Firestore/Source/API/FIRAggregateQuery+Internal.h"
Expand Down
2 changes: 1 addition & 1 deletion Firestore/Source/API/FSTFirestoreComponent.mm
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
#import "FirebaseCore/Extension/FIRComponentContainer.h"
#import "FirebaseCore/Extension/FIRComponentType.h"
#import "FirebaseCore/Extension/FIRLibrary.h"
#import "FirebaseCore/Extension/FIROptionsInternal.h"
#import "FirebaseCore/Sources/Public/FirebaseCore/FIROptions.h"
#import "Firestore/Source/API/FIRFirestore+Internal.h"

#include "Firestore/core/include/firebase/firestore/firestore_version.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

#import "FirebaseCore/Extension/FIRAppInternal.h"
#import "FirebaseCore/Extension/FIRHeartbeatLogger.h"
#import "FirebaseCore/Extension/FIROptionsInternal.h"
#import "FirebaseCore/Sources/Public/FirebaseCore/FIROptions.h"

#include "Firestore/core/src/util/string_apple.h"

Expand Down
1 change: 1 addition & 0 deletions Firestore/core/src/util/log_apple.mm
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include <string>

#import "FirebaseCore/Extension/FIRLogger.h"
#import "FirebaseCore/Sources/Public/FirebaseCore/FIRLoggerLevel.h"

#include "Firestore/core/src/util/string_apple.h"

Expand Down
2 changes: 1 addition & 1 deletion Firestore/core/test/unit/testutil/app_testing.mm
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/

#import "FirebaseCore/Extension/FIRAppInternal.h"
#import "FirebaseCore/Extension/FIROptionsInternal.h"
#import "FirebaseCore/Sources/Public/FirebaseCore/FIROptions.h"

#include "Firestore/core/src/util/string_apple.h"
#include "Firestore/core/test/unit/testutil/app_testing.h"
Expand Down
2 changes: 2 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
# commit Gemfile and Gemfile.lock.
source 'https://rubygems.org'

#TODO: revert before merge

# To test CocoaPods pre-releases, update to a relevant commit or tag like below
# cocoapods-core and xcodeproj may or may not also need tags. For additional
# testing, enable the cron jobs with a global search and replace from your
Expand Down
20 changes: 19 additions & 1 deletion SharedTestUtilities/FIROptionsMock.m
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

#import <OCMock/OCMock.h>

#import "FirebaseCore/Extension/FIROptionsInternal.h"
#import "FirebaseCore/Sources/Public/FirebaseCore/FIROptions.h"
#import "SharedTestUtilities/FIROptionsMock.h"

NSString *const kAPIKey = @"correct_api_key";
Expand All @@ -31,6 +31,24 @@
NSString *const kBundleID = @"com.google.FirebaseSDKTests";
NSString *const kProjectID = @"abc-xyz-123";

/**
* Keys for the strings in the plist file.
*/
extern NSString *const kFIRAPIKey;
extern NSString *const kFIRTrackingID;
extern NSString *const kFIRGoogleAppID;
extern NSString *const kFIRClientID;
extern NSString *const kFIRGCMSenderID;
extern NSString *const kFIRAndroidClientID;
extern NSString *const kFIRDatabaseURL;
extern NSString *const kFIRStorageBucket;
extern NSString *const kFIRBundleID;
extern NSString *const kFIRProjectID;

@interface FIROptions ()
+ (NSDictionary *)defaultOptionsDictionary;
@end

@interface FIROptionsMock ()

@end
Expand Down

0 comments on commit 47bfe02

Please sign in to comment.