Browse Source
			
			
			
			
				
		OMP#OS-17021 Plugin wakelock See merge request non-oss/flutter/flutter-plugins!13merge-requests/13/merge
				 23 changed files with 714 additions and 0 deletions
			
			
		@ -0,0 +1,30 @@
					 | 
				
			||||
# Miscellaneous | 
				
			||||
*.class | 
				
			||||
*.log | 
				
			||||
*.pyc | 
				
			||||
*.swp | 
				
			||||
.DS_Store | 
				
			||||
.atom/ | 
				
			||||
.buildlog/ | 
				
			||||
.history | 
				
			||||
.svn/ | 
				
			||||
migrate_working_dir/ | 
				
			||||
 | 
				
			||||
# IntelliJ related | 
				
			||||
*.iml | 
				
			||||
*.ipr | 
				
			||||
*.iws | 
				
			||||
.idea/ | 
				
			||||
 | 
				
			||||
# The .vscode folder contains launch configuration and tasks you configure in | 
				
			||||
# VS Code which you may wish to be included in version control, so this line | 
				
			||||
# is commented out by default. | 
				
			||||
#.vscode/ | 
				
			||||
 | 
				
			||||
# Flutter/Dart/Pub related | 
				
			||||
# Libraries should not include pubspec.lock, per https://dart.dev/guides/libraries/private-files#pubspeclock. | 
				
			||||
/pubspec.lock | 
				
			||||
**/doc/api/ | 
				
			||||
.dart_tool/ | 
				
			||||
.packages | 
				
			||||
build/ | 
				
			||||
@ -0,0 +1,28 @@
					 | 
				
			||||
# wakelock_aurora | 
				
			||||
 | 
				
			||||
