-
Notifications
You must be signed in to change notification settings - Fork 33
Adding feature flags #372
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
Adding feature flags #372
Conversation
|
||
public class FeatureFlagService : IFeatureFlagService | ||
{ | ||
private readonly ISyncLocalStorageService _storage; // Injected storage service |
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.
ISyncLocalStorageService is used in a dedicated storage service, don't inject it directly here instead use the interface IClientStorage
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.
Fixed
@@ -116,7 +116,29 @@ | |||
</div> | |||
</div> | |||
</div> | |||
|
|||
@if (selectedNetwork == "Angornet") |
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.
now I wonder if we actually want to only allow feature flags for testnet or also on mainnet.
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.
If we are keeping these as experimental features i think we should only allow on testnets,
I believe that feature flags for mainnet are more applicable when some of our 'stable' features start deviating from main purpose and not be relevant to most users
In that case we can allow the specific users to enable / disable those features
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.
If we really want the feature flags for both the mainnet and testnet, I think what we can do that while injecting the NetworkConfiguration, and then in it the method would return the dictionary of features depending on the network selected(current network)...
{ | ||
return _storage.GetItem<Dictionary<string, bool>>("FeatureFlags") ?? new() | ||
{ | ||
{"HW_Support", false} |
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.
hmm I am not a fan of putting our default feature flags in the storage class, it should come form the config file INetworkConfiguration
But I am not sure how we can pass it to here?
Perhaps inject the interface and return the feature flag collection from here?
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.
yeah that will be much better, on it
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.
@dangershony I have Implemented this in the latest commit
@@ -29,5 +29,8 @@ public interface IClientStorage | |||
|
|||
string GetCurrencyDisplaySetting(); | |||
void SetCurrencyDisplaySetting(string setting); | |||
|
|||
void setFeatureFlags(Dictionary<string, bool> featureFlags); |
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.
yes this is what I was looking for
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.
Almost ready one more small change to more the flags to config
{ | ||
_featureFlagService.SetFeatureFlag(key, value); | ||
_featureFlags[key] = value; | ||
} |
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.
leave space between methods (fix it in a future pr)
Purpose:
Changes: