35 changed files with 861 additions and 38 deletions
			
			
		@ -0,0 +1,37 @@
					 | 
				
			||||
<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd"> | 
				
			||||
<node> | 
				
			||||
  <interface name="org.freedesktop.Notifications"> | 
				
			||||
    <signal name="NotificationClosed"> | 
				
			||||
      <arg name="id" type="u" direction="out"/> | 
				
			||||
      <arg name="reason" type="u" direction="out"/> | 
				
			||||
    </signal> | 
				
			||||
    <signal name="ActionInvoked"> | 
				
			||||
      <arg name="id" type="u" direction="out"/> | 
				
			||||
      <arg name="action_key" type="s" direction="out"/> | 
				
			||||
    </signal> | 
				
			||||
    <method name="Notify"> | 
				
			||||
      <annotation name="org.qtproject.QtDBus.QtTypeName.In6" value="QVariantMap"/> | 
				
			||||
      <arg type="u" direction="out"/> | 
				
			||||
      <arg name="app_name" type="s" direction="in"/> | 
				
			||||
      <arg name="replaces_id" type="u" direction="in"/> | 
				
			||||
      <arg name="app_icon" type="s" direction="in"/> | 
				
			||||
      <arg name="summary" type="s" direction="in"/> | 
				
			||||
      <arg name="body" type="s" direction="in"/> | 
				
			||||
      <arg name="actions" type="as" direction="in"/> | 
				
			||||
      <arg name="hints" type="a{sv}" direction="in"/> | 
				
			||||
      <arg name="timeout" type="i" direction="in"/> | 
				
			||||
    </method> | 
				
			||||
    <method name="CloseNotification"> | 
				
			||||
      <arg name="id" type="u" direction="in"/> | 
				
			||||
    </method> | 
				
			||||
    <method name="GetCapabilities"> | 
				
			||||
      <arg type="as" name="caps" direction="out"/> | 
				
			||||
    </method> | 
				
			||||
    <method name="GetServerInformation"> | 
				
			||||
      <arg type="s" name="name" direction="out"/> | 
				
			||||
      <arg type="s" name="vendor" direction="out"/> | 
				
			||||
      <arg type="s" name="version" direction="out"/> | 
				
			||||
      <arg type="s" name="spec_version" direction="out"/> | 
				
			||||
    </method> | 
				
			||||
  </interface> | 
				
			||||
</node> | 
				
			||||
@ -0,0 +1,57 @@
					 | 
				
			||||
// This file was generated using the following command and may be overwritten. | 
				
			||||
// dart-dbus generate-remote-object data/org.freedesktop.Notifications.xml | 
				
			||||
 | 
				
			||||
import 'package:dbus/dbus.dart'; | 
				
			||||
 | 
				
			||||
/// Signal data for org.freedesktop.Notifications.NotificationClosed. | 
				
			||||
class OrgFreedesktopNotificationsNotificationClosed extends DBusSignal { | 
				
			||||
  int get id => values[0].asUint32(); | 
				
			||||
  int get reason => values[1].asUint32(); | 
				
			||||
 | 
				
			||||
  OrgFreedesktopNotificationsNotificationClosed(DBusSignal signal) : super(sender: signal.sender, path: signal.path, interface: signal.interface, name: signal.name, values: signal.values); | 
				
			||||
} | 
				
			||||
 | 
				
			||||
/// Signal data for org.freedesktop.Notifications.ActionInvoked. | 
				
			||||
class OrgFreedesktopNotificationsActionInvoked extends DBusSignal { | 
				
			||||
  int get id => values[0].asUint32(); | 
				
			||||
  String get action_key => values[1].asString(); | 
				
			||||
 | 
				
			||||
  OrgFreedesktopNotificationsActionInvoked(DBusSignal signal) : super(sender: signal.sender, path: signal.path, interface: signal.interface, name: signal.name, values: signal.values); | 
				
			||||
} | 
				
			||||
 | 
				
			||||
class OrgFreedesktopNotifications extends DBusRemoteObject { | 
				
			||||
  /// Stream of org.freedesktop.Notifications.NotificationClosed signals. | 
				
			||||
  late final Stream<OrgFreedesktopNotificationsNotificationClosed> notificationClosed; | 
				
			||||
 | 
				
			||||
  /// Stream of org.freedesktop.Notifications.ActionInvoked signals. | 
				
			||||
  late final Stream<OrgFreedesktopNotificationsActionInvoked> actionInvoked; | 
				
			||||
 | 
				
