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 <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 `FirebaseApp` using `FirebaseApp.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
|
|
|
40 |
* `-FIRDebugDisabled`.
|
|
|
41 |
*
|
|
|
42 |
* It is also possible to change the default logging level in code by calling
|
|
|
43 |
* `FirebaseConfiguration.shared.setLoggerLevel(_:)` with the desired level.
|
|
|
44 |
*/
|
|
|
45 |
NS_SWIFT_NAME(FirebaseApp)
|
|
|
46 |
@interface FIRApp : NSObject
|
|
|
47 |
|
|
|
48 |
/**
|
|
|
49 |
* Configures a default Firebase app. Raises an exception if any configuration step fails. The
|
|
|
50 |
* default app is named "__FIRAPP_DEFAULT". This method should be called after the app is launched
|
|
|
51 |
* and before using Firebase services. This method should be called from the main thread and
|
|
|
52 |
* contains synchronous file I/O (reading GoogleService-Info.plist from disk).
|
|
|
53 |
*/
|
|
|
54 |
+ (void)configure;
|
|
|
55 |
|
|
|
56 |
/**
|
|
|
57 |
* Configures the default Firebase app with the provided options. The default app is named
|
|
|
58 |
* "__FIRAPP_DEFAULT". Raises an exception if any configuration step fails. This method should be
|
|
|
59 |
* called from the main thread.
|
|
|
60 |
*
|
|
|
61 |
* @param options The Firebase application options used to configure the service.
|
|
|
62 |
*/
|
|
|
63 |
+ (void)configureWithOptions:(FIROptions *)options NS_SWIFT_NAME(configure(options:));
|
|
|
64 |
|
|
|
65 |
/**
|
|
|
66 |
* Configures a Firebase app with the given name and options. Raises an exception if any
|
|
|
67 |
* configuration step fails. This method should be called from the main thread.
|
|
|
68 |
*
|
|
|
69 |
* @param name The application's name given by the developer. The name should should only contain
|
|
|
70 |
Letters, Numbers and Underscore.
|
|
|
71 |
* @param options The Firebase application options used to configure the services.
|
|
|
72 |
*/
|
|
|
73 |
// clang-format off
|
|
|
74 |
+ (void)configureWithName:(NSString *)name
|
|
|
75 |
options:(FIROptions *)options NS_SWIFT_NAME(configure(name:options:));
|
|
|
76 |
// clang-format on
|
|
|
77 |
|
|
|
78 |
/**
|
|
|
79 |
* Returns the default app, or `nil` if the default app does not exist.
|
|
|
80 |
*/
|
|
|
81 |
+ (nullable FIRApp *)defaultApp NS_SWIFT_NAME(app());
|
|
|
82 |
|
|
|
83 |
/**
|
|
|
84 |
* Returns a previously created `FirebaseApp` instance with the given name, or `nil` if no such app
|
|
|
85 |
* exists. This method is thread safe.
|
|
|
86 |
*/
|
|
|
87 |
+ (nullable FIRApp *)appNamed:(NSString *)name NS_SWIFT_NAME(app(name:));
|
|
|
88 |
|
|
|
89 |
/**
|
|
|
90 |
* Returns the set of all extant `FirebaseApp` instances, or `nil` if there are no `FirebaseApp`
|
|
|
91 |
* instances. This method is thread safe.
|
|
|
92 |
*/
|
|
|
93 |
@property(class, readonly, nullable) NSDictionary<NSString *, FIRApp *> *allApps;
|
|
|
94 |
|
|
|
95 |
/**
|
|
|
96 |
* Cleans up the current `FirebaseApp`, freeing associated data and returning its name to the pool
|
|
|
97 |
* for future use. This method is thread safe.
|
|
|
98 |
*/
|
|
|
99 |
- (void)deleteApp:(FIRAppVoidBoolCallback)completion;
|
|
|
100 |
|
|
|
101 |
/**
|
|
|
102 |
* `FirebaseApp` instances should not be initialized directly. Call `FirebaseApp.configure()`,
|
|
|
103 |
* `FirebaseApp.configure(options:)`, or `FirebaseApp.configure(name:options:)` directly.
|
|
|
104 |
*/
|
|
|
105 |
- (instancetype)init NS_UNAVAILABLE;
|
|
|
106 |
|
|
|
107 |
/**
|
|
|
108 |
* Gets the name of this app.
|
|
|
109 |
*/
|
|
|
110 |
@property(nonatomic, copy, readonly) NSString *name;
|
|
|
111 |
|
|
|
112 |
/**
|
|
|
113 |
* Gets a copy of the options for this app. These are non-modifiable.
|
|
|
114 |
*/
|
|
|
115 |
@property(nonatomic, copy, readonly) FIROptions *options;
|
|
|
116 |
|
|
|
117 |
/**
|
|
|
118 |
* Gets or sets whether automatic data collection is enabled for all products. Defaults to `true`
|
|
|
119 |
* unless `FirebaseDataCollectionDefaultEnabled` is set to `NO` in your app's Info.plist. This value
|
|
|
120 |
* is persisted across runs of the app so that it can be set once when users have consented to
|
|
|
121 |
* collection.
|
|
|
122 |
*/
|
|
|
123 |
@property(nonatomic, readwrite, getter=isDataCollectionDefaultEnabled)
|
|
|
124 |
BOOL dataCollectionDefaultEnabled;
|
|
|
125 |
|
|
|
126 |
@end
|
|
|
127 |
|
|
|
128 |
NS_ASSUME_NONNULL_END
|