The Aurora implementation of [`wakelock`][https://pub.dev/packages/wakelock]. | 
				
			||||
 | 
				
			||||
## Usage | 
				
			||||
This package is not an _endorsed_ implementation of `wakelock`.  | 
				
			||||
Therefore, you have to include `wakelock_aurora` alongside `wakelock` as dependencies in your `pubspec.yaml` file. | 
				
			||||
 | 
				
			||||
**pubspec.yaml** | 
				
			||||
 | 
				
			||||
```yaml | 
				
			||||
dependencies: | 
				
			||||
  wakelock: ^0.6.2 | 
				
			||||
  wakelock_aurora: | 
				
			||||
    path: # path to folder with plugin | 
				
			||||
``` | 
				
			||||
 | 
				
			||||
***.dart** | 
				
			||||
 | 
				
			||||
```dart | 
				
			||||
import 'package:wakelock/wakelock.dart'; | 
				
			||||
 | 
				
			||||
// The following line will enable wakelock. | 
				
			||||
Wakelock.enable(); | 
				
			||||
 | 
				
			||||
// The next line disables the wakelock again. | 
				
			||||
Wakelock.disable(); | 
				
			||||
``` | 
				
			||||
@ -0,0 +1,4 @@
					 | 
				
			||||
# Copyright (c) 2023. Open Mobile Platform LLC. | 
				
			||||
# License: Proprietary. | 
				
			||||
 | 
				
			||||
include: package:flutter_lints/flutter.yaml | 
				
			||||
@ -0,0 +1,10 @@
					 | 
				
			||||
<?xml version="1.0" encoding="UTF-8" ?> | 
				
			||||
<!DOCTYPE node PUBLIC | 
				
			||||
  "-//freedesktop//DTD D-Bus Object Introspection 1.0//EN" | 
				
			||||
  "http://standards.freedesktop.org/dbus/1.0/introspect.dtd"> | 
				
			||||
<node name="/com/nokia/mce/request"> | 
				
			||||
  <interface name="com.nokia.mce.request"> | 
				
			||||
    <method name="req_display_blanking_pause"> | 
				
			||||
    </method> | 
				
			||||
  </interface> | 
				
			||||
</node> | 
				
			||||
| 
		 After Width: | Height: | Size: 59 KiB  | 
@ -0,0 +1,47 @@
					 | 
				
			||||
# Miscellaneous | 
				
			||||
*.class | 
				
			||||
*.log | 
				
			||||
*.pyc | 
				
			||||
*.swp | 
				
			||||
.DS_Store | 
				
			||||
.atom/ | 
				
			||||
.buildlog/ | 
				
			||||
.history | 
				
			||||
.svn/ | 
				
			||||
migrate_working_dir/ | 
				
			||||
 | 
				
			||||
# IntelliJ related | 
				
			||||
*.iml | 
				
			||||
*.ipr | 
				
			||||
*.iws | 
				
			||||
.idea/ | 
				
			||||
 | 
				
			||||
# The .vscode folder contains launch configuration and tasks you configure in | 
				
			||||
# VS Code which you may wish to be included in version control, so this line | 
				
			||||
# is commented out by default. | 
				
			||||
#.vscode/ | 
				
			||||
 | 
				
			||||
# Flutter/Dart/Pub related | 
				
			||||
**/doc/api/ | 
				
			||||
**/ios/Flutter/.last_build_id | 
				
			||||
.dart_tool/ | 
				
			||||
.flutter-plugins | 
				
			||||
.flutter-plugins-dependencies | 
				
			||||
.packages | 
				
			||||
.pub-cache/ | 
				
			||||
.pub/ | 
				
			||||
/build/ | 
				
			||||
 | 
				
			||||
# Symbolication related | 
				
			||||
app.*.symbols | 
				
			||||
 | 
				
			||||
# Obfuscation related | 
				
			||||
app.*.map.json | 
				
			||||
 | 
				
			||||
# Android Studio will place build artifacts here | 
				
			||||
/android/app/debug | 
				
			||||
/android/app/profile | 
				
			||||
/android/app/release | 
				
			||||
 | 
				
			||||
# Aurora generated | 
				
			||||
/aurora/flutter | 
				
			||||
@ -0,0 +1,21 @@
					 | 
				
			||||
# wakelock_aurora_example | 
				
			||||
 | 
				
			||||
Demonstrates how to use the wakelock_aurora plugin. | 
				
			||||
 | 
				
			||||
## Build | 
				
			||||
 | 
				
			||||
```shell | 
				
			||||
# Add an alias if it doesn't already exist | 
				
			||||
alias flutter-aurora=$HOME/.local/opt/flutter-sdk/bin/flutter | 
				
			||||
# Get dependencies | 
				
			||||
flutter-aurora pub get | 
				
			||||
# Run build | 
				
			||||
flutter-aurora build aurora --release # [--release|--debug|--profile] | 
				
			||||
``` | 
				
			||||
 | 
				
			||||
You can collect, sign, run an example on the device with a script located in the `script/build_example.sh` | 
				
			||||
More information in `build_example.sh`. | 
				
			||||
 | 
				
			||||
### Preview example | 
				
			||||
 | 
				
			||||
 | 
				
			||||
@ -0,0 +1,4 @@
					 | 
				
			||||
# Copyright (c) 2023. Open Mobile Platform LLC. | 
				
			||||
# License: Proprietary. | 
				
			||||
 | 
				
			||||
include: package:flutter_lints/flutter.yaml | 
				
			||||
@ -0,0 +1 @@
					 | 
				
			||||
flutter/ephemeral | 
				
			||||
@ -0,0 +1,50 @@
					 | 
				
			||||
# Copyright (c) 2023. Open Mobile Platform LLC. | 
				
			||||
# License: Proprietary. | 
				
			||||
 | 
				
			||||
cmake_minimum_required(VERSION 3.10) | 
				
			||||
project(com.example.wakelock_aurora_example LANGUAGES CXX) | 
				
			||||
 | 
				
			||||
include(GNUInstallDirs) | 
				
			||||
 | 
				
			||||
set(BINARY_NAME ${CMAKE_PROJECT_NAME}) | 
				
			||||
set(FLUTTER_DIR ${CMAKE_CURRENT_SOURCE_DIR}/flutter) | 
				
			||||
 | 
				
			||||
set(CMAKE_CXX_STANDARD 17) | 
				
			||||
set(CMAKE_CXX_STANDARD_REQUIRED ON) | 
				
			||||
 | 
				
			||||
set(CMAKE_CXX_FLAGS "-Wall -Wextra") | 
				
			||||
set(CMAKE_CXX_FLAGS_RELEASE "-O3") | 
				
			||||
 | 
				
			||||
set(CMAKE_SKIP_RPATH OFF) | 
				
			||||
set(CMAKE_INSTALL_RPATH "\$ORIGIN/../share/${BINARY_NAME}/lib") | 
				
			||||
 | 
				
			||||
find_package(PkgConfig REQUIRED) | 
				
			||||
pkg_check_modules(FlutterEmbedder REQUIRED IMPORTED_TARGET flutter-embedder) | 
				
			||||
 | 
				
			||||
add_executable(${BINARY_NAME} main.cpp ${FLUTTER_DIR}/generated_plugin_registrant.cpp) | 
				
			||||
target_link_libraries(${BINARY_NAME} PRIVATE PkgConfig::FlutterEmbedder) | 
				
			||||
target_include_directories(${BINARY_NAME} PRIVATE ${FLUTTER_DIR}) | 
				
			||||
 | 
				
			||||
include(flutter/generated_plugins.cmake) | 
				
			||||
 | 
				
			||||
set(PACKAGE_INSTALL_DIR    ${CMAKE_INSTALL_DATADIR}/${BINARY_NAME}) | 
				
			||||
set(DESKTOP_INSTALL_DIR    ${CMAKE_INSTALL_DATADIR}/applications) | 
				
			||||
set(ICONS_INSTALL_ROOT_DIR ${CMAKE_INSTALL_DATADIR}/icons/hicolor) | 
				
			||||
 | 
				
			||||
add_custom_command(TARGET ${BINARY_NAME} POST_BUILD | 
				
			||||
                   COMMAND ${CMAKE_COMMAND} -E copy | 
				
			||||
                   ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/libflutter-embedder.so | 
				
			||||
                   ${PROJECT_BINARY_DIR}/bundle/lib/libflutter-embedder.so) | 
				
			||||
 | 
				
			||||
install(FILES     ${PROJECT_BINARY_DIR}/bundle/icudtl.dat     DESTINATION ${PACKAGE_INSTALL_DIR}) | 
				
			||||
install(DIRECTORY ${PROJECT_BINARY_DIR}/bundle/flutter_assets DESTINATION ${PACKAGE_INSTALL_DIR}) | 
				
			||||
install(DIRECTORY ${PROJECT_BINARY_DIR}/bundle/lib            DESTINATION ${PACKAGE_INSTALL_DIR}) | 
				
			||||
 | 
				
			||||
install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) | 
				
			||||
