1 |
efrain |
1 |
/*
|
|
|
2 |
* Copyright 2017 Google
|
|
|
3 |
*
|
|
|
4 |
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
5 |
* you may not use this file except in compliance with the License.
|
|
|
6 |
* You may obtain a copy of the License at
|
|
|
7 |
*
|
|
|
8 |
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
9 |
*
|
|
|
10 |
* Unless required by applicable law or agreed to in writing, software
|
|
|
11 |
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
12 |
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
13 |
* See the License for the specific language governing permissions and
|
|
|
14 |
* limitations under the License.
|
|
|
15 |
*/
|
|
|
16 |
|
|
|
17 |
#import <FirebaseCore/FIRApp.h>
|
|
|
18 |
|
|
|
19 |
@class FIRComponentContainer;
|
|
|
20 |
@protocol FIRLibrary;
|
|
|
21 |
|
|
|
22 |
/**
|
|
|
23 |
* The internal interface to `FirebaseApp`. This is meant for first-party integrators, who need to
|
|
|
24 |
* receive `FirebaseApp` notifications, log info about the success or failure of their
|
|
|
25 |
* configuration, and access other internal functionality of `FirebaseApp`.
|
|
|
26 |
*
|
|
|
27 |
* TODO(b/28296561): Restructure this header.
|
|
|
28 |
*/
|
|
|
29 |
NS_ASSUME_NONNULL_BEGIN
|
|
|
30 |
|
|
|
31 |
typedef NS_ENUM(NSInteger, FIRConfigType) {
|
|
|
32 |
FIRConfigTypeCore = 1,
|
|
|
33 |
FIRConfigTypeSDK = 2,
|
|
|
34 |
};
|
|
|
35 |
|
|
|
36 |
extern NSString *const kFIRDefaultAppName;
|
|
|
37 |
extern NSString *const kFIRAppReadyToConfigureSDKNotification;
|
|
|
38 |
extern NSString *const kFIRAppDeleteNotification;
|
|
|
39 |
extern NSString *const kFIRAppIsDefaultAppKey;
|
|
|
40 |
extern NSString *const kFIRAppNameKey;
|
|
|
41 |
extern NSString *const kFIRGoogleAppIDKey;
|
|
|
42 |
extern NSString *const kFirebaseCoreErrorDomain;
|
|
|
43 |
|
|
|
44 |
/** The `UserDefaults` suite name for `FirebaseCore`, for those storage locations that use it. */
|
|
|
45 |
extern NSString *const kFirebaseCoreDefaultsSuiteName;
|
|
|
46 |
|
|
|
47 |
/**
|
|
|
48 |
* The format string for the `UserDefaults` key used for storing the data collection enabled flag.
|
|
|
49 |
* This includes formatting to append the `FirebaseApp`'s name.
|
|
|
50 |
*/
|
|
|
51 |
extern NSString *const kFIRGlobalAppDataCollectionEnabledDefaultsKeyFormat;
|
|
|
52 |
|
|
|
53 |
/**
|
|
|
54 |
* The plist key used for storing the data collection enabled flag.
|
|
|
55 |
*/
|
|
|
56 |
extern NSString *const kFIRGlobalAppDataCollectionEnabledPlistKey;
|
|
|
57 |
|
|
|
58 |
/** @var FirebaseAuthStateDidChangeInternalNotification
|
|
|
59 |
@brief The name of the @c NotificationCenter notification which is posted when the auth state
|
|
|
60 |
changes (e.g. a new token has been produced, a user logs in or out). The object parameter of
|
|
|
61 |
the notification is a dictionary possibly containing the key:
|
|
|
62 |
@c FirebaseAuthStateDidChangeInternalNotificationTokenKey (the new access token.) If it does not
|
|
|
63 |
contain this key it indicates a sign-out event took place.
|
|
|
64 |
*/
|
|
|
65 |
extern NSString *const FIRAuthStateDidChangeInternalNotification;
|
|
|
66 |
|
|
|
67 |
/** @var FirebaseAuthStateDidChangeInternalNotificationTokenKey
|
|
|
68 |
@brief A key present in the dictionary object parameter of the
|
|
|
69 |
@c FirebaseAuthStateDidChangeInternalNotification notification. The value associated with this
|
|
|
70 |
key will contain the new access token.
|
|
|
71 |
*/
|
|
|
72 |
extern NSString *const FIRAuthStateDidChangeInternalNotificationTokenKey;
|
|
|
73 |
|
|
|
74 |
/** @var FirebaseAuthStateDidChangeInternalNotificationAppKey
|
|
|
75 |
@brief A key present in the dictionary object parameter of the
|
|
|
76 |
@c FirebaseAuthStateDidChangeInternalNotification notification. The value associated with this
|
|
|
77 |
key will contain the FirebaseApp associated with the auth instance.
|
|
|
78 |
*/
|
|
|
79 |
extern NSString *const FIRAuthStateDidChangeInternalNotificationAppKey;
|
|
|
80 |
|
|
|
81 |
/** @var FirebaseAuthStateDidChangeInternalNotificationUIDKey
|
|
|
82 |
@brief A key present in the dictionary object parameter of the
|
|
|
83 |
@c FirebaseAuthStateDidChangeInternalNotification notification. The value associated with this
|
|
|
84 |
key will contain the new user's UID (or nil if there is no longer a user signed in).
|
|
|
85 |
*/
|
|
|
86 |
extern NSString *const FIRAuthStateDidChangeInternalNotificationUIDKey;
|
|
|
87 |
|
|
|
88 |
@interface FIRApp ()
|
|
|
89 |
|
|
|
90 |
/**
|
|
|
91 |
* A flag indicating if this is the default app (has the default app name).
|
|
|
92 |
*/
|
|
|
93 |
@property(nonatomic, readonly) BOOL isDefaultApp;
|
|
|
94 |
|
|
|
95 |
/*
|
|
|
96 |
* The container of interop SDKs for this app.
|
|
|
97 |
*/
|
|
|
98 |
@property(nonatomic) FIRComponentContainer *container;
|
|
|
99 |
|
|
|
100 |
/**
|
|
|
101 |
* Checks if the default app is configured without trying to configure it.
|
|
|
102 |
*/
|
|
|
103 |
+ (BOOL)isDefaultAppConfigured;
|
|
|
104 |
|
|
|
105 |
/**
|
|
|
106 |
* Registers a given third-party library with the given version number to be reported for
|
|
|
107 |
* analytics.
|
|
|
108 |
*
|
|
|
109 |
* @param name Name of the library.
|
|
|
110 |
* @param version Version of the library.
|
|
|
111 |
*/
|
|
|
112 |
+ (void)registerLibrary:(nonnull NSString *)name withVersion:(nonnull NSString *)version;
|
|
|
113 |
|
|
|
114 |
/**
|
|
|
115 |
* Registers a given internal library to be reported for analytics.
|
|
|
116 |
*
|
|
|
117 |
* @param library Optional parameter for component registration.
|
|
|
118 |
* @param name Name of the library.
|
|
|
119 |
*/
|
|
|
120 |
+ (void)registerInternalLibrary:(nonnull Class<FIRLibrary>)library
|
|
|
121 |
withName:(nonnull NSString *)name;
|
|
|
122 |
|
|
|
123 |
/**
|
|
|
124 |
* Registers a given internal library with the given version number to be reported for
|
|
|
125 |
* analytics. This should only be used for non-Firebase libraries that have their own versioning
|
|
|
126 |
* scheme.
|
|
|
127 |
*
|
|
|
128 |
* @param library Optional parameter for component registration.
|
|
|
129 |
* @param name Name of the library.
|
|
|
130 |
* @param version Version of the library.
|
|
|
131 |
*/
|
|
|
132 |
+ (void)registerInternalLibrary:(nonnull Class<FIRLibrary>)library
|
|
|
133 |
withName:(nonnull NSString *)name
|
|
|
134 |
withVersion:(nonnull NSString *)version;
|
|
|
135 |
|
|
|
136 |
/**
|
|
|
137 |
* A concatenated string representing all the third-party libraries and version numbers.
|
|
|
138 |
*/
|
|
|
139 |
+ (NSString *)firebaseUserAgent;
|
|
|
140 |
|
|
|
141 |
/**
|
|
|
142 |
* Can be used by the unit tests in each SDK to reset `FirebaseApp`. This method is thread unsafe.
|
|
|
143 |
*/
|
|
|
144 |
+ (void)resetApps;
|
|
|
145 |
|
|
|
146 |
/**
|
|
|
147 |
* Can be used by the unit tests in each SDK to set customized options.
|
|
|
148 |
*/
|
|
|
149 |
- (instancetype)initInstanceWithName:(NSString *)name options:(FIROptions *)options;
|
|
|
150 |
|
|
|
151 |
@end
|
|
|
152 |
|
|
|
153 |
NS_ASSUME_NONNULL_END
|