			||||
  OrgFreedesktopNotifications(DBusClient client, String destination, DBusObjectPath path) : super(client, name: destination, path: path) { | 
				
			||||
    notificationClosed = DBusRemoteObjectSignalStream(object: this, interface: 'org.freedesktop.Notifications', name: 'NotificationClosed', signature: DBusSignature('uu')).asBroadcastStream().map((signal) => OrgFreedesktopNotificationsNotificationClosed(signal)); | 
				
			||||
 | 
				
			||||
    actionInvoked = DBusRemoteObjectSignalStream(object: this, interface: 'org.freedesktop.Notifications', name: 'ActionInvoked', signature: DBusSignature('us')).asBroadcastStream().map((signal) => OrgFreedesktopNotificationsActionInvoked(signal)); | 
				
			||||
  } | 
				
			||||
 | 
				
			||||
  /// Invokes org.freedesktop.Notifications.Notify() | 
				
			||||
  Future<int> callNotify(String app_name, int replaces_id, String app_icon, String summary, String body, List<String> actions, Map<String, DBusValue> hints, int timeout, {bool noAutoStart = false, bool allowInteractiveAuthorization = false}) async { | 
				
			||||
    var result = await callMethod('org.freedesktop.Notifications', 'Notify', [DBusString(app_name), DBusUint32(replaces_id), DBusString(app_icon), DBusString(summary), DBusString(body), DBusArray.string(actions), DBusDict.stringVariant(hints), DBusInt32(timeout)], replySignature: DBusSignature('u'), noAutoStart: noAutoStart, allowInteractiveAuthorization: allowInteractiveAuthorization); | 
				
			||||
    return result.returnValues[0].asUint32(); | 
				
			||||
  } | 
				
			||||
 | 
				
			||||
  /// Invokes org.freedesktop.Notifications.CloseNotification() | 
				
			||||
  Future<void> callCloseNotification(int id, {bool noAutoStart = false, bool allowInteractiveAuthorization = false}) async { | 
				
			||||
    await callMethod('org.freedesktop.Notifications', 'CloseNotification', [DBusUint32(id)], replySignature: DBusSignature(''), noAutoStart: noAutoStart, allowInteractiveAuthorization: allowInteractiveAuthorization); | 
				
			||||
  } | 
				
			||||
 | 
				
			||||
  /// Invokes org.freedesktop.Notifications.GetCapabilities() | 
				
			||||
  Future<List<String>> callGetCapabilities({bool noAutoStart = false, bool allowInteractiveAuthorization = false}) async { | 
				
			||||
    var result = await callMethod('org.freedesktop.Notifications', 'GetCapabilities', [], replySignature: DBusSignature('as'), noAutoStart: noAutoStart, allowInteractiveAuthorization: allowInteractiveAuthorization); | 
				
			||||
    return result.returnValues[0].asStringArray().toList(); | 
				
			||||
  } | 
				
			||||
 | 
				
			||||
  /// Invokes org.freedesktop.Notifications.GetServerInformation() | 
				
			||||
  Future<List<DBusValue>> callGetServerInformation({bool noAutoStart = false, bool allowInteractiveAuthorization = false}) async { | 
				
			||||
    var result = await callMethod('org.freedesktop.Notifications', 'GetServerInformation', [], replySignature: DBusSignature('ssss'), noAutoStart: noAutoStart, allowInteractiveAuthorization: allowInteractiveAuthorization); | 
				
			||||
    return result.returnValues; | 
				
			||||
  } | 
				
			||||
} | 
				
			||||
@ -0,0 +1,32 @@
					 | 
				
			||||
# 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/ | 
				
			||||
.metadata | 
				
			||||
run.sh | 
				
			||||
@ -0,0 +1,18 @@
					 | 
				
			||||
# package_info_plus_aurora | 
				
			||||
 | 
				
			||||
The Aurora implementation of [`package_info_plus`][https://pub.dev/packages/package_info_plus]. | 
				
			||||
 | 
				
			||||
## Usage | 
				
			||||
This package is not an _endorsed_ implementation of `package_info_plus`.  | 
				
			||||
Therefore, you have to include `package_info_plus_aurora` alongside `package_info_plus` as dependencies in your `pubspec.yaml` file. | 
				
			||||
 | 
				
			||||
```yaml | 
				
			||||
dependencies: | 
				
			||||
  package_info_plus: 4.0.0 | 
				
			||||
  package_info_plus_aurora: | 
				
			||||
    path: # path to folder with plugin | 
				
			||||
``` | 
				
			||||
 | 
				
			||||
### Preview example | 
				
			||||
 | 
				
			||||
 | 
				
			||||
@ -0,0 +1 @@
					 | 
				
			||||
include: package:flutter_lints/flutter.yaml | 
				
			||||
@ -0,0 +1,23 @@
					 | 
				
			||||
cmake_minimum_required(VERSION 3.10) | 
				
			||||
 | 
				
			||||
set(PROJECT_NAME package_info_plus_aurora) | 
				
			||||
set(PLUGIN_NAME  package_info_plus_aurora_platform_plugin) | 
				
			||||
 | 
				
			||||
project(${PROJECT_NAME} LANGUAGES CXX) | 
				
			||||
 | 
				
			||||
set(CMAKE_CXX_STANDARD 17) | 
				
			||||
set(CMAKE_CXX_STANDARD_REQUIRED ON) | 
				
			||||
 | 
				
			||||
set(CMAKE_CXX_FLAGS "-Wall -Wextra -Wno-psabi") | 
				
			||||
set(CMAKE_CXX_FLAGS_RELEASE "-O3") | 
				
			||||
 | 
				
			||||
find_package(PkgConfig REQUIRED) | 
				
			||||
pkg_check_modules(FlutterEmbedder REQUIRED IMPORTED_TARGET flutter-embedder) | 
				
			||||
 | 
				
			||||
add_library(${PLUGIN_NAME} SHARED package_info_plus_aurora_plugin.cpp) | 
				
			||||
 | 
				
			||||
set_target_properties(${PLUGIN_NAME} PROPERTIES CXX_VISIBILITY_PRESET hidden) | 
				
			||||
target_link_libraries(${PLUGIN_NAME} PRIVATE PkgConfig::FlutterEmbedder) | 
				
			||||
 | 
				
			||||
target_include_directories(${PLUGIN_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include) | 
				
			||||
target_compile_definitions(${PLUGIN_NAME} PRIVATE PLUGIN_IMPL) | 
				
			||||
@ -0,0 +1,24 @@
					 | 
				
			||||
#ifndef FLUTTER_PLUGIN_PACKAGE_INFO_PLUS_AURORA_PLUGIN_H | 
				
			||||
#define FLUTTER_PLUGIN_PACKAGE_INFO_PLUS_AURORA_PLUGIN_H | 
				
			||||
 | 
				
			||||
#include <flutter/plugin-interface.h> | 
				
			||||
 | 
				
			||||
#ifdef PLUGIN_IMPL | 
				
			||||
#define PLUGIN_EXPORT __attribute__((visibility("default"))) | 
				
			||||
#else | 
				
			||||
#define PLUGIN_EXPORT | 
				
			||||
#endif | 
				
			||||
 | 
				
			||||
class PLUGIN_EXPORT PackageInfoPlusAuroraPlugin final : public PluginInterface | 
				
			||||
{ | 
				
			||||
public: | 
				
			||||
    void RegisterWithRegistrar(PluginRegistrar ®istrar) override; | 
				
			||||
 | 
				
			||||
private: | 
				
			||||
    void onMethodCall(const MethodCall &call); | 
				
			||||
    void onGetApplicationOrg(const MethodCall &call); | 
				
			||||
    void onGetApplicationName(const MethodCall &call); | 
				
			||||
    void unimplemented(const MethodCall &call); | 
				
			||||
}; | 
				
			||||
 | 
				
			||||
#endif /* FLUTTER_PLUGIN_PACKAGE_INFO_PLUS_AURORA_PLUGIN_H */ | 
				
			||||
@ -0,0 +1,43 @@
					 | 
				
			||||
#include <package_info_plus_aurora/package_info_plus_aurora_plugin.h> | 
				
			||||
#include <flutter/method-channel.h> | 
				
			||||
#include <flutter/application.h> | 
				
			||||
#include <sys/utsname.h> | 
				
			||||
 | 
				
			||||
void PackageInfoPlusAuroraPlugin::RegisterWithRegistrar(PluginRegistrar ®istrar) | 
				
			||||
{ | 
				
			||||
    registrar.RegisterMethodChannel("package_info_plus_aurora", | 
				
			||||
                                    MethodCodecType::Standard, | 
				
			||||
                                    [this](const MethodCall &call) { this->onMethodCall(call); }); | 
				
			||||
} | 
				
			||||
 | 
				
			||||
void PackageInfoPlusAuroraPlugin::onMethodCall(const MethodCall &call) | 
				
			||||
{ | 
				
			||||
    const auto &method = call.GetMethod(); | 
				
			||||
 | 
				
			||||
    if (method == "getApplicationOrg") { | 
				
			||||
        onGetApplicationOrg(call); | 
				
			||||
        return; | 
				
			||||
    } | 
				
			||||
    
 | 
				
			||||
    if (method == "getApplicationName") { | 
				
			||||
        onGetApplicationName(call); | 
				
			||||
        return; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    unimplemented(call); | 
				
			||||
} | 
				
			||||
 | 
				
			||||
void PackageInfoPlusAuroraPlugin::onGetApplicationOrg(const MethodCall &call) | 
				
			||||
{ | 
				
			||||
    call.SendSuccessResponse(Application::GetID().orgname); | 
				
			||||
} | 
				
			||||
 | 
				
			||||
void PackageInfoPlusAuroraPlugin::onGetApplicationName(const MethodCall &call) | 
				
			||||
{ | 
				
			||||
    call.SendSuccessResponse(Application::GetID().appname); | 
				
			||||
} | 
				
			||||
 | 
				
			||||
void PackageInfoPlusAuroraPlugin::unimplemented(const MethodCall &call) | 
				
			||||
{ | 
				
			||||
    call.SendSuccessResponse(nullptr); | 
				
			||||
} | 
				
			||||
| 
		 After Width: | Height: | Size: 92 KiB  | 
@ -0,0 +1,45 @@
					 | 
				
			||||
# 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/ | 
				
			||||
pubspec.lock | 
				
			||||
 | 
				
			||||
# 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 | 
				
			||||
@ -0,0 +1,17 @@
					 | 
				
			||||
# package_info_plus_aurora_example | 
				
			||||
 | 
				
			||||
Demonstrates how to use the package_info_plus_aurora_example 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 | 
				
			||||
``` | 
				
			||||
 | 
				
			||||
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`. | 
				
			||||
@ -0,0 +1 @@
					 | 
				
			||||
include: package:flutter_lints/flutter.yaml | 
				
			||||
@ -0,0 +1 @@
					 | 
				
			||||
flutter/ephemeral | 
				
			||||
@ -0,0 +1,47 @@
					 | 
				
			||||
cmake_minimum_required(VERSION 3.10) | 
				
			||||
project(com.example.package_info_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) | 
				
			||||
@ -0,0 +1,12 @@
					 | 
				
			||||
[Desktop Entry] | 
				
			||||
Type=Application | 
				
			||||
Name=Example Info Plus | 
				
			||||
Comment=Demonstrates how to use the package_info_plus_aurora plugin. | 
				
			||||
Icon=com.example.package_info_plus_aurora_example | 
				
			||||
Exec=/usr/bin/com.example.package_info_plus_aurora_example | 
				
			||||
X-Nemo-Application-Type=silica-qt5 | 
				
			||||
 | 
				
			||||
[X-Application] | 
				
			||||
Permissions= | 
				
			||||
OrganizationName=com.example | 
				
			||||
ApplicationName=package_info_plus_aurora_example | 
				
			||||
@ -0,0 +1,16 @@
					 | 
				
			||||
//
 | 
				
			||||
//  Generated file. Do not edit.
 | 
				
			||||
//
 | 
				
			||||
 | 
				
			||||
// clang-format off
 | 
				
			||||
 | 
				
			||||
#include <flutter/application.h> | 
				
			||||
#include <package_info_plus_aurora/package_info_plus_aurora_plugin.h> | 
				
			||||
 | 
				
			||||
#include "generated_plugin_registrant.h" | 
				
			||||
 | 
				
			||||
void RegisterPlugins() { | 
				
			||||
    Application::RegisterPlugins({ | 
				
			||||
        std::make_shared<PackageInfoPlusAuroraPlugin>(), | 
				
			||||
    }); | 
				
			||||
} | 
				
			||||
@ -0,0 +1,12 @@
					 | 
				
			||||
//
 | 
				
			||||
//  Generated file. Do not edit.
 | 
				
			||||
//
 | 
				
			||||
 | 
				
			||||
// clang-format off
 | 
				
			||||
 | 
				
			||||
#ifndef GENERATED_PLUGIN_REGISTRANT | 
				
			||||
#define GENERATED_PLUGIN_REGISTRANT | 
				
			||||
 | 
				
			||||
void RegisterPlugins(); | 
				
			||||
 | 
				
			||||
#endif /* GENERATED_PLUGIN_REGISTRANT */ | 
				
			||||
@ -0,0 +1,31 @@
					 | 
				
			||||
# | 
				
			||||
# Generated file, do not edit. | 
				
			||||
# | 
				
			||||
set(ROOT_PROJECT_BINARY_DIR "${PROJECT_BINARY_DIR}") | 
				
			||||
 | 
				
			||||
function(add_library TARGET) | 
				
			||||
    _add_library(${TARGET} ${ARGN}) | 
				
			||||
 | 
				
			||||
    if(NOT "${TARGET}" MATCHES "^PkgConfig::.*") | 
				
			||||
      add_custom_command(TARGET ${TARGET} POST_BUILD | 
				
			||||
                        COMMAND ${CMAKE_COMMAND} -E copy | 
				
			||||
                        "$<TARGET_FILE:${TARGET}>" | 
				
			||||
                        "${ROOT_PROJECT_BINARY_DIR}/bundle/lib/$<TARGET_FILE_NAME:${TARGET}>") | 
				
			||||
    endif(NOT "${TARGET}" MATCHES "^PkgConfig::.*") | 
				
			||||
endfunction() | 
				
			||||
 | 
				
			||||
list(APPEND FLUTTER_PLATFORM_PLUGIN_LIST | 
				
			||||
    package_info_plus_aurora | 
				
			||||
) | 
				
			||||
 | 
				
			||||
list(APPEND FLUTTER_FFI_PLUGIN_LIST | 
				
			||||
) | 
				
			||||
 | 
				
			||||
foreach(PLUGIN ${FLUTTER_PLATFORM_PLUGIN_LIST}) | 
				
			||||
    add_subdirectory(flutter/ephemeral/.plugin_symlinks/${PLUGIN}/aurora plugins/${PLUGIN}) | 
				
			||||
    target_link_libraries(${BINARY_NAME} PRIVATE ${PLUGIN}_platform_plugin) | 
				
			||||
endforeach(PLUGIN) | 
				
			||||
 | 
				
			||||
foreach(FFI_PLUGIN ${FLUTTER_FFI_PLUGIN_LIST}) | 
				
			||||
    add_subdirectory(flutter/ephemeral/.plugin_symlinks/${FFI_PLUGIN}/aurora plugins/${FFI_PLUGIN}) | 
				
			||||
endforeach(FFI_PLUGIN) | 
				
			||||
| 
		 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,10 @@
					 | 
				
			||||
#include <flutter/application.h> | 
				
			||||
#include "generated_plugin_registrant.h" | 
				
			||||
 | 
				
			||||
int main(int argc, char *argv[]) { | 
				
			||||
    Application::Initialize(argc, argv); | 
				
			||||
    Application::SetPixelRatio(1.8); | 
				
			||||
    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.package_info_plus_aurora_example | 
				
			||||
Summary: Demonstrates how to use the package_info_plus_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,168 @@
					 | 
				
			||||
import 'package:flutter/material.dart'; | 
				
			||||
import 'dart:async'; | 
				
			||||
 | 
				
			||||
import 'package:flutter/services.dart'; | 
				
			||||
import 'package:package_info_plus/package_info_plus.dart'; | 
				
			||||
 | 
				
			||||
void main() { | 
				
			||||
  runApp(const MyApp()); | 
				
			||||
} | 
				
			||||
 | 
				
			||||
class MyApp extends StatefulWidget { | 
				
			||||
  const MyApp({super.key}); | 
				
			||||
 | 
				
			||||
  @override | 
				
			||||
  State<MyApp> createState() => _MyAppState(); | 
				
			||||
} | 
				
			||||
 | 
				
			||||
class _MyAppState extends State<MyApp> { | 
				
			||||
  String? _error; | 
				
			||||
  String? _appName; | 
				
			||||
  String? _packageName; | 
				
			||||
  String? _version; | 
				
			||||
  String? _buildNumber; | 
				
			||||
 | 
				
			||||
  @override | 
				
			||||
  void initState() { | 
				
			||||
    super.initState(); | 
				
			||||
    initPlatformState(); | 
				
			||||
  } | 
				
			||||
 | 
				
			||||
  Future<void> initPlatformState() async { | 
				
			||||
    try { | 
				
			||||
      PackageInfo packageInfo = await PackageInfo.fromPlatform(); | 
				
			||||
 | 
				
			||||
      String appName = packageInfo.appName; | 
				
			||||
      String packageName = packageInfo.packageName; | 
				
			||||
      String version = packageInfo.version; | 
				
			||||
      String buildNumber = packageInfo.buildNumber; | 
				
			||||
 | 
				
			||||
      // Update state variable | 
				
			||||
      setState(() { | 
				
			||||
        _appName = appName; | 
				
			||||
        _packageName = packageName; | 
				
			||||
        _version = version; | 
				
			||||
        _buildNumber = buildNumber; | 
				
			||||
      }); | 
				
			||||
    } on Exception catch (e) { | 
				
			||||
      setState(() { | 
				
			||||
        _error = e.toString(); | 
				
			||||
      }); | 
				
			||||
    } | 
				
			||||
  } | 
				
			||||
 | 
				
			||||
  @override | 
				
			||||
  Widget build(BuildContext context) { | 
				
			||||
    const textStyleWhite = TextStyle(fontSize: 18, color: Colors.white); | 
				
			||||
    const textStyleTitle = TextStyle(fontSize: 20, color: Colors.black); | 
				
			||||
    const textStylePath = TextStyle(fontSize: 18, color: Colors.black54); | 
				
			||||
 | 
				
			||||
    const spaceMedium = SizedBox(height: 20); | 
				
			||||
    const spaceSmall = SizedBox(height: 10); | 
				
			||||
 | 
				
			||||
    return MaterialApp( | 
				
			||||
      home: Scaffold( | 
				
			||||
        appBar: AppBar( | 
				
			||||
          title: const Text('Example package_info_plus'), | 
				
			||||
        ), | 
				
			||||
        body: Stack( | 
				
			||||
          children: [ | 
				
			||||
            // Error message | 
				
			||||
            Visibility( | 
				
			||||
              visible: _error != null, | 
				
			||||
              child: Center( | 
				
			||||
                child: Padding( | 
				
			||||
                  padding: const EdgeInsets.all(16), | 
				
			||||
                  child: Container( | 
				
			||||
                    padding: const EdgeInsets.all(20), | 
				
			||||
                    decoration: const BoxDecoration( | 
				
			||||
                      color: Colors.redAccent, | 
				
			||||
                      borderRadius: BorderRadius.all(Radius.circular(10.0)), | 
				
			||||
                    ), | 
				
			||||
                    child: Text( | 
				
			||||
                      _error ?? '', | 
				
			||||
                      style: textStyleWhite, | 
				
			||||
                    ), | 
				
			||||
                  ), | 
				
			||||
                ), | 
				
			||||
              ), | 
				
			||||
            ), | 
				
			||||
            // List directories path | 
				
			||||
            Visibility( | 
				
			||||
              visible: _error == null, | 
				
			||||
              child: 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 package_info_plus', | 
				
			||||
                            style: textStyleWhite, | 
				
			||||
                            textAlign: TextAlign.center, | 
				
			||||
                          ), | 
				
			||||
                        ), | 
				
			||||
                        const SizedBox(height: 30), | 
				
			||||
 | 
				
			||||
                        const Text( | 
				
			||||
                          'Application Name', | 
				
			||||
                          style: textStyleTitle, | 
				
			||||
                        ), | 
				
			||||
                        spaceSmall, | 
				
			||||
                        Text( | 
				
			||||
                          _appName ?? 'Not found.', | 
				
			||||
                          style: textStylePath, | 
				
			||||
                        ), | 
				
			||||
 | 
				
			||||
                        spaceMedium, | 
				
			||||
                        const Text( | 
				
			||||
                          'Package Name', | 
				
			||||
                          style: textStyleTitle, | 
				
			||||
                        ), | 
				
			||||
                        spaceSmall, | 
				
			||||
                        Text( | 
				
			||||
                          _packageName ?? 'Not found.', | 
				
			||||
                          style: textStylePath, | 
				
			||||
                        ), | 
				
			||||
 | 
				
			||||
                        spaceMedium, | 
				
			||||
                        const Text( | 
				
			||||
                          'Version', | 
				
			||||
                          style: textStyleTitle, | 
				
			||||
                        ), | 
				
			||||
                        spaceSmall, | 
				
			||||
                        Text( | 
				
			||||
                          _version ?? 'Not found.', | 
				
			||||
                          style: textStylePath, | 
				
			||||
                        ), | 
				
			||||
 | 
				
			||||
                        spaceMedium, | 
				
			||||
                        const Text( | 
				
			||||
                          'Build Number', | 
				
			||||
                          style: textStyleTitle, | 
				
			||||
                        ), | 
				
			||||
                        spaceSmall, | 
				
			||||
                        Text( | 
				
			||||
                          _buildNumber ?? 'Not found.', | 
				
			||||
                          style: textStylePath, | 
				
			||||
                        ), | 
				
			||||
                      ], | 
				
			||||
                    ), | 
				
			||||
                  ), | 
				
			||||
                ), | 
				
			||||
              ), | 
				
			||||
            ), | 
				
			||||
          ], | 
				
			||||
        ), | 
				
			||||
      ), | 
				
			||||
    ); | 
				
			||||
  } | 
				
			||||
} | 
				
			||||
