Browse Source

harbour, notes: Use wakelock on note page

pull/19/head
jld3103 2 years ago
parent
commit
d94a7ea5fa
No known key found for this signature in database
GPG Key ID: 9062417B9E8EB7B3
  1. 2
      packages/harbour/lib/src/apps/notes/app.dart
  2. 7
      packages/harbour/lib/src/apps/notes/pages/note.dart

2
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';

7
packages/harbour/lib/src/apps/notes/pages/note.dart

@ -73,6 +73,9 @@ class _NotesNotePageState extends State<NotesNotePage> {
});
WidgetsBinding.instance.addPostFrameCallback((final _) {
if (Provider.of<HarbourPlatform>(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<NotesNotePage> {
return WillPopScope(
onWillPop: () async {
_update();
if (Provider.of<HarbourPlatform>(context, listen: false).canUseWakelock) {
await Wakelock.disable();
}
return true;
},
child: Scaffold(

Loading…
Cancel
Save