FIRApp.h 2.53 KB
Newer Older
Libin Lu's avatar
Libin Lu committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>

@class FIROptions;

NS_ASSUME_NONNULL_BEGIN

typedef void (^FIRAppVoidBoolCallback)(BOOL success);

/**
 * The entry point of Firebase SDKs.
 *
 * Initialize and configure FIRApp using [FIRApp configure];
 * Or other customized ways as shown below.
 */
@interface FIRApp : NSObject

/**
 * Configures a default Firebase app. Raises an exception if any configuration step fails. The
 * default app is named "__FIRAPP_DEFAULT". This method should be called after the app is launched
 * and before using Firebase services. This method is thread safe.
 */
+ (void)configure;

/**
 * Configures the default Firebase app with the provided options. The default app is named
 * "__FIRAPP_DEFAULT". Raises an exception if any configuration step fails. This method is thread
 * safe.
 *
 * @param options The Firebase application options used to configure the service.
 */
+ (void)configureWithOptions:(FIROptions *)options;

/**
 * Configures a Firebase app with the given name and options. Raises an exception if any
 * configuration step fails. This method is thread safe.
 *
 * @param name The application's name given by the developer. The name should should only contain
               Letters, Numbers and Underscore.
 * @param options The Firebase application options used to configure the services.
 */
+ (void)configureWithName:(NSString *)name options:(FIROptions *)options;

/**
 * Returns the default app, or nil if the default app does not exist.
 */
+ (nullable FIRApp *)defaultApp NS_SWIFT_NAME(defaultApp());

/**
 * Returns a previously created FIRApp instance with the given name, or nil if no such app exists.
 * This method is thread safe.
 */
+ (nullable FIRApp *)appNamed:(NSString *)name;

/**
 * Returns the set of all extant FIRApp instances, or nil if there is no FIRApp instance. This
 * method is thread safe.
 */
+ (nullable NSDictionary *)allApps;

/**
 * Cleans up the current FIRApp, freeing associated data and returning its name to the pool for
 * future use. This method is thread safe in class level.
 */
- (void)deleteApp:(FIRAppVoidBoolCallback)completion;

/**
 * FIRFirebaseApp instances should not be initialized directly. Call |FIRApp configure|, or
 * |FIRApp configureWithOptions:|, or |FIRApp configureWithNames:options| directly.
 */
- (nullable instancetype)init NS_UNAVAILABLE;

/**
 * Gets the name of this app.
 */
@property(nonatomic, copy, readonly) NSString *name;

/**
 * Gets the options for this app.
 */
@property(nonatomic, readonly) FIROptions *options;

@end

NS_ASSUME_NONNULL_END