Skip to content

Commit ed6aae1

Browse files
committed
fixes
1 parent 4c44769 commit ed6aae1

File tree

8 files changed

+68
-11
lines changed

8 files changed

+68
-11
lines changed

FirebaseCore/InternalObjC/FIRComponentContainer.m

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,33 @@
2222

2323
NS_ASSUME_NONNULL_BEGIN
2424

25+
@interface FIRComponentContainer (Private)
26+
27+
/// Initializes a container for a given app. This should only be called by the app itself.
28+
- (instancetype)initWithApp:(FIRApp *)app
29+
isDefaultApp:(BOOL)isDefaultApp
30+
isAppForARCore:(BOOL)isAppForARCore;
31+
32+
/// Retrieves an instance that conforms to the specified protocol. This will return `nil` if the
33+
/// protocol wasn't registered, or if the instance couldn't be instantiated for the provided app.
34+
- (nullable id)instanceForProtocol:(Protocol *)protocol
35+
NS_SWIFT_UNAVAILABLE("Use `instance(for:)` from the FirebaseCoreExtension module instead.");
36+
37+
/// Instantiates all the components that have registered as "eager" after initialization.
38+
- (void)instantiateEagerComponents;
39+
40+
/// Remove all of the cached instances stored and allow them to clean up after themselves.
41+
- (void)removeAllCachedInstances;
42+
43+
/// Removes all the components. After calling this method no new instances will be created.
44+
- (void)removeAllComponents;
45+
46+
/// Register a class to provide components for the interoperability system. The class should conform
47+
/// to `FIRComponentRegistrant` and provide an array of `FIRComponent` objects.
48+
+ (void)registerAsComponentRegistrant:(Class<FIRLibrary>)klass;
49+
50+
@end
51+
2552
@interface FIRComponentContainer ()
2653

2754
/// The dictionary of components that are registered for a particular app. The key is an `NSString`

FirebaseCore/InternalObjC/FIRComponentType.m

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,15 @@
1616

1717
#import "FirebaseCore/InternalObjC/FIRComponentType.h"
1818

19-
#import "FirebaseCore/InternalObjC/FIRComponentContainerInternal.h"
19+
#import "FirebaseCore/InternalObjC/FIRComponentContainer.h"
20+
21+
@interface FIRComponentContainer (InstanceForProtocol)
22+
23+
/// Retrieves an instance that conforms to the specified protocol. This will return `nil` if the
24+
/// protocol wasn't registered, or if the instance couldn't be instantiated for the provided app.
25+
- (nullable id)instanceForProtocol:(Protocol *)protocol
26+
NS_SWIFT_UNAVAILABLE("Use `instance(for:)` from the FirebaseCoreExtension module instead.");
27+
@end
2028

2129
@implementation FIRComponentType
2230

FirebaseCore/Sources/FIRApp.m

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,22 +28,23 @@
2828

2929
#import "FirebaseCore/Sources/Public/FirebaseCore/FIRApp.h"
3030

31+
@import FirebaseCoreInternal;
32+
#if SWIFT_PACKAGE
33+
@import FirebaseCoreInternalObjC;
34+
#endif
35+
3136
#import "FirebaseCore/Sources/FIRAnalyticsConfiguration.h"
3237
#import "FirebaseCore/Sources/FIRBundleUtil.h"
3338
#import "FirebaseCore/Sources/FIRConfigurationInternal.h"
3439
#import "FirebaseCore/Sources/FIRFirebaseUserAgent.h"
3540

3641
#import "FirebaseCore/Extension/FIRAppInternal.h"
3742
#import "FirebaseCore/Extension/FIRHeartbeatLogger.h"
43+
#import "FirebaseCore/Sources/FIRComponentContainerInternal.h"
3844
#import "FirebaseCore/Sources/FIROptionsInternal.h"
3945
#import "FirebaseCore/Sources/Public/FirebaseCore/FIROptions.h"
4046
#import "FirebaseCore/Sources/Public/FirebaseCore/FIRVersion.h"
4147

