Browse Source

Merge pull request #475 from provokateurin/fix/wakelock

Fix wakelock
pull/477/head
Kate 1 year ago committed by GitHub
parent
commit
1090368e12
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 41
      packages/app/pubspec.lock
  2. 7
      packages/app/pubspec.yaml
  3. 7
      packages/app/pubspec_overrides.yaml
  4. 1
      packages/neon/neon/lib/src/platform/android.dart
  5. 1
      packages/neon/neon/lib/src/platform/linux.dart
  6. 3
      packages/neon/neon/lib/src/platform/platform.dart
  7. 7
      packages/neon/neon/pubspec.yaml
  8. 7
      packages/neon/neon/pubspec_overrides.yaml
  9. 2
      packages/neon/neon_news/lib/neon_news.dart
  10. 11
      packages/neon/neon_news/lib/pages/article.dart
  11. 9
      packages/neon/neon_news/pubspec.yaml
  12. 7
      packages/neon/neon_news/pubspec_overrides.yaml
  13. 3
      packages/neon/neon_notes/lib/neon_notes.dart
  14. 12
      packages/neon/neon_notes/lib/pages/note.dart
  15. 9
      packages/neon/neon_notes/pubspec.yaml
  16. 7
      packages/neon/neon_notes/pubspec_overrides.yaml

41
packages/app/pubspec.lock

@ -1425,47 +1425,22 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "11.3.0" version: "11.3.0"
wakelock: wakelock_plus:
dependency: transitive dependency: transitive
description: description:
name: wakelock name: wakelock_plus
sha256: "769ecf42eb2d07128407b50cb93d7c10bd2ee48f0276ef0119db1d25cc2f87db" sha256: aac3f3258f01781ec9212df94eecef1eb9ba9350e106728def405baa096ba413
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "0.6.2" version: "1.1.1"
wakelock_macos: wakelock_plus_platform_interface:
dependency: transitive
description:
name: wakelock_macos
sha256: "047c6be2f88cb6b76d02553bca5a3a3b95323b15d30867eca53a19a0a319d4cd"
url: "https://pub.dev"
source: hosted
version: "0.4.0"
wakelock_platform_interface:
dependency: transitive
description:
name: wakelock_platform_interface
sha256: "1f4aeb81fb592b863da83d2d0f7b8196067451e4df91046c26b54a403f9de621"
url: "https://pub.dev"
source: hosted
version: "0.3.0"
wakelock_web:
dependency: transitive dependency: transitive
description: description:
name: wakelock_web name: wakelock_plus_platform_interface
sha256: "1b256b811ee3f0834888efddfe03da8d18d0819317f20f6193e2922b41a501b5" sha256: "40fabed5da06caff0796dc638e1f07ee395fb18801fbff3255a2372db2d80385"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "0.4.0" version: "1.1.0"
wakelock_windows:
dependency: "direct overridden"
description:
path: wakelock_windows
ref: "269e1dba6bca6975a0bc44da6a42e56ca7428da9"
resolved-ref: "269e1dba6bca6975a0bc44da6a42e56ca7428da9"
url: "https://github.com/fikretonuresen/wakelock"
source: git
version: "0.2.2"
webdriver: webdriver:
dependency: transitive dependency: transitive
description: description:

7
packages/app/pubspec.yaml

@ -44,13 +44,6 @@ dev_dependencies:
url: https://github.com/stack11/dart_nit_picking url: https://github.com/stack11/dart_nit_picking
ref: 0b2ee0d ref: 0b2ee0d
dependency_overrides:
wakelock_windows: # TODO: https://github.com/creativecreatorormaybenot/wakelock/pull/195
git:
url: https://github.com/fikretonuresen/wakelock
path: wakelock_windows
ref: 269e1dba6bca6975a0bc44da6a42e56ca7428da9
flutter: flutter:
uses-material-design: true uses-material-design: true
assets: assets:

7
packages/app/pubspec_overrides.yaml