install(FILES desktop/${BINARY_NAME}.desktop DESTINATION ${DESKTOP_INSTALL_DIR}) | 
				
			||||
 | 
				
			||||
foreach(ICONS_SIZE 86x86 108x108 128x128 172x172) | 
				
			||||
    install(FILES icons/${ICONS_SIZE}.png | 
				
			||||
            RENAME ${BINARY_NAME}.png | 
				
			||||
            DESTINATION ${ICONS_INSTALL_ROOT_DIR}/${ICONS_SIZE}/apps/) | 
				
			||||
endforeach(ICONS_SIZE) | 
				
			||||
@ -0,0 +1,12 @@
					 | 
				
			||||
[Desktop Entry] | 
				
			||||
Type=Application | 
				
			||||
Name=wakelock_aurora_example | 
				
			||||
Comment=Demonstrates how to use the wakelock_aurora plugin. | 
				
			||||
Icon=com.example.wakelock_aurora_example | 
				
			||||
Exec=/usr/bin/com.example.wakelock_aurora_example | 
				
			||||
X-Nemo-Application-Type=silica-qt5 | 
				
			||||
 | 
				
			||||
[X-Application] | 
				
			||||
Permissions= | 
				
			||||
OrganizationName=com.example | 
				
			||||
ApplicationName=wakelock_aurora_example | 
				
			||||
| 
		 After Width: | Height: | Size: 9.7 KiB  | 
| 
		 After Width: | Height: | Size: 13 KiB  | 
| 
		 After Width: | Height: | Size: 23 KiB  | 
| 
		 After Width: | Height: | Size: 6.5 KiB  | 
@ -0,0 +1,13 @@
					 | 
				
			||||
/*
 | 
				
			||||
 * Copyright (c) 2023. Open Mobile Platform LLC. | 
				
			||||
 * License: Proprietary. | 
				
			||||
 */ | 
				
			||||
#include <flutter/application.h> | 
				
			||||
#include "generated_plugin_registrant.h" | 
				
			||||
 | 
				
			||||
int main(int argc, char *argv[]) { | 
				
			||||
    Application::Initialize(argc, argv); | 
				
			||||
    RegisterPlugins(); | 
				
			||||
    Application::Launch(); | 
				
			||||
    return 0; | 
				
			||||
} | 
				
			||||
@ -0,0 +1,31 @@
					 | 
				
			||||
%global __provides_exclude_from ^%{_datadir}/%{name}/lib/.*$ | 
				
			||||
%global __requires_exclude ^lib(dconf|flutter-embedder|maliit-glib|appmanifest-.+|.+_platform_plugin)\\.so.*$ | 
				
			||||
 | 
				
			||||
