Коммит c5b0c69b создал по автору Красавин Никита Сергеевич's avatar Красавин Никита Сергеевич
Просмотр файлов

move from flutter-plugins repo

владелец ba004cc8
# 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/
## Updated: 05/29/2024 17:26:29 PM
## Info
- Last tag: wakelock_plus_aurora-0.5.0
- Released: 2
## Versions
- Version: wakelock_plus_aurora-0.5.0 (24/04/2024)
- Version: wakelock_plus_aurora-0.0.1 (28/12/2023)
### Version: wakelock_plus_aurora-0.5.0 (24/04/2024)
#### Feature
- Add example application.
### Version: wakelock_plus_aurora-0.0.1 (28/12/2023)
#### Feature
- Add changeln, update dependency ref, readme.
# wakelock_plus_aurora
The Aurora implementation of [`wakelock_plus`](https://pub.dev/packages/wakelock_plus).
## Usage
This package is not an _endorsed_ implementation of `wakelock_plus`.
Therefore, you have to include `wakelock_plus_aurora` alongside `wakelock_plus` as dependencies in your `pubspec.yaml` file.
**pubspec.yaml**
```yaml
dependencies:
wakelock_plus: ^1.1.1
wakelock_plus_aurora:
git:
url: https://gitlab.com/omprussia/flutter/flutter-plugins.git
ref: wakelock_plus_aurora-0.5.0
path: packages/wakelock_plus/wakelock_plus_aurora
```
***.dart**
```dart
import 'package:wakelock_plus/wakelock_plus.dart';
// ...
// The following line will enable the Android and iOS wakelock.
WakelockPlus.enable();
// The next line disables the wakelock again.
WakelockPlus.disable();
```
# SPDX-FileCopyrightText: Copyright 2023 Open Mobile Platform LLC <community@omp.ru>
# SPDX-License-Identifier: BSD-3-Clause
include: package:flutter_lints/flutter.yaml
## Application configuration file Changeln
## Version config: 0.0.2
## Comment tags by which they will be searched
## and groups by which they will be analyzed.
commits:
Bug: '[wakelock_plus_aurora][bug]'
Change: '[wakelock_plus_aurora][change]'
Feature: '[wakelock_plus_aurora][feature]'
## Path to mako template
template: ../../../.changeln/changeln.mako
## Regular expression to break the comment into groups
## to format the comment output in the changelog in the
## "regex" variable.
##
## The empty value is not used.
parse: ''
## Filter tags using regular expressions
##
## The empty value is not used.
filter: '^((?!wakelock_plus_aurora).)*$'
<?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>
# 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
.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
# Wakelock plus aurora example
Demonstrates how to use the wakelock_plus_aurora plugin.
## Usage
Get dependency
```shell
flutter-aurora pub get
```
Build aurora application
```shell
flutter-aurora build aurora --release
```
# SPDX-FileCopyrightText: Copyright 2024 Open Mobile Platform LLC <community@omp.ru>
# SPDX-License-Identifier: BSD-3-Clause
include: package:flutter_lints/flutter.yaml
# SPDX-FileCopyrightText: Copyright 2024 Open Mobile Platform LLC <community@omp.ru>
# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.10)
project(ru.auroraos.wakelock_plus_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)
[Desktop Entry]
Type=Application
Name=Wakelock plus
Comment=The Aurora OS example of wakelock_plus_aurora.
Icon=ru.auroraos.wakelock_plus_aurora_example
Exec=/usr/bin/ru.auroraos.wakelock_plus_aurora_example
X-Nemo-Application-Type=silica-qt5
[X-Application]
Permissions=
OrganizationName=ru.auroraos
ApplicationName=wakelock_plus_aurora_example
/**
* SPDX-FileCopyrightText: Copyright 2024 Open Mobile Platform LLC <community@omp.ru>
* SPDX-License-Identifier: BSD-3-Clause
*/
#include <flutter/flutter_aurora.h>
#include "generated_plugin_registrant.h"
int main(int argc, char* argv[]) {
aurora::Initialize(argc, argv);
aurora::RegisterPlugins();
aurora::Launch();
return 0;
}
%global __provides_exclude_from ^%{_datadir}/%{name}/lib/.*$
%global __requires_exclude ^lib(dconf|flutter-embedder|maliit-glib|.+_platform_plugin)\\.so.*$
Name: ru.auroraos.wakelock_plus_aurora_example
Summary: Demonstrates how to use the wakelock_plus_aurora plugin.
Version: 0.1.0
Release: 1
License: BSD 3-Clause
Source0: %{name}-%{version}.tar.zst
BuildRequires: cmake
BuildRequires: ninja
%description
%{summary}.
%prep
%autosetup
%build
%cmake -GNinja -DCMAKE_BUILD_TYPE=%{_flutter_build_type} -DPSDK_VERSION=%{_flutter_psdk_version} -DPSDK_MAJOR=%{_flutter_psdk_major}
%ninja_build
%install
%ninja_install
%files
%{_bindir}/%{name}
%{_datadir}/%{name}/*
%{_datadir}/applications/%{name}.desktop
%{_datadir}/icons/hicolor/*/apps/%{name}.png
// SPDX-FileCopyrightText: Copyright 2024 Open Mobile Platform LLC <community@omp.ru>
// SPDX-License-Identifier: BSD-3-Clause
import 'package:flutter/material.dart';
import 'package:internal_aurora/abb_bar_action.dart';
import 'package:internal_aurora/list_button.dart';
import 'package:internal_aurora/list_item_data.dart';
import 'package:internal_aurora/list_item_info.dart';
import 'package:internal_aurora/list_separated.dart';
import 'package:internal_aurora/theme/colors.dart';
import 'package:internal_aurora/theme/theme.dart';
import 'plugin_impl.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatefulWidget {
const MyApp({super.key});
@override
State<MyApp> createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
final PluginImpl _impl = PluginImpl();
bool _isEnable = false;
@override
void initState() {
_init();
super.initState();
}
/// The method should not change its name for standardization
Future<void> _init() async {
if (!mounted) return;
setState(() async {
_isEnable = await _impl.isEnable();
});
}
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: internalTheme,
home: Scaffold(
appBar: AppBar(
title: const Text('Wakelock plus'),
actions: [AppBarAction(onPressed: _init)],
),
body: ListSeparated(
children: [
const ListItemInfo("""
Plugin that allows you to keep the device screen awake,
i.e. prevent the screen from sleeping.
"""),
ListItemData(
'State Wakelock',
InternalColors.purple,
description: 'Displays the sleep lock status of the device',
widthData: 140,
value: _isEnable,
builder: (value) => value?.toString().toUpperCase(),
),
ListButton(
'Toggle',
InternalColors.green,
onPressed: () async {
await _impl.setStateWakelockPlus(!_isEnable);
await _init();
},
),
],
),
),
);
}
}
// SPDX-FileCopyrightText: Copyright 2024 Open Mobile Platform LLC <community@omp.ru>
// SPDX-License-Identifier: BSD-3-Clause
import 'package:wakelock_plus/wakelock_plus.dart';
/// Main features of the plugin wakelock_plus
class PluginImpl {
/// Check is enable Wakelock
Future<bool> isEnable() {
return WakelockPlus.enabled;
}
/// Set state Wakelock
Future<void> setStateWakelockPlus(bool enable) {
return WakelockPlus.toggle(enable: enable);
}
}
Поддерживает Markdown
0% или .
You are about to add 0 people to the discussion. Proceed with caution.
Сначала завершите редактирование этого сообщения!
Пожалуйста, зарегистрируйтесь или чтобы прокомментировать