feat: fix debug updater
This commit is contained in:
@@ -344,7 +344,7 @@ class _SettingsScreenViewState extends State<SettingsScreenView> {
|
||||
showDialog(
|
||||
context: context,
|
||||
barrierDismissible: !update.mandatory,
|
||||
builder: (context) => AlertDialog(
|
||||
builder: (dialogContext) => AlertDialog(
|
||||
title: const Text("Update available"),
|
||||
content: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
@@ -358,30 +358,13 @@ class _SettingsScreenViewState extends State<SettingsScreenView> {
|
||||
actions: [
|
||||
if (!update.mandatory)
|
||||
TextButton(
|
||||
onPressed: () => Navigator.pop(context),
|
||||
onPressed: () => Navigator.pop(dialogContext),
|
||||
child: const Text("Later"),
|
||||
),
|
||||
FilledButton(
|
||||
onPressed: () async {
|
||||
Navigator.pop(context);
|
||||
|
||||
try {
|
||||
await context.read<SettingsViewModel>().installUpdate(
|
||||
update,
|
||||
onProgress: (progress) {
|
||||
debugPrint(
|
||||
"Download ${(progress * 100).toStringAsFixed(0)}%",
|
||||
);
|
||||
},
|
||||
);
|
||||
} catch (e, stack) {
|
||||
Sentry.captureException(e, stackTrace: stack);
|
||||
if (!mounted) return;
|
||||
|
||||
ScaffoldMessenger.of(
|
||||
context,
|
||||
).showSnackBar(SnackBar(content: Text("Update failed: $e")));
|
||||
}
|
||||
onPressed: () {
|
||||
Navigator.pop(dialogContext);
|
||||
context.push('/update-progress', extra: update);
|
||||
},
|
||||
child: const Text("Update"),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user