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