Last active
February 14, 2019 13:45
-
-
Save claudiosanchez/d82f5b0440c2eaf0e0c3d97d7373653b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Our ViewModel will check very early on if it should show the Spending Analysis Widget or not. | |
public override void OnAppearing() | |
{ | |
ShowSpendingAnalysis = _featureFlagService.Can(Features.CanSeeSpendingAnalysis); | |
} | |
... | |
// This method lives in a FeatureFlagService implementation. Remember to always keep your ViewModels clean! | |
public bool Can(string id) | |
{ | |
if (_client == null) Initialize(); | |
var results = _client.BoolVariation(id); | |
// Logging would be good | |
Console.WriteLine($"Feature {id} is {results} for user {_user.Name} ({_user.Key})"); | |
return results; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment