commit | author | age
|
a6c014
|
1 |
/* |
L |
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 <Foundation/Foundation.h> |
|
18 |
|
|
19 |
@class FIROptions; |
|
20 |
|
|
21 |
NS_ASSUME_NONNULL_BEGIN |
|
22 |
|
|
23 |
/** A block that takes a BOOL and has no return value. */ |
|
24 |
typedef void (^FIRAppVoidBoolCallback)(BOOL success) NS_SWIFT_NAME(FirebaseAppVoidBoolCallback); |
|
25 |
|
|
26 |
/** |
|
27 |
* The entry point of Firebase SDKs. |
|
28 |
* |
|
29 |
* Initialize and configure FIRApp using +[FIRApp configure] |
|
30 |
* or other customized ways as shown below. |
|
31 |
* |
|
32 |
* The logging system has two modes: default mode and debug mode. In default mode, only logs with |
|
33 |
* log level Notice, Warning and Error will be sent to device. In debug mode, all logs will be sent |
|
34 |
* to device. The log levels that Firebase uses are consistent with the ASL log levels. |
|
35 |
* |
|
36 |
* Enable debug mode by passing the -FIRDebugEnabled argument to the application. You can add this |
|
37 |
* argument in the application's Xcode scheme. When debug mode is enabled via -FIRDebugEnabled, |
|
38 |
* further executions of the application will also be in debug mode. In order to return to default |
|
39 |
* mode, you must explicitly disable the debug mode with the application argument -FIRDebugDisabled. |
|
40 |
* |
|
41 |
* It is also possible to change the default logging level in code by calling setLoggerLevel: on |
|
42 |
* the FIRConfiguration interface. |
|
43 |
*/ |
|
44 |
NS_SWIFT_NAME(FirebaseApp) |
|
45 |
@interface FIRApp : NSObject |
|
46 |
|
|
47 |
/** |
|
48 |
* Configures a default Firebase app. Raises an exception if any configuration step fails. The |
|
49 |
* default app is named "__FIRAPP_DEFAULT". This method should be called after the app is launched |
|
50 |
* and before using Firebase services. This method should be called from the main thread and |
|
51 |
* contains synchronous file I/O (reading GoogleService-Info.plist from disk). |
|
52 |
*/ |
|
53 |
+ (void)configure; |
|
54 |
|
|
55 |
/** |
|
56 |
* Configures the default Firebase app with the provided options. The default app is named |
|
57 |
* "__FIRAPP_DEFAULT". Raises an exception if any configuration step fails. This method should be |
|
58 |
* called from the main thread. |
|
59 |
* |
|
60 |
* @param options The Firebase application options used to configure the service. |
|
61 |
*/ |
|
62 |
+ (void)configureWithOptions:(FIROptions *)options NS_SWIFT_NAME(configure(options:)); |
|
63 |
|
|
64 |
/** |
|
65 |
* Configures a Firebase app with the given name and options. Raises an exception if any |
|
66 |
* configuration step fails. This method should be called from the main thread. |
|
67 |
* |
|
68 |
* @param name The application's name given by the developer. The name should should only contain |
|
69 |
Letters, Numbers and Underscore. |
|
70 |
* @param options The Firebase application options used to configure the services. |
|
71 |
*/ |
|
72 |
// clang-format off |
|
73 |
+ (void)configureWithName:(NSString *)name |
|
74 |
options:(FIROptions *)options NS_SWIFT_NAME(configure(name:options:)); |
|
75 |
// clang-format on |
|
76 |
|
|
77 |
/** |
|
78 |
* Returns the default app, or nil if the default app does not exist. |
|
79 |
*/ |
|
80 |
+ (nullable FIRApp *)defaultApp NS_SWIFT_NAME(app()); |
|
81 |
|
|
82 |
/** |
|
83 |
* Returns a previously created FIRApp instance with the given name, or nil if no such app exists. |
|
84 |
* This method is thread safe. |
|
85 |
*/ |
|
86 |
+ (nullable FIRApp *)appNamed:(NSString *)name NS_SWIFT_NAME(app(name:)); |
|
87 |
|
|
88 |
/** |
|
89 |
* Returns the set of all extant FIRApp instances, or nil if there are no FIRApp instances. This |
|
90 |
* method is thread safe. |
|
91 |
*/ |
|
92 |
@property(class, readonly, nullable) NSDictionary<NSString *, FIRApp *> *allApps; |
|
93 |
|
|
94 |
/** |
|
95 |
* Cleans up the current FIRApp, freeing associated data and returning its name to the pool for |
|
96 |
* future use. This method is thread safe. |
|
97 |
*/ |
|
98 |
- (void)deleteApp:(FIRAppVoidBoolCallback)completion; |
|
99 |
|
|
100 |
/** |
|
101 |
* FIRApp instances should not be initialized directly. Call +[FIRApp configure], |
|
102 |
* +[FIRApp configureWithOptions:], or +[FIRApp configureWithNames:options:] directly. |
|
103 |
*/ |
|
104 |
- (instancetype)init NS_UNAVAILABLE; |
|
105 |
|
|
106 |
/** |
|
107 |
* Gets the name of this app. |
|
108 |
*/ |
|
109 |
@property(nonatomic, copy, readonly) NSString *name; |
|
110 |
|
|
111 |
/** |
|
112 |
* Gets a copy of the options for this app. These are non-modifiable. |
|
113 |
*/ |
|
114 |
@property(nonatomic, copy, readonly) FIROptions *options; |
|
115 |
|
|
116 |
/** |
|
117 |
* Gets or sets whether automatic data collection is enabled for all products. Defaults to `YES` |
|
118 |
* unless `FirebaseDataCollectionDefaultEnabled` is set to `NO` in your app's Info.plist. This value |
|
119 |
* is persisted across runs of the app so that it can be set once when users have consented to |
|
120 |
* collection. |
|
121 |
*/ |
|
122 |
@property(nonatomic, readwrite, getter=isDataCollectionDefaultEnabled) |
|
123 |
BOOL dataCollectionDefaultEnabled; |
|
124 |
|
|
125 |
@end |
|
126 |
|
|
127 |
NS_ASSUME_NONNULL_END |