8000 Adding feature flags by theDRB123 · Pull Request #372 · block-core/angor · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

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

Merged
merged 3 commits into from
May 14, 2025
Merged

Conversation

theDRB123
Copy link
Contributor

Purpose:

  • Adding a feature flag services to dynamically enable/disable specific features when on Angornet

Changes:

  • Select network modal updated to show Feature Flag section
  • Added FeatureFlag service

image


public class FeatureFlagService : IFeatureFlagService
{
private readonly ISyncLocalStorageService _storage; // Injected storage service
Copy link
Member

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

Copy link
Contributor Author

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")
Copy link
Member

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.

Copy link
Contributor Author

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

Copy link
Contributor Author

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}
Copy link
Member

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?

Copy link
Contributor Author

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

Copy link
Contributor Author
@theDRB123 theDRB123 May 14, 2025

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);
Copy link
Member

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

Copy link
Member
@dangershony dangershony left a 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;
}
Copy link
Member

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)

@dangershony dangershony merged commit ce61776 into block-core:main May 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0