diff --git a/packages/app/pubspec.lock b/packages/app/pubspec.lock index 09d8b682..10a17114 100644 --- a/packages/app/pubspec.lock +++ b/packages/app/pubspec.lock @@ -1425,47 +1425,22 @@ packages: url: "https://pub.dev" source: hosted version: "11.3.0" - wakelock: + wakelock_plus: dependency: transitive description: - name: wakelock - sha256: "769ecf42eb2d07128407b50cb93d7c10bd2ee48f0276ef0119db1d25cc2f87db" + name: wakelock_plus + sha256: aac3f3258f01781ec9212df94eecef1eb9ba9350e106728def405baa096ba413 url: "https://pub.dev" source: hosted - version: "0.6.2" - wakelock_macos: - 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: + version: "1.1.1" + wakelock_plus_platform_interface: dependency: transitive description: - name: wakelock_web - sha256: "1b256b811ee3f0834888efddfe03da8d18d0819317f20f6193e2922b41a501b5" + name: wakelock_plus_platform_interface + sha256: "40fabed5da06caff0796dc638e1f07ee395fb18801fbff3255a2372db2d80385" url: "https://pub.dev" source: hosted - version: "0.4.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" + version: "1.1.0" webdriver: dependency: transitive description: diff --git a/packages/app/pubspec.yaml b/packages/app/pubspec.yaml index 6e138a2a..4e96fdf4 100644 --- a/packages/app/pubspec.yaml +++ b/packages/app/pubspec.yaml @@ -44,13 +44,6 @@ dev_dependencies: url: https://github.com/stack11/dart_nit_picking 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: uses-material-design: true assets: diff --git a/packages/app/pubspec_overrides.yaml b/packages/app/pubspec_overrides.yaml index 769385c2..42527add 100644 --- a/packages/app/pubspec_overrides.yaml +++ b/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: dynamite_runtime: path: ../dynamite/dynamite_runtime @@ -18,8 +18,3 @@ dependency_overrides: path: ../nextcloud sort_box: path: ../sort_box - wakelock_windows: - git: - url: https://github.com/fikretonuresen/wakelock - ref: 269e1dba6bca6975a0bc44da6a42e56ca7428da9 - path: wakelock_windows diff --git a/packages/neon/neon/lib/src/platform/android.dart b/packages/neon/neon/lib/src/platform/android.dart index 53f96543..90dbf997 100644 --- a/packages/neon/neon/lib/src/platform/android.dart +++ b/packages/neon/neon/lib/src/platform/android.dart @@ -10,7 +10,6 @@ class AndroidNeonPlatform extends NeonPlatform { AndroidNeonPlatform() : super( canUseWebView: true, - canUseWakelock: true, canUseQuickActions: true, canUseSystemTray: false, canUseWindowManager: false, diff --git a/packages/neon/neon/lib/src/platform/linux.dart b/packages/neon/neon/lib/src/platform/linux.dart index 471c8db1..49fb669c 100644 --- a/packages/neon/neon/lib/src/platform/linux.dart +++ b/packages/neon/neon/lib/src/platform/linux.dart @@ -11,7 +11,6 @@ class LinuxNeonPlatform extends NeonPlatform { LinuxNeonPlatform() : super( canUseWebView: false, - canUseWakelock: false, canUseQuickActions: false, canUseSystemTray: true, canUseWindowManager: true, diff --git a/packages/neon/neon/lib/src/platform/platform.dart b/packages/neon/neon/lib/src/platform/platform.dart index 1466c866..e41f67ba 100644 --- a/packages/neon/neon/lib/src/platform/platform.dart +++ b/packages/neon/neon/lib/src/platform/platform.dart @@ -23,7 +23,6 @@ Future getNeonPlatform() async { abstract class NeonPlatform { NeonPlatform({ required this.canUseWebView, - required this.canUseWakelock, required this.canUseQuickActions, required this.canUseSystemTray, required this.canUseWindowManager, @@ -36,8 +35,6 @@ abstract class NeonPlatform { final bool canUseWebView; - final bool canUseWakelock; - final bool canUseQuickActions; final bool canUseSystemTray; diff --git a/packages/neon/neon/pubspec.yaml b/packages/neon/neon/pubspec.yaml index 93ab4173..0479da47 100644 --- a/packages/neon/neon/pubspec.yaml +++ b/packages/neon/neon/pubspec.yaml @@ -66,13 +66,6 @@ dev_dependencies: ref: 0b2ee0d 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: uses-material-design: true assets: diff --git a/packages/neon/neon/pubspec_overrides.yaml b/packages/neon/neon/pubspec_overrides.yaml index fa3b7c95..2e927e31 100644 --- a/packages/neon/neon/pubspec_overrides.yaml +++ b/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: dynamite_runtime: path: ../../dynamite/dynamite_runtime @@ -6,8 +6,3 @@ dependency_overrides: path: ../../nextcloud sort_box: path: ../../sort_box - wakelock_windows: - git: - url: https://github.com/fikretonuresen/wakelock - ref: 269e1dba6bca6975a0bc44da6a42e56ca7428da9 - path: wakelock_windows diff --git a/packages/neon/neon_news/lib/neon_news.dart b/packages/neon/neon_news/lib/neon_news.dart index 3a534290..9b9863ea 100644 --- a/packages/neon/neon_news/lib/neon_news.dart +++ b/packages/neon/neon_news/lib/neon_news.dart @@ -23,7 +23,7 @@ import 'package:provider/provider.dart'; import 'package:rxdart/rxdart.dart'; import 'package:share_plus/share_plus.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'; part 'blocs/article.dart'; diff --git a/packages/neon/neon_news/lib/pages/article.dart b/packages/neon/neon_news/lib/pages/article.dart index eaa2d232..e2ccda80 100644 --- a/packages/neon/neon_news/lib/pages/article.dart +++ b/packages/neon/neon_news/lib/pages/article.dart @@ -33,10 +33,8 @@ class _NewsArticlePageState extends State { NeonException.showSnackbar(context, error); }); - WidgetsBinding.instance.addPostFrameCallback((final _) async { - if (Provider.of(context, listen: false).canUseWakelock) { - await Wakelock.enable(); - } + WidgetsBinding.instance.addPostFrameCallback((final _) { + unawaited(WakelockPlus.enable()); }); if (widget.useWebView) { @@ -102,9 +100,8 @@ class _NewsArticlePageState extends State { return true; } - if (mounted && Provider.of(context, listen: false).canUseWakelock) { - await Wakelock.disable(); - } + unawaited(WakelockPlus.disable()); + return false; }, child: Scaffold( diff --git a/packages/neon/neon_news/pubspec.yaml b/packages/neon/neon_news/pubspec.yaml index c4c3a2c0..d0c003ac 100644 --- a/packages/neon/neon_news/pubspec.yaml +++ b/packages/neon/neon_news/pubspec.yaml @@ -25,7 +25,7 @@ dependencies: rxdart: ^0.27.7 share_plus: ^7.0.0 url_launcher: ^6.1.11 - wakelock: ^0.6.2 + wakelock_plus: ^1.1.1 webview_flutter: ^4.2.0 dev_dependencies: @@ -36,13 +36,6 @@ dev_dependencies: url: https://github.com/stack11/dart_nit_picking 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: uses-material-design: true assets: diff --git a/packages/neon/neon_news/pubspec_overrides.yaml b/packages/neon/neon_news/pubspec_overrides.yaml index 807ec964..bc921fe9 100644 --- a/packages/neon/neon_news/pubspec_overrides.yaml +++ b/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: dynamite_runtime: path: ../../dynamite/dynamite_runtime @@ -8,8 +8,3 @@ dependency_overrides: path: ../../nextcloud sort_box: path: ../../sort_box - wakelock_windows: - git: - url: https://github.com/fikretonuresen/wakelock - ref: 269e1dba6bca6975a0bc44da6a42e56ca7428da9 - path: wakelock_windows diff --git a/packages/neon/neon_notes/lib/neon_notes.dart b/packages/neon/neon_notes/lib/neon_notes.dart index a5c29136..7478f852 100644 --- a/packages/neon/neon_notes/lib/neon_notes.dart +++ b/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:neon/blocs.dart'; import 'package:neon/models.dart'; -import 'package:neon/platform.dart'; import 'package:neon/settings.dart'; import 'package:neon/sort_box.dart'; import 'package:neon/utils.dart'; @@ -23,7 +22,7 @@ import 'package:provider/provider.dart'; import 'package:queue/queue.dart'; import 'package:rxdart/rxdart.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/notes.dart'; diff --git a/packages/neon/neon_notes/lib/pages/note.dart b/packages/neon/neon_notes/lib/pages/note.dart index 16ed07ce..f5336f83 100644 --- a/packages/neon/neon_notes/lib/pages/note.dart +++ b/packages/neon/neon_notes/lib/pages/note.dart @@ -41,10 +41,9 @@ class _NotesNotePageState extends State { _contentController.addListener(() => _contentStreamController.add(_contentController.text)); _titleController.addListener(() => _titleStreamController.add(_titleController.text)); - WidgetsBinding.instance.addPostFrameCallback((final _) async { - if (Provider.of(context, listen: false).canUseWakelock) { - await Wakelock.enable(); - } + WidgetsBinding.instance.addPostFrameCallback((final _) { + unawaited(WakelockPlus.enable()); + if (widget.bloc.options.defaultNoteViewTypeOption.value == DefaultNoteViewType.edit || widget.bloc.initialContent.isEmpty) { setState(() { @@ -65,9 +64,8 @@ class _NotesNotePageState extends State { @override Widget build(final BuildContext context) => BackButtonListener( onBackButtonPressed: () async { - if (Provider.of(context, listen: false).canUseWakelock) { - await Wakelock.disable(); - } + unawaited(WakelockPlus.disable()); + return false; }, child: Scaffold( diff --git a/packages/neon/neon_notes/pubspec.yaml b/packages/neon/neon_notes/pubspec.yaml index 6319ea2b..e151e5a6 100644 --- a/packages/neon/neon_notes/pubspec.yaml +++ b/packages/neon/neon_notes/pubspec.yaml @@ -26,7 +26,7 @@ dependencies: queue: ^3.1.0+2 rxdart: ^0.27.7 url_launcher: ^6.1.11 - wakelock: ^0.6.2 + wakelock_plus: ^1.1.1 dev_dependencies: build_runner: ^2.4.4 @@ -36,13 +36,6 @@ dev_dependencies: url: https://github.com/stack11/dart_nit_picking 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: uses-material-design: true assets: diff --git a/packages/neon/neon_notes/pubspec_overrides.yaml b/packages/neon/neon_notes/pubspec_overrides.yaml index 807ec964..bc921fe9 100644 --- a/packages/neon/neon_notes/pubspec_overrides.yaml +++ b/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: dynamite_runtime: path: ../../dynamite/dynamite_runtime @@ -8,8 +8,3 @@ dependency_overrides: path: ../../nextcloud sort_box: path: ../../sort_box - wakelock_windows: - git: - url: https://github.com/fikretonuresen/wakelock - ref: 269e1dba6bca6975a0bc44da6a42e56ca7428da9 - path: wakelock_windows