mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2025-01-22 10:34:32 +00:00
Merge pull request #912 from cypherstack/fusionwakelock
Prevent screen lock on desktop and mobile Fusion progress view / dialog
This commit is contained in:
commit
6d1e3e9629
2 changed files with 25 additions and 0 deletions
|
@ -12,6 +12,7 @@ import 'dart:async';
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||||
|
import 'package:wakelock/wakelock.dart';
|
||||||
|
|
||||||
import '../../pages_desktop_specific/cashfusion/sub_widgets/fusion_progress.dart';
|
import '../../pages_desktop_specific/cashfusion/sub_widgets/fusion_progress.dart';
|
||||||
import '../../providers/cash_fusion/fusion_progress_ui_state_provider.dart';
|
import '../../providers/cash_fusion/fusion_progress_ui_state_provider.dart';
|
||||||
|
@ -84,6 +85,8 @@ class _FusionProgressViewState extends ConsumerState<FusionProgressView> {
|
||||||
message: "Stopping fusion",
|
message: "Stopping fusion",
|
||||||
);
|
);
|
||||||
|
|
||||||
|
await Wakelock.disable();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
|
@ -96,6 +99,12 @@ class _FusionProgressViewState extends ConsumerState<FusionProgressView> {
|
||||||
super.initState();
|
super.initState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void dispose() {
|
||||||
|
Wakelock.disable();
|
||||||
|
super.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final bool _succeeded =
|
final bool _succeeded =
|
||||||
|
@ -108,6 +117,8 @@ class _FusionProgressViewState extends ConsumerState<FusionProgressView> {
|
||||||
.watch(fusionProgressUIStateProvider(widget.walletId))
|
.watch(fusionProgressUIStateProvider(widget.walletId))
|
||||||
.fusionRoundsCompleted;
|
.fusionRoundsCompleted;
|
||||||
|
|
||||||
|
Wakelock.enable();
|
||||||
|
|
||||||
return WillPopScope(
|
return WillPopScope(
|
||||||
onWillPop: () async {
|
onWillPop: () async {
|
||||||
return await _requestAndProcessCancel();
|
return await _requestAndProcessCancel();
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
import 'dart:io';
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_riverpod/flutter_riverpod.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/cash_fusion/fusion_progress_ui_state_provider.dart';
|
||||||
import '../../../providers/global/prefs_provider.dart';
|
import '../../../providers/global/prefs_provider.dart';
|
||||||
|
@ -137,6 +139,8 @@ class _FusionDialogViewState extends ConsumerState<FusionDialogView> {
|
||||||
message: "Stopping fusion",
|
message: "Stopping fusion",
|
||||||
);
|
);
|
||||||
|
|
||||||
|
await Wakelock.disable();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
|
@ -150,6 +154,12 @@ class _FusionDialogViewState extends ConsumerState<FusionDialogView> {
|
||||||
super.initState();
|
super.initState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
dispose() {
|
||||||
|
Wakelock.disable();
|
||||||
|
super.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final bool _succeeded =
|
final bool _succeeded =
|
||||||
|
@ -162,6 +172,10 @@ class _FusionDialogViewState extends ConsumerState<FusionDialogView> {
|
||||||
.watch(fusionProgressUIStateProvider(widget.walletId))
|
.watch(fusionProgressUIStateProvider(widget.walletId))
|
||||||
.fusionRoundsCompleted;
|
.fusionRoundsCompleted;
|
||||||
|
|
||||||
|
if (!Platform.isLinux) {
|
||||||
|
Wakelock.enable();
|
||||||
|
}
|
||||||
|
|
||||||
return DesktopDialog(
|
return DesktopDialog(
|
||||||
maxHeight: 600,
|
maxHeight: 600,
|
||||||
child: SingleChildScrollView(
|
child: SingleChildScrollView(
|
||||||
|
|
Loading…
Reference in a new issue