diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..57a2afc --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,59 @@ +{ + "files.associations": { + "optional": "cpp", + "system_error": "cpp", + "string": "cpp", + "array": "cpp", + "atomic": "cpp", + "bit": "cpp", + "*.tcc": "cpp", + "cctype": "cpp", + "clocale": "cpp", + "cmath": "cpp", + "codecvt": "cpp", + "compare": "cpp", + "concepts": "cpp", + "condition_variable": "cpp", + "cstdarg": "cpp", + "cstddef": "cpp", + "cstdint": "cpp", + "cstdio": "cpp", + "cstdlib": "cpp", + "ctime": "cpp", + "cwchar": "cpp", + "cwctype": "cpp", + "deque": "cpp", + "unordered_map": "cpp", + "vector": "cpp", + "exception": "cpp", + "algorithm": "cpp", + "functional": "cpp", + "iterator": "cpp", + "memory": "cpp", + "memory_resource": "cpp", + "numeric": "cpp", + "random": "cpp", + "ratio": "cpp", + "string_view": "cpp", + "tuple": "cpp", + "type_traits": "cpp", + "utility": "cpp", + "fstream": "cpp", + "initializer_list": "cpp", + "iomanip": "cpp", + "iosfwd": "cpp", + "istream": "cpp", + "limits": "cpp", + "mutex": "cpp", + "new": "cpp", + "numbers": "cpp", + "ostream": "cpp", + "semaphore": "cpp", + "sstream": "cpp", + "stdexcept": "cpp", + "stop_token": "cpp", + "streambuf": "cpp", + "thread": "cpp", + "typeinfo": "cpp" + } +} \ No newline at end of file diff --git a/packages/shared_preferences/README.md b/packages/shared_preferences/README.md deleted file mode 100644 index f966827..0000000 --- a/packages/shared_preferences/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# shared_preferences - -A new Flutter FFI plugin project. \ No newline at end of file diff --git a/packages/shared_preferences/aurora/CMakeLists.txt b/packages/shared_preferences/aurora/CMakeLists.txt deleted file mode 100644 index 2a058bc..0000000 --- a/packages/shared_preferences/aurora/CMakeLists.txt +++ /dev/null @@ -1,12 +0,0 @@ -cmake_minimum_required(VERSION 3.10) - -set(PLUGIN_NAME shared_preferences) -project(${PLUGIN_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") - -add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../src ${CMAKE_CURRENT_BINARY_DIR}/shared) diff --git a/packages/shared_preferences/example/aurora/desktop/com.example.shared_preferences_example.desktop b/packages/shared_preferences/example/aurora/desktop/com.example.shared_preferences_example.desktop deleted file mode 100644 index 78c23e2..0000000 --- a/packages/shared_preferences/example/aurora/desktop/com.example.shared_preferences_example.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Type=Application -Name=shared_preferences_example -Comment=Demonstrates how to use the shared_preferences plugin. -Icon=com.example.shared_preferences_example -Exec=/usr/bin/com.example.shared_preferences_example -X-Nemo-Application-Type=silica-qt5 - -[X-Application] -Permissions= -OrganizationName=com.example -ApplicationName=shared_preferences_example diff --git a/packages/shared_preferences/example/defaultuser@ b/packages/shared_preferences/example/defaultuser@ deleted file mode 100644 index 87b4552..0000000 Binary files a/packages/shared_preferences/example/defaultuser@ and /dev/null differ diff --git a/packages/shared_preferences/example/lib/main.dart b/packages/shared_preferences/example/lib/main.dart deleted file mode 100644 index 43494b6..0000000 --- a/packages/shared_preferences/example/lib/main.dart +++ /dev/null @@ -1,75 +0,0 @@ -import 'package:flutter/material.dart'; -import 'dart:async'; - -import 'package:shared_preferences/shared_preferences.dart' - as shared_preferences; - -void main() { - runApp(const MyApp()); -} - -class MyApp extends StatefulWidget { - const MyApp({super.key}); - - @override - _MyAppState createState() => _MyAppState(); -} - -class _MyAppState extends State { - late int sumResult; - late Future sumAsyncResult; - - @override - void initState() { - super.initState(); - sumResult = shared_preferences.sum(1, 2); - sumAsyncResult = shared_preferences.sumAsync(3, 4); - } - - @override - Widget build(BuildContext context) { - const textStyle = TextStyle(fontSize: 25); - const spacerSmall = SizedBox(height: 10); - return MaterialApp( - home: Scaffold( - appBar: AppBar( - title: const Text('Native Packages'), - ), - body: SingleChildScrollView( - child: Container( - padding: const EdgeInsets.all(10), - child: Column( - children: [ - const Text( - 'This calls a native function through FFI that is shipped as source in the package. ' - 'The native code is built as part of the Flutter Runner build.', - style: textStyle, - textAlign: TextAlign.center, - ), - spacerSmall, - Text( - 'sum(1, 2) = $sumResult', - style: textStyle, - textAlign: TextAlign.center, - ), - spacerSmall, - FutureBuilder( - future: sumAsyncResult, - builder: (BuildContext context, AsyncSnapshot value) { - final displayValue = - (value.hasData) ? value.data : 'loading'; - return Text( - 'await sumAsync(3, 4) = $displayValue', - style: textStyle, - textAlign: TextAlign.center, - ); - }, - ), - ], - ), - ), - ), - ), - ); - } -} diff --git a/packages/shared_preferences/ffigen.yaml b/packages/shared_preferences/ffigen.yaml deleted file mode 100644 index 9e0d4b1..0000000 --- a/packages/shared_preferences/ffigen.yaml +++ /dev/null @@ -1,22 +0,0 @@ -# Run with `flutter pub run ffigen --config ffigen.yaml`. -name: SharedPreferencesBindings -llvm-path: - - '/usr/lib/llvm-14/lib/libclang.so' # Ubuntu 22.04 - - '/usr/lib/llvm-15/lib/libclang.so' # Ubuntu 23.04 -description: | - Bindings for `src/shared_preferences.h`. - - Regenerate bindings with `flutter pub run ffigen --config ffigen.yaml`. -output: 'lib/shared_preferences_bindings_generated.dart' -headers: - entry-points: - - 'src/shared_preferences.h' - include-directives: - - 'src/shared_preferences.h' -preamble: | - // ignore_for_file: always_specify_types - // ignore_for_file: camel_case_types - // ignore_for_file: non_constant_identifier_names -comments: - style: any - length: full \ No newline at end of file diff --git a/packages/shared_preferences/lib/shared_preferences.dart b/packages/shared_preferences/lib/shared_preferences.dart deleted file mode 100644 index c1a0203..0000000 --- a/packages/shared_preferences/lib/shared_preferences.dart +++ /dev/null @@ -1,131 +0,0 @@ - -import 'dart:async'; -import 'dart:ffi'; -import 'dart:io'; -import 'dart:isolate'; - -import 'shared_preferences_bindings_generated.dart'; - -/// A very short-lived native function. -/// -/// For very short-lived functions, it is fine to call them on the main isolate. -/// They will block the Dart execution while running the native function, so -/// only do this for native functions which are guaranteed to be short-lived. -int sum(int a, int b) => _bindings.sum(a, b); - -/// A longer lived native function, which occupies the thread calling it. -/// -/// Do not call these kind of native functions in the main isolate. They will -/// block Dart execution. This will cause dropped frames in Flutter applications. -/// Instead, call these native functions on a separate isolate. -/// -/// Modify this to suit your own use case. Example use cases: -/// -/// 1. Reuse a single isolate for various different kinds of requests. -/// 2. Use multiple helper isolates for parallel execution. -Future sumAsync(int a, int b) async { - final SendPort helperIsolateSendPort = await _helperIsolateSendPort; - final int requestId = _nextSumRequestId++; - final _SumRequest request = _SumRequest(requestId, a, b); - final Completer completer = Completer(); - _sumRequests[requestId] = completer; - helperIsolateSendPort.send(request); - return completer.future; -} - -const String _libName = 'shared_preferences'; - -/// The dynamic library in which the symbols for [SharedPreferencesBindings] can be found. -final DynamicLibrary _dylib = () { - if (Platform.isMacOS || Platform.isIOS) { - return DynamicLibrary.open('$_libName.framework/$_libName'); - } - if (Platform.isAndroid || Platform.isLinux) { - return DynamicLibrary.open('lib$_libName.so'); - } - if (Platform.isWindows) { - return DynamicLibrary.open('$_libName.dll'); - } - throw UnsupportedError('Unknown platform: ${Platform.operatingSystem}'); -}(); - -/// The bindings to the native functions in [_dylib]. -final SharedPreferencesBindings _bindings = SharedPreferencesBindings(_dylib); - - -/// A request to compute `sum`. -/// -/// Typically sent from one isolate to another. -class _SumRequest { - final int id; - final int a; - final int b; - - const _SumRequest(this.id, this.a, this.b); -} - -/// A response with the result of `sum`. -/// -/// Typically sent from one isolate to another. -class _SumResponse { - final int id; - final int result; - - const _SumResponse(this.id, this.result); -} - -/// Counter to identify [_SumRequest]s and [_SumResponse]s. -int _nextSumRequestId = 0; - -/// Mapping from [_SumRequest] `id`s to the completers corresponding to the correct future of the pending request. -final Map> _sumRequests = >{}; - -/// The SendPort belonging to the helper isolate. -Future _helperIsolateSendPort = () async { - // The helper isolate is going to send us back a SendPort, which we want to - // wait for. - final Completer completer = Completer(); - - // Receive port on the main isolate to receive messages from the helper. - // We receive two types of messages: - // 1. A port to send messages on. - // 2. Responses to requests we sent. - final ReceivePort receivePort = ReceivePort() - ..listen((dynamic data) { - if (data is SendPort) { - // The helper isolate sent us the port on which we can sent it requests. - completer.complete(data); - return; - } - if (data is _SumResponse) { - // The helper isolate sent us a response to a request we sent. - final Completer completer = _sumRequests[data.id]!; - _sumRequests.remove(data.id); - completer.complete(data.result); - return; - } - throw UnsupportedError('Unsupported message type: ${data.runtimeType}'); - }); - - // Start the helper isolate. - await Isolate.spawn((SendPort sendPort) async { - final ReceivePort helperReceivePort = ReceivePort() - ..listen((dynamic data) { - // On the helper isolate listen to requests and respond to them. - if (data is _SumRequest) { - final int result = _bindings.sum_long_running(data.a, data.b); - final _SumResponse response = _SumResponse(data.id, result); - sendPort.send(response); - return; - } - throw UnsupportedError('Unsupported message type: ${data.runtimeType}'); - }); - - // Send the the port to the main isolate on which we can receive requests. - sendPort.send(helperReceivePort.sendPort); - }, receivePort.sendPort); - - // Wait until the helper isolate has sent us back the SendPort on which we - // can start sending requests. - return completer.future; -}(); diff --git a/packages/shared_preferences/lib/shared_preferences_bindings_generated.dart b/packages/shared_preferences/lib/shared_preferences_bindings_generated.dart deleted file mode 100644 index dce4212..0000000 --- a/packages/shared_preferences/lib/shared_preferences_bindings_generated.dart +++ /dev/null @@ -1,69 +0,0 @@ -// ignore_for_file: always_specify_types -// ignore_for_file: camel_case_types -// ignore_for_file: non_constant_identifier_names - -// AUTO GENERATED FILE, DO NOT EDIT. -// -// Generated by `package:ffigen`. -import 'dart:ffi' as ffi; - -/// Bindings for `src/shared_preferences.h`. -/// -/// Regenerate bindings with `flutter pub run ffigen --config ffigen.yaml`. -/// -class SharedPreferencesBindings { - /// Holds the symbol lookup function. - final ffi.Pointer Function(String symbolName) - _lookup; - - /// The symbols are looked up in [dynamicLibrary]. - SharedPreferencesBindings(ffi.DynamicLibrary dynamicLibrary) - : _lookup = dynamicLibrary.lookup; - - /// The symbols are looked up with [lookup]. - SharedPreferencesBindings.fromLookup( - ffi.Pointer Function(String symbolName) - lookup) - : _lookup = lookup; - - /// A very short-lived native function. - /// - /// For very short-lived functions, it is fine to call them on the main isolate. - /// They will block the Dart execution while running the native function, so - /// only do this for native functions which are guaranteed to be short-lived. - int sum( - int a, - int b, - ) { - return _sum( - a, - b, - ); - } - - late final _sumPtr = - _lookup>( - 'sum'); - late final _sum = _sumPtr.asFunction(); - - /// A longer lived native function, which occupies the thread calling it. - /// - /// Do not call these kind of native functions in the main isolate. They will - /// block Dart execution. This will cause dropped frames in Flutter applications. - /// Instead, call these native functions on a separate isolate. - int sum_long_running( - int a, - int b, - ) { - return _sum_long_running( - a, - b, - ); - } - - late final _sum_long_runningPtr = - _lookup>( - 'sum_long_running'); - late final _sum_long_running = - _sum_long_runningPtr.asFunction(); -} diff --git a/packages/shared_preferences/.gitignore b/packages/shared_preferences/shared_preferences_aurora/.gitignore similarity index 98% rename from packages/shared_preferences/.gitignore rename to packages/shared_preferences/shared_preferences_aurora/.gitignore index abc5ecc..96486fd 100644 --- a/packages/shared_preferences/.gitignore +++ b/packages/shared_preferences/shared_preferences_aurora/.gitignore @@ -28,4 +28,3 @@ migrate_working_dir/ .dart_tool/ .packages build/ -.metadata \ No newline at end of file diff --git a/packages/shared_preferences/shared_preferences_aurora/.metadata b/packages/shared_preferences/shared_preferences_aurora/.metadata new file mode 100644 index 0000000..a1644dc --- /dev/null +++ b/packages/shared_preferences/shared_preferences_aurora/.metadata @@ -0,0 +1,30 @@ +# This file tracks properties of this Flutter project. +# Used by Flutter tool to assess capabilities and perform upgrades etc. +# +# This file should be version controlled. + +version: + revision: 135454af32477f815a7525073027a3ff9eff1bfd + channel: unknown + +project_type: plugin + +# Tracks metadata for the flutter migrate command +migration: + platforms: + - platform: root + create_revision: 135454af32477f815a7525073027a3ff9eff1bfd + base_revision: 135454af32477f815a7525073027a3ff9eff1bfd + - platform: aurora + create_revision: 135454af32477f815a7525073027a3ff9eff1bfd + base_revision: 135454af32477f815a7525073027a3ff9eff1bfd + + # User provided section + + # List of Local paths (relative to this file) that should be + # ignored by the migrate tool. + # + # Files that are not part of the templates will be ignored by default. + unmanaged_files: + - 'lib/main.dart' + - 'ios/Runner.xcodeproj/project.pbxproj' diff --git a/packages/shared_preferences/shared_preferences_aurora/CHANGELOG.md b/packages/shared_preferences/shared_preferences_aurora/CHANGELOG.md new file mode 100644 index 0000000..41cc7d8 --- /dev/null +++ b/packages/shared_preferences/shared_preferences_aurora/CHANGELOG.md @@ -0,0 +1,3 @@ +## 0.0.1 + +* TODO: Describe initial release. diff --git a/packages/shared_preferences/shared_preferences_aurora/LICENSE b/packages/shared_preferences/shared_preferences_aurora/LICENSE new file mode 100644 index 0000000..ba75c69 --- /dev/null +++ b/packages/shared_preferences/shared_preferences_aurora/LICENSE @@ -0,0 +1 @@ +TODO: Add your license here. diff --git a/packages/shared_preferences/shared_preferences_aurora/README.md b/packages/shared_preferences/shared_preferences_aurora/README.md new file mode 100644 index 0000000..036dbb7 --- /dev/null +++ b/packages/shared_preferences/shared_preferences_aurora/README.md @@ -0,0 +1,15 @@ +# shared_preferences_aurora + +A new Flutter plugin project. + +## Getting Started + +This project is a starting point for a Flutter +[plug-in package](https://flutter.dev/developing-packages/), +a specialized package that includes platform-specific implementation code for +Android and/or iOS. + +For help getting started with Flutter development, view the +[online documentation](https://flutter.dev/docs), which offers tutorials, +samples, guidance on mobile development, and a full API reference. + diff --git a/packages/shared_preferences/analysis_options.yaml b/packages/shared_preferences/shared_preferences_aurora/analysis_options.yaml similarity index 100% rename from packages/shared_preferences/analysis_options.yaml rename to packages/shared_preferences/shared_preferences_aurora/analysis_options.yaml diff --git a/packages/shared_preferences/shared_preferences_aurora/aurora/CMakeLists.txt b/packages/shared_preferences/shared_preferences_aurora/aurora/CMakeLists.txt new file mode 100644 index 0000000..336e7b6 --- /dev/null +++ b/packages/shared_preferences/shared_preferences_aurora/aurora/CMakeLists.txt @@ -0,0 +1,25 @@ +cmake_minimum_required(VERSION 3.10) + +set(PROJECT_NAME shared_preferences_aurora) +set(PLUGIN_NAME shared_preferences_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) +pkg_check_modules(Qt5Core REQUIRED IMPORTED_TARGET Qt5Core) + +add_library(${PLUGIN_NAME} SHARED shared_preferences_aurora_plugin.cpp) + +set_target_properties(${PLUGIN_NAME} PROPERTIES CXX_VISIBILITY_PRESET hidden) +target_link_libraries(${PLUGIN_NAME} PRIVATE PkgConfig::FlutterEmbedder) +target_link_libraries(${PLUGIN_NAME} PRIVATE PkgConfig::Qt5Core) + +target_include_directories(${PLUGIN_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include) +target_compile_definitions(${PLUGIN_NAME} PRIVATE PLUGIN_IMPL) diff --git a/packages/shared_preferences/shared_preferences_aurora/aurora/include/shared_preferences_aurora/shared_preferences_aurora_plugin.h b/packages/shared_preferences/shared_preferences_aurora/aurora/include/shared_preferences_aurora/shared_preferences_aurora_plugin.h new file mode 100644 index 0000000..f8d4cc3 --- /dev/null +++ b/packages/shared_preferences/shared_preferences_aurora/aurora/include/shared_preferences_aurora/shared_preferences_aurora_plugin.h @@ -0,0 +1,24 @@ +#ifndef FLUTTER_PLUGIN_SHARED_PREFERENCES_AURORA_PLUGIN_H +#define FLUTTER_PLUGIN_SHARED_PREFERENCES_AURORA_PLUGIN_H + +#include + +#ifdef PLUGIN_IMPL +#define PLUGIN_EXPORT __attribute__((visibility("default"))) +#else +#define PLUGIN_EXPORT +#endif + +class PLUGIN_EXPORT SharedPreferencesAuroraPlugin final : public PluginInterface +{ +public: + void RegisterWithRegistrar(PluginRegistrar ®istrar) override; + +private: + void onMethodCall(const MethodCall &call); + void onGetInt(const MethodCall &call); + void onSetInt(const MethodCall &call); + void unimplemented(const MethodCall &call); +}; + +#endif /* FLUTTER_PLUGIN_SHARED_PREFERENCES_AURORA_PLUGIN_H */ diff --git a/packages/shared_preferences/shared_preferences_aurora/aurora/shared_preferences_aurora_plugin.cpp b/packages/shared_preferences/shared_preferences_aurora/aurora/shared_preferences_aurora_plugin.cpp new file mode 100644 index 0000000..206d0e6 --- /dev/null +++ b/packages/shared_preferences/shared_preferences_aurora/aurora/shared_preferences_aurora_plugin.cpp @@ -0,0 +1,59 @@ +#include +#include +#include +#include +#include + +void SharedPreferencesAuroraPlugin::RegisterWithRegistrar(PluginRegistrar ®istrar) +{ + registrar.RegisterMethodChannel("shared_preferences_aurora", + MethodCodecType::Standard, + [this](const MethodCall &call) { this->onMethodCall(call); }); +} + +void SharedPreferencesAuroraPlugin::onMethodCall(const MethodCall &call) +{ + const auto &method = call.GetMethod(); + + if (method == "getInt") { + onGetInt(call); + return; + } + else if (method == "setInt") { + onSetInt(call); + return; + } + + unimplemented(call); +} + +void SharedPreferencesAuroraPlugin::onGetInt(const MethodCall &call) +{ + // get arguments + std::string key = call.GetArguments()["key"].GetString(); + int value = call.GetArguments()["value"].GetInt(); + // init settings + const auto [orgname, appname] = Application::GetID(); + QSettings settings(QString::fromStdString(orgname), QString::fromStdString(appname)); + // send response + call.SendSuccessResponse(settings.value(QString::fromStdString(key), value).toInt()); +} + +void SharedPreferencesAuroraPlugin::onSetInt(const MethodCall &call) +{ + // get arguments + std::string key = call.GetArguments()["key"].GetString(); + int value = call.GetArguments()["value"].GetInt(); + // init settings + const auto [orgname, appname] = Application::GetID(); + QSettings settings(QString::fromStdString(orgname), QString::fromStdString(appname)); + // save + settings.setValue(QString::fromStdString(key), value); + // send response + call.SendSuccessResponse(true); +} + +void SharedPreferencesAuroraPlugin::unimplemented(const MethodCall &call) +{ + call.SendSuccessResponse(nullptr); +} diff --git a/packages/shared_preferences/example/.gitignore b/packages/shared_preferences/shared_preferences_aurora/example/.gitignore similarity index 100% rename from packages/shared_preferences/example/.gitignore rename to packages/shared_preferences/shared_preferences_aurora/example/.gitignore diff --git a/packages/shared_preferences/example/README.md b/packages/shared_preferences/shared_preferences_aurora/example/README.md similarity index 84% rename from packages/shared_preferences/example/README.md rename to packages/shared_preferences/shared_preferences_aurora/example/README.md index 3122994..405c877 100644 --- a/packages/shared_preferences/example/README.md +++ b/packages/shared_preferences/shared_preferences_aurora/example/README.md @@ -1,6 +1,6 @@ -# shared_preferences_example +# shared_preferences_aurora_example -Demonstrates how to use the shared_preferences plugin. +Demonstrates how to use the shared_preferences_aurora plugin. ## Getting Started diff --git a/packages/shared_preferences/example/analysis_options.yaml b/packages/shared_preferences/shared_preferences_aurora/example/analysis_options.yaml similarity index 100% rename from packages/shared_preferences/example/analysis_options.yaml rename to packages/shared_preferences/shared_preferences_aurora/example/analysis_options.yaml diff --git a/packages/shared_preferences/example/aurora/.gitignore b/packages/shared_preferences/shared_preferences_aurora/example/aurora/.gitignore similarity index 100% rename from packages/shared_preferences/example/aurora/.gitignore rename to packages/shared_preferences/shared_preferences_aurora/example/aurora/.gitignore diff --git a/packages/shared_preferences/example/aurora/CMakeLists.txt b/packages/shared_preferences/shared_preferences_aurora/example/aurora/CMakeLists.txt similarity index 96% rename from packages/shared_preferences/example/aurora/CMakeLists.txt rename to packages/shared_preferences/shared_preferences_aurora/example/aurora/CMakeLists.txt index 8773a3d..57b3d4e 100644 --- a/packages/shared_preferences/example/aurora/CMakeLists.txt +++ b/packages/shared_preferences/shared_preferences_aurora/example/aurora/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.10) -project(com.example.shared_preferences_example LANGUAGES CXX) +project(com.example.shared_preferences_aurora_example LANGUAGES CXX) include(GNUInstallDirs) diff --git a/packages/shared_preferences/shared_preferences_aurora/example/aurora/desktop/com.example.shared_preferences_aurora_example.desktop b/packages/shared_preferences/shared_preferences_aurora/example/aurora/desktop/com.example.shared_preferences_aurora_example.desktop new file mode 100644 index 0000000..ebb83d1 --- /dev/null +++ b/packages/shared_preferences/shared_preferences_aurora/example/aurora/desktop/com.example.shared_preferences_aurora_example.desktop @@ -0,0 +1,12 @@ +[Desktop Entry] +Type=Application +Name=shared_preferences_aurora_example +Comment=Demonstrates how to use the shared_preferences_aurora plugin. +Icon=com.example.shared_preferences_aurora_example +Exec=/usr/bin/com.example.shared_preferences_aurora_example +X-Nemo-Application-Type=silica-qt5 + +[X-Application] +Permissions= +OrganizationName=com.example +ApplicationName=shared_preferences_aurora_example diff --git a/packages/shared_preferences/example/aurora/flutter/generated_plugin_registrant.cpp b/packages/shared_preferences/shared_preferences_aurora/example/aurora/flutter/generated_plugin_registrant.cpp similarity index 61% rename from packages/shared_preferences/example/aurora/flutter/generated_plugin_registrant.cpp rename to packages/shared_preferences/shared_preferences_aurora/example/aurora/flutter/generated_plugin_registrant.cpp index b315972..32f7152 100644 --- a/packages/shared_preferences/example/aurora/flutter/generated_plugin_registrant.cpp +++ b/packages/shared_preferences/shared_preferences_aurora/example/aurora/flutter/generated_plugin_registrant.cpp @@ -5,10 +5,12 @@ // clang-format off #include +#include #include "generated_plugin_registrant.h" void RegisterPlugins() { Application::RegisterPlugins({ + std::make_shared(), }); } diff --git a/packages/shared_preferences/example/aurora/flutter/generated_plugin_registrant.h b/packages/shared_preferences/shared_preferences_aurora/example/aurora/flutter/generated_plugin_registrant.h similarity index 100% rename from packages/shared_preferences/example/aurora/flutter/generated_plugin_registrant.h rename to packages/shared_preferences/shared_preferences_aurora/example/aurora/flutter/generated_plugin_registrant.h diff --git a/packages/shared_preferences/example/aurora/flutter/generated_plugins.cmake b/packages/shared_preferences/shared_preferences_aurora/example/aurora/flutter/generated_plugins.cmake similarity index 97% rename from packages/shared_preferences/example/aurora/flutter/generated_plugins.cmake rename to packages/shared_preferences/shared_preferences_aurora/example/aurora/flutter/generated_plugins.cmake index 73b50df..3e5cadb 100644 --- a/packages/shared_preferences/example/aurora/flutter/generated_plugins.cmake +++ b/packages/shared_preferences/shared_preferences_aurora/example/aurora/flutter/generated_plugins.cmake @@ -15,10 +15,10 @@ function(add_library TARGET) endfunction() list(APPEND FLUTTER_PLATFORM_PLUGIN_LIST + shared_preferences_aurora ) list(APPEND FLUTTER_FFI_PLUGIN_LIST - shared_preferences ) foreach(PLUGIN ${FLUTTER_PLATFORM_PLUGIN_LIST}) diff --git a/packages/shared_preferences/example/aurora/icons/108x108.png b/packages/shared_preferences/shared_preferences_aurora/example/aurora/icons/108x108.png similarity index 100% rename from packages/shared_preferences/example/aurora/icons/108x108.png rename to packages/shared_preferences/shared_preferences_aurora/example/aurora/icons/108x108.png diff --git a/packages/shared_preferences/example/aurora/icons/128x128.png b/packages/shared_preferences/shared_preferences_aurora/example/aurora/icons/128x128.png similarity index 100% rename from packages/shared_preferences/example/aurora/icons/128x128.png rename to packages/shared_preferences/shared_preferences_aurora/example/aurora/icons/128x128.png diff --git a/packages/shared_preferences/example/aurora/icons/172x172.png b/packages/shared_preferences/shared_preferences_aurora/example/aurora/icons/172x172.png similarity index 100% rename from packages/shared_preferences/example/aurora/icons/172x172.png rename to packages/shared_preferences/shared_preferences_aurora/example/aurora/icons/172x172.png diff --git a/packages/shared_preferences/example/aurora/icons/86x86.png b/packages/shared_preferences/shared_preferences_aurora/example/aurora/icons/86x86.png similarity index 100% rename from packages/shared_preferences/example/aurora/icons/86x86.png rename to packages/shared_preferences/shared_preferences_aurora/example/aurora/icons/86x86.png diff --git a/packages/shared_preferences/example/aurora/main.cpp b/packages/shared_preferences/shared_preferences_aurora/example/aurora/main.cpp similarity index 100% rename from packages/shared_preferences/example/aurora/main.cpp rename to packages/shared_preferences/shared_preferences_aurora/example/aurora/main.cpp diff --git a/packages/shared_preferences/example/aurora/rpm/com.example.shared_preferences_example.spec b/packages/shared_preferences/shared_preferences_aurora/example/aurora/rpm/com.example.shared_preferences_aurora_example.spec similarity index 82% rename from packages/shared_preferences/example/aurora/rpm/com.example.shared_preferences_example.spec rename to packages/shared_preferences/shared_preferences_aurora/example/aurora/rpm/com.example.shared_preferences_aurora_example.spec index b66ae7d..a05f586 100644 --- a/packages/shared_preferences/example/aurora/rpm/com.example.shared_preferences_example.spec +++ b/packages/shared_preferences/shared_preferences_aurora/example/aurora/rpm/com.example.shared_preferences_aurora_example.spec @@ -1,8 +1,8 @@ %global __provides_exclude_from ^%{_datadir}/%{name}/lib/.*$ %global __requires_exclude ^lib(dconf|flutter-embedder|maliit-glib|appmanifest-.+|.+_platform_plugin)\\.so.*$ -Name: com.example.shared_preferences_example -Summary: Demonstrates how to use the shared_preferences plugin. +Name: com.example.shared_preferences_aurora_example +Summary: Demonstrates how to use the shared_preferences_aurora plugin. Version: 0.1.0 Release: 1 License: Proprietary diff --git a/packages/shared_preferences/shared_preferences_aurora/example/lib/main.dart b/packages/shared_preferences/shared_preferences_aurora/example/lib/main.dart new file mode 100644 index 0000000..03446a8 --- /dev/null +++ b/packages/shared_preferences/shared_preferences_aurora/example/lib/main.dart @@ -0,0 +1,63 @@ +import 'package:flutter/material.dart'; +import 'dart:async'; + +import 'package:flutter/services.dart'; +import 'package:shared_preferences_aurora/shared_preferences_aurora.dart'; + +void main() { + runApp(const MyApp()); +} + +class MyApp extends StatefulWidget { + const MyApp({super.key}); + + @override + State createState() => _MyAppState(); +} + +class _MyAppState extends State { + int _platformVersion = -1; + final _sharedPreferencesAuroraPlugin = SharedPreferencesAurora(); + + @override + void initState() { + super.initState(); + initPlatformState(); + } + + // Platform messages are asynchronous, so we initialize in an async method. + Future initPlatformState() async { + int platformVersion; + // Platform messages may fail, so we use a try/catch PlatformException. + // We also handle the message potentially returning null. + try { + await _sharedPreferencesAuroraPlugin.setInt('key', 222); + platformVersion = await _sharedPreferencesAuroraPlugin.getInt('key', -99); + } on PlatformException { + platformVersion = -2; + } + + // If the widget was removed from the tree while the asynchronous platform + // message was in flight, we want to discard the reply rather than calling + // setState to update our non-existent appearance. + if (!mounted) return; + + setState(() { + _platformVersion = platformVersion; + }); + } + + @override + Widget build(BuildContext context) { + return MaterialApp( + home: Scaffold( + appBar: AppBar( + title: const Text('Plugin example app'), + ), + body: Center( + child: Text('Running on: $_platformVersion\n'), + ), + ), + ); + } +} diff --git a/packages/shared_preferences/example/pubspec.lock b/packages/shared_preferences/shared_preferences_aurora/example/pubspec.lock similarity index 98% rename from packages/shared_preferences/example/pubspec.lock rename to packages/shared_preferences/shared_preferences_aurora/example/pubspec.lock index 708ef84..b3d3936 100644 --- a/packages/shared_preferences/example/pubspec.lock +++ b/packages/shared_preferences/shared_preferences_aurora/example/pubspec.lock @@ -109,7 +109,7 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "2.1.4" - shared_preferences: + shared_preferences_aurora: dependency: "direct main" description: path: ".." @@ -172,4 +172,4 @@ packages: version: "2.1.2" sdks: dart: ">=2.18.6 <3.0.0" - flutter: ">=2.11.0" + flutter: ">=2.5.0" diff --git a/packages/shared_preferences/example/pubspec.yaml b/packages/shared_preferences/shared_preferences_aurora/example/pubspec.yaml similarity index 73% rename from packages/shared_preferences/example/pubspec.yaml rename to packages/shared_preferences/shared_preferences_aurora/example/pubspec.yaml index b81209b..ceb093e 100644 --- a/packages/shared_preferences/example/pubspec.yaml +++ b/packages/shared_preferences/shared_preferences_aurora/example/pubspec.yaml @@ -1,24 +1,10 @@ -name: shared_preferences_example -description: Demonstrates how to use the shared_preferences plugin. +name: shared_preferences_aurora_example +description: Demonstrates how to use the shared_preferences_aurora plugin. # The following line prevents the package from being accidentally published to # pub.dev using `flutter pub publish`. This is preferred for private packages. publish_to: 'none' # Remove this line if you wish to publish to pub.dev -# The following defines the version and build number for your application. -# A version number is three numbers separated by dots, like 1.2.43 -# followed by an optional build number separated by a +. -# Both the version and the builder number may be overridden in flutter -# build by specifying --build-name and --build-number, respectively. -# In Android, build-name is used as versionName while build-number used as versionCode. -# Read more about Android versioning at https://developer.android.com/studio/publish/versioning -# In iOS, build-name is used as CFBundleShortVersionString while build-number is used as CFBundleVersion. -# Read more about iOS versioning at -# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html -# In Windows, build-name is used as the major, minor, and patch parts -# of the product and file versions while build-number is used as the build suffix. -version: 1.0.0+1 - environment: sdk: '>=2.18.6 <3.0.0' @@ -32,9 +18,9 @@ dependencies: flutter: sdk: flutter - shared_preferences: + shared_preferences_aurora: # When depending on this package from a real application you should use: - # shared_preferences: ^x.y.z + # shared_preferences_aurora: ^x.y.z # See https://dart.dev/tools/pub/dependencies#version-constraints # The example app is bundled with the plugin so we use a path dependency on # the parent directory to use the current plugin's version. diff --git a/packages/shared_preferences/shared_preferences_aurora/example/test/widget_test.dart b/packages/shared_preferences/shared_preferences_aurora/example/test/widget_test.dart new file mode 100644 index 0000000..2fc5cb7 --- /dev/null +++ b/packages/shared_preferences/shared_preferences_aurora/example/test/widget_test.dart @@ -0,0 +1,27 @@ +// This is a basic Flutter widget test. +// +// To perform an interaction with a widget in your test, use the WidgetTester +// utility in the flutter_test package. For example, you can send tap and scroll +// gestures. You can also use WidgetTester to find child widgets in the widget +// tree, read text, and verify that the values of widget properties are correct. + +import 'package:flutter/material.dart'; +import 'package:flutter_test/flutter_test.dart'; + +import 'package:shared_preferences_aurora_example/main.dart'; + +void main() { + testWidgets('Verify Platform version', (WidgetTester tester) async { + // Build our app and trigger a frame. + await tester.pumpWidget(const MyApp()); + + // Verify that platform version is retrieved. + expect( + find.byWidgetPredicate( + (Widget widget) => widget is Text && + widget.data!.startsWith('Running on:'), + ), + findsOneWidget, + ); + }); +} diff --git a/packages/shared_preferences/shared_preferences_aurora/lib/shared_preferences_aurora.dart b/packages/shared_preferences/shared_preferences_aurora/lib/shared_preferences_aurora.dart new file mode 100644 index 0000000..b91e61d --- /dev/null +++ b/packages/shared_preferences/shared_preferences_aurora/lib/shared_preferences_aurora.dart @@ -0,0 +1,11 @@ +import 'shared_preferences_aurora_platform_interface.dart'; + +class SharedPreferencesAurora { + Future getInt(String key, int value) { + return SharedPreferencesAuroraPlatform.instance.getInt(key, value); + } + + Future setInt(String key, int value) { + return SharedPreferencesAuroraPlatform.instance.setInt(key, value); + } +} diff --git a/packages/shared_preferences/shared_preferences_aurora/lib/shared_preferences_aurora_method_channel.dart b/packages/shared_preferences/shared_preferences_aurora/lib/shared_preferences_aurora_method_channel.dart new file mode 100644 index 0000000..d2d25fe --- /dev/null +++ b/packages/shared_preferences/shared_preferences_aurora/lib/shared_preferences_aurora_method_channel.dart @@ -0,0 +1,30 @@ +import 'package:flutter/foundation.dart'; +import 'package:flutter/services.dart'; + +import 'shared_preferences_aurora_platform_interface.dart'; + +/// An implementation of [SharedPreferencesAuroraPlatform] that uses method channels. +class MethodChannelSharedPreferencesAurora + extends SharedPreferencesAuroraPlatform { + /// The method channel used to interact with the native platform. + @visibleForTesting + final methodChannel = const MethodChannel('shared_preferences_aurora'); + + @override + Future getInt(String key, int value) async { + final result = await methodChannel.invokeMethod('getInt', { + 'key': key, + 'value': value, + }); + return result ?? value; + } + + @override + Future setInt(String key, int value) async { + return await methodChannel.invokeMethod('setInt', { + 'key': key, + 'value': value, + }) ?? + false; + } +} diff --git a/packages/shared_preferences/shared_preferences_aurora/lib/shared_preferences_aurora_platform_interface.dart b/packages/shared_preferences/shared_preferences_aurora/lib/shared_preferences_aurora_platform_interface.dart new file mode 100644 index 0000000..d0e0450 --- /dev/null +++ b/packages/shared_preferences/shared_preferences_aurora/lib/shared_preferences_aurora_platform_interface.dart @@ -0,0 +1,34 @@ +import 'package:plugin_platform_interface/plugin_platform_interface.dart'; + +import 'shared_preferences_aurora_method_channel.dart'; + +abstract class SharedPreferencesAuroraPlatform extends PlatformInterface { + /// Constructs a SharedPreferencesAuroraPlatform. + SharedPreferencesAuroraPlatform() : super(token: _token); + + static final Object _token = Object(); + + static SharedPreferencesAuroraPlatform _instance = + MethodChannelSharedPreferencesAurora(); + + /// The default instance of [SharedPreferencesAuroraPlatform] to use. + /// + /// Defaults to [MethodChannelSharedPreferencesAurora]. + static SharedPreferencesAuroraPlatform get instance => _instance; + + /// Platform-specific implementations should set this with their own + /// platform-specific class that extends [SharedPreferencesAuroraPlatform] when + /// they register themselves. + static set instance(SharedPreferencesAuroraPlatform instance) { + PlatformInterface.verifyToken(instance, _token); + _instance = instance; + } + + Future getInt(String key, int value) { + throw UnimplementedError('getInt() has not been implemented.'); + } + + Future setInt(String key, int value) { + throw UnimplementedError('setInt() has not been implemented.'); + } +} diff --git a/packages/shared_preferences/pubspec.yaml b/packages/shared_preferences/shared_preferences_aurora/pubspec.yaml similarity index 91% rename from packages/shared_preferences/pubspec.yaml rename to packages/shared_preferences/shared_preferences_aurora/pubspec.yaml index f68b559..af18dbb 100644 --- a/packages/shared_preferences/pubspec.yaml +++ b/packages/shared_preferences/shared_preferences_aurora/pubspec.yaml @@ -1,11 +1,11 @@ -name: shared_preferences -description: A new Flutter FFI plugin project. +name: shared_preferences_aurora +description: A new Flutter plugin project. version: 0.0.1 homepage: environment: sdk: '>=2.18.6 <3.0.0' - flutter: ">=2.11.0" + flutter: ">=2.5.0" dependencies: flutter: @@ -13,8 +13,6 @@ dependencies: plugin_platform_interface: ^2.0.2 dev_dependencies: - ffi: ^1.2.1 - ffigen: ^5.0.1 flutter_test: sdk: flutter flutter_lints: ^2.0.0 @@ -34,12 +32,10 @@ flutter: # This is required for using `dart:ffi`. # All these are used by the tooling to maintain consistency when # adding or updating assets for this project. - # - # Please refer to README.md for a detailed explanation. plugin: platforms: aurora: - ffiPlugin: true + pluginClass: SharedPreferencesAuroraPlugin # To add assets to your plugin package, add an assets section, like this: # assets: diff --git a/packages/shared_preferences/shared_preferences_aurora/test/shared_preferences_aurora_method_channel_test.dart b/packages/shared_preferences/shared_preferences_aurora/test/shared_preferences_aurora_method_channel_test.dart new file mode 100644 index 0000000..391c42f --- /dev/null +++ b/packages/shared_preferences/shared_preferences_aurora/test/shared_preferences_aurora_method_channel_test.dart @@ -0,0 +1,24 @@ +import 'package:flutter/services.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:shared_preferences_aurora/shared_preferences_aurora_method_channel.dart'; + +void main() { + MethodChannelSharedPreferencesAurora platform = MethodChannelSharedPreferencesAurora(); + const MethodChannel channel = MethodChannel('shared_preferences_aurora'); + + TestWidgetsFlutterBinding.ensureInitialized(); + + setUp(() { + channel.setMockMethodCallHandler((MethodCall methodCall) async { + return '42'; + }); + }); + + tearDown(() { + channel.setMockMethodCallHandler(null); + }); + + test('getPlatformVersion', () async { + expect(await platform.getPlatformVersion(), '42'); + }); +} diff --git a/packages/shared_preferences/shared_preferences_aurora/test/shared_preferences_aurora_test.dart b/packages/shared_preferences/shared_preferences_aurora/test/shared_preferences_aurora_test.dart new file mode 100644 index 0000000..bae150b --- /dev/null +++ b/packages/shared_preferences/shared_preferences_aurora/test/shared_preferences_aurora_test.dart @@ -0,0 +1,29 @@ +import 'package:flutter_test/flutter_test.dart'; +import 'package:shared_preferences_aurora/shared_preferences_aurora.dart'; +import 'package:shared_preferences_aurora/shared_preferences_aurora_platform_interface.dart'; +import 'package:shared_preferences_aurora/shared_preferences_aurora_method_channel.dart'; +import 'package:plugin_platform_interface/plugin_platform_interface.dart'; + +class MockSharedPreferencesAuroraPlatform + with MockPlatformInterfaceMixin + implements SharedPreferencesAuroraPlatform { + + @override + Future getPlatformVersion() => Future.value('42'); +} + +void main() { + final SharedPreferencesAuroraPlatform initialPlatform = SharedPreferencesAuroraPlatform.instance; + + test('$MethodChannelSharedPreferencesAurora is the default instance', () { + expect(initialPlatform, isInstanceOf()); + }); + + test('getPlatformVersion', () async { + SharedPreferencesAurora sharedPreferencesAuroraPlugin = SharedPreferencesAurora(); + MockSharedPreferencesAuroraPlatform fakePlatform = MockSharedPreferencesAuroraPlatform(); + SharedPreferencesAuroraPlatform.instance = fakePlatform; + + expect(await sharedPreferencesAuroraPlugin.getPlatformVersion(), '42'); + }); +} diff --git a/packages/shared_preferences/src/CMakeLists.txt b/packages/shared_preferences/src/CMakeLists.txt deleted file mode 100644 index e5ea665..0000000 --- a/packages/shared_preferences/src/CMakeLists.txt +++ /dev/null @@ -1,17 +0,0 @@ -# The Flutter tooling requires that developers have CMake 3.10 or later -# installed. You should not increase this version, as doing so will cause -# the plugin to fail to compile for some customers of the plugin. -cmake_minimum_required(VERSION 3.10) - -project(shared_preferences_library VERSION 0.0.1 LANGUAGES C) - -add_library(shared_preferences SHARED - "shared_preferences.c" -) - -set_target_properties(shared_preferences PROPERTIES - PUBLIC_HEADER shared_preferences.h - OUTPUT_NAME "shared_preferences" -) - -target_compile_definitions(shared_preferences PUBLIC DART_SHARED_LIB) diff --git a/packages/shared_preferences/src/shared_preferences.c b/packages/shared_preferences/src/shared_preferences.c deleted file mode 100644 index ca9b678..0000000 --- a/packages/shared_preferences/src/shared_preferences.c +++ /dev/null @@ -1,23 +0,0 @@ -#include "shared_preferences.h" - -// A very short-lived native function. -// -// For very short-lived functions, it is fine to call them on the main isolate. -// They will block the Dart execution while running the native function, so -// only do this for native functions which are guaranteed to be short-lived. -FFI_PLUGIN_EXPORT intptr_t sum(intptr_t a, intptr_t b) { return a + b; } - -// A longer-lived native function, which occupies the thread calling it. -// -// Do not call these kind of native functions in the main isolate. They will -// block Dart execution. This will cause dropped frames in Flutter applications. -// Instead, call these native functions on a separate isolate. -FFI_PLUGIN_EXPORT intptr_t sum_long_running(intptr_t a, intptr_t b) { - // Simulate work. -#if _WIN32 - Sleep(5000); -#else - usleep(5000 * 1000); -#endif - return a + b; -} diff --git a/packages/shared_preferences/src/shared_preferences.h b/packages/shared_preferences/src/shared_preferences.h deleted file mode 100644 index 084c642..0000000 --- a/packages/shared_preferences/src/shared_preferences.h +++ /dev/null @@ -1,30 +0,0 @@ -#include -#include -#include - -#if _WIN32 -#include -#else -#include -#include -#endif - -#if _WIN32 -#define FFI_PLUGIN_EXPORT __declspec(dllexport) -#else -#define FFI_PLUGIN_EXPORT -#endif - -// A very short-lived native function. -// -// For very short-lived functions, it is fine to call them on the main isolate. -// They will block the Dart execution while running the native function, so -// only do this for native functions which are guaranteed to be short-lived. -FFI_PLUGIN_EXPORT intptr_t sum(intptr_t a, intptr_t b); - -// A longer lived native function, which occupies the thread calling it. -// -// Do not call these kind of native functions in the main isolate. They will -// block Dart execution. This will cause dropped frames in Flutter applications. -// Instead, call these native functions on a separate isolate. -FFI_PLUGIN_EXPORT intptr_t sum_long_running(intptr_t a, intptr_t b); diff --git a/packages/xdga_directories/ffigen.yaml b/packages/xdga_directories/ffigen.yaml index fcd032d..f04a98e 100644 --- a/packages/xdga_directories/ffigen.yaml +++ b/packages/xdga_directories/ffigen.yaml @@ -2,6 +2,7 @@ name: XdgaDirectoriesBindings llvm-path: - '/usr/lib/llvm-14/lib/libclang.so' # Ubuntu 22.04 + - '/usr/lib/llvm-15/lib/libclang.so' # Ubuntu 23.04 description: | Bindings for `src/xdga_directories.h`. diff --git a/script/build_example.sh b/script/build_example.sh index 286104c..48c04a4 100755 --- a/script/build_example.sh +++ b/script/build_example.sh @@ -43,7 +43,11 @@ else ## Open example dir cd "example" || exit ## Build aurora example app - $FLATTER build aurora --release + { + $FLATTER build aurora --release + } || { + exit 1; + } fi if [ -n "$sign" ]; then @@ -72,9 +76,11 @@ fi if [ -n "$device" ]; then IFS=':' read -ra ADDR <<< "$device" + IFS='/' read -ra ADDP <<< "$package" D_IP="${ADDR[0]}" D_PASS="${ADDR[1]}" + APP_KEY="${ADDP[-1]}" # shellcheck disable=SC2012 rpm=$(ls "$PWD"/build/aurora/arm/release/RPMS/*.rpm | sort -r | head -n 1) @@ -83,8 +89,8 @@ if [ -n "$device" ]; then scp "$rpm" defaultuser@"$D_IP:/home/defaultuser/Downloads" # install rpm - ssh -t defaultuser@$D_IP "echo $D_PASS | devel-su pkcon -y install-local /home/defaultuser/Downloads/*$package*.rpm" + ssh -t defaultuser@$D_IP "echo $D_PASS | devel-su pkcon -y install-local /home/defaultuser/Downloads/*$APP_KEY*.rpm" # run application - ssh -t defaultuser@$D_IP "/usr/bin/com.example.${package}_example" + ssh -t defaultuser@$D_IP "/usr/bin/com.example.${APP_KEY}_example" fi \ No newline at end of file