diff options
author | Paul Beusterien <paulbeusterien@google.com> | 2017-09-08 08:49:57 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-09-08 08:49:57 -0700 |
commit | 2631d33d292ef9a8ff056c6c112dc640eade1d30 (patch) | |
tree | 8636452220468cf8ea7e86188eb222061e7e2433 /Firebase/Core | |
parent | 2da73418e216b16a5f099fcc6d29cdff000e56a8 (diff) |
473 bytes of low-hanging size fruit and typo fix (#246)
Diffstat (limited to 'Firebase/Core')
-rw-r--r-- | Firebase/Core/FIROptions.m | 59 |
1 files changed, 19 insertions, 40 deletions
diff --git a/Firebase/Core/FIROptions.m b/Firebase/Core/FIROptions.m index 24086ea..6611af2 100644 --- a/Firebase/Core/FIROptions.m +++ b/Firebase/Core/FIROptions.m @@ -67,6 +67,11 @@ NSString *const kFIRExceptionBadModification = */ @property(nonatomic, readonly) NSDictionary *analyticsOptionsDictionary; +/** + * Throw exception if editing is locked when attempting to modify an option. + */ +- (void)checkEditingLocked; + @end @implementation FIROptions { @@ -233,11 +238,14 @@ static NSDictionary *sDefaultOptionsDictionary = nil; return self.optionsDictionary[kFIRAPIKey]; } -- (void)setAPIKey:(NSString *)APIKey { +- (void)checkEditingLocked { if (self.isEditingLocked) { [NSException raise:kFirebaseCoreErrorDomain format:kFIRExceptionBadModification]; } +} +- (void)setAPIKey:(NSString *)APIKey { + [self checkEditingLocked]; _optionsDictionary[kFIRAPIKey] = [APIKey copy]; } @@ -246,10 +254,7 @@ static NSDictionary *sDefaultOptionsDictionary = nil; } - (void)setClientID:(NSString *)clientID { - if (self.isEditingLocked) { - [NSException raise:kFirebaseCoreErrorDomain format:kFIRExceptionBadModification]; - } - + [self checkEditingLocked]; _optionsDictionary[kFIRClientID] = [clientID copy]; } @@ -258,10 +263,7 @@ static NSDictionary *sDefaultOptionsDictionary = nil; } - (void)setTrackingID:(NSString *)trackingID { - if (self.isEditingLocked) { - [NSException raise:kFirebaseCoreErrorDomain format:kFIRExceptionBadModification]; - } - + [self checkEditingLocked]; _optionsDictionary[kFIRTrackingID] = [trackingID copy]; } @@ -270,10 +272,7 @@ static NSDictionary *sDefaultOptionsDictionary = nil; } - (void)setGCMSenderID:(NSString *)GCMSenderID { - if (self.isEditingLocked) { - [NSException raise:kFirebaseCoreErrorDomain format:kFIRExceptionBadModification]; - } - + [self checkEditingLocked]; _optionsDictionary[kFIRGCMSenderID] = [GCMSenderID copy]; } @@ -282,10 +281,7 @@ static NSDictionary *sDefaultOptionsDictionary = nil; } - (void)setProjectID:(NSString *)projectID { - if (self.isEditingLocked) { - [NSException raise:kFirebaseCoreErrorDomain format:kFIRExceptionBadModification]; - } - + [self checkEditingLocked]; _optionsDictionary[kFIRProjectID] = [projectID copy]; } @@ -294,10 +290,7 @@ static NSDictionary *sDefaultOptionsDictionary = nil; } - (void)setAndroidClientID:(NSString *)androidClientID { - if (self.isEditingLocked) { - [NSException raise:kFirebaseCoreErrorDomain format:kFIRExceptionBadModification]; - } - + [self checkEditingLocked]; _optionsDictionary[kFIRAndroidClientID] = [androidClientID copy]; } @@ -306,10 +299,7 @@ static NSDictionary *sDefaultOptionsDictionary = nil; } - (void)setGoogleAppID:(NSString *)googleAppID { - if (self.isEditingLocked) { - [NSException raise:kFirebaseCoreErrorDomain format:kFIRExceptionBadModification]; - } - + [self checkEditingLocked]; _optionsDictionary[kFIRGoogleAppID] = [googleAppID copy]; } @@ -326,9 +316,7 @@ static NSDictionary *sDefaultOptionsDictionary = nil; } - (void)setDatabaseURL:(NSString *)databaseURL { - if (self.isEditingLocked) { - [NSException raise:kFirebaseCoreErrorDomain format:kFIRExceptionBadModification]; - } + [self checkEditingLocked]; _optionsDictionary[kFIRDatabaseURL] = [databaseURL copy]; } @@ -338,18 +326,12 @@ static NSDictionary *sDefaultOptionsDictionary = nil; } - (void)setStorageBucket:(NSString *)storageBucket { - if (self.isEditingLocked) { - [NSException raise:kFirebaseCoreErrorDomain format:kFIRExceptionBadModification]; - } - + [self checkEditingLocked]; _optionsDictionary[kFIRStorageBucket] = [storageBucket copy]; } - (void)setDeepLinkURLScheme:(NSString *)deepLinkURLScheme { - if (self.isEditingLocked) { - [NSException raise:kFirebaseCoreErrorDomain format:kFIRExceptionBadModification]; - } - + [self checkEditingLocked]; _deepLinkURLScheme = [deepLinkURLScheme copy]; } @@ -358,10 +340,7 @@ static NSDictionary *sDefaultOptionsDictionary = nil; } - (void)setBundleID:(NSString *)bundleID { - if (self.isEditingLocked) { - [NSException raise:kFirebaseCoreErrorDomain format:kFIRExceptionBadModification]; - } - + [self checkEditingLocked]; _optionsDictionary[kFIRBundleID] = [bundleID copy]; } |