-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Add support for other Firebase products to integrate with Remote Config. #6692
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
Conversation
|
||
/// Adds a listener that will be called whenever one of the get methods is called. | ||
/// @param listener Function that takes in the parameter key and the config. | ||
- (void)addListener:(void (^_Nonnull)(NSString *_Nonnull, NSDictionary *_Nonnull))listener; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should remove this from the header file since we're just calling it internally within the RC SDK and not changing the public API
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
@@ -284,6 +306,14 @@ - (void)loadConfigFromMainTable { | |||
self->_defaultConfig = [defaultConfig mutableCopy]; | |||
dispatch_semaphore_signal(self->_configLoadFromDBSemaphore); | |||
}]; | |||
|
|||
[_DBManager loadPersonalizationWithCompletionHandler:^(BOOL success, NSDictionary *fetchedConfig, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rename to fetchedPersonalization
and activePersonalization
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
|
||
if (handler) { | ||
dispatch_async(dispatch_get_main_queue(), ^{ | ||
handler(YES, activePersonalization, fetchedPersonalization, nil); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the handler definition expects fetched
and then active
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LOL, too much copying and pasting.
@@ -331,6 +358,10 @@ - (FIRRemoteConfigValue *)configValueForKey:(NSString *)key { | |||
@"Key %@ should come from source:%zd instead coming from source: %zd.", key, | |||
(long)FIRRemoteConfigSourceRemote, (long)value.source); | |||
} | |||
if ([self->_configContent.activePersonalization count] > 0) { | |||
[self callListeners:value.stringValue | |||
metadata:self->_configContent.activePersonalization[key]]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thinking: we mentioned that the listener approach would allow us to add other side-effects in the future, but given the current implementation all the listeners would be called specifically with personalization metadata, which limits the functionality we can add
Stores Personalization metadata in database along with Remote Config parameters. Adds a RCNPersonalization class that logs Personalization events, and listeners that call that when get*() is called.