@ -0,0 +1,23 @@
					 | 
				
			||||
name: package_info_plus_aurora_example | 
				
			||||
description: Demonstrates how to use the package_info_plus_aurora plugin. | 
				
			||||
 | 
				
			||||
publish_to: 'none' | 
				
			||||
 | 
				
			||||
environment: | 
				
			||||
  sdk: '>=2.18.6 <3.0.0' | 
				
			||||
 | 
				
			||||
dependencies: | 
				
			||||
  flutter: | 
				
			||||
    sdk: flutter | 
				
			||||
  package_info_plus: ^4.0.0 | 
				
			||||
  package_info_plus_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,58 @@
					 | 
				
			||||
import 'dart:io'; | 
				
			||||
import 'package:flutter/widgets.dart'; | 
				
			||||
import 'package_info_plus_aurora_platform_interface.dart'; | 
				
			||||
import 'package:package_info_plus_platform_interface/package_info_platform_interface.dart'; | 
				
			||||
import 'package:package_info_plus_platform_interface/package_info_data.dart'; | 
				
			||||
 | 
				
			||||
class PackageInfoPlusAurora extends PackageInfoPlatform { | 
				
			||||
  /// Register this dart class as the platform implementation for aurora | 
				
			||||
  static void registerWith() { | 
				
			||||
    PackageInfoPlatform.instance = PackageInfoPlusAurora(); | 
				
			||||
  } | 
				
