Skip to content

Avoid using default FIROptions directly. #2124

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 27, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,8 @@

#import <Foundation/Foundation.h>

NS_ASSUME_NONNULL_BEGIN

@interface FIRDynamicLinkComponentsKeyProvider : NSObject

+ (NSString *)APIKey;
+ (nullable NSString *)APIKey;

@end

NS_ASSUME_NONNULL_END
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,20 @@

#import "DynamicLinks/FDLURLComponents/FIRDynamicLinkComponentsKeyProvider.h"

#import <FirebaseCore/FIRAppInternal.h>
#import <FirebaseCore/FIROptions.h>

NS_ASSUME_NONNULL_BEGIN

@implementation FIRDynamicLinkComponentsKeyProvider

+ (NSString *)APIKey {
static NSString *apiKey;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
apiKey = [FIROptions defaultOptions].APIKey;
});
return apiKey;
+ (nullable NSString *)APIKey {
// If there's no default app, immediately return nil since reading from the default app will cause
// an error to be logged.
if (![FIRApp isDefaultAppConfigured]) {
return nil;
}

// FDL only supports the default app, use the options from it.
return [FIRApp defaultApp].options.APIKey;
}

@end

NS_ASSUME_NONNULL_END