Name: com.example.wakelock_aurora_example | 
				
			||||
Summary: Demonstrates how to use the wakelock_aurora plugin. | 
				
			||||
Version: 0.1.0 | 
				
			||||
Release: 1 | 
				
			||||
License: Proprietary | 
				
			||||
Source0: %{name}-%{version}.tar.zst | 
				
			||||
 | 
				
			||||
BuildRequires: cmake | 
				
			||||
BuildRequires: pkgconfig(flutter-embedder) | 
				
			||||
 | 
				
			||||
%description | 
				
			||||
%{summary}. | 
				
			||||
 | 
				
			||||
%prep | 
				
			||||
%autosetup | 
				
			||||
 | 
				
			||||
%build | 
				
			||||
%cmake -DCMAKE_BUILD_TYPE=%{_flutter_build_type} | 
				
			||||
%make_build | 
				
			||||
 | 
				
			||||
%install | 
				
			||||
%make_install | 
				
			||||
 | 
				
			||||
%files | 
				
			||||
%{_bindir}/%{name} | 
				
			||||
%{_datadir}/%{name}/* | 
				
			||||
%{_datadir}/applications/%{name}.desktop | 
				
			||||
%{_datadir}/icons/hicolor/*/apps/%{name}.png | 
				
			||||
@ -0,0 +1,78 @@
					 | 
				
			||||
/* | 
				
			||||
 * Copyright (c) 2023. Open Mobile Platform LLC. | 
				
			||||
 * License: Proprietary. | 
				
			||||
 */ | 
				
			||||
import 'dart:async'; | 
				
			||||
import 'package:flutter/material.dart'; | 
				
			||||
import 'package:wakelock/wakelock.dart'; | 
				
			||||
 | 
				
			||||
void main() { | 
				
			||||
  runApp(const MyApp()); | 
				
			||||
} | 
				
			||||
 | 
				
			||||
class MyApp extends StatefulWidget { | 
				
			||||
  const MyApp({super.key}); | 
				
			||||
 | 
				
			||||
  @override | 
				
			||||
  State<MyApp> createState() => _MyAppState(); | 
				
			||||
} | 
				
			||||
 | 
				
			||||
class _MyAppState extends State<MyApp> { | 
				
			||||
  bool _enableWakelock = false; | 
				
			||||
 | 
				
			||||
  @override | 
				
			||||
  void initState() { | 
				
			||||
    super.initState(); | 
				
			||||
  } | 
				
			||||
 | 
				
			||||
  Future<void> _toggleWakelock() async { | 
				
			||||
    final enableWakelock = !(await Wakelock.enabled); | 
				
			||||
    await Wakelock.toggle(enable: enableWakelock); | 
				
			||||
    setState(() { | 
				
			||||
      _enableWakelock = enableWakelock; | 
				
			||||
    }); | 
				
			||||
  } | 
				
			||||
 | 
				
			||||
  @override | 
				
			||||
  Widget build(BuildContext context) { | 
				
			||||
    const textStyleWhite = TextStyle(fontSize: 18, color: Colors.white); | 
				
			||||
 | 
				
			||||
    return MaterialApp( | 
				
			||||
      home: Scaffold( | 
				
			||||
        appBar: AppBar( | 
				
			||||
          title: const Text('Example wakelock'), | 
				
			||||
        ), | 
				
			||||
        body: SingleChildScrollView( | 
				
			||||
          child: Padding( | 
				
			||||
            padding: const EdgeInsets.all(16), | 
				
			||||
            child: Center( | 
				
			||||
              child: Column( | 
				
			||||
                children: [ | 
				
			||||
                  // Info | 
				
			||||
                  Container( | 
				
			||||
                    padding: const EdgeInsets.all(20), | 
				
			||||
                    decoration: const BoxDecoration( | 
				
			||||
                      color: Colors.green, | 
				
			||||
                      borderRadius: BorderRadius.all(Radius.circular(10.0)), | 
				
			||||
                    ), | 
				
			||||
                    child: const Text( | 
				
			||||
                      'Demo application demonstration implementation of wakelock', | 
				
			||||
                      style: textStyleWhite, | 
				
			||||
                      textAlign: TextAlign.center, | 
				
			||||
                    ), | 
				
			||||
                  ), | 
				
			||||
                  const SizedBox(height: 30), | 
				
			||||
 | 
				
			||||
                  ElevatedButton( | 
				
			||||
                    onPressed: _toggleWakelock, | 
				
			||||
                    child: Text('Toggle wakelock: $_enableWakelock'), | 
				
			||||
                  ), | 
				
			||||
                ], | 
				
			||||
              ), | 
				
			||||
            ), | 
				
			||||
          ), | 
				
			||||
        ), | 
				
			||||
      ), | 
				
			||||
    ); | 
				
			||||
  } | 
				