			||||
 | 
				
			||||
  final _platform = PackageInfoPlusAuroraPlatform.instance; | 
				
			||||
 | 
				
			||||
  @override | 
				
			||||
  Future<PackageInfoData> getAll() async { | 
				
			||||
    final versionJson = await _getVersionJson(); | 
				
			||||
    return PackageInfoData( | 
				
			||||
      appName: versionJson['app_name'] ?? '', | 
				
			||||
      packageName: versionJson['package_name'] ?? '', | 
				
			||||
      version: versionJson['version'] ?? '', | 
				
			||||
      buildNumber: versionJson['build_number'] ?? '', | 
				
			||||
      buildSignature: '', | 
				
			||||
    ); | 
				
			||||
  } | 
				
			||||
 | 
				
			||||
  Future<Map<String, dynamic>> _getVersionJson() async { | 
				
			||||
    try { | 
				
			||||
      // Get package from aurora platform | 
				
			||||
      final org = await _platform.getApplicationOrg(); | 
				
			||||
      final name = await _platform.getApplicationName(); | 
				
			||||
      final packageName = '$org.$name'; | 
				
			||||
 | 
				
			||||
      // Get application name | 
				
			||||
      final desktop = | 
				
			||||
          (await File('/usr/share/applications/$packageName.desktop') | 
				
			||||
                  .readAsLines()) | 
				
			||||
              .where((element) => element.contains('Name=')); | 
				
			||||
 | 
				
			||||
      // Get application versions | 
				
			||||
      final result = (await Process.run('rpm', | 
				
			||||
              ['-q', '--queryformat', '%{VERSION}\n%{RELEASE}', packageName])) | 
				
			||||
          .stdout | 
				
			||||
          .toString() | 
				
			||||
          .split('\n'); | 
				
			||||
 | 
				
			||||
      return <String, dynamic>{ | 
				
			||||
        'app_name': desktop.isNotEmpty ? desktop.first.substring(5) : null, | 
				
			||||
        'package_name': packageName, | 
				
			||||
        'version': result[0], | 
				
			||||
        'build_number': result[1], | 
				
			||||
      }; | 
				
			||||
    } catch (e) { | 
				
			||||
      debugPrint(e.toString()); | 
				
			||||
      return <String, dynamic>{}; | 
				
			||||
    } | 
				
			||||
  } | 
				
