|
16 | 16 |
|
17 | 17 | #import <Foundation/Foundation.h>
|
18 | 18 |
|
| 19 | +#import <FirebaseAuthInterop/FIRAuthInterop.h> |
19 | 20 | #import <FirebaseCore/FIRAppInternal.h>
|
| 21 | +#import <FirebaseCore/FIRComponent.h> |
| 22 | +#import <FirebaseCore/FIRComponentContainer.h> |
| 23 | +#import <FirebaseCore/FIRDependency.h> |
20 | 24 | #import <FirebaseCore/FIRLogger.h>
|
| 25 | +#import <FirebaseCore/FIROptions.h> |
21 | 26 |
|
22 | 27 | #import "FIRDatabase.h"
|
23 |
| -#import "FIRDatabase_Private.h" |
| 28 | +#import "FIRDatabaseConfig_Private.h" |
24 | 29 | #import "FIRDatabaseQuery_Private.h"
|
| 30 | +#import "FIRDatabaseReference_Private.h" |
| 31 | +#import "FIRDatabase_Private.h" |
| 32 | +#import "FRepoInfo.h" |
25 | 33 | #import "FRepoManager.h"
|
26 | 34 | #import "FValidation.h"
|
27 |
| -#import "FIRDatabaseConfig_Private.h" |
28 |
| -#import "FRepoInfo.h" |
29 |
| -#import "FIRDatabaseConfig.h" |
30 |
| -#import "FIRDatabaseReference_Private.h" |
31 |
| -#import <FirebaseCore/FIROptions.h> |
32 | 35 |
|
33 | 36 | @interface FIRDatabase ()
|
34 | 37 | @property (nonatomic, strong) FRepoInfo *repoInfo;
|
35 | 38 | @property (nonatomic, strong) FIRDatabaseConfig *config;
|
36 | 39 | @property (nonatomic, strong) FRepo *repo;
|
37 | 40 | @end
|
38 | 41 |
|
| 42 | + |
| 43 | +// Empty protocol for use with Interop registration. |
| 44 | +@protocol FIRDatabaseNilProtocol |
| 45 | +@end |
| 46 | + |
39 | 47 | @implementation FIRDatabase
|
40 | 48 |
|
41 | 49 | /** A NSMutableDictionary of FirebaseApp name and FRepoInfo to FirebaseDatabase instance. */
|
@@ -69,6 +77,23 @@ + (void)load {
|
69 | 77 | }
|
70 | 78 | }
|
71 | 79 | }];
|
| 80 | + [FIRComponentContainer registerAsComponentRegistrant:self]; |
| 81 | +} |
| 82 | + |
| 83 | ++ (NSArray<FIRComponent *> *)componentsToRegister { |
| 84 | + FIRDependency *auth = |
| 85 | + [FIRDependency dependencyWithProtocol:@protocol(FIRAuthInterop) |
| 86 | + isRequired:NO]; |
| 87 | + FIRComponentCreationBlock creationBlock = |
| 88 | + ^id _Nullable(FIRComponentContainer *container, BOOL *isCacheable) { |
| 89 | + return [self databaseForApp:container.app]; |
| 90 | + }; |
| 91 | + FIRComponent *databaseProvider = |
| 92 | + [FIRComponent componentWithProtocol:@protocol(FIRDatabaseNilProtocol) |
| 93 | + instantiationTiming:FIRInstantiationTimingLazy |
| 94 | + dependencies:@[ auth ] |
| 95 | + creationBlock:creationBlock]; |
| 96 | + return @[ databaseProvider ]; |
72 | 97 | }
|
73 | 98 |
|
74 | 99 | /**
|
|
0 commit comments