Open osipxd opened 4 years ago
It would be great to have the ability to simply create complex flipper configs compositions.
We have three configs (in order of priority):
debug
remote
local
If value not found in debug config, it will get from remote config. If value not configured in remote config it will get from local.
class LocalFlipperConfig() : FlipperConfig { /*...*/ } class RemoteFlipperConfig(localConfig: LocalFlipperConfig) : FlipperConfig { override fun featureIsEnabled(feature: Feature): Boolean { return if (hasValue(feature.id)) ... else localConfig.featureIsEnabled(feature) } } class DebugFlipperConfig(remoteConfig: RemoteFlipperConfig) : FlipperConfig { override fun featureIsEnabled(feature: Feature): Boolean { return if (hasValue(feature.id)) ... else remoteConfig.featureIsEnabled(feature) } } ToggleRouter.init(DebugFlipperConfig(RemoteFlipperConfig(LocalFlipperConfig())))
class LocalFlipperConfig() : FlipperConfig { /*...*/ } class RemoteFlipperConfig() : FlipperConfig { /*...*/ } class DebugFlipperConfig() : FlipperConfig { /*...*/ } ToggleRouter.init( DebugFlipperConfig(), RemoteFlipperConfig(), LocalFlipperConfig() )
One of the ways I see - add method contains to FlipperConfig. Iterate over all configs and check if it contains the desired feature.
contains
FlipperConfig
It would be great to have the ability to simply create complex flipper configs compositions.
We have three configs (in order of priority):
debug
- configured from in-app debug panelremote
- values from Firebase remote configlocal
- hardcoded default valuesIf value not found in
debug
config, it will get fromremote
config. If value not configured inremote
config it will get fromlocal
.Our current solution
Desired solution