			||||
} | 
				
			||||
@ -0,0 +1,21 @@
					 | 
				
			||||
import 'package:flutter/foundation.dart'; | 
				
			||||
import 'package:flutter/services.dart'; | 
				
			||||
 | 
				
			||||
import 'package_info_plus_aurora_platform_interface.dart'; | 
				
			||||
 | 
				
			||||
/// An implementation of [PackageInfoPlusAuroraPlatform] that uses method channels. | 
				
			||||
class MethodChannelPackageInfoPlusAurora extends PackageInfoPlusAuroraPlatform { | 
				
			||||
  /// The method channel used to interact with the native platform. | 
				
			||||
  @visibleForTesting | 
				
			||||
  final methodChannel = const MethodChannel('package_info_plus_aurora'); | 
				
			||||
 | 
				
			||||
  @override | 
				
			||||
  Future<String?> getApplicationOrg() async { | 
				
			||||
    return await methodChannel.invokeMethod<String>('getApplicationOrg'); | 
				
			||||
  } | 
				
			||||
 | 
				
			||||
  @override | 
				
			||||
  Future<String?> getApplicationName() async { | 
				
			||||
    return await methodChannel.invokeMethod<String>('getApplicationName'); | 
				
			||||
  } | 
				
			||||
} | 
				
			||||
