From 977207ffb3f81406d1d87cb03ff741131e25acba Mon Sep 17 00:00:00 2001 From: sneurlax Date: Wed, 3 Jul 2024 18:01:32 -0500 Subject: [PATCH] enable wakelock on windows and macos --- .../cashfusion/sub_widgets/fusion_dialog.dart | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/lib/pages_desktop_specific/cashfusion/sub_widgets/fusion_dialog.dart b/lib/pages_desktop_specific/cashfusion/sub_widgets/fusion_dialog.dart index 51502bf81..09bce3a3b 100644 --- a/lib/pages_desktop_specific/cashfusion/sub_widgets/fusion_dialog.dart +++ b/lib/pages_desktop_specific/cashfusion/sub_widgets/fusion_dialog.dart @@ -1,7 +1,9 @@ import 'dart:async'; +import 'dart:io'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:wakelock/wakelock.dart'; import '../../../providers/cash_fusion/fusion_progress_ui_state_provider.dart'; import '../../../providers/global/prefs_provider.dart'; @@ -137,6 +139,8 @@ class _FusionDialogViewState extends ConsumerState { message: "Stopping fusion", ); + await Wakelock.disable(); + return true; } else { return false; @@ -150,6 +154,12 @@ class _FusionDialogViewState extends ConsumerState { super.initState(); } + @override + dispose() { + Wakelock.disable(); + super.dispose(); + } + @override Widget build(BuildContext context) { final bool _succeeded = @@ -162,6 +172,10 @@ class _FusionDialogViewState extends ConsumerState { .watch(fusionProgressUIStateProvider(widget.walletId)) .fusionRoundsCompleted; + if (!Platform.isLinux) { + Wakelock.enable(); + } + return DesktopDialog( maxHeight: 600, child: SingleChildScrollView(