			||||
} | 
				
			||||
@ -0,0 +1,264 @@
					 | 
				
			||||
# Generated by pub | 
				
			||||
# See https://dart.dev/tools/pub/glossary#lockfile | 
				
			||||
packages: | 
				
			||||
  args: | 
				
			||||
    dependency: transitive | 
				
			||||
    description: | 
				
			||||
      name: args | 
				
			||||
      url: "https://pub.dartlang.org" | 
				
			||||
    source: hosted | 
				
			||||
    version: "2.4.1" | 
				
			||||
  async: | 
				
			||||
    dependency: transitive | 
				
			||||
    description: | 
				
			||||
      name: async | 
				
			||||
      url: "https://pub.dartlang.org" | 
				
			||||
    source: hosted | 
				
			||||
    version: "2.9.0" | 
				
			||||
  boolean_selector: | 
				
			||||
    dependency: transitive | 
				
			||||
    description: | 
				
			||||
      name: boolean_selector | 
				
			||||
      url: "https://pub.dartlang.org" | 
				
			||||
    source: hosted | 
				
			||||
    version: "2.1.0" | 
				
			||||
  characters: | 
				
			||||
    dependency: transitive | 
				
			||||
    description: | 
				
			||||
      name: characters | 
				
			||||
      url: "https://pub.dartlang.org" | 
				
			||||
    source: hosted | 
				
			||||
    version: "1.2.1" | 
				
			||||
  clock: | 
				
			||||
    dependency: transitive | 
				
			||||
    description: | 
				
			||||
      name: clock | 
				
			||||
      url: "https://pub.dartlang.org" | 
				
			||||
    source: hosted | 
				
			||||
    version: "1.1.1" | 
				
			||||
  collection: | 
				
			||||
    dependency: transitive | 
				
			||||
    description: | 
				
			||||
      name: collection | 
				
			||||
      url: "https://pub.dartlang.org" | 
				
			||||
    source: hosted | 
				
			||||
    version: "1.16.0" | 
				
			||||
  cupertino_icons: | 
				
			||||
    dependency: "direct main" | 
				
			||||
    description: | 
				
			||||
      name: cupertino_icons | 
				
			||||
      url: "https://pub.dartlang.org" | 
				
			||||
    source: hosted | 
				
			||||
    version: "1.0.5" | 
				
			||||
  dbus: | 
				
			||||
    dependency: transitive | 
				
			||||
    description: | 
				
			||||
      name: dbus | 
				
			||||
      url: "https://pub.dartlang.org" | 
				
			||||
    source: hosted | 
				
			||||
    version: "0.7.8" | 
				
			||||
  fake_async: | 
				
			||||
    dependency: transitive | 
				
			||||
    description: | 
				
			||||
      name: fake_async | 
				
			||||
      url: "https://pub.dartlang.org" | 
				
			||||
    source: hosted | 
				
			||||
    version: "1.3.1" | 
				
			||||
  ffi: | 
				
			||||
    dependency: transitive | 
				
			||||
    description: | 
				
			||||
      name: ffi | 
				
			||||
      url: "https://pub.dartlang.org" | 
				
			||||
    source: hosted | 
				
			||||
    version: "2.0.2" | 
				
			||||
  flutter: | 
				
			||||
    dependency: "direct main" | 
				
			||||
    description: flutter | 
				
			||||
    source: sdk | 
				
			||||
    version: "0.0.0" | 
				
			||||
  flutter_lints: | 
				
			||||
    dependency: "direct dev" | 
				
			||||
    description: | 
				
			||||
      name: flutter_lints | 
				
			||||
      url: "https://pub.dartlang.org" | 
				
			||||
    source: hosted | 
				
			||||
    version: "2.0.1" | 
				
			||||
  flutter_test: | 
				
			||||
    dependency: "direct dev" | 
				
			||||
    description: flutter | 
				
			||||
    source: sdk | 
				
			||||
    version: "0.0.0" | 
				
			||||
  flutter_web_plugins: | 
				
			||||
    dependency: transitive | 
				
			||||
    description: flutter | 
				
			||||
    source: sdk | 
				
			||||
    version: "0.0.0" | 
				
			||||
  js: | 
				
			||||
    dependency: transitive | 
				
			||||
    description: | 
				
			||||
      name: js | 
				
			||||
      url: "https://pub.dartlang.org" | 
				
			||||
    source: hosted | 
				
			||||
    version: "0.6.4" | 
				
			||||
  lints: | 
				
			||||
    dependency: transitive | 
				
			||||
    description: | 
				
			||||
      name: lints | 
				
			||||
      url: "https://pub.dartlang.org" | 
				
			||||
    source: hosted | 
				
			||||
    version: "2.0.1" | 
				
			||||
  matcher: | 
				
			||||
    dependency: transitive | 
				
			||||
    description: | 
				
			||||
      name: matcher | 
				
			||||
      url: "https://pub.dartlang.org" | 
				
			||||
    source: hosted | 
				
			||||
    version: "0.12.12" | 
				
			||||
  material_color_utilities: | 
				
			||||
    dependency: transitive | 
				
			||||
    description: | 
				
			||||
      name: material_color_utilities | 
				
			||||
      url: "https://pub.dartlang.org" | 
				
			||||
    source: hosted | 
				
			||||
    version: "0.1.5" | 
				
			||||
  meta: | 
				
			||||
    dependency: transitive | 
				
			||||
    description: | 
				
			||||
      name: meta | 
				
			||||
      url: "https://pub.dartlang.org" | 
				
			||||
    source: hosted | 
				
			||||
    version: "1.8.0" | 
				
			||||
  path: | 
				
			||||
    dependency: transitive | 
				
			||||
    description: | 
				
			||||
      name: path | 
				
			||||
      url: "https://pub.dartlang.org" | 
				
			||||
    source: hosted | 
				
			||||
    version: "1.8.2" | 
				
			||||
  petitparser: | 
				
			||||
    dependency: transitive | 
				
			||||
    description: | 
				
			||||
      name: petitparser | 
				
			||||
      url: "https://pub.dartlang.org" | 
				
			||||
    source: hosted | 
				
			||||
    version: "5.1.0" | 
				
			||||
  plugin_platform_interface: | 
				
			||||
    dependency: transitive | 
				
			||||
    description: | 
				
			||||
      name: plugin_platform_interface | 
				
			||||
      url: "https://pub.dartlang.org" | 
				
			||||
    source: hosted | 
				
			||||
    version: "2.1.4" | 
				
			||||
  sky_engine: | 
				
			||||
    dependency: transitive | 
				
			||||
    description: flutter | 
				
			||||
    source: sdk | 
				
			||||
    version: "0.0.99" | 
				
			||||
  source_span: | 
				
			||||
    dependency: transitive | 
				
			||||
    description: | 
				
			||||
      name: source_span | 
				
			||||
      url: "https://pub.dartlang.org" | 
				
			||||
    source: hosted | 
				
			||||
    version: "1.9.0" | 
				
			||||
  stack_trace: | 
				
			||||
    dependency: transitive | 
				
			||||
    description: | 
				
			||||
      name: stack_trace | 
				
			||||
      url: "https://pub.dartlang.org" | 
				
			||||
    source: hosted | 
				
			||||
    version: "1.10.0" | 
				
			||||
  stream_channel: | 
				
			||||
    dependency: transitive | 
				
			||||
    description: | 
				
			||||
      name: stream_channel | 
				
			||||
      url: "https://pub.dartlang.org" | 
				
			||||
    source: hosted | 
				
			||||
    version: "2.1.0" | 
				
			||||
  string_scanner: | 
				
			||||
    dependency: transitive | 
				
			||||
    description: | 
				
			||||
      name: string_scanner | 
				
			||||
      url: "https://pub.dartlang.org" | 
				
			||||
    source: hosted | 
				
			||||
    version: "1.1.1" | 
				
			||||
  term_glyph: | 
				
			||||
    dependency: transitive | 
				
			||||
    description: | 
				
			||||
      name: term_glyph | 
				
			||||
      url: "https://pub.dartlang.org" | 
				
			||||
    source: hosted | 
				
			||||
    version: "1.2.1" | 
				
			||||
  test_api: | 
				
			||||
    dependency: transitive | 
				
			||||
    description: | 
				
			||||
      name: test_api | 
				
			||||
      url: "https://pub.dartlang.org" | 
				
			||||
    source: hosted | 
				
			||||
    version: "0.4.12" | 
				
			||||
  vector_math: | 
				
			||||
    dependency: transitive | 
				
			||||
    description: | 
				
			||||
      name: vector_math | 
				
			||||
      url: "https://pub.dartlang.org" | 
				
			||||
    source: hosted | 
				
			||||
    version: "2.1.2" | 
				
			||||
  wakelock: | 
				
			||||
    dependency: "direct main" | 
				
			||||
    description: | 
				
			||||
      name: wakelock | 
				
			||||
      url: "https://pub.dartlang.org" | 
				
			||||
    source: hosted | 
				
			||||
    version: "0.6.2" | 
				
			||||
  wakelock_aurora: | 
				
			||||
    dependency: "direct main" | 
				
			||||
    description: | 
				
			||||
      path: ".." | 
				
			||||
      relative: true | 
				
			||||
    source: path | 
				
			||||
    version: "0.0.1" | 
				
			||||
  wakelock_macos: | 
				
			||||
    dependency: transitive | 
				
			||||
    description: | 
				
			||||
      name: wakelock_macos | 
				
			||||
      url: "https://pub.dartlang.org" | 
				
			||||
    source: hosted | 
				
			||||
    version: "0.4.0" | 
				
			||||
  wakelock_platform_interface: | 
				
			||||
    dependency: transitive | 
				
			||||
    description: | 
				
			||||
      name: wakelock_platform_interface | 
				
			||||
      url: "https://pub.dartlang.org" | 
				
			||||
    source: hosted | 
				
			||||
    version: "0.3.0" | 
				
			||||
  wakelock_web: | 
				
			||||
    dependency: transitive | 
				
			||||
    description: | 
				
			||||
      name: wakelock_web | 
				
			||||
      url: "https://pub.dartlang.org" | 
				
			||||
    source: hosted | 
				
			||||
    version: "0.4.0" | 
				
			||||
  wakelock_windows: | 
				
			||||
    dependency: transitive | 
				
			||||
    description: | 
				
			||||
      name: wakelock_windows | 
				
			||||
      url: "https://pub.dartlang.org" | 
				
			||||
    source: hosted | 
				
			||||
    version: "0.2.1" | 
				
			||||
  win32: | 
				
			||||
    dependency: transitive | 
				
			||||
    description: | 
				
			||||
      name: win32 | 
				
			||||
      url: "https://pub.dartlang.org" | 
				
			||||
    source: hosted | 
				
			||||
    version: "3.1.4" | 
				
			||||
  xml: | 
				
			||||
    dependency: transitive | 
				
			||||
    description: | 
				
			||||
      name: xml | 
				
			||||
      url: "https://pub.dartlang.org" | 
				
			||||
    source: hosted | 
				
			||||
    version: "6.1.0" | 
				
			||||