@ -0,0 +1,34 @@
					 | 
				
			||||
import 'package:plugin_platform_interface/plugin_platform_interface.dart'; | 
				
			||||
 | 
				
			||||
import 'package_info_plus_aurora_method_channel.dart'; | 
				
			||||
 | 
				
			||||
abstract class PackageInfoPlusAuroraPlatform extends PlatformInterface { | 
				
			||||
  /// Constructs a PackageInfoPlusAuroraPlatform. | 
				
			||||
  PackageInfoPlusAuroraPlatform() : super(token: _token); | 
				
			||||
 | 
				
			||||
  static final Object _token = Object(); | 
				
			||||
 | 
				
			||||
  static PackageInfoPlusAuroraPlatform _instance = | 
				
			||||
      MethodChannelPackageInfoPlusAurora(); | 
				
			||||
 | 
				
			||||
  /// The default instance of [PackageInfoPlusAuroraPlatform] to use. | 
				
			||||
  /// | 
				
			||||
  /// Defaults to [MethodChannelPackageInfoPlusAurora]. | 
				
			||||
  static PackageInfoPlusAuroraPlatform get instance => _instance; | 
				
			||||
 | 
				
			||||
  /// Platform-specific implementations should set this with their own | 
				
			||||
  /// platform-specific class that extends [PackageInfoPlusAuroraPlatform] when | 
				
