Remote configs apply on the next startup after they are fetched. This means that the first startup will always use initialConfig.
Refactor ClientConfigService to take an optional RemoteConfigConnection. If the connection is present, then we attempt a remote config load.
If the remote config load succeeds, we cache the result to user defaults.
On the next startup, we read the config from user defaults before trying to fetch remotely again.
If the cached config is corrupt, clear it so we don't have a startup failure loop.
These failsafes all mean that we should always have some valid config to use for logging, as long as the initialConfig that was hard-coded into the app was valid.
Added a new package, PromotedFirebaseRemoteConfig. This contains extensions to ClientConfig and an implementation of FirebaseRemoteConfigConnection.
Clients provide a configuration plist file to set up the Firebase connection. Unlike Analytics, Remote Config can use a Firebase App other than the default one, so Remote Config can load from a different Firebase account.
Extensive console logging of Remote Config functionality so that users can submit system logs for diagnosis.
ClientConfig
Support serialization to JSON for caching locally.
Add ability to merge from a [String: String] dictionary, transforming and validating the values as we go along.
Additional validation of fields to ensure that we don't get into a bad state from invalid configs.
Dependencies
Installed Firebase Remote Config as a dependency on both Swift PM and Cocoapods.
Had to do some creative configuration in the podspec. Added a bunch of explanation.
Dependency management with library
Dependency management is more complicated because there's a nontrivial part of the library that now runs before ClientConfig is loaded.
Added tests to ensure that we don't try to access functionality that requires a ClientConfigbefore the config is loaded.
Added tests that access every field of Module to ensure they all load properly.
Added PendingLogMessages struct to handle console logging before ClientConfig is loaded.
Formatting
Adopt source code formatting closer to Swift community standards. Also similar to Google's Swift Style Guide.
Will apply to files when modifying them in the future.
Summary
PendingLogMessages
to handle console logging beforeClientConfig
is loaded.Module
dependencies.Configuration
Configuring Remote Config requires the following steps:
plist
file from Firebase Console for the app used for Remote Config. Add this file to your app resources.PromotedFirebaseRemoteConfig
module in your build system.Example:
ClientConfigService and Firebase
Remote configs apply on the next startup after they are fetched. This means that the first startup will always use
initialConfig
.ClientConfigService
to take an optionalRemoteConfigConnection
. If the connection is present, then we attempt a remote config load.initialConfig
that was hard-coded into the app was valid.PromotedFirebaseRemoteConfig
. This contains extensions toClientConfig
and an implementation ofFirebaseRemoteConfigConnection
.plist
file to set up the Firebase connection. Unlike Analytics, Remote Config can use a Firebase App other than the default one, so Remote Config can load from a different Firebase account.ClientConfig
[String: String]
dictionary, transforming and validating the values as we go along.Dependencies
Dependency management with library
Dependency management is more complicated because there's a nontrivial part of the library that now runs before
ClientConfig
is loaded.ClientConfig
before the config is loaded.Module
to ensure they all load properly.PendingLogMessages
struct to handle console logging beforeClientConfig
is loaded.Formatting