Skip to content

Commit

Permalink
Fix FIROptions module organization (firebase#13765)
Browse files Browse the repository at this point in the history
  • Loading branch information
paulb777 authored Oct 2, 2024
1 parent b2f1e26 commit 8f44bbc
Show file tree
Hide file tree
Showing 33 changed files with 109 additions and 100 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/installations.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ jobs:
run: |
export FIS_INTEGRATION_TESTS_REQUIRED=${{ steps.secrets.outputs.val }}
scripts/third_party/travis/retry.sh scripts/pod_lib_lint.rb FirebaseInstallations.podspec \
--platforms=${{ matrix.target }} --test-specs=--platforms=${{ matrix.test-specs }}
--platforms=${{ matrix.target }} --test-specs=${{ matrix.test-specs }}
spm-package-resolved:
env:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,9 @@ - (void)setUp {

// Must initialize FIRApp before calling set experiment as Firebase Analytics internal event
// logging requires it.
NSDictionary *optionsDictionary = @{
kFIRGoogleAppID : @"1:123456789012:ios:1234567890123456",
@"GCM_SENDER_ID" : @"123456789012"
};
FIROptions *options = [[FIROptions alloc] initInternalWithOptionsDictionary:optionsDictionary];
FIROptions *options =
[[FIROptions alloc] initWithGoogleAppID:@"1:123456789012:ios:1234567890123456"
GCMSenderID:@"123456789012"];
[FIRApp configureWithOptions:options];
}

Expand Down
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
1 change: 1 addition & 0 deletions FirebaseAppDistribution/Sources/FIRFADLogger.m
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

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

FIRLoggerService kFIRLoggerAppDistribution = @"[FirebaseAppDistribution]";

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
3 changes: 3 additions & 0 deletions FirebaseCore/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Firebase 11.4.0
- [fixed] Fixed issue building documentation with some Firebase products. (#13756)

# Firebase 11.0.0
- [changed] **Breaking change**: Firebase's minimum supported versions have
updated for the following platforms:
Expand Down
21 changes: 21 additions & 0 deletions FirebaseCore/Extension/FIRAppInternal.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,27 @@ extern NSString *const kFIRAppNameKey;
extern NSString *const kFIRGoogleAppIDKey;
extern NSString *const kFirebaseCoreErrorDomain;

/**
* 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;

/**
* Keys for the plist file name
*/
extern NSString *const kServiceInfoFileName;

extern NSString *const kServiceInfoFileType;

/**
* The format string for the `UserDefaults` key used for storing the data collection enabled flag.
* This includes formatting to append the `FirebaseApp`'s name.
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
Original file line number Diff line number Diff line change
Expand Up @@ -14,28 +14,7 @@
* limitations under the License.
*/

#import <FirebaseCore/FIROptions.h>

/**
* 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;

/**
* Keys for the plist file name
*/
extern NSString *const kServiceInfoFileName;

extern NSString *const kServiceInfoFileType;
#import "FirebaseCore/Sources/Public/FirebaseCore/FIROptions.h"

/**
* This header file exposes the initialization of FirebaseOptions to internal use.
Expand Down
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
33 changes: 9 additions & 24 deletions FirebaseDynamicLinks/Sources/FIRDynamicLinks.m
Original file line number Diff line number Diff line change
Expand Up @@ -166,30 +166,15 @@ - (void)configureDynamicLinks:(FIRApp *)app {
userInfo:errorDict];
}
if (error) {
NSString *message = nil;
if (options.usingOptionsFromDefaultPlist) {
// Configured using plist file
message = [NSString
stringWithFormat:
@"Firebase Dynamic Links has stopped your project "
@"because there are missing or incorrect values provided in %@.%@ that may "
@"prevent your app from behaving as expected:\n\n"
@"Error: %@\n\n"
@"Please fix these issues to ensure that Firebase is correctly configured in "
@"your project.",
kServiceInfoFileName, kServiceInfoFileType, error.localizedFailureReason];
} else {
// Configured manually
message = [NSString
stringWithFormat:
@"Firebase Dynamic Links has stopped your project "
@"because there are incorrect values provided in Firebase's configuration "
@"options that may prevent your app from behaving as expected:\n\n"
@"Error: %@\n\n"
@"Please fix these issues to ensure that Firebase is correctly configured in "
@"your project.",
error.localizedFailureReason];
}
NSString *message =
[NSString stringWithFormat:
@"Firebase Dynamic Links has stopped your project "
@"because there are incorrect values provided in Firebase's configuration "
@"options that may prevent your app from behaving as expected:\n\n"
@"Error: %@\n\n"
@"Please fix these issues to ensure that Firebase is correctly configured in "
@"your project.",
error.localizedFailureReason];
[NSException raise:kFirebaseDurableDeepLinkErrorDomain format:@"%@", message];
}
[self checkForCustomDomainEntriesInInfoPlist];
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
Original file line number Diff line number Diff line change
Expand Up @@ -97,12 +97,10 @@ - (void)tearDown {
#pragma mark - Initialization

- (void)testInitWhenProjectIDSetThenItIsPassedToAPIService {
FIROptions *options = [[FIROptions alloc] initInternalWithOptionsDictionary:@{
kFIRAPIKey : @"api-key",
kFIRProjectID : @"project-id",
kFIRGoogleAppID : @"app-id",
kFIRGCMSenderID : @"sender-id"
}];
FIROptions *options = [[FIROptions alloc] initWithGoogleAppID:@"app-id" GCMSenderID:@"sender-id"];
options.projectID = @"project-id";
options.APIKey = @"api-key";

FIRApp *app = [[FIRApp alloc] initInstanceWithName:@"app-name" options:options];

OCMExpect([self.mockAPIService alloc]).andReturn(self.mockAPIService);
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: 4 additions & 0 deletions FirebaseMessaging/Tests/UnitTests/FIRMessagingTokenInfoTest.m
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@
static NSString *const kIID = @"eMP633ZkDYA";
static BOOL const kAPNSSandbox = NO;

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

@interface FIRMessagingTokenInfoTest : XCTestCase

@property(nonatomic, strong) NSData *APNSDeviceToken;
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
Loading

0 comments on commit 8f44bbc

Please sign in to comment.