Add warp config generator

This commit is contained in:
problematicconsumer
2024-02-18 12:35:11 +03:30
parent ce6ab59bf7
commit 33dc21918d
15 changed files with 459 additions and 973 deletions

View File

@@ -28,7 +28,8 @@ class WarpOptionsTiles extends HookConsumerWidget {
Widget build(BuildContext context, WidgetRef ref) {
final t = ref.watch(translationsProvider);
final warpPrefaceCompleted = ref.watch(warpOptionNotifierProvider);
final warpOptions = ref.watch(warpOptionNotifierProvider);
final warpPrefaceCompleted = warpOptions.consentGiven;
final canChangeOptions = warpPrefaceCompleted && options.enableWarp;
return Column(
@@ -51,6 +52,26 @@ class WarpOptionsTiles extends HookConsumerWidget {
}
},
),
ListTile(
title: Text(t.settings.config.generateWarpConfig),
subtitle: canChangeOptions
? switch (warpOptions.configGeneration) {
AsyncLoading() => const LinearProgressIndicator(),
AsyncError() => Text(
t.settings.config.missingWarpConfig,
style:
TextStyle(color: Theme.of(context).colorScheme.error),
),
_ => null,
}
: null,
enabled: canChangeOptions,
onTap: () async {
await ref
.read(warpOptionNotifierProvider.notifier)
.generateWarpConfig();
},
),
ListTile(
title: Text(t.settings.config.warpDetourMode),
subtitle: Text(options.warpDetourMode.present(t)),