			||||
  /// they register themselves. | 
				
			||||
  static set instance(PackageInfoPlusAuroraPlatform instance) { | 
				
			||||
    PlatformInterface.verifyToken(instance, _token); | 
				
			||||
    _instance = instance; | 
				
			||||
  } | 
				
			||||
 | 
				
			||||
  Future<String?> getApplicationOrg() { | 
				
			||||
    throw UnimplementedError('getApplicationOrg() has not been implemented.'); | 
				
			||||
  } | 
				
			||||
 | 
				
			||||
  Future<String?> getApplicationName() { | 
				
			||||
    throw UnimplementedError('getApplicationName() has not been implemented.'); | 
				
			||||
  } | 
				
			||||
} | 
				
			||||
@ -0,0 +1,26 @@
					 | 
				
			||||
name: package_info_plus_aurora | 
				
			||||
description: A new Flutter plugin project. | 
				
			||||
version: 0.0.1 | 
				
			||||
homepage: | 
				
			||||
 | 
				
			||||
environment: | 
				
			||||
  sdk: '>=2.18.6 <3.0.0' | 
				
			||||
  flutter: ">=2.5.0" | 
				
			||||
 | 
				
			||||
dependencies: | 
				
			||||
  flutter: | 
				
			||||
    sdk: flutter | 
				
			||||
  plugin_platform_interface: ^2.0.2 | 
				
			||||
  package_info_plus_platform_interface: ^2.0.1 | 
				
			||||
 | 
				
			||||
dev_dependencies: | 
				
			||||
  flutter_test: | 
				
			||||
    sdk: flutter | 
				
			||||
  flutter_lints: ^2.0.0 | 
				
			||||
 | 
				
			||||
flutter: | 
				
			||||
  plugin: | 
				
			||||
    platforms: | 
				
			||||
      aurora: | 
				
			||||
        pluginClass: PackageInfoPlusAuroraPlugin | 
				
			||||
        dartPluginClass: PackageInfoPlusAurora | 
				
			||||
@ -0,0 +1,35 @@
					 | 
				
			||||
import 'package:flutter/services.dart'; | 
				
			||||
import 'package:flutter_test/flutter_test.dart'; | 
				
			||||
import 'package:package_info_plus_aurora/package_info_plus_aurora_method_channel.dart'; | 
				
			||||
 | 
				
			||||
void main() { | 
				
			||||
  MethodChannelPackageInfoPlusAurora platform = | 
				
			||||
      MethodChannelPackageInfoPlusAurora(); | 
				
			||||
  const MethodChannel channel = MethodChannel('package_info_plus_aurora'); | 
				
			||||
 | 
				
			||||
  TestWidgetsFlutterBinding.ensureInitialized(); | 
				
			||||
 | 
				
			||||
  setUp(() { | 
				
			||||
    channel.setMockMethodCallHandler((MethodCall methodCall) async { | 
				
			||||
      switch (methodCall.method) { | 
				
			||||
        case 'getApplicationOrg': | 
				
			||||
          return 'com.example'; | 
				
			||||
        case 'getApplicationName': | 
				
			||||
          return 'path_provider_aurora'; | 
				
			||||
      } | 
				
			||||
      return ''; | 
				
			||||
    }); | 
				
			||||
  }); | 
				
			||||
 | 
				
			||||
  tearDown(() { | 
				
			||||
    channel.setMockMethodCallHandler(null); | 
				
			||||
  }); | 
				
			||||
 | 
				
			||||
  test('onGetApplicationOrg', () async { | 
				
			||||
    expect(await platform.getApplicationOrg(), 'com.example'); | 
				
			||||
  }); | 
				
			||||
 | 
				
			||||
  test('onGetApplicationName', () async { | 
				
			||||
    expect(await platform.getApplicationName(), 'path_provider_aurora'); | 
				
			||||
  }); | 
				
			||||
} | 
				
			||||
					Loading…
					
					
				
		Reference in new issue