mirror of
https://github.com/Yubico/yubioath-flutter.git
synced 2024-11-22 08:22:16 +03:00
Fix updating a Provider in build.
This commit is contained in:
parent
7949dfdfb9
commit
c82b147d66
@ -87,12 +87,16 @@ Future<Widget> initialize() async {
|
||||
child: DismissKeyboard(
|
||||
child: YubicoAuthenticatorApp(page: Consumer(
|
||||
builder: (context, ref, child) {
|
||||
// Hardcoded feature set
|
||||
ref.read(featureFlagProvider.notifier)
|
||||
..setFeature(features.fido, false)
|
||||
..setFeature(features.piv, false)
|
||||
..setFeature(features.otp, false)
|
||||
..setFeature(features.management, false);
|
||||
Timer.run(() {
|
||||
ref.read(featureFlagProvider.notifier)
|
||||
// TODO: Load feature flags from file/config?
|
||||
//..loadConfig(config)
|
||||
// Disable unimplemented feature
|
||||
..setFeature(features.fido, false)
|
||||
..setFeature(features.piv, false)
|
||||
..setFeature(features.otp, false)
|
||||
..setFeature(features.management, false);
|
||||
});
|
||||
|
||||
// activates window state provider
|
||||
ref.read(androidWindowStateProvider);
|
||||
|
@ -233,17 +233,18 @@ Future<Widget> initialize(List<String> argv) async {
|
||||
// Load feature flags, if they exist
|
||||
featureFile.exists().then(
|
||||
(exists) async {
|
||||
final featureFlag = ref.read(featureFlagProvider.notifier);
|
||||
if (exists) {
|
||||
try {
|
||||
final featureConfig =
|
||||
jsonDecode(await featureFile.readAsString());
|
||||
ref
|
||||
.read(featureFlagProvider.notifier)
|
||||
.loadConfig(featureConfig);
|
||||
featureFlag.loadConfig(featureConfig);
|
||||
} catch (error) {
|
||||
_log.error('Failed to parse feature flags', error);
|
||||
}
|
||||
}
|
||||
// Hardcode features here:
|
||||
// featureFlag.setFeature(feature, false);
|
||||
},
|
||||
);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user