11 changed files with 370 additions and 270 deletions
@ -1,26 +0,0 @@
|
||||
# Copyright (c) 2023. Open Mobile Platform LLC. |
||||
# License: Proprietary. |
||||
|
||||
cmake_minimum_required(VERSION 3.10) |
||||
|
||||
set(PROJECT_NAME path_provider_aurora) |
||||
set(PLUGIN_NAME path_provider_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 path_provider_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) |
@ -1,28 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2023. Open Mobile Platform LLC. |
||||
* License: Proprietary. |
||||
*/ |
||||
#ifndef FLUTTER_PLUGIN_PATH_PROVIDER_AURORA_PLUGIN_H |
||||
#define FLUTTER_PLUGIN_PATH_PROVIDER_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 PathProviderAuroraPlugin 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_PATH_PROVIDER_AURORA_PLUGIN_H */ |
@ -1,47 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2023. Open Mobile Platform LLC. |
||||
* License: Proprietary. |
||||
*/ |
||||
#include <path_provider_aurora/path_provider_aurora_plugin.h> |
||||
#include <flutter/method-channel.h> |
||||
#include <flutter/application.h> |
||||
#include <sys/utsname.h> |
||||
|
||||
void PathProviderAuroraPlugin::RegisterWithRegistrar(PluginRegistrar ®istrar) |
||||
{ |
||||
registrar.RegisterMethodChannel("path_provider_aurora", |
||||
MethodCodecType::Standard, |
||||
[this](const MethodCall &call) { this->onMethodCall(call); }); |
||||
} |
||||
|
||||
void PathProviderAuroraPlugin::onMethodCall(const MethodCall &call) |
||||
{ |
||||
const auto &method = call.GetMethod(); |
||||
|
||||
if (method == "getApplicationOrg") { |
||||
onGetApplicationOrg(call); |
||||
return; |
||||
} |
||||
|
||||
if (method == "getApplicationName") { |
||||
onGetApplicationName(call); |
||||
return; |
||||
} |
||||
|
||||
unimplemented(call); |
||||
} |
||||
|
||||
void PathProviderAuroraPlugin::onGetApplicationOrg(const MethodCall &call) |
||||
{ |
||||
call.SendSuccessResponse(Application::GetID().orgname); |
||||
} |
||||
|
||||
void PathProviderAuroraPlugin::onGetApplicationName(const MethodCall &call) |
||||
{ |
||||
call.SendSuccessResponse(Application::GetID().appname); |
||||
} |
||||
|
||||
void PathProviderAuroraPlugin::unimplemented(const MethodCall &call) |
||||
{ |
||||
call.SendSuccessResponse(nullptr); |
||||
} |
@ -0,0 +1,324 @@
|
||||
# Generated by pub |
||||
# See https://dart.dev/tools/pub/glossary#lockfile |
||||
packages: |
||||
async: |
||||
dependency: transitive |
||||
description: |
||||
name: async |
||||
url: "https://pub.dartlang.org" |
||||
source: hosted |
||||
version: "2.9.0" |
||||
boolean_selector: |
||||
dependency: transitive |
||||
description: |
||||
name: boolean_selector |
||||
url: "https://pub.dartlang.org" |
||||
source: hosted |
||||
version: "2.1.0" |
||||
characters: |
||||
dependency: transitive |
||||
description: |
||||
name: characters |
||||
url: "https://pub.dartlang.org" |
||||
source: hosted |
||||
version: "1.2.1" |
||||
clock: |
||||
dependency: transitive |
||||
description: |
||||
name: clock |
||||
url: "https://pub.dartlang.org" |
||||
source: hosted |
||||
version: "1.1.1" |
||||
collection: |
||||
dependency: transitive |
||||
description: |
||||
name: collection |
||||
url: "https://pub.dartlang.org" |
||||
source: hosted |
||||
version: "1.16.0" |
||||
cupertino_icons: |
||||
dependency: "direct main" |
||||
description: |
||||
name: cupertino_icons |
||||
url: "https://pub.dartlang.org" |
||||
source: hosted |
||||
version: "1.0.5" |
||||
fake_async: |
||||
dependency: transitive |
||||
description: |
||||
name: fake_async |
||||
url: "https://pub.dartlang.org" |
||||
source: hosted |
||||
version: "1.3.1" |
||||
ffi: |
||||
dependency: transitive |
||||
description: |
||||
name: ffi |
||||
url: "https://pub.dartlang.org" |
||||
source: hosted |
||||
version: "2.0.2" |
||||
file: |
||||
dependency: transitive |
||||
description: |
||||
name: file |
||||
url: "https://pub.dartlang.org" |
||||
source: hosted |
||||
version: "6.1.4" |
||||
flutter: |
||||
dependency: "direct main" |
||||
description: flutter |
||||
source: sdk |
||||
version: "0.0.0" |
||||
flutter_lints: |
||||
dependency: "direct dev" |
||||
description: |
||||
name: flutter_lints |
||||
url: "https://pub.dartlang.org" |
||||
source: hosted |
||||
version: "2.0.1" |
||||
flutter_test: |
||||
dependency: "direct dev" |
||||
description: flutter |
||||
source: sdk |
||||
version: "0.0.0" |
||||
flutter_web_plugins: |
||||
dependency: transitive |
||||
description: flutter |
||||
source: sdk |
||||
version: "0.0.0" |
||||
http: |
||||
dependency: transitive |
||||
description: |
||||
name: http |
||||
url: "https://pub.dartlang.org" |
||||
source: hosted |
||||
version: "0.13.5" |
||||
http_parser: |
||||
dependency: transitive |
||||
description: |
||||
name: http_parser |
||||
url: "https://pub.dartlang.org" |
||||
source: hosted |
||||
version: "4.0.2" |
||||
js: |
||||
dependency: transitive |
||||
description: |
||||
name: js |
||||
url: "https://pub.dartlang.org" |
||||
source: hosted |
||||
version: "0.6.4" |
||||
lints: |
||||
dependency: transitive |
||||
description: |
||||
name: lints |
||||
url: "https://pub.dartlang.org" |
||||
source: hosted |
||||
version: "2.0.1" |
||||
matcher: |
||||
dependency: transitive |
||||
description: |
||||
name: matcher |
||||
url: "https://pub.dartlang.org" |
||||
source: hosted |
||||
version: "0.12.12" |
||||
material_color_utilities: |
||||
dependency: transitive |
||||
description: |
||||
name: material_color_utilities |
||||
url: "https://pub.dartlang.org" |
||||
source: hosted |
||||
version: "0.1.5" |
||||
meta: |
||||
dependency: transitive |
||||
description: |
||||
name: meta |
||||
url: "https://pub.dartlang.org" |
||||
source: hosted |
||||
version: "1.8.0" |
||||
package_info_plus: |
||||
dependency: transitive |
||||
description: |
||||
name: package_info_plus |
||||
url: "https://pub.dartlang.org" |
||||
source: hosted |
||||
version: "4.0.0" |
||||
package_info_plus_aurora: |
||||
dependency: transitive |
||||
description: |
||||
path: "packages/package_info_plus/package_info_plus_aurora" |
||||
ref: dev |
||||
resolved-ref: "47dd76ca473269566811d8c48fbfd22f1d8120f9" |
||||
url: "git@os-git.omprussia.ru:non-oss/flutter/flutter-plugins.git" |
||||
source: git |
||||
version: "0.0.1" |
||||
package_info_plus_platform_interface: |
||||
dependency: transitive |
||||
description: |
||||
name: package_info_plus_platform_interface |
||||
url: "https://pub.dartlang.org" |
||||
source: hosted |
||||
version: "2.0.1" |
||||
path: |
||||
dependency: transitive |
||||
description: |
||||
name: path |
||||
url: "https://pub.dartlang.org" |
||||
source: hosted |
||||
version: "1.8.2" |
||||
path_provider: |
||||
dependency: "direct main" |
||||
description: |
||||
name: path_provider |
||||
url: "https://pub.dartlang.org" |
||||
source: hosted |
||||
version: "2.0.15" |
||||
path_provider_android: |
||||
dependency: transitive |
||||
description: |
||||
name: path_provider_android |
||||
url: "https://pub.dartlang.org" |
||||
source: hosted |
||||
version: "2.0.27" |
||||
path_provider_aurora: |
||||
dependency: "direct main" |
||||
description: |
||||
path: ".." |
||||
relative: true |
||||
source: path |
||||
version: "0.0.1" |
||||
path_provider_foundation: |
||||
dependency: transitive |
||||
description: |
||||
name: path_provider_foundation |
||||
url: "https://pub.dartlang.org" |
||||
source: hosted |
||||
version: "2.2.3" |
||||
path_provider_linux: |
||||
dependency: transitive |
||||
description: |
||||
name: path_provider_linux |
||||
url: "https://pub.dartlang.org" |
||||
source: hosted |
||||
version: "2.1.11" |
||||
path_provider_platform_interface: |
||||
dependency: transitive |
||||
description: |
||||
name: path_provider_platform_interface |
||||
url: "https://pub.dartlang.org" |
||||
source: hosted |
||||
version: "2.0.6" |
||||
path_provider_windows: |
||||
dependency: transitive |
||||
description: |
||||
name: path_provider_windows |
||||
url: "https://pub.dartlang.org" |
||||
source: hosted |
||||
version: "2.1.7" |
||||
platform: |
||||
dependency: transitive |
||||
description: |
||||
name: platform |
||||
url: "https://pub.dartlang.org" |
||||
source: hosted |
||||
version: "3.1.0" |
||||
plugin_platform_interface: |
||||
dependency: transitive |
||||
description: |
||||
name: plugin_platform_interface |
||||
url: "https://pub.dartlang.org" |
||||
source: hosted |
||||
version: "2.1.4" |
||||
process: |
||||
dependency: transitive |
||||
description: |
||||
name: process |
||||
url: "https://pub.dartlang.org" |
||||
source: hosted |
||||
version: "4.2.4" |
||||
sky_engine: |
||||
dependency: transitive |
||||
description: flutter |
||||
source: sdk |
||||
version: "0.0.99" |
||||
source_span: |
||||
dependency: transitive |
||||
description: |
||||
name: source_span |
||||
url: "https://pub.dartlang.org" |
||||
source: hosted |
||||
version: "1.9.0" |
||||
stack_trace: |
||||
dependency: transitive |
||||
description: |
||||
name: stack_trace |
||||
url: "https://pub.dartlang.org" |
||||
source: hosted |
||||
version: "1.10.0" |
||||
stream_channel: |
||||
dependency: transitive |
||||
description: |
||||
name: stream_channel |
||||
url: "https://pub.dartlang.org" |
||||
source: hosted |
||||
version: "2.1.0" |
||||
string_scanner: |
||||
dependency: transitive |
||||
description: |
||||
name: string_scanner |
||||
url: "https://pub.dartlang.org" |
||||
source: hosted |
||||
version: "1.1.1" |
||||
term_glyph: |
||||
dependency: transitive |
||||
description: |
||||
name: term_glyph |
||||
url: "https://pub.dartlang.org" |
||||
source: hosted |
||||
version: "1.2.1" |
||||
test_api: |
||||
dependency: transitive |
||||
description: |
||||
name: test_api |
||||
url: "https://pub.dartlang.org" |
||||
source: hosted |
||||
version: "0.4.12" |
||||
typed_data: |
||||
dependency: transitive |
||||
description: |
||||
name: typed_data |
||||
url: "https://pub.dartlang.org" |
||||
source: hosted |
||||
version: "1.3.2" |
||||
vector_math: |
||||
dependency: transitive |
||||
description: |
||||
name: vector_math |
||||
url: "https://pub.dartlang.org" |
||||
source: hosted |
||||
version: "2.1.2" |
||||
win32: |
||||
dependency: transitive |
||||
description: |
||||
name: win32 |
||||
url: "https://pub.dartlang.org" |
||||
source: hosted |
||||
version: "4.1.4" |
||||
xdg_directories: |
||||
dependency: transitive |
||||
description: |
||||
name: xdg_directories |
||||
url: "https://pub.dartlang.org" |
||||
source: hosted |
||||
version: "1.0.0" |
||||
xdga_directories: |
||||
dependency: transitive |
||||
description: |
||||
path: "packages/xdga_directories" |
||||
ref: dev |
||||
resolved-ref: "47dd76ca473269566811d8c48fbfd22f1d8120f9" |
||||
url: "git@os-git.omprussia.ru:non-oss/flutter/flutter-plugins.git" |
||||
source: git |
||||
version: "0.0.1" |
||||
sdks: |
||||
dart: ">=2.18.6 <3.0.0" |
||||
flutter: ">=3.3.0" |
@ -1,25 +0,0 @@
|
||||
/* |
||||
* Copyright (c) 2023. Open Mobile Platform LLC. |
||||
* License: Proprietary. |
||||
*/ |
||||
import 'package:flutter/foundation.dart'; |
||||
import 'package:flutter/services.dart'; |
||||
|
||||
import 'path_provider_aurora_platform_interface.dart'; |
||||
|
||||
/// An implementation of [PathProviderAuroraPlatform] that uses method channels. |
||||
class MethodChannelPathProviderAurora extends PathProviderAuroraPlatform { |
||||
/// The method channel used to interact with the native platform. |
||||
@visibleForTesting |
||||
final methodChannel = const MethodChannel('path_provider_aurora'); |
||||
|
||||
@override |
||||
Future<String?> getApplicationOrg() async { |
||||
return await methodChannel.invokeMethod<String>('getApplicationOrg'); |
||||
} |
||||
|
||||
@override |
||||
Future<String?> getApplicationName() async { |
||||
return await methodChannel.invokeMethod<String>('getApplicationName'); |
||||
} |
||||
} |
@ -1,37 +0,0 @@
|
||||
/* |
||||
* Copyright (c) 2023. Open Mobile Platform LLC. |
||||
* License: Proprietary. |
||||
*/ |
||||
import 'package:plugin_platform_interface/plugin_platform_interface.dart'; |
||||
|
||||
import 'path_provider_aurora_method_channel.dart'; |
||||
|
||||
abstract class PathProviderAuroraPlatform extends PlatformInterface { |
||||
/// Constructs a PathProviderAuroraPlatform. |
||||
PathProviderAuroraPlatform() : super(token: _token); |
||||
|
||||
static final Object _token = Object(); |
||||
|
||||
static PathProviderAuroraPlatform _instance = MethodChannelPathProviderAurora(); |
||||
|
||||
/// The default instance of [PathProviderAuroraPlatform] to use. |
||||
/// |
||||
/// Defaults to [MethodChannelPathProviderAurora]. |
||||
static PathProviderAuroraPlatform get instance => _instance; |
||||
|
||||
/// Platform-specific implementations should set this with their own |
||||
/// platform-specific class that extends [PathProviderAuroraPlatform] when |
||||
/// they register themselves. |
||||
static set instance(PathProviderAuroraPlatform 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.'); |
||||
} |
||||
} |
@ -1,38 +0,0 @@
|
||||
/* |
||||
* Copyright (c) 2023. Open Mobile Platform LLC. |
||||
* License: Proprietary. |
||||
*/ |
||||
import 'package:flutter/services.dart'; |
||||
import 'package:flutter_test/flutter_test.dart'; |
||||
import 'package:path_provider_aurora/path_provider_aurora_method_channel.dart'; |
||||
|
||||
void main() { |
||||
MethodChannelPathProviderAurora platform = MethodChannelPathProviderAurora(); |
||||
const MethodChannel channel = MethodChannel('path_provider_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