@ -1,4 +1,4 @@
# melos_managed_dependency_overrides: dynamite_runtime,file_icons,neon,neon_files,neon_news,neon_notes,neon_notifications,nextcloud,sort_box,wakelock_windows # melos_managed_dependency_overrides: dynamite_runtime,file_icons,neon,neon_files,neon_news,neon_notes,neon_notifications,nextcloud,sort_box
dependency_overrides: dependency_overrides:
dynamite_runtime: dynamite_runtime:
path: ../dynamite/dynamite_runtime path: ../dynamite/dynamite_runtime
@ -18,8 +18,3 @@ dependency_overrides:
path: ../nextcloud path: ../nextcloud
sort_box: sort_box:
path: ../sort_box path: ../sort_box
wakelock_windows:
git:
url: https://github.com/fikretonuresen/wakelock
ref: 269e1dba6bca6975a0bc44da6a42e56ca7428da9
path: wakelock_windows

1
packages/neon/neon/lib/src/platform/android.dart

@ -10,7 +10,6 @@ class AndroidNeonPlatform extends NeonPlatform {
AndroidNeonPlatform() AndroidNeonPlatform()
: super( : super(
canUseWebView: true, canUseWebView: true,
canUseWakelock: true,
canUseQuickActions: true, canUseQuickActions: true,
canUseSystemTray: false, canUseSystemTray: false,
canUseWindowManager: false, canUseWindowManager: false,

1
packages/neon/neon/lib/src/platform/linux.dart

@ -11,7 +11,6 @@ class LinuxNeonPlatform extends NeonPlatform {
LinuxNeonPlatform() LinuxNeonPlatform()
: super( : super(
canUseWebView: false, canUseWebView: false,
canUseWakelock: false,
canUseQuickActions: false, canUseQuickActions: false,
canUseSystemTray: true, canUseSystemTray: true,
canUseWindowManager: true, canUseWindowManager: true,

3
packages/neon/neon/lib/src/platform/platform.dart

@ -23,7 +23,6 @@ Future<NeonPlatform> getNeonPlatform() async {
abstract class NeonPlatform { abstract class NeonPlatform {
NeonPlatform({ NeonPlatform({
required this.canUseWebView, required this.canUseWebView,
required this.canUseWakelock,
required this.canUseQuickActions, required this.canUseQuickActions,
required this.canUseSystemTray, required this.canUseSystemTray,
required this.canUseWindowManager, required this.canUseWindowManager,
@ -36,8 +35,6 @@ abstract class NeonPlatform {
final bool canUseWebView; final bool canUseWebView;
final bool canUseWakelock;
final bool canUseQuickActions; final bool canUseQuickActions;
final bool canUseSystemTray; final bool canUseSystemTray;

7
packages/neon/neon/pubspec.yaml

@ -66,13 +66,6 @@ dev_dependencies:
ref: 0b2ee0d ref: 0b2ee0d
test: ^1.24.3 test: ^1.24.3
dependency_overrides:
wakelock_windows: # TODO: https://github.com/creativecreatorormaybenot/wakelock/pull/195
git:
url: https://github.com/fikretonuresen/wakelock
path: wakelock_windows
ref: 269e1dba6bca6975a0bc44da6a42e56ca7428da9
flutter: flutter:
uses-material-design: true uses-material-design: true
assets: assets:

7
packages/neon/neon/pubspec_overrides.yaml

@ -1,4 +1,4 @@
# melos_managed_dependency_overrides: dynamite_runtime,nextcloud,sort_box,wakelock_windows # melos_managed_dependency_overrides: dynamite_runtime,nextcloud,sort_box
dependency_overrides: dependency_overrides:
dynamite_runtime: dynamite_runtime:
path: ../../dynamite/dynamite_runtime path: ../../dynamite/dynamite_runtime
@ -6,8 +6,3 @@ dependency_overrides:
path: ../../nextcloud path: ../../nextcloud
sort_box: sort_box:
path: ../../sort_box path: ../../sort_box
wakelock_windows:
git:
url: https://github.com/fikretonuresen/wakelock
ref: 269e1dba6bca6975a0bc44da6a42e56ca7428da9
path: wakelock_windows

2
packages/neon/neon_news/lib/neon_news.dart

@ -23,7 +23,7 @@ import 'package:provider/provider.dart';
import 'package:rxdart/rxdart.dart'; import 'package:rxdart/rxdart.dart';
import 'package:share_plus/share_plus.dart'; import 'package:share_plus/share_plus.dart';
import 'package:url_launcher/url_launcher_string.dart'; import 'package:url_launcher/url_launcher_string.dart';
import 'package:wakelock/wakelock.dart'; import 'package:wakelock_plus/wakelock_plus.dart';
import 'package:webview_flutter/webview_flutter.dart'; import 'package:webview_flutter/webview_flutter.dart';
part 'blocs/article.dart'; part 'blocs/article.dart';

11
packages/neon/neon_news/lib/pages/article.dart

@ -33,10 +33,8 @@ class _NewsArticlePageState extends State<NewsArticlePage> {
NeonException.showSnackbar(context, error); NeonException.showSnackbar(context, error);
}); });
WidgetsBinding.instance.addPostFrameCallback((final _) async { WidgetsBinding.instance.addPostFrameCallback((final _) {
if (Provider.of<NeonPlatform>(context, listen: false).canUseWakelock) { unawaited(WakelockPlus.enable());
await Wakelock.enable();
}
}); });
if (widget.useWebView) { if (widget.useWebView) {
@ -102,9 +100,8 @@ class _NewsArticlePageState extends State<NewsArticlePage> {
return true; return true;
} }
if (mounted && Provider.of<NeonPlatform>(context, listen: false).canUseWakelock) { unawaited(WakelockPlus.disable());
await Wakelock.disable();
}
return false; return false;
}, },
child: Scaffold( child: Scaffold(

9
packages/neon/neon_news/pubspec.yaml

@ -25,7 +25,7 @@ dependencies:
rxdart: ^0.27.7 rxdart: ^0.27.7
share_plus: ^7.0.0 share_plus: ^7.0.0
url_launcher: ^6.1.11 url_launcher: ^6.1.11
wakelock: ^0.6.2 wakelock_plus: ^1.1.1
webview_flutter: ^4.2.0 webview_flutter: ^4.2.0
dev_dependencies: dev_dependencies:
@ -36,13 +36,6 @@ dev_dependencies:
url: https://github.com/stack11/dart_nit_picking url: https://github.com/stack11/dart_nit_picking
ref: 0b2ee0d ref: 0b2ee0d
dependency_overrides:
wakelock_windows: # TODO: https://github.com/creativecreatorormaybenot/wakelock/pull/195
git:
url: https://github.com/fikretonuresen/wakelock
path: wakelock_windows
ref: 269e1dba6bca6975a0bc44da6a42e56ca7428da9
flutter: flutter:
uses-material-design: true uses-material-design: true
assets: assets:

7
packages/neon/neon_news/pubspec_overrides.yaml

@ -1,4 +1,4 @@
# melos_managed_dependency_overrides: dynamite_runtime,neon,nextcloud,sort_box,wakelock_windows # melos_managed_dependency_overrides: dynamite_runtime,neon,nextcloud,sort_box
dependency_overrides: dependency_overrides:
dynamite_runtime: dynamite_runtime:
path: ../../dynamite/dynamite_runtime path: ../../dynamite/dynamite_runtime
@ -8,8 +8,3 @@ dependency_overrides:
path: ../../nextcloud path: ../../nextcloud
sort_box: sort_box:
path: ../../sort_box path: ../../sort_box
wakelock_windows:
git:
url: https://github.com/fikretonuresen/wakelock
ref: 269e1dba6bca6975a0bc44da6a42e56ca7428da9
path: wakelock_windows

3
packages/neon/neon_notes/lib/neon_notes.dart

@ -11,7 +11,6 @@ import 'package:go_router/go_router.dart';
import 'package:material_design_icons_flutter/material_design_icons_flutter.dart'; import 'package:material_design_icons_flutter/material_design_icons_flutter.dart';
import 'package:neon/blocs.dart'; import 'package:neon/blocs.dart';
import 'package:neon/models.dart'; import 'package:neon/models.dart';
import 'package:neon/platform.dart';
import 'package:neon/settings.dart'; import 'package:neon/settings.dart';
import 'package:neon/sort_box.dart'; import 'package:neon/sort_box.dart';
import 'package:neon/utils.dart'; import 'package:neon/utils.dart';
@ -23,7 +22,7 @@ import 'package:provider/provider.dart';
import 'package:queue/queue.dart'; import 'package:queue/queue.dart';
import 'package:rxdart/rxdart.dart'; import 'package:rxdart/rxdart.dart';
import 'package:url_launcher/url_launcher_string.dart'; import 'package:url_launcher/url_launcher_string.dart';
import 'package:wakelock/wakelock.dart'; import 'package:wakelock_plus/wakelock_plus.dart';
part 'blocs/note.dart'; part 'blocs/note.dart';
part 'blocs/notes.dart'; part 'blocs/notes.dart';

12
packages/neon/neon_notes/lib/pages/note.dart

@ -41,10 +41,9 @@ class _NotesNotePageState extends State<NotesNotePage> {
_contentController.addListener(() => _contentStreamController.add(_contentController.text)); _contentController.addListener(() => _contentStreamController.add(_contentController.text));
_titleController.addListener(() => _titleStreamController.add(_titleController.text)); _titleController.addListener(() => _titleStreamController.add(_titleController.text));
WidgetsBinding.instance.addPostFrameCallback((final _) async { WidgetsBinding.instance.addPostFrameCallback((final _) {
if (Provider.of<NeonPlatform>(context, listen: false).canUseWakelock) { unawaited(WakelockPlus.enable());
await Wakelock.enable();
}
if (widget.bloc.options.defaultNoteViewTypeOption.value == DefaultNoteViewType.edit || if (widget.bloc.options.defaultNoteViewTypeOption.value == DefaultNoteViewType.edit ||
widget.bloc.initialContent.isEmpty) { widget.bloc.initialContent.isEmpty) {
setState(() { setState(() {
@ -65,9 +64,8 @@ class _NotesNotePageState extends State<NotesNotePage> {
@override @override
Widget build(final BuildContext context) => BackButtonListener( Widget build(final BuildContext context) => BackButtonListener(
onBackButtonPressed: () async { onBackButtonPressed: () async {
if (Provider.of<NeonPlatform>(context, listen: false).canUseWakelock) { unawaited(WakelockPlus.disable());
await Wakelock.disable();
}
return false; return false;
}, },
child: Scaffold( child: Scaffold(

9
packages/neon/neon_notes/pubspec.yaml

@ -26,7 +26,7 @@ dependencies:
queue: ^3.1.0+2 queue: ^3.1.0+2
rxdart: ^0.27.7 rxdart: ^0.27.7
url_launcher: ^6.1.11 url_launcher: ^6.1.11
wakelock: ^0.6.2 wakelock_plus: ^1.1.1
dev_dependencies: dev_dependencies:
build_runner: ^2.4.4 build_runner: ^2.4.4
@ -36,13 +36,6 @@ dev_dependencies:
url: https://github.com/stack11/dart_nit_picking url: https://github.com/stack11/dart_nit_picking
ref: 0b2ee0d ref: 0b2ee0d
dependency_overrides:
wakelock_windows: # TODO: https://github.com/creativecreatorormaybenot/wakelock/pull/195
git:
url: https://github.com/fikretonuresen/wakelock
path: wakelock_windows
ref: 269e1dba6bca6975a0bc44da6a42e56ca7428da9
flutter: flutter:
uses-material-design: true uses-material-design: true
assets: assets:

7
packages/neon/neon_notes/pubspec_overrides.yaml

@ -1,4 +1,4 @@
# melos_managed_dependency_overrides: dynamite_runtime,neon,nextcloud,sort_box,wakelock_windows # melos_managed_dependency_overrides: dynamite_runtime,neon,nextcloud,sort_box
dependency_overrides: dependency_overrides:
dynamite_runtime: dynamite_runtime:
path: ../../dynamite/dynamite_runtime path: ../../dynamite/dynamite_runtime
@ -8,8 +8,3 @@ dependency_overrides:
path: ../../nextcloud path: ../../nextcloud
sort_box: sort_box:
path: ../../sort_box path: ../../sort_box
wakelock_windows:
git:
url: https://github.com/fikretonuresen/wakelock
ref: 269e1dba6bca6975a0bc44da6a42e56ca7428da9
path: wakelock_windows

Loading…
Cancel
Save