42-
@import FirebaseCoreInternal;
43-
#if SWIFT_PACKAGE
44-
@import FirebaseCoreInternalObjC;
45-
#endif
46-
4748
#import <GoogleUtilities/GULAppEnvironmentUtil.h>
4849

4950
#import <objc/runtime.h>

FirebaseCore/InternalObjC/FIRComponentContainerInternal.h renamed to FirebaseCore/Sources/FIRComponentContainerInternal.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,12 @@
1515
*/
1616
#import <Foundation/Foundation.h>
1717

18-
#import "FIRComponentContainer.h"
18+
@import FirebaseCoreInternal;
19+
#ifdef SWIFT_PACKAGE
20+
@import FirebaseCoreInternalObjC;
21+
#else
22+
@import FirebaseCoreInternal;
23+
#endif
1924

2025
@class FIRApp;
2126
@protocol FIRLibrary;

FirebaseCore/Tests/Unit/FIRComponentContainerTest.m

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616

1717
#import "FirebaseCore/Extension/FIRAppInternal.h"
1818
#import "FirebaseCore/InternalObjC/FIRComponentContainer.h"
19-
#import "FirebaseCore/InternalObjC/FIRComponentContainerInternal.h"
2019
#import "FirebaseCore/InternalObjC/FIRComponentType.h"
2120
#import "FirebaseCore/Tests/Unit/FIRTestComponents.h"
2221
#import "SharedTestUtilities/FIROptionsMock.h"
@@ -34,6 +33,16 @@ + (void)registerAsComponentRegistrant:(Class<FIRLibrary>)klass
3433
- (instancetype)initWithApp:(FIRApp *)app
3534
isDefaultApp:(BOOL)isDefaultApp
3635
registrants:(NSMutableSet<Class> *)allRegistrants;
36+
37+
/// Instantiates all the components that have registered as "eager" after initialization.
38+
- (void)instantiateEagerComponents;
39+
40+
/// Remove all of the cached instances stored and allow them to clean up after themselves.
41+
- (void)removeAllCachedInstances;
42+
43+
/// Removes all the components. After calling this method no new instances will be created.
44+
- (void)removeAllComponents;
45+
3746
@end
3847

3948
@interface FIRComponentContainer (TestInternalImplementations)

FirebaseCore/Tests/Unit/FIRComponentTypeTest.m

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,19 @@
1414

1515
#import "FirebaseCore/Tests/Unit/FIRTestCase.h"
1616

17-
#import "FirebaseCore/InternalObjC/FIRComponentContainerInternal.h"
1817
#import "FirebaseCore/InternalObjC/FIRComponentType.h"
1918

2019
#import "FirebaseCore/Tests/Unit/FIRTestComponents.h"
2120

21+
@interface FIRComponentContainer (Private)
22+
23+
/// Retrieves an instance that conforms to the specified protocol. This will return `nil` if the
24+
/// protocol wasn't registered, or if the instance couldn't be instantiated for the provided app.
25+
- (nullable id)instanceForProtocol:(Protocol *)protocol
26+
NS_SWIFT_UNAVAILABLE("Use `instance(for:)` from the FirebaseCoreExtension module instead.");
27+
28+
@end
29+
2230
@interface FIRComponentTypeTest : FIRTestCase
2331

2432
@property(nonatomic, strong) id componentContainerMock;

FirebaseCore/Tests/Unit/FIRTestComponents.m

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616

1717
#import "FirebaseCore/Extension/FIRAppInternal.h"
1818
#import "FirebaseCore/InternalObjC/FIRComponentContainer.h"
19-
#import "FirebaseCore/InternalObjC/FIRComponentContainerInternal.h"
2019
#import "FirebaseCore/InternalObjC/FIRComponentType.h"
2120
#import "FirebaseCore/Tests/Unit/FIRTestComponents.h"
2221

FirebaseStorage/Tests/Unit/StorageComponentTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
import Foundation
1616

1717
import FirebaseCore
18-
import FirebaseCoreExtension
18+
@_implementationOnly import FirebaseCoreExtension
1919
@testable import FirebaseStorage
2020

2121
import FirebaseAppCheckInterop

0 commit comments

Comments
 (0)