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

v0.3.0

владельцы b0d1bb41 9e94f0dc
......@@ -10,6 +10,9 @@
* Nikita Krasavin, <n.krasavin@omp.ru>
* Reviewer, 2025
* Sergey Ovchinnikov, <s.ovchinnikov@omp.ru>
* Reviewer, 2025
* Aleksandr Morozov
* Developer, 2025
......
# Changelog
## 0.3.0
* Added support for flutter 3.32.7.
## 0.2.0
* Added support for new GeoClue API in Aurora OS >= 5.2.0
* Implemented factory pattern for API version selection with backward compatibility
......
......@@ -2,8 +2,6 @@
[Original README](https://github.com/canonical/geoclue.dart)
<a name="plugin-description"></a>
# Geoclue_aurora
Geoclue is a D-Bus service that provides location information on Aurora OS devices. The plugin is an implementation [geoclue](https://pub.dev/packages/geoclue).
......@@ -19,11 +17,8 @@ final location = await GeoClue.getLocation(
## Contents
- [Plugin description](#plugin-description)
- [Installation and build](#installation-and-assembly)
- [Detailed description](#detailed-description)
- [Information about branches](#branch-information)
- [Known errors](#known-errors)
- [Compatibility](#compatibility)
- [Terms of use and participation in development](#terms-of-use-and-participation)
......@@ -52,19 +47,9 @@ flutter-aurora pub get
The plugin implements all the functions of the [geoclue](https://pub.dev/packages/geoclue ) plugin, without limitations.
<a name="branch-information"></a>
## Information about branches
The versions of the application comply with the [branch naming](https://developer.auroraos.ru/doc/software_development/examples#branches) agreement .
<a name="known-errors"></a>
## Known errors
No errors observed.
<a name="compatibility"></a>
## Compatibility
The application has been working correctly since the 5.0.0 version of the Aurora OS.
The application has been working correctly since the 5.0.0 version of the Aurora OS. Required flutter 3.32.7 or newer.
### API Versions
The plugin automatically detects your Aurora OS version and uses the appropriate API implementation:
......
......@@ -2,8 +2,6 @@
[Оригинальный README](https://github.com/canonical/geoclue.dart)
<a name="plugin-description"></a>
# Geoclue_aurora
Geoclue — это служба D-Bus, которая предоставляет информацию о геопозиции на устройствах ОС Аврора. Плагин является реализацией [geoclue](https://pub.dev/packages/geoclue).
......@@ -18,11 +16,8 @@ final location = await GeoClue.getLocation(
```
## Содержание
- [Описание плагина](#plugin-description)
- [Установка и сборка](#installation-and-assembly)
- [Подробное описание](#detailed-description)
- [Информация о ветках](#branch-information)
- [Известные ошибки](#known-errors)
- [Совместимость](#compatibility)
- [Правила использования и участие в разработке](#terms-of-use-and-participation)
......@@ -49,20 +44,9 @@ flutter-aurora pub get
Плагин реализует все функции плагина [geoclue](https://pub.dev/packages/geoclue) без ограничений.
<a name="branch-information"></a>
## Информация о ветках
Версии приложения соответствуют соглашению об [наименовании веток](https://developer.auroraos.ru/doc/software_development/examples#branches).
<a name="known-errors"></a>
## Известные ошибки
На данный момент ошибки не обнаружены.
<a name="compatibility"></a>
## Совместимость
Приложение корректно работает начиная с 5.0.0 версии ОС Авроры.
Приложение корректно работает начиная с 5.0.0 версии ОС Авроры. Также требуется версия flutter 3.32.7 или новее.
### Версии API
Плагин автоматически определяет версию ОС Авроры и использует соответствующую реализацию API:
......
......@@ -8,4 +8,5 @@ The example demonstrates:
- how to get geopostion stream.
## Screenshots
![Main screen](screenshots/main_page.png)
![page_1](screenshots/page_1.png)
![page_2](screenshots/page_2.png)
\ Нет новой строки в конце файла
......@@ -8,4 +8,5 @@
- как получить геопозицию при помощи `Stream`.
## Скриншоты
![Main screen](screenshots/main_page.png)
![page_1](screenshots/page_1.png)
![page_2](screenshots/page_2.png)
flutter/ephemeral
/flutter
/rpm/requires.inc
/rpm/defines.inc
\ Нет новой строки в конце файла
# SPDX-FileCopyrightText: Copyright 2025 Open Mobile Platform LLC <community@omp.ru>
# Copyright 2024 Noname_1111788
# Copyright 2024 Alexander Syrykh
# SPDX-License-Identifier: BSD-3-Clause
# This file will be recreated at the next build. To avoid this, delete this line.
# CMAKE_SYSTEM_PROCESSOR - CPU architecture name (armv7l, aarch64, x86_64)
# CMAKE_BUILD_TYPE - Build mode (debug, profile, release)
......@@ -9,7 +6,7 @@
# PSDK_MAJOR - Build psdk major version
cmake_minimum_required(VERSION 3.10)
project(ru.auroraos.geoclue_aurora_example LANGUAGES CXX)
project(${FLUTTER_PROJECT_NAME} LANGUAGES CXX)
include(GNUInstallDirs)
......@@ -25,24 +22,16 @@ 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})
add_executable(${BINARY_NAME} main.cpp)
include(flutter/generated_plugins.cmake)
target_link_libraries(${BINARY_NAME} PRIVATE aurora_embedder::aurora_embedder)
target_include_directories(${BINARY_NAME} PRIVATE ${FLUTTER_DIR})
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})
......
# This file will be recreated at the next build. To avoid this, delete this line.
[Desktop Entry]
Type=Application
Name=geoclue_aurora_example
Comment=Demonstrates how to use the geoclue_aurora plugin.
Icon=ru.auroraos.geoclue_aurora_example
Exec=/usr/bin/ru.auroraos.geoclue_aurora_example
Comment=The Aurora OS example of geoclue_aurora.
Icon=ru.aurora.geoclue_aurora_example
Exec=/usr/bin/ru.aurora.geoclue_aurora_example
X-Nemo-Application-Type=silica-qt5
[X-Application]
Permissions=Internet;Location;
OrganizationName=ru.auroraos
Permissions=Location;Internet
OrganizationName=ru.aurora
ApplicationName=geoclue_aurora_example
......@@ -3,12 +3,9 @@
// Copyright 2024 Alexander Syrykh
// 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;
int main(int argc, char *argv[]) {
aurora::FlutterApp app(argc, argv);
return app.exec();
}
%dnl This file will be recreated at the next build. To avoid this, delete this line.
%include %{_sourcedir}/defines.inc
%global __provides_exclude_from ^%{_datadir}/%{name}/lib/.*$
%global __requires_exclude ^lib(dconf|flutter-embedder|maliit-glib|.+_platform_plugin)\\.so.*$
%global __requires_exclude %{_flutter_excludes}
Name: ru.auroraos.geoclue_aurora_example
Name: %{orgName}.%{appName}%{?flavor}
Summary: The Aurora OS example of geoclue_aurora.
Version: 0.1.0
Version: %{appVersion}
Release: 1
License: Proprietary
Source0: %{name}-%{version}.tar.zst
BuildRequires: cmake
BuildRequires: ninja
%requires
%dnl Place to add custom BuildRequires.
%description
%{summary}.
......@@ -18,7 +22,7 @@ BuildRequires: ninja
%autosetup
%build
%cmake -GNinja -DCMAKE_BUILD_TYPE=%{_flutter_build_type} -DPSDK_VERSION=%{_flutter_psdk_version} -DPSDK_MAJOR=%{_flutter_psdk_major}
%cmake -GNinja -DCMAKE_BUILD_TYPE=%{_flutter_build_type} -DPSDK_VERSION=%{_flutter_psdk_version} -DPSDK_MAJOR=%{_flutter_psdk_major} -DFLUTTER_PROJECT_NAME=%{name}
%ninja_build
%install
......
......@@ -5,12 +5,7 @@
import 'package:flutter/material.dart';
import 'package:internal_aurora/abb_bar_action.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 'package:aurora_controls/aurora_controls.dart';
import 'dart:async';
import 'package:geoclue_aurora/geoclue_aurora.dart';
......@@ -45,6 +40,7 @@ class MyApp extends StatefulWidget {
class _MyAppState extends State<MyApp> {
final PluginImpl _impl = PluginImpl();
final ScrollController _scrollController = ScrollController();
late Future<GeoCluePosition> _geocluePosition;
late Future<GeoClueVelocity> _geoclueVelocity;
......@@ -52,6 +48,12 @@ class _MyAppState extends State<MyApp> {
late Stream<GeoClueVelocity> _onGeoClueVelocityChanged;
late Stream<GeoCluePositionProvider> _onGeoCluePositionProviderChanged;
@override
void dispose() {
_scrollController.dispose();
super.dispose();
}
@override
void initState() {
_init();
......@@ -73,71 +75,221 @@ class _MyAppState extends State<MyApp> {
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: internalTheme,
final theme = AuroraTheme.of(context);
return AuroraApp(
home: Scaffold(
appBar: AppBar(
title: const Text('Geoclue'),
actions: [AppBarAction(onPressed: _init)],
actions: [AuroraAppBarButton(icon: AuroraIcons.refresh(), onPressed: _init)],
),
body: ListSeparated(
children: [
const ListItemInfo("""
This plugin allows you to track the current position,
velocity and position provider changes.
"""),
ListItemData(
'GeoCluePosition',
InternalColors.orange,
description: 'Returns the current GeoClue position.',
widthData: 200,
future: _geocluePosition,
builder: (value) => value.toString(),
buttonHide: false,
buttonText: 'Get current position',
buttonOnPressed: () => setState(() {
_geocluePosition = _impl.getLocation();
}),
),
ListItemData(
'GeoClueVelocity',
InternalColors.purple,
description: 'Returns the current GeoClue velocity.',
widthData: 200,
future: _geoclueVelocity,
builder: (value) => value.toString(),
buttonHide: false,
buttonText: 'Get current velocity',
buttonOnPressed: () => setState(() {
_geoclueVelocity = _impl.getVelocity();
}),
body: AuroraScrollbar(
controller: _scrollController,
child: SingleChildScrollView(
controller: _scrollController,
padding: const EdgeInsets.all(AuroraGeometry.moduleX3),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const AuroraSectionHeader('Geoclue Data'),
CustomListItemData<GeoCluePosition>(
title: 'GeoCluePosition',
color: theme.primary,
description: 'Returns the current GeoClue position.',
future: _geocluePosition,
builder: (value) => value.toString(),
buttonHide: false,
buttonText: 'Get current position',
buttonOnPressed: () => setState(() {
_geocluePosition = _impl.getLocation();
}),
),
CustomListItemData<GeoClueVelocity>(
title: 'GeoClueVelocity',
color: theme.secondary,
description: 'Returns the current GeoClue velocity.',
future: _geoclueVelocity,
builder: (value) => value.toString(),
buttonHide: false,
buttonText: 'Get current velocity',
buttonOnPressed: () => setState(() {
_geoclueVelocity = _impl.getVelocity();
}),
),
const SizedBox(height: AuroraGeometry.moduleX2),
const AuroraSectionHeader('Geoclue Streams'),
CustomListItemData<GeoCluePosition>(
title: 'GeoCluePosition Stream',
color: theme.highlight,
description: 'Returns a stream that updates when the GeoClue position.',
stream: _onGeoCluePositionChanged,
),
CustomListItemData<GeoClueVelocity>(
title: 'GeoClueVelocity Stream',
color: theme.error,
description: 'Returns a stream that updates when the GeoClue velocity.',
stream: _onGeoClueVelocityChanged,
),
CustomListItemData<GeoCluePositionProvider>(
title: 'GeoCluePositionProvider Stream',
color: theme.primary80,
description: 'Returns a stream that updates when the GeoClue position provider.',
stream: _onGeoCluePositionProviderChanged,
),
],
),
ListItemData(
'GeoCluePosition Stream',
InternalColors.green,
description:
'Returns a stream that updates when the GeoClue position.',
widthData: 200,
stream: _onGeoCluePositionChanged,
),
),
),
);
}
}
// Custom widgets to replace internal_aurora components
class CustomListItemInfo extends StatelessWidget {
final String text;
const CustomListItemInfo(this.text, {super.key});
@override
Widget build(BuildContext context) {
final theme = AuroraTheme.of(context);
return Container(
width: double.infinity,
padding: const EdgeInsets.all(AuroraGeometry.moduleX3),
margin: const EdgeInsets.symmetric(vertical: AuroraGeometry.module),
decoration: BoxDecoration(
color: theme.overlayBackground,
borderRadius: BorderRadius.circular(AuroraGeometry.moduleX2),
border: Border.all(color: theme.primary40),
),
child: Text(
text,
style: theme.textThemeData.regularSmall,
),
);
}
}
class CustomListItemData<T> extends StatelessWidget {
final String title;
final Color color;
final String? description;
final double? widthData;
final Future<T>? future;
final Stream<T>? stream;
final T? data;
final String Function(T)? builder;
final bool buttonHide;
final String? buttonText;
final VoidCallback? buttonOnPressed;
const CustomListItemData({
super.key,
required this.title,
required this.color,
this.description,
this.widthData,
this.future,
this.stream,
this.data,
this.builder,
this.buttonHide = true,
this.buttonText,
this.buttonOnPressed,
});
@override
Widget build(BuildContext context) {
final theme = AuroraTheme.of(context);
Widget dataWidget;
if (future != null) {
dataWidget = FutureBuilder<T>(
future: future,
builder: (context, snapshot) {
if (snapshot.connectionState == ConnectionState.waiting) {
return const AuroraBusyIndicator(running: true);
} else if (snapshot.hasError) {
return Text(
'Error: ${snapshot.error}',
style: theme.textThemeData.regularSmall.copyWith(color: theme.error),
);
} else if (snapshot.hasData) {
return Text(
builder != null ? builder!(snapshot.data!) : snapshot.data.toString(),
style: theme.textThemeData.regularSmall,
);
} else {
return Text('No data', style: theme.textThemeData.regularSmall);
}
},
);
} else if (stream != null) {
dataWidget = StreamBuilder<T>(
stream: stream,
builder: (context, snapshot) {
if (snapshot.connectionState == ConnectionState.waiting) {
return const AuroraBusyIndicator(running: true);
} else if (snapshot.hasError) {
return Text(
'Error: ${snapshot.error}',
style: theme.textThemeData.regularSmall.copyWith(color: theme.error),
);
} else if (snapshot.hasData) {
return Text(
builder != null ? builder!(snapshot.data!) : snapshot.data.toString(),
style: theme.textThemeData.regularSmall,
);
} else {
return Text('No data', style: theme.textThemeData.regularSmall);
}
},
);
} else {
dataWidget = Text(
data != null ? (builder != null ? builder!(data!) : data.toString()) : 'No data',
style: theme.textThemeData.regularSmall,
);
}
return Container(
width: double.infinity,
padding: const EdgeInsets.all(AuroraGeometry.moduleX3),
margin: const EdgeInsets.symmetric(vertical: AuroraGeometry.module),
decoration: BoxDecoration(
color: theme.overlayBackground,
borderRadius: BorderRadius.circular(AuroraGeometry.moduleX2),
border: Border.all(color: color),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
title,
style: theme.textThemeData.regularMedium?.copyWith(
color: color,
fontWeight: FontWeight.bold,
),
ListItemData(
'GeoClueVelocity Stream',
InternalColors.red,
description:
'Returns a stream that updates when the GeoClue velocity.',
widthData: 200,
stream: _onGeoClueVelocityChanged,
),
if (description != null) ...[
const SizedBox(height: AuroraGeometry.module),
Text(
description!,
style: theme.textThemeData.regularSmall,
),
ListItemData(
'GeoCluePositionProvider Stream',
InternalColors.blue,
description:
'Returns a stream that updates when the GeoClue position provider.',
widthData: 200,
stream: _onGeoCluePositionProviderChanged,
],
const SizedBox(height: AuroraGeometry.moduleX2),
dataWidget,
if (!buttonHide && buttonText != null && buttonOnPressed != null) ...[
const SizedBox(height: AuroraGeometry.moduleX2),
AuroraButton(
onPressed: buttonOnPressed,
label: buttonText!,
primary: false,
),
],
),
],
),
);
}
......
......@@ -5,21 +5,19 @@
name: geoclue_aurora_example
description: "The Aurora OS example of geoclue_aurora."
organization: "ru.aurora"
publish_to: "none" # Remove this line if you wish to publish to pub.dev
version: 1.1.0
version: 1.2.0
environment:
sdk: ">=3.2.2 <4.0.0"
sdk: ^3.8.1
flutter: ^3.32.7
dependencies:
flutter:
sdk: flutter
flutter_localizations:
sdk: flutter
internal_aurora:
git:
url: https://developer.auroraos.ru/git/flutter/flutter-community-plugins/internal_aurora.git
ref: aurora-0.5.3
aurora_controls:
geoclue_aurora:
path: ../
logging: ^1.2.0
......
......@@ -6,10 +6,12 @@
name: geoclue_aurora
description: "GeoClue: The Geolocation Service"
homepage: https://gitlab.freedesktop.org/geoclue/geoclue/-/wikis/home
version: 0.2.0
version: 0.3.0
environment:
sdk: ">=3.2.2 <4.0.0"
sdk: ^3.8.1
flutter: ^3.32.7
dependencies:
dbus: ^0.7.10
......@@ -19,3 +21,11 @@ dependencies:
dev_dependencies:
build_runner: ^2.1.8
lints: ^2.0.0
flutter:
plugin:
platforms:
aurora:
permissions:
- Location
- Internet
Поддерживает Markdown
0% или .
You are about to add 0 people to the discussion. Proceed with caution.
Сначала завершите редактирование этого сообщения!
Пожалуйста, зарегистрируйтесь или чтобы прокомментировать