sdks: | 
				
			||||
  dart: ">=2.18.6 <3.0.0" | 
				
			||||
  flutter: ">=2.5.0" | 
				
			||||
@ -0,0 +1,26 @@
					 | 
				
			||||
# Copyright (c) 2023. Open Mobile Platform LLC. | 
				
			||||
# License: Proprietary. | 
				
			||||
 | 
				
			||||
name: wakelock_aurora_example | 
				
			||||
description: Demonstrates how to use the wakelock_aurora plugin. | 
				
			||||
 | 
				
			||||
publish_to: 'none' | 
				
			||||
 | 
				
			||||
environment: | 
				
			||||
  sdk: '>=2.18.6 <3.0.0' | 
				
			||||
 | 
				
			||||
dependencies: | 
				
			||||
  flutter: | 
				
			||||
    sdk: flutter | 
				
			||||
  wakelock: ^0.6.2 | 
				
			||||
  wakelock_aurora: | 
				
			||||
    path: ../ | 
				
			||||
  cupertino_icons: ^1.0.2 | 
				
			||||
 | 
				
			||||
dev_dependencies: | 
				
			||||
  flutter_test: | 
				
			||||
    sdk: flutter | 
				
			||||
  flutter_lints: ^2.0.0 | 
				
			||||
 | 
				
			||||
flutter: | 
				
			||||
  uses-material-design: true | 
				
			||||
@ -0,0 +1,22 @@
					 | 
				
			||||
/* | 
				
			||||
 * Copyright (c) 2023. Open Mobile Platform LLC. | 
				
			||||
 * License: Proprietary. | 
				
			||||
 */ | 
				
			||||
import 'package:dbus/dbus.dart'; | 
				
			||||
 | 
				
			||||
class ComNokiaMceRequest extends DBusRemoteObject { | 
				
			||||
  ComNokiaMceRequest(DBusClient client, String destination, | 
				
			||||
      {DBusObjectPath path = | 
				
			||||
          const DBusObjectPath.unchecked('/com/nokia/mce/request')}) | 
				
			||||
      : super(client, name: destination, path: path); | 
				
			||||
 | 
				
			||||
  /// Invokes com.nokia.mce.request.req_display_blanking_pause() | 
				
			||||
  Future<void> callreq_display_blanking_pause( | 
				
			||||
      {bool noAutoStart = false, | 
				
			||||
      bool allowInteractiveAuthorization = false}) async { | 
				
			||||
    await callMethod('com.nokia.mce.request', 'req_display_blanking_pause', [], | 
				
			||||
        replySignature: DBusSignature(''), | 
				
			||||
        noAutoStart: noAutoStart, | 
				
			||||
        allowInteractiveAuthorization: allowInteractiveAuthorization); | 
				
			||||
  } | 
				
			||||
} | 
				
			||||
@ -0,0 +1,45 @@
					 | 
				
			||||
/* | 
				
			||||
 * Copyright (c) 2023. Open Mobile Platform LLC. | 
				
			||||
 * License: Proprietary. | 
				
			||||
 */ | 
				
			||||
import 'dart:async'; | 
				
			||||
 | 
				
			||||
import 'package:dbus/dbus.dart'; | 
				
			||||
import 'package:flutter/foundation.dart'; | 
				
			||||
import 'package:wakelock_platform_interface/wakelock_platform_interface.dart'; | 
				
			||||
import 'com_nokia_mce_request.dart'; | 
				
			||||
 | 
				
			||||
class WakelockAurora extends WakelockPlatformInterface { | 
				
			||||
  bool _enable = false; | 
				
			||||
  Timer? _timer; | 
				
			||||
 | 
				
			||||
  static void registerWith() { | 
				
			||||
    if (TargetPlatform.aurora == defaultTargetPlatform) { | 
				
			||||
      WakelockPlatformInterface.instance = WakelockAurora(); | 
				
			||||
    } | 
				
			||||
  } | 
				
			||||
 | 
				
			||||
  @override | 
				
			||||
  Future<void> toggle({required bool enable}) async { | 
				
			||||
    if (_enable != enable) { | 
				
			||||
      _enable = enable; | 
				
			||||
      final client = DBusClient.system(); | 
				
			||||
      final request = ComNokiaMceRequest(client, 'com.nokia.mce'); | 
				
			||||
      if (_timer == null) { | 
				
			||||
        request.callreq_display_blanking_pause(); | 
				
			||||
        _timer = Timer.periodic(const Duration(seconds: 60), (timer) { | 
				
			||||
          request.callreq_display_blanking_pause(); | 
				
			||||
        }); | 
				
			||||
      } else { | 
				
			||||
        _timer?.cancel(); | 
				
			||||
        _timer = null; | 
				
			||||
      } | 
				
			||||
      await client.close(); | 
				
			||||
    } | 
				
			||||
  } | 
				
			||||
 | 
				
			||||
  @override | 
				
			||||
  Future<bool> get enabled async { | 
				
			||||
    return _enable; | 
				
			||||
  } | 
				
			||||
} | 
				
			||||
@ -0,0 +1,28 @@
					 | 
				
			||||
# Copyright (c) 2023. Open Mobile Platform LLC. | 
				
			||||
# License: Proprietary. | 
				
			||||
 | 
				
			||||
name: wakelock_aurora | 
				
			||||
description: A new Flutter plugin project. | 
				
			||||
version: 0.0.1 | 
				
			||||
 | 
				
			||||
environment: | 
				
			||||
  sdk: '>=2.18.6 <3.0.0' | 
				
			||||
  flutter: ">=2.5.0" | 
				
			||||
 | 
				
			||||
dependencies: | 
				
			||||
  flutter: | 
				
			||||
    sdk: flutter | 
				
			||||
  dbus: ^0.7.8 | 
				
			||||
  plugin_platform_interface: ^2.0.2 | 
				
			||||
  wakelock_platform_interface: ^0.3.0 | 
				
			||||
 | 
				
			||||
dev_dependencies: | 
				
			||||
  flutter_test: | 
				
			||||
    sdk: flutter | 
				
			||||
  flutter_lints: ^2.0.0 | 
				
			||||
 | 
				
			||||
flutter: | 
				
			||||
  plugin: | 
				
			||||
    platforms: | 
				
			||||
      aurora: | 
				
			||||
        dartPluginClass: WakelockAurora | 
				
			||||
					Loading…
					
					
				
		Reference in new issue