diff --git a/packages/harbour/lib/src/apps/notes/app.dart b/packages/harbour/lib/src/apps/notes/app.dart index e089dfa4..00388980 100644 --- a/packages/harbour/lib/src/apps/notes/app.dart +++ b/packages/harbour/lib/src/apps/notes/app.dart @@ -9,11 +9,13 @@ import 'package:harbour/src/harbour.dart'; import 'package:intersperse/intersperse.dart'; import 'package:material_design_icons_flutter/material_design_icons_flutter.dart'; import 'package:nextcloud/nextcloud.dart'; +import 'package:provider/provider.dart'; import 'package:rxdart/rxdart.dart'; import 'package:settings/settings.dart'; import 'package:shared_preferences/shared_preferences.dart'; import 'package:sort_box/sort_box.dart'; import 'package:url_launcher/url_launcher_string.dart'; +import 'package:wakelock/wakelock.dart'; part 'dialogs/create_note.dart'; part 'dialogs/select_category.dart'; diff --git a/packages/harbour/lib/src/apps/notes/pages/note.dart b/packages/harbour/lib/src/apps/notes/pages/note.dart index d3c0a9f2..352e77c2 100644 --- a/packages/harbour/lib/src/apps/notes/pages/note.dart +++ b/packages/harbour/lib/src/apps/notes/pages/note.dart @@ -73,6 +73,9 @@ class _NotesNotePageState extends State { }); WidgetsBinding.instance.addPostFrameCallback((final _) { + if (Provider.of(context, listen: false).canUseWakelock) { + Wakelock.enable(); + } if (widget.bloc.options.defaultNoteViewTypeOption.value == DefaultNoteViewType.edit || widget.note.content!.isEmpty) { setState(() { @@ -94,6 +97,10 @@ class _NotesNotePageState extends State { return WillPopScope( onWillPop: () async { _update(); + + if (Provider.of(context, listen: false).canUseWakelock) { + await Wakelock.disable(); + } return true; }, child: Scaffold(