@ -0,0 +1,52 @@ |
|||||||
|
# Miscellaneous |
||||||
|
*.class |
||||||
|
*.log |
||||||
|
*.pyc |
||||||
|
*.swp |
||||||
|
.DS_Store |
||||||
|
.atom/ |
||||||
|
.buildlog/ |
||||||
|
.history |
||||||
|
.svn/ |
||||||
|
|
||||||
|
# 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/ |
||||||
|
|
||||||
|
# Web related |
||||||
|
lib/generated_plugin_registrant.dart |
||||||
|
|
||||||
|
# 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 |
||||||
|
/android/app/src/main/jniLibs |
||||||
|
|
||||||
|
/target |
||||||
|
/Cargo.lock |
||||||
|
/.tdn |
||||||
|
/demo |
@ -0,0 +1,10 @@ |
|||||||
|
# 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 and should not be manually edited. |
||||||
|
|
||||||
|
version: |
||||||
|
revision: 8f5d0371afeffa533e4efcbaf7f2394af4811af9 |
||||||
|
channel: master |
||||||
|
|
||||||
|
project_type: app |
@ -0,0 +1,42 @@ |
|||||||
|
[package] |
||||||
|
name = "esse" |
||||||
|
version = "0.1.0" |
||||||
|
authors = ["CympleTech <contact@cympletech.com>"] |
||||||
|
edition = "2018" |
||||||
|
license = "MIT/Apache-2.0" |
||||||
|
|
||||||
|
[lib] |
||||||
|
name = "esse" |
||||||
|
crate-type = ["cdylib", "staticlib"] |
||||||
|
|
||||||
|
[[bin]] |
||||||
|
name = "esse" |
||||||
|
path = "src/daemon.rs" |
||||||
|
|
||||||
|
[profile.release] |
||||||
|
opt-level = 's' |
||||||
|
lto = true |
||||||
|
codegen-units = 1 |
||||||
|
panic = 'abort' |
||||||
|
|
||||||
|
[dependencies] |
||||||
|
log = "0.4" |
||||||
|
rand = "0.7" |
||||||
|
simplelog = "0.8" |
||||||
|
image = "0.23" |
||||||
|
base64 = "0.13" |
||||||
|
sha2 = "0.9" |
||||||
|
blake3 = "0.3" |
||||||
|
aes-gcm = "0.8" |
||||||
|
async-lock = "2.3" |
||||||
|
async-channel = "1.4" |
||||||
|
async-fs = "1.5" |
||||||
|
serde = { version = "1", features = ["derive"] } |
||||||
|
postcard = { version = "0.5", default-features = false, features = ["alloc"] } |
||||||
|
sysinfo = "0.16" |
||||||
|
tdn = { git = "https://github.com/cypherlink/TDN", branch="main", default-features = false, features = ["full"] } |
||||||
|
tdn-did = { git = "https://github.com/cypherlink/tdn-did", branch="main" } |
||||||
|
tdn-storage = { git = "https://github.com/cypherlink/tdn-storage", branch="main" } |
||||||
|
|
||||||
|
[target.'cfg(target_os="android")'.dependencies] |
||||||
|
jni = { version = "0.19", default-features = false } |
@ -0,0 +1,201 @@ |
|||||||
|
Apache License |
||||||
|
Version 2.0, January 2004 |
||||||
|
http://www.apache.org/licenses/ |
||||||
|
|
||||||
|
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION |
||||||
|
|
||||||
|
1. Definitions. |
||||||
|
|
||||||
|
"License" shall mean the terms and conditions for use, reproduction, |
||||||
|
and distribution as defined by Sections 1 through 9 of this document. |
||||||
|
|
||||||
|
"Licensor" shall mean the copyright owner or entity authorized by |
||||||
|
the copyright owner that is granting the License. |
||||||
|
|
||||||
|
"Legal Entity" shall mean the union of the acting entity and all |
||||||
|
other entities that control, are controlled by, or are under common |
||||||
|
control with that entity. For the purposes of this definition, |
||||||
|
"control" means (i) the power, direct or indirect, to cause the |
||||||
|
direction or management of such entity, whether by contract or |
||||||
|
otherwise, or (ii) ownership of fifty percent (50%) or more of the |
||||||
|
outstanding shares, or (iii) beneficial ownership of such entity. |
||||||
|
|
||||||
|
"You" (or "Your") shall mean an individual or Legal Entity |
||||||
|
exercising permissions granted by this License. |
||||||
|
|
||||||
|
"Source" form shall mean the preferred form for making modifications, |
||||||
|
including but not limited to software source code, documentation |
||||||
|
source, and configuration files. |
||||||
|
|
||||||
|
"Object" form shall mean any form resulting from mechanical |
||||||
|
transformation or translation of a Source form, including but |
||||||
|
not limited to compiled object code, generated documentation, |
||||||
|
and conversions to other media types. |
||||||
|
|
||||||
|
"Work" shall mean the work of authorship, whether in Source or |
||||||
|
Object form, made available under the License, as indicated by a |
||||||
|
copyright notice that is included in or attached to the work |
||||||
|
(an example is provided in the Appendix below). |
||||||
|
|
||||||
|
"Derivative Works" shall mean any work, whether in Source or Object |
||||||
|
form, that is based on (or derived from) the Work and for which the |
||||||
|
editorial revisions, annotations, elaborations, or other modifications |
||||||
|
represent, as a whole, an original work of authorship. For the purposes |
||||||
|
of this License, Derivative Works shall not include works that remain |
||||||
|
separable from, or merely link (or bind by name) to the interfaces of, |
||||||
|
the Work and Derivative Works thereof. |
||||||
|
|
||||||
|
"Contribution" shall mean any work of authorship, including |
||||||
|
the original version of the Work and any modifications or additions |
||||||
|
to that Work or Derivative Works thereof, that is intentionally |
||||||
|
submitted to Licensor for inclusion in the Work by the copyright owner |
||||||
|
or by an individual or Legal Entity authorized to submit on behalf of |
||||||
|
the copyright owner. For the purposes of this definition, "submitted" |
||||||
|
means any form of electronic, verbal, or written communication sent |
||||||
|
to the Licensor or its representatives, including but not limited to |
||||||
|
communication on electronic mailing lists, source code control systems, |
||||||
|
and issue tracking systems that are managed by, or on behalf of, the |
||||||
|
Licensor for the purpose of discussing and improving the Work, but |
||||||
|
excluding communication that is conspicuously marked or otherwise |
||||||
|
designated in writing by the copyright owner as "Not a Contribution." |
||||||
|
|
||||||
|
"Contributor" shall mean Licensor and any individual or Legal Entity |
||||||
|
on behalf of whom a Contribution has been received by Licensor and |
||||||
|
subsequently incorporated within the Work. |
||||||
|
|
||||||
|
2. Grant of Copyright License. Subject to the terms and conditions of |
||||||
|
this License, each Contributor hereby grants to You a perpetual, |
||||||
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable |
||||||
|
copyright license to reproduce, prepare Derivative Works of, |
||||||
|
publicly display, publicly perform, sublicense, and distribute the |
||||||
|
Work and such Derivative Works in Source or Object form. |
||||||
|
|
||||||
|
3. Grant of Patent License. Subject to the terms and conditions of |
||||||
|
this License, each Contributor hereby grants to You a perpetual, |
||||||
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable |
||||||
|
(except as stated in this section) patent license to make, have made, |
||||||
|
use, offer to sell, sell, import, and otherwise transfer the Work, |
||||||
|
where such license applies only to those patent claims licensable |
||||||
|
by such Contributor that are necessarily infringed by their |
||||||
|
Contribution(s) alone or by combination of their Contribution(s) |
||||||
|
with the Work to which such Contribution(s) was submitted. If You |
||||||
|
institute patent litigation against any entity (including a |
||||||
|
cross-claim or counterclaim in a lawsuit) alleging that the Work |
||||||
|
or a Contribution incorporated within the Work constitutes direct |
||||||
|
or contributory patent infringement, then any patent licenses |
||||||
|
granted to You under this License for that Work shall terminate |
||||||
|
as of the date such litigation is filed. |
||||||
|
|
||||||
|
4. Redistribution. You may reproduce and distribute copies of the |
||||||
|
Work or Derivative Works thereof in any medium, with or without |
||||||
|
modifications, and in Source or Object form, provided that You |
||||||
|
meet the following conditions: |
||||||
|
|
||||||
|
(a) You must give any other recipients of the Work or |
||||||
|
Derivative Works a copy of this License; and |
||||||
|
|
||||||
|
(b) You must cause any modified files to carry prominent notices |
||||||
|
stating that You changed the files; and |
||||||
|
|
||||||
|
(c) You must retain, in the Source form of any Derivative Works |
||||||
|
that You distribute, all copyright, patent, trademark, and |
||||||
|
attribution notices from the Source form of the Work, |
||||||
|
excluding those notices that do not pertain to any part of |
||||||
|
the Derivative Works; and |
||||||
|
|
||||||
|
(d) If the Work includes a "NOTICE" text file as part of its |
||||||
|
distribution, then any Derivative Works that You distribute must |
||||||
|
include a readable copy of the attribution notices contained |
||||||
|
within such NOTICE file, excluding those notices that do not |
||||||
|
pertain to any part of the Derivative Works, in at least one |
||||||
|
of the following places: within a NOTICE text file distributed |
||||||
|
as part of the Derivative Works; within the Source form or |
||||||
|
documentation, if provided along with the Derivative Works; or, |
||||||
|
within a display generated by the Derivative Works, if and |
||||||
|
wherever such third-party notices normally appear. The contents |
||||||
|
of the NOTICE file are for informational purposes only and |
||||||
|
do not modify the License. You may add Your own attribution |
||||||
|
notices within Derivative Works that You distribute, alongside |
||||||
|
or as an addendum to the NOTICE text from the Work, provided |
||||||
|
that such additional attribution notices cannot be construed |
||||||
|
as modifying the License. |
||||||
|
|
||||||
|
You may add Your own copyright statement to Your modifications and |
||||||
|
may provide additional or different license terms and conditions |
||||||
|
for use, reproduction, or distribution of Your modifications, or |
||||||
|
for any such Derivative Works as a whole, provided Your use, |
||||||
|
reproduction, and distribution of the Work otherwise complies with |
||||||
|
the conditions stated in this License. |
||||||
|
|
||||||
|
5. Submission of Contributions. Unless You explicitly state otherwise, |
||||||
|
any Contribution intentionally submitted for inclusion in the Work |
||||||
|
by You to the Licensor shall be under the terms and conditions of |
||||||
|
this License, without any additional terms or conditions. |
||||||
|
Notwithstanding the above, nothing herein shall supersede or modify |
||||||
|
the terms of any separate license agreement you may have executed |
||||||
|
with Licensor regarding such Contributions. |
||||||
|
|
||||||
|
6. Trademarks. This License does not grant permission to use the trade |
||||||
|
names, trademarks, service marks, or product names of the Licensor, |
||||||
|
except as required for reasonable and customary use in describing the |
||||||
|
origin of the Work and reproducing the content of the NOTICE file. |
||||||
|
|
||||||
|
7. Disclaimer of Warranty. Unless required by applicable law or |
||||||
|
agreed to in writing, Licensor provides the Work (and each |
||||||
|
Contributor provides its Contributions) on an "AS IS" BASIS, |
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or |
||||||
|
implied, including, without limitation, any warranties or conditions |
||||||
|
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A |
||||||
|
PARTICULAR PURPOSE. You are solely responsible for determining the |
||||||
|
appropriateness of using or redistributing the Work and assume any |
||||||
|
risks associated with Your exercise of permissions under this License. |
||||||
|
|
||||||
|
8. Limitation of Liability. In no event and under no legal theory, |
||||||
|
whether in tort (including negligence), contract, or otherwise, |
||||||
|
unless required by applicable law (such as deliberate and grossly |
||||||
|
negligent acts) or agreed to in writing, shall any Contributor be |
||||||
|
liable to You for damages, including any direct, indirect, special, |
||||||
|
incidental, or consequential damages of any character arising as a |
||||||
|
result of this License or out of the use or inability to use the |
||||||
|
Work (including but not limited to damages for loss of goodwill, |
||||||
|
work stoppage, computer failure or malfunction, or any and all |
||||||
|
other commercial damages or losses), even if such Contributor |
||||||
|
has been advised of the possibility of such damages. |
||||||
|
|
||||||
|
9. Accepting Warranty or Additional Liability. While redistributing |
||||||
|
the Work or Derivative Works thereof, You may choose to offer, |
||||||
|
and charge a fee for, acceptance of support, warranty, indemnity, |
||||||
|
or other liability obligations and/or rights consistent with this |
||||||
|
License. However, in accepting such obligations, You may act only |
||||||
|
on Your own behalf and on Your sole responsibility, not on behalf |
||||||
|
of any other Contributor, and only if You agree to indemnify, |
||||||
|
defend, and hold each Contributor harmless for any liability |
||||||
|
incurred by, or claims asserted against, such Contributor by reason |
||||||
|
of your accepting any such warranty or additional liability. |
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS |
||||||
|
|
||||||
|
APPENDIX: How to apply the Apache License to your work. |
||||||
|
|
||||||
|
To apply the Apache License to your work, attach the following |
||||||
|
boilerplate notice, with the fields enclosed by brackets "{}" |
||||||
|
replaced with your own identifying information. (Don't include |
||||||
|
the brackets!) The text should be enclosed in the appropriate |
||||||
|
comment syntax for the file format. We also recommend that a |
||||||
|
file or class name and description of purpose be included on the |
||||||
|
same "printed page" as the copyright notice for easier |
||||||
|
identification within third-party archives. |
||||||
|
|
||||||
|
Copyright (c) 2021-NOW CympleTech |
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License"); |
||||||
|
you may not use this file except in compliance with the License. |
||||||
|
You may obtain a copy of the License at |
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0 |
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software |
||||||
|
distributed under the License is distributed on an "AS IS" BASIS, |
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||||
|
See the License for the specific language governing permissions and |
||||||
|
limitations under the License. |
@ -0,0 +1,25 @@ |
|||||||
|
Copyright (c) 2021-NOW CympleTech |
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any |
||||||
|
person obtaining a copy of this software and associated |
||||||
|
documentation files (the "Software"), to deal in the |
||||||
|
Software without restriction, including without |
||||||
|
limitation the rights to use, copy, modify, merge, |
||||||
|
publish, distribute, sublicense, and/or sell copies of |
||||||
|
the Software, and to permit persons to whom the Software |
||||||
|
is furnished to do so, subject to the following |
||||||
|
conditions: |
||||||
|
|
||||||
|
The above copyright notice and this permission notice |
||||||
|
shall be included in all copies or substantial portions |
||||||
|
of the Software. |
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF |
||||||
|
ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED |
||||||
|
TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A |
||||||
|
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT |
||||||
|
SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY |
||||||
|
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION |
||||||
|
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR |
||||||
|
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
||||||
|
DEALINGS IN THE SOFTWARE. |
@ -0,0 +1,78 @@ |
|||||||
|
# ESSE |
||||||
|
|
||||||
|
**ESSE** (Encrypted Symmetrical Session Engine) An open source encrypted peer-to-peer session system would allow data to be sent securely from one terminal to another without going through third-party services. |
||||||
|
|
||||||
|
 |
||||||
|
|
||||||
|
ESSE, stands for Encrypted Symmetrical Session Engine, positioned as an engine. The engine is coded in [**Rust**](https://github.com/rust-lang/rust) language and [**TDN**](https://github.com/cypherlink/TDN) framework, and the cross-platform user interface is built using [**Flutter**](https://github.com/flutter/flutter). |
||||||
|
|
||||||
|
## Features |
||||||
|
- Distributed Identity. |
||||||
|
- Distributed Network. |
||||||
|
- Distributed Storage and Synchronize. |
||||||
|
- Multi-identity system. |
||||||
|
- Built-in IM application. |
||||||
|
- Support Android, iOS, MacOS, Windows, Linux. |
||||||
|
|
||||||
|
[Detail (English)](https://github.com/cympletech/ess/wiki/what-is-ESSE) / [详细介绍 (简体中文)](https://github.com/cympletech/ess/wiki/ESSE-是什么) |
||||||
|
|
||||||
|
## Usage |
||||||
|
### 1. Use Binary executable. |
||||||
|
[Download](https://github.com/cympletech/esse/releases) |
||||||
|
|
||||||
|
### 2. Compile |
||||||
|
#### 2.1. pre-installed. |
||||||
|
- Rustup [install](https://rustup.rs/) |
||||||
|
- Rust (Nightly Version) |
||||||
|
- Flutter (Master channel) |
||||||
|
|
||||||
|
You can use [rust.sh](./rust.sh) to auto compile Rust code. |
||||||
|
|
||||||
|
#### 2.2. Compile Rust code to dynamic link library (FFI) |
||||||
|
##### Linux / MacOS / Windows |
||||||
|
- `cargo build --release` |
||||||
|
|
||||||
|
##### Linux |
||||||
|
- `cp target/release/libesse.so core/linux/share/libesse.so` |
||||||
|
|
||||||
|
##### MacOS |
||||||
|
- `cp target/release/libesse.a core/macos/share/libesse.a` |
||||||
|
|
||||||
|
##### Windows |
||||||
|
- `cp target/release/libesse.so core/windows/share/esse.dll` |
||||||
|
|
||||||
|
##### Android |
||||||
|
1. Add your android device target. |
||||||
|
|
||||||
|
- `rustup target add aarch64-linux-android` |
||||||
|
- `rustup target add armv7-linux-androideabi` |
||||||
|
- `rustup target add x86_64-linux-android` |
||||||
|
|
||||||
|
2. Configure your NDK. |
||||||
|
|
||||||
|
3. Build a jniLibs. |
||||||
|
- `cargo build --release --target=aarch64-linux-android` |
||||||
|
- `cp target/aarch64-linux-android/release/libesse.so core/android/src/main/jniLibs/arm64-v8a/` |
||||||
|
|
||||||
|
##### IOS |
||||||
|
1. Install [lipo](https://github.com/TimNN/cargo-lipo) |
||||||
|
2. `cargo lipo --release` |
||||||
|
3. `cp target/universal/release/libesse.a core/ios/share/libesse.a` |
||||||
|
|
||||||
|
#### 2.3. Run flutter to build binary |
||||||
|
- `flutter run` or `flutter run --release` in terminal run. |
||||||
|
- Or Android `flutter build apk` |
||||||
|
- If Linux `flutter build linux` |
||||||
|
- If MacOS `flutter build macos` |
||||||
|
- If Windows `flutter build windows` |
||||||
|
|
||||||
|
## License |
||||||
|
|
||||||
|
This project is licensed under either of |
||||||
|
|
||||||
|
* Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or |
||||||
|
http://www.apache.org/licenses/LICENSE-2.0) |
||||||
|
* MIT license ([LICENSE-MIT](LICENSE-MIT) or |
||||||
|
http://opensource.org/licenses/MIT) |
||||||
|
|
||||||
|
at your option. |
@ -0,0 +1,11 @@ |
|||||||
|
gradle-wrapper.jar |
||||||
|
/.gradle |
||||||
|
/captures/ |
||||||
|
/gradlew |
||||||
|
/gradlew.bat |
||||||
|
/local.properties |
||||||
|
GeneratedPluginRegistrant.java |
||||||
|
|
||||||
|
# Remember to never publicly share your keystore. |
||||||
|
# See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app |
||||||
|
key.properties |
@ -0,0 +1,63 @@ |
|||||||
|
def localProperties = new Properties() |
||||||
|
def localPropertiesFile = rootProject.file('local.properties') |
||||||
|
if (localPropertiesFile.exists()) { |
||||||
|
localPropertiesFile.withReader('UTF-8') { reader -> |
||||||
|
localProperties.load(reader) |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
def flutterRoot = localProperties.getProperty('flutter.sdk') |
||||||
|
if (flutterRoot == null) { |
||||||
|
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") |
||||||
|
} |
||||||
|
|
||||||
|
def flutterVersionCode = localProperties.getProperty('flutter.versionCode') |
||||||
|
if (flutterVersionCode == null) { |
||||||
|
flutterVersionCode = '1' |
||||||
|
} |
||||||
|
|
||||||
|
def flutterVersionName = localProperties.getProperty('flutter.versionName') |
||||||
|
if (flutterVersionName == null) { |
||||||
|
flutterVersionName = '1.0' |
||||||
|
} |
||||||
|
|
||||||
|
apply plugin: 'com.android.application' |
||||||
|
apply plugin: 'kotlin-android' |
||||||
|
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" |
||||||
|
|
||||||
|
android { |
||||||
|
compileSdkVersion 30 |
||||||
|
|
||||||
|
sourceSets { |
||||||
|
main.java.srcDirs += 'src/main/kotlin' |
||||||
|
} |
||||||
|
|
||||||
|
defaultConfig { |
||||||
|
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). |
||||||
|
applicationId "com.cympletech.esse" |
||||||
|
minSdkVersion 21 |
||||||
|
targetSdkVersion 30 |
||||||
|
versionCode flutterVersionCode.toInteger() |
||||||
|
versionName flutterVersionName |
||||||
|
} |
||||||
|
|
||||||
|
buildTypes { |
||||||
|
release { |
||||||
|
// TODO: Add your own signing config for the release build. |
||||||
|
// Signing with the debug keys for now, so `flutter run --release` works. |
||||||
|
signingConfig signingConfigs.debug |
||||||
|
|
||||||
|
shrinkResources false |
||||||
|
minifyEnabled false |
||||||
|
useProguard false |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
flutter { |
||||||
|
source '../..' |
||||||
|
} |
||||||
|
|
||||||
|
dependencies { |
||||||
|
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" |
||||||
|
} |
@ -0,0 +1,9 @@ |
|||||||
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android" |
||||||
|
package="com.cympletech.esse"> |
||||||
|
<!-- Flutter needs it to communicate with the running application |
||||||
|
to allow setting breakpoints, to provide hot reload, etc. |
||||||
|
--> |
||||||
|
<uses-permission android:name="android.permission.INTERNET"/> |
||||||
|
<uses-permission android:name="android.permission.RECORD_AUDIO" /> |
||||||
|
<application android:usesCleartextTraffic="true"></application> |
||||||
|
</manifest> |
@ -0,0 +1,43 @@ |
|||||||
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android" |
||||||
|
package="com.cympletech.esse"> |
||||||
|
<application |
||||||
|
android:label="Esse" |
||||||
|
android:requestLegacyExternalStorage="true" |
||||||
|
android:icon="@mipmap/ic_launcher"> |
||||||
|
<activity |
||||||
|
android:name=".MainActivity" |
||||||
|
android:launchMode="singleTop" |
||||||
|
android:theme="@style/LaunchTheme" |
||||||
|
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode" |
||||||
|
android:hardwareAccelerated="true" |
||||||
|
android:windowSoftInputMode="adjustResize"> |
||||||
|
<!-- Specifies an Android theme to apply to this Activity as soon as |
||||||
|
the Android process has started. This theme is visible to the user |
||||||
|
while the Flutter UI initializes. After that, this theme continues |
||||||
|
to determine the Window background behind the Flutter UI. --> |
||||||
|
<meta-data |
||||||
|
android:name="io.flutter.embedding.android.NormalTheme" |
||||||
|
android:resource="@style/NormalTheme" |
||||||
|
/> |
||||||
|
<!-- Displays an Android View that continues showing the launch screen |
||||||
|
Drawable until Flutter paints its first frame, then this splash |
||||||
|
screen fades out. A splash screen is useful to avoid any visual |
||||||
|
gap between the end of Android's launch screen and the painting of |
||||||
|
Flutter's first frame. --> |
||||||
|
<meta-data |
||||||
|
android:name="io.flutter.embedding.android.SplashScreenDrawable" |
||||||
|
android:resource="@drawable/launch_background" |
||||||
|
/> |
||||||
|
<intent-filter> |
||||||
|
<action android:name="android.intent.action.MAIN"/> |
||||||
|
<category android:name="android.intent.category.LAUNCHER"/> |
||||||
|
</intent-filter> |
||||||
|
</activity> |
||||||
|
<!-- Don't delete the meta-data below. |
||||||
|
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java --> |
||||||
|
<meta-data |
||||||
|
android:name="flutterEmbedding" |
||||||
|
android:value="2" /> |
||||||
|
</application> |
||||||
|
<uses-permission android:name="android.permission.INTERNET"/> |
||||||
|
</manifest> |
@ -0,0 +1,6 @@ |
|||||||
|
package com.cympletech.esse |
||||||
|
|
||||||
|
import io.flutter.embedding.android.FlutterActivity |
||||||
|
|
||||||
|
class MainActivity: FlutterActivity() { |
||||||
|
} |
@ -0,0 +1,12 @@ |
|||||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||||
|
<!-- Modify this file to customize your launch splash screen --> |
||||||
|
<layer-list xmlns:android="http://schemas.android.com/apk/res/android"> |
||||||
|
<item android:drawable="?android:colorBackground" /> |
||||||
|
|
||||||
|
<!-- You can insert your own image assets here --> |
||||||
|
<!-- <item> |
||||||
|
<bitmap |
||||||
|
android:gravity="center" |
||||||
|
android:src="@mipmap/launch_image" /> |
||||||
|
</item> --> |
||||||
|
</layer-list> |
@ -0,0 +1,12 @@ |
|||||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||||
|
<!-- Modify this file to customize your launch splash screen --> |
||||||
|
<layer-list xmlns:android="http://schemas.android.com/apk/res/android"> |
||||||
|
<item android:drawable="@android:color/white" /> |
||||||
|
|
||||||
|
<!-- You can insert your own image assets here --> |
||||||
|
<!-- <item> |
||||||
|
<bitmap |
||||||
|
android:gravity="center" |
||||||
|
android:src="@mipmap/launch_image" /> |
||||||
|
</item> --> |
||||||
|
</layer-list> |
After Width: | Height: | Size: 2.1 KiB |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 2.8 KiB |
After Width: | Height: | Size: 4.5 KiB |
After Width: | Height: | Size: 6.9 KiB |
@ -0,0 +1,18 @@ |
|||||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||||
|
<resources> |
||||||
|
<!-- Theme applied to the Android Window while the process is starting when the OS's Dark Mode setting is on --> |
||||||
|
<style name="LaunchTheme" parent="@android:style/Theme.Black.NoTitleBar"> |
||||||
|
<!-- Show a splash screen on the activity. Automatically removed when |
||||||
|
Flutter draws its first frame --> |
||||||
|
<item name="android:windowBackground">@drawable/launch_background</item> |
||||||
|
</style> |
||||||
|
<!-- Theme applied to the Android Window as soon as the process has started. |
||||||
|
This theme determines the color of the Android Window while your |
||||||
|
Flutter UI initializes, as well as behind your Flutter UI while its |
||||||
|
running. |
||||||
|
|
||||||
|
This Theme is only used starting with V2 of Flutter's Android embedding. --> |
||||||
|
<style name="NormalTheme" parent="@android:style/Theme.Black.NoTitleBar"> |
||||||
|
<item name="android:windowBackground">?android:colorBackground</item> |
||||||
|
</style> |
||||||
|
</resources> |
@ -0,0 +1,18 @@ |
|||||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||||
|
<resources> |
||||||
|
<!-- Theme applied to the Android Window while the process is starting when the OS's Dark Mode setting is off --> |
||||||
|
<style name="LaunchTheme" parent="@android:style/Theme.Light.NoTitleBar"> |
||||||
|
<!-- Show a splash screen on the activity. Automatically removed when |
||||||
|
Flutter draws its first frame --> |
||||||
|
<item name="android:windowBackground">@drawable/launch_background</item> |
||||||
|
</style> |
||||||
|
<!-- Theme applied to the Android Window as soon as the process has started. |
||||||
|
This theme determines the color of the Android Window while your |
||||||
|
Flutter UI initializes, as well as behind your Flutter UI while its |
||||||
|
running. |
||||||
|
|
||||||
|
This Theme is only used starting with V2 of Flutter's Android embedding. --> |
||||||
|
<style name="NormalTheme" parent="@android:style/Theme.Light.NoTitleBar"> |
||||||
|
<item name="android:windowBackground">?android:colorBackground</item> |
||||||
|
</style> |
||||||
|
</resources> |
@ -0,0 +1,7 @@ |
|||||||
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android" |
||||||
|
package="com.cympletech.esse"> |
||||||
|
<!-- Flutter needs it to communicate with the running application |
||||||
|
to allow setting breakpoints, to provide hot reload, etc. |
||||||
|
--> |
||||||
|
<uses-permission android:name="android.permission.RECORD_AUDIO" /> |
||||||
|
</manifest> |
@ -0,0 +1,31 @@ |
|||||||
|
buildscript { |
||||||
|
ext.kotlin_version = '1.3.50' |
||||||
|
repositories { |
||||||
|
google() |
||||||
|
jcenter() |
||||||
|
} |
||||||
|
|
||||||
|
dependencies { |
||||||
|
classpath 'com.android.tools.build:gradle:4.1.0' |
||||||
|
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
allprojects { |
||||||
|
repositories { |
||||||
|
google() |
||||||
|
jcenter() |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
rootProject.buildDir = '../build' |
||||||
|
subprojects { |
||||||
|
project.buildDir = "${rootProject.buildDir}/${project.name}" |
||||||
|
} |
||||||
|
subprojects { |
||||||
|
project.evaluationDependsOn(':app') |
||||||
|
} |
||||||
|
|
||||||
|
task clean(type: Delete) { |
||||||
|
delete rootProject.buildDir |
||||||
|
} |
@ -0,0 +1,3 @@ |
|||||||
|
org.gradle.jvmargs=-Xmx1536M |
||||||
|
android.useAndroidX=true |
||||||
|
android.enableJetifier=true |
@ -0,0 +1,6 @@ |
|||||||
|
#Fri Jun 23 08:50:38 CEST 2017 |
||||||
|
distributionBase=GRADLE_USER_HOME |
||||||
|
distributionPath=wrapper/dists |
||||||
|
zipStoreBase=GRADLE_USER_HOME |
||||||
|
zipStorePath=wrapper/dists |
||||||
|
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip |
@ -0,0 +1,11 @@ |
|||||||
|
include ':app' |
||||||
|
|
||||||
|
def localPropertiesFile = new File(rootProject.projectDir, "local.properties") |
||||||
|
def properties = new Properties() |
||||||
|
|
||||||
|
assert localPropertiesFile.exists() |
||||||
|
localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) } |
||||||
|
|
||||||
|
def flutterSdkPath = properties.getProperty("flutter.sdk") |
||||||
|
assert flutterSdkPath != null, "flutter.sdk not set in local.properties" |
||||||
|
apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle" |
After Width: | Height: | Size: 593 KiB |
After Width: | Height: | Size: 584 KiB |
After Width: | Height: | Size: 5.9 KiB |
After Width: | Height: | Size: 5.2 KiB |
After Width: | Height: | Size: 16 KiB |
After Width: | Height: | Size: 2.7 KiB |
After Width: | Height: | Size: 6.9 KiB |
After Width: | Height: | Size: 7.7 KiB |
After Width: | Height: | Size: 8.4 KiB |
After Width: | Height: | Size: 8.3 KiB |
After Width: | Height: | Size: 10 KiB |
After Width: | Height: | Size: 6.9 KiB |
After Width: | Height: | Size: 19 KiB |
After Width: | Height: | Size: 4.0 KiB |
After Width: | Height: | Size: 10 KiB |
After Width: | Height: | Size: 20 KiB |
After Width: | Height: | Size: 14 KiB |
After Width: | Height: | Size: 10 KiB |
@ -0,0 +1,17 @@ |
|||||||
|
.DS_Store |
||||||
|
.dart_tool/ |
||||||
|
|
||||||
|
.packages |
||||||
|
.pub/ |
||||||
|
|
||||||
|
build/ |
||||||
|
|
||||||
|
linux/share/libesse.so |
||||||
|
macos/share/libesse.a |
||||||
|
windows/share/esse.lib |
||||||
|
windows/share/esse.dll |
||||||
|
windows/share/esse.dll.lib |
||||||
|
ios/share/libesse.a |
||||||
|
android/src/main/jniLibs/arm64-v8a/libesse.so |
||||||
|
android/src/main/jniLibs/armeabi-v7a/libesse.so |
||||||
|
android/src/main/jniLibs/x86/libesse.so |
@ -0,0 +1,10 @@ |
|||||||
|
# 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 and should not be manually edited. |
||||||
|
|
||||||
|
version: |
||||||
|
revision: 02d441ea55b328133c266991f43b0a1148edb63f |
||||||
|
channel: master |
||||||
|
|
||||||
|
project_type: plugin |
@ -0,0 +1,15 @@ |
|||||||
|
# esse_core |
||||||
|
|
||||||
|
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, view our |
||||||
|
[online documentation](https://flutter.dev/docs), which offers tutorials, |
||||||
|
samples, guidance on mobile development, and a full API reference. |
||||||
|
|
@ -0,0 +1,8 @@ |
|||||||
|
*.iml |
||||||
|
.gradle |
||||||
|
/local.properties |
||||||
|
/.idea/workspace.xml |
||||||
|
/.idea/libraries |
||||||
|
.DS_Store |
||||||
|
/build |
||||||
|
/captures |
@ -0,0 +1,46 @@ |
|||||||
|
group 'com.esse_core.esse_core' |
||||||
|
version '1.0-SNAPSHOT' |
||||||
|
|
||||||
|
buildscript { |
||||||
|
ext.kotlin_version = '1.3.50' |
||||||
|
repositories { |
||||||
|
google() |
||||||
|
jcenter() |
||||||
|
} |
||||||
|
|
||||||
|
dependencies { |
||||||
|
classpath 'com.android.tools.build:gradle:4.1.0' |
||||||
|
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
rootProject.allprojects { |
||||||
|
repositories { |
||||||
|
google() |
||||||
|
jcenter() |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
apply plugin: 'com.android.library' |
||||||
|
apply plugin: 'kotlin-android' |
||||||
|
|
||||||
|
android { |
||||||
|
compileSdkVersion 30 |
||||||
|
|
||||||
|
sourceSets { |
||||||
|
main.java.srcDirs += 'src/main/kotlin' |
||||||
|
} |
||||||
|
defaultConfig { |
||||||
|
minSdkVersion 16 |
||||||
|
} |
||||||
|
|
||||||
|
sourceSets { |
||||||
|
main { |
||||||
|
jniLibs.srcDirs = ['src/main/jniLibs'] |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
dependencies { |
||||||
|
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" |
||||||
|
} |
@ -0,0 +1,3 @@ |
|||||||
|
org.gradle.jvmargs=-Xmx1536M |
||||||
|
android.useAndroidX=true |
||||||
|
android.enableJetifier=true |
@ -0,0 +1,5 @@ |
|||||||
|
distributionBase=GRADLE_USER_HOME |
||||||
|
distributionPath=wrapper/dists |
||||||
|
zipStoreBase=GRADLE_USER_HOME |
||||||
|
zipStorePath=wrapper/dists |
||||||
|
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip |
@ -0,0 +1,3 @@ |
|||||||
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android" |
||||||
|
package="com.esse_core.esse_core"> |
||||||
|
</manifest> |
@ -0,0 +1,59 @@ |
|||||||
|
package com.esse_core.esse_core |
||||||
|
|
||||||
|
import kotlin.concurrent.thread |
||||||
|
import androidx.annotation.NonNull |
||||||
|
|
||||||
|
import io.flutter.embedding.engine.plugins.FlutterPlugin |
||||||
|
import io.flutter.plugin.common.MethodCall |
||||||
|
import io.flutter.plugin.common.MethodChannel |
||||||
|
import io.flutter.plugin.common.MethodChannel.MethodCallHandler |
||||||
|
import io.flutter.plugin.common.MethodChannel.Result |
||||||
|
import io.flutter.plugin.common.PluginRegistry.Registrar |
||||||
|
|
||||||
|
class RustCore { |
||||||
|
companion object { |
||||||
|
init { |
||||||
|
System.loadLibrary("esse") |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
private external fun start(pattern: String) |
||||||
|
|
||||||
|
fun daemon(path: String) = start(path) |
||||||
|
} |
||||||
|
|
||||||
|
/** EsseCorePlugin */ |
||||||
|
class EsseCorePlugin: FlutterPlugin, MethodCallHandler { |
||||||
|
/// The MethodChannel that will the communication between Flutter and native Android |
||||||
|
/// |
||||||
|
/// This local reference serves to register the plugin with the Flutter Engine and unregister it |
||||||
|
/// when the Flutter Engine is detached from the Activity |
||||||
|
private lateinit var channel : MethodChannel |
||||||
|
|
||||||
|
override fun onAttachedToEngine(@NonNull flutterPluginBinding: FlutterPlugin.FlutterPluginBinding) { |
||||||
|
channel = MethodChannel(flutterPluginBinding.binaryMessenger, "esse_core") |
||||||
|
channel.setMethodCallHandler(this) |
||||||
|
} |
||||||
|
|
||||||
|
override fun onMethodCall(@NonNull call: MethodCall, @NonNull result: Result) { |
||||||
|
if (call.method == "getPlatformVersion") { |
||||||
|
result.success("Android ${android.os.Build.VERSION.RELEASE}") |
||||||
|
} else if (call.method == "daemon") { |
||||||
|
val path : String? = call.argument("path") |
||||||
|
if (path != null && path.length > 0) { |
||||||
|
thread(isDaemon=true) { |
||||||
|
RustCore().daemon(path) |
||||||
|
} |
||||||
|
} else { |
||||||
|
print("Empty string") |
||||||
|
} |
||||||
|
result.success("Daemon success.") |
||||||
|
} else { |
||||||
|
result.notImplemented() |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
override fun onDetachedFromEngine(@NonNull binding: FlutterPlugin.FlutterPluginBinding) { |
||||||
|
channel.setMethodCallHandler(null) |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,37 @@ |
|||||||
|
.idea/ |
||||||
|
.vagrant/ |
||||||
|
.sconsign.dblite |
||||||
|
.svn/ |
||||||
|
|
||||||
|
.DS_Store |
||||||
|
*.swp |
||||||
|
profile |
||||||
|
|
||||||
|
DerivedData/ |
||||||
|
build/ |
||||||
|
GeneratedPluginRegistrant.h |
||||||
|
GeneratedPluginRegistrant.m |
||||||
|
|
||||||
|
.generated/ |
||||||
|
|
||||||
|
*.pbxuser |
||||||
|
*.mode1v3 |
||||||
|
*.mode2v3 |
||||||
|
*.perspectivev3 |
||||||
|
|
||||||
|
!default.pbxuser |
||||||
|
!default.mode1v3 |
||||||
|
!default.mode2v3 |
||||||
|
!default.perspectivev3 |
||||||
|
|
||||||
|
xcuserdata |
||||||
|
|
||||||
|
*.moved-aside |
||||||
|
|
||||||
|
*.pyc |
||||||
|
*sync/ |
||||||
|
Icon? |
||||||
|
.tags* |
||||||
|
|
||||||
|
/Flutter/Generated.xcconfig |
||||||
|
/Flutter/flutter_export_environment.sh |
@ -0,0 +1,6 @@ |
|||||||
|
#import <Flutter/Flutter.h> |
||||||
|
|
||||||
|
void start(const char *db_path); |
||||||
|
|
||||||
|
@interface EsseCorePlugin : NSObject<FlutterPlugin> |
||||||
|
@end |
@ -0,0 +1,15 @@ |
|||||||
|
#import "EsseCorePlugin.h" |
||||||
|
#if __has_include(<esse_core/esse_core-Swift.h>) |
||||||
|
#import <esse_core/esse_core-Swift.h> |
||||||
|
#else |
||||||
|
// Support project import fallback if the generated compatibility header |
||||||
|
// is not copied when this plugin is created as a library. |
||||||
|
// https://forums.swift.org/t/swift-static-libraries-dont-copy-generated-objective-c-header/19816 |
||||||
|
#import "esse_core-Swift.h" |
||||||
|
#endif |
||||||
|
|
||||||
|
@implementation EsseCorePlugin |
||||||
|
+ (void)registerWithRegistrar:(NSObject<FlutterPluginRegistrar>*)registrar { |
||||||
|
[SwiftEsseCorePlugin registerWithRegistrar:registrar]; |
||||||
|
} |
||||||
|
@end |
@ -0,0 +1,33 @@ |
|||||||
|
import Flutter |
||||||
|
import UIKit |
||||||
|
|
||||||
|
public class SwiftEsseCorePlugin: NSObject, FlutterPlugin { |
||||||
|
public static func register(with registrar: FlutterPluginRegistrar) { |
||||||
|
let channel = FlutterMethodChannel(name: "esse_core", binaryMessenger: registrar.messenger()) |
||||||
|
let instance = SwiftEsseCorePlugin() |
||||||
|
registrar.addMethodCallDelegate(instance, channel: channel) |
||||||
|
} |
||||||
|
|
||||||
|
public func handle(_ call: FlutterMethodCall, result: @escaping FlutterResult) { |
||||||
|
switch call.method { |
||||||
|
case "getPlatformVersion": |
||||||
|
result("iOS " + UIDevice.current.systemVersion) |
||||||
|
case "daemon": |
||||||
|
guard let args = call.arguments else { |
||||||
|
return |
||||||
|
} |
||||||
|
if let myArgs = args as? [String: Any], |
||||||
|
let path = myArgs["path"] as? String |
||||||
|
{ |
||||||
|
DispatchQueue.global().async { |
||||||
|
start(path) |
||||||
|
} |
||||||
|
result("Daemon success") |
||||||
|
} else { |
||||||
|
result("Daemon path invalid") |
||||||
|
} |
||||||
|
default: |
||||||
|
result(FlutterMethodNotImplemented) |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,24 @@ |
|||||||
|
# |
||||||
|
# To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html. |
||||||
|
# Run `pod lib lint esse_core.podspec` to validate before publishing. |
||||||
|
# |
||||||
|
Pod::Spec.new do |s| |
||||||
|
s.name = 'esse_core' |
||||||
|
s.version = '0.0.1' |
||||||
|
s.summary = 'A new flutter plugin project.' |
||||||
|
s.description = <<-DESC |
||||||
|
A new flutter plugin project. |
||||||
|
DESC |
||||||
|
s.homepage = 'http://example.com' |
||||||
|
s.license = { :file => '../LICENSE' } |
||||||
|
s.author = { 'Your Company' => 'email@example.com' } |
||||||
|
s.source = { :path => '.' } |
||||||
|
s.source_files = 'Classes/**/*' |
||||||
|
s.vendored_libraries = "share/*.a" |
||||||
|
s.dependency 'Flutter' |
||||||
|
s.platform = :ios, '8.0' |
||||||
|
|
||||||
|
# Flutter.framework does not contain a i386 slice. |
||||||
|
s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES', 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'i386' } |
||||||
|
s.swift_version = '5.0' |
||||||
|
end |
@ -0,0 +1,18 @@ |
|||||||
|
import 'dart:async'; |
||||||
|
|
||||||
|
import 'package:flutter/services.dart'; |
||||||
|
|
||||||
|
class EsseCore { |
||||||
|
static const MethodChannel _channel = const MethodChannel('esse_core'); |
||||||
|
|
||||||
|
static Future<String> get platformVersion async { |
||||||
|
final String version = await _channel.invokeMethod('getPlatformVersion'); |
||||||
|
return version; |
||||||
|
} |
||||||
|
|
||||||
|
static Future<void> daemon(String path) async { |
||||||
|
final String version = |
||||||
|
await _channel.invokeMethod('daemon', {'path': path}); |
||||||
|
print("over daemon: " + version); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,36 @@ |
|||||||
|
cmake_minimum_required(VERSION 3.10) |
||||||
|
set(PROJECT_NAME "esse_core") |
||||||
|
project(${PROJECT_NAME} LANGUAGES CXX) |
||||||
|
|
||||||
|
# This value is used when generating builds using this plugin, so it must |
||||||
|
# not be changed |
||||||
|
set(PLUGIN_NAME "esse_core_plugin") |
||||||
|
|
||||||
|
add_library(${PLUGIN_NAME} SHARED |
||||||
|
"esse_core_plugin.cc" |
||||||
|
) |
||||||
|
apply_standard_settings(${PLUGIN_NAME}) |
||||||
|
set_target_properties(${PLUGIN_NAME} PROPERTIES |
||||||
|
CXX_VISIBILITY_PRESET hidden) |
||||||
|
target_compile_definitions(${PLUGIN_NAME} PRIVATE FLUTTER_PLUGIN_IMPL) |
||||||
|
target_include_directories(${PLUGIN_NAME} INTERFACE |
||||||
|
"${CMAKE_CURRENT_SOURCE_DIR}/include") |
||||||
|
target_include_directories(${PLUGIN_NAME} INTERFACE |
||||||
|
"${CMAKE_CURRENT_SOURCE_DIR}/share") |
||||||
|
|
||||||
|
target_link_libraries(${PLUGIN_NAME} PRIVATE flutter) |
||||||
|
target_link_libraries(${PLUGIN_NAME} PRIVATE PkgConfig::GTK) |
||||||
|
|
||||||
|
## First Time & Debug To Lanuch install libraries. |
||||||
|
target_link_directories(${PLUGIN_NAME} PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/share") |
||||||
|
target_link_libraries(${PLUGIN_NAME} PRIVATE libesse.so) |
||||||
|
|
||||||
|
## Secound Time, because libraries had in lib, and can found. |
||||||
|
#find_library(ESSE_LIB NAMES libesse.so esse) |
||||||
|
#target_link_libraries(${PLUGIN_NAME} PRIVATE ${ESSE_LIB}) |
||||||
|
|
||||||
|
# List of absolute paths to libraries that should be bundled with the plugin |
||||||
|
set(esse_core_bundled_libraries |
||||||
|
"${CMAKE_CURRENT_SOURCE_DIR}/share/libesse.so" |
||||||
|
PARENT_SCOPE |
||||||
|
) |
@ -0,0 +1,101 @@ |
|||||||
|
#include "include/esse_core/esse_core_plugin.h" |
||||||
|
#include "share/esse.h" |
||||||
|
|
||||||
|
#include <flutter_linux/flutter_linux.h> |
||||||
|
#include <gtk/gtk.h> |
||||||
|
#include <sys/utsname.h> |
||||||
|
|
||||||
|
#include <cstring> |
||||||
|
|
||||||
|
#define ESSE_CORE_PLUGIN(obj) \ |
||||||
|
(G_TYPE_CHECK_INSTANCE_CAST((obj), esse_core_plugin_get_type(), \ |
||||||
|
EsseCorePlugin)) |
||||||
|
|
||||||
|
struct _EsseCorePlugin { |
||||||
|
GObject parent_instance; |
||||||
|
}; |
||||||
|
|
||||||
|
G_DEFINE_TYPE(EsseCorePlugin, esse_core_plugin, g_object_get_type()) |
||||||
|
|
||||||
|
gpointer daemon(gpointer pp) |
||||||
|
{ |
||||||
|
start((gchar*) pp); |
||||||
|
return NULL; |
||||||
|
} |
||||||
|
|
||||||
|
// Called when a method call is received from Flutter.
|
||||||
|
static void esse_core_plugin_handle_method_call( |
||||||
|
EsseCorePlugin* self, |
||||||
|
FlMethodCall* method_call) { |
||||||
|
g_autoptr(FlMethodResponse) response = nullptr; |
||||||
|
|
||||||
|
const gchar* method = fl_method_call_get_name(method_call); |
||||||
|
|
||||||
|
if (strcmp(method, "getPlatformVersion") == 0) { |
||||||
|
struct utsname uname_data = {}; |
||||||
|
uname(&uname_data); |
||||||
|
g_autofree gchar *version = g_strdup_printf("Linux %s", uname_data.version); |
||||||
|
g_autoptr(FlValue) result = fl_value_new_string(version); |
||||||
|
response = FL_METHOD_RESPONSE(fl_method_success_response_new(result)); |
||||||
|
} else if (strcmp(method, "daemon") == 0) { |
||||||
|
const gchar *path = fl_value_get_string( |
||||||
|
fl_value_lookup( |
||||||
|
fl_method_call_get_args(method_call), |
||||||
|
fl_value_new_string("path") |
||||||
|
) |
||||||
|
); |
||||||
|
|
||||||
|
int len = strlen(path); |
||||||
|
char *str; |
||||||
|
int i; |
||||||
|
str = (char*)malloc((len+1)*sizeof(char)); |
||||||
|
for(i=0; i<len; i++){ |
||||||
|
str[i] = *(path+i); |
||||||
|
} |
||||||
|
str[len] = '\0'; |
||||||
|
gpointer pp = (gpointer) (gchar*) str; |
||||||
|
GThread *gthread = NULL; |
||||||
|
gthread = g_thread_new("daemon", daemon, pp); |
||||||
|
|
||||||
|
// TODO check gthread is ok.
|
||||||
|
|
||||||
|
g_autoptr(FlValue) result = fl_value_new_string(path); |
||||||
|
response = FL_METHOD_RESPONSE(fl_method_success_response_new(result)); |
||||||
|
} else { |
||||||
|
response = FL_METHOD_RESPONSE(fl_method_not_implemented_response_new()); |
||||||
|
} |
||||||
|
|
||||||
|
fl_method_call_respond(method_call, response, nullptr); |
||||||
|
} |
||||||
|
|
||||||
|
static void esse_core_plugin_dispose(GObject* object) { |
||||||
|
G_OBJECT_CLASS(esse_core_plugin_parent_class)->dispose(object); |
||||||
|
} |
||||||
|
|
||||||
|
static void esse_core_plugin_class_init(EsseCorePluginClass* klass) { |
||||||
|
G_OBJECT_CLASS(klass)->dispose = esse_core_plugin_dispose; |
||||||
|
} |
||||||
|
|
||||||
|
static void esse_core_plugin_init(EsseCorePlugin* self) {} |
||||||
|
|
||||||
|
static void method_call_cb(FlMethodChannel* channel, FlMethodCall* method_call, |
||||||
|
gpointer user_data) { |
||||||
|
EsseCorePlugin* plugin = ESSE_CORE_PLUGIN(user_data); |
||||||
|
esse_core_plugin_handle_method_call(plugin, method_call); |
||||||
|
} |
||||||
|
|
||||||
|
void esse_core_plugin_register_with_registrar(FlPluginRegistrar* registrar) { |
||||||
|
EsseCorePlugin* plugin = ESSE_CORE_PLUGIN( |
||||||
|
g_object_new(esse_core_plugin_get_type(), nullptr)); |
||||||
|
|
||||||
|
g_autoptr(FlStandardMethodCodec) codec = fl_standard_method_codec_new(); |
||||||
|
g_autoptr(FlMethodChannel) channel = |
||||||
|
fl_method_channel_new(fl_plugin_registrar_get_messenger(registrar), |
||||||
|
"esse_core", |
||||||
|
FL_METHOD_CODEC(codec)); |
||||||
|
fl_method_channel_set_method_call_handler(channel, method_call_cb, |
||||||
|
g_object_ref(plugin), |
||||||
|
g_object_unref); |
||||||
|
|
||||||
|
g_object_unref(plugin); |
||||||
|
} |
@ -0,0 +1,26 @@ |
|||||||
|
#ifndef FLUTTER_PLUGIN_ESSE_CORE_PLUGIN_H_ |
||||||
|
#define FLUTTER_PLUGIN_ESSE_CORE_PLUGIN_H_ |
||||||
|
|
||||||
|
#include <flutter_linux/flutter_linux.h> |
||||||
|
|
||||||
|
G_BEGIN_DECLS |
||||||
|
|
||||||
|
#ifdef FLUTTER_PLUGIN_IMPL |
||||||
|
#define FLUTTER_PLUGIN_EXPORT __attribute__((visibility("default"))) |
||||||
|
#else |
||||||
|
#define FLUTTER_PLUGIN_EXPORT |
||||||
|
#endif |
||||||
|
|
||||||
|
typedef struct _EsseCorePlugin EsseCorePlugin; |
||||||
|
typedef struct { |
||||||
|
GObjectClass parent_class; |
||||||
|
} EsseCorePluginClass; |
||||||
|
|
||||||
|
FLUTTER_PLUGIN_EXPORT GType esse_core_plugin_get_type(); |
||||||
|
|
||||||
|
FLUTTER_PLUGIN_EXPORT void esse_core_plugin_register_with_registrar( |
||||||
|
FlPluginRegistrar* registrar); |
||||||
|
|
||||||
|
G_END_DECLS |
||||||
|
|
||||||
|
#endif // FLUTTER_PLUGIN_ESSE_CORE_PLUGIN_H_
|
@ -0,0 +1 @@ |
|||||||
|
extern "C" void start(const char *db_path); |
@ -0,0 +1 @@ |
|||||||
|
void start(const char *db_path); |
@ -0,0 +1,33 @@ |
|||||||
|
import Cocoa |
||||||
|
import FlutterMacOS |
||||||
|
|
||||||
|
public class EsseCorePlugin: NSObject, FlutterPlugin { |
||||||
|
public static func register(with registrar: FlutterPluginRegistrar) { |
||||||
|
let channel = FlutterMethodChannel(name: "esse_core", binaryMessenger: registrar.messenger) |
||||||
|
let instance = EsseCorePlugin() |
||||||
|
registrar.addMethodCallDelegate(instance, channel: channel) |
||||||
|
} |
||||||
|
|
||||||
|
public func handle(_ call: FlutterMethodCall, result: @escaping FlutterResult) { |
||||||
|
switch call.method { |
||||||
|
case "getPlatformVersion": |
||||||
|
result("macOS " + ProcessInfo.processInfo.operatingSystemVersionString) |
||||||
|
case "daemon": |
||||||
|
guard let args = call.arguments else { |
||||||
|
return |
||||||
|
} |
||||||
|
if let myArgs = args as? [String: Any], |
||||||
|
let path = myArgs["path"] as? String |
||||||
|
{ |
||||||
|
DispatchQueue.global().async { |
||||||
|
start(path) |
||||||
|
} |
||||||
|
result("Daemon success") |
||||||
|
} else { |
||||||
|
result("Daemon path invalid") |
||||||
|
} |
||||||
|
default: |
||||||
|
result(FlutterMethodNotImplemented) |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,11 @@ |
|||||||
|
// This is a generated file; do not edit or check into version control. |
||||||
|
FLUTTER_ROOT=/Users/arya/workspace/flutter |
||||||
|
FLUTTER_APPLICATION_PATH=/Users/arya/workspace/cymple/esse/core |
||||||
|
FLUTTER_BUILD_DIR=build |
||||||
|
FLUTTER_BUILD_NAME=0.0.1 |
||||||
|
FLUTTER_BUILD_NUMBER=0.0.1 |
||||||
|
EXCLUDED_ARCHS=arm64 |
||||||
|
DART_OBFUSCATION=false |
||||||
|
TRACK_WIDGET_CREATION=false |
||||||
|
TREE_SHAKE_ICONS=false |
||||||
|
PACKAGE_CONFIG=.packages |
@ -0,0 +1,12 @@ |
|||||||
|
#!/bin/sh |
||||||
|
# This is a generated file; do not edit or check into version control. |
||||||
|
export "FLUTTER_ROOT=/Users/arya/workspace/flutter" |
||||||
|
export "FLUTTER_APPLICATION_PATH=/Users/arya/workspace/cymple/esse/core" |
||||||
|
export "FLUTTER_BUILD_DIR=build" |
||||||
|
export "FLUTTER_BUILD_NAME=0.0.1" |
||||||
|
export "FLUTTER_BUILD_NUMBER=0.0.1" |
||||||
|
export "EXCLUDED_ARCHS=arm64" |
||||||
|
export "DART_OBFUSCATION=false" |
||||||
|
export "TRACK_WIDGET_CREATION=false" |
||||||
|
export "TREE_SHAKE_ICONS=false" |
||||||
|
export "PACKAGE_CONFIG=.packages" |
@ -0,0 +1,23 @@ |
|||||||
|
# |
||||||
|
# To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html. |
||||||
|
# Run `pod lib lint esse_core.podspec` to validate before publishing. |
||||||
|
# |
||||||
|
Pod::Spec.new do |s| |
||||||
|
s.name = 'esse_core' |
||||||
|
s.version = '0.0.1' |
||||||
|
s.summary = 'A new flutter plugin project.' |
||||||
|
s.description = <<-DESC |
||||||
|
A new flutter plugin project. |
||||||
|
DESC |
||||||
|
s.homepage = 'http://example.com' |
||||||
|
s.license = { :file => '../LICENSE' } |
||||||
|
s.author = { 'Your Company' => 'email@example.com' } |
||||||
|
s.source = { :path => '.' } |
||||||
|
s.source_files = 'Classes/**/*' |
||||||
|
s.vendored_libraries = "share/*.a" |
||||||
|
s.dependency 'FlutterMacOS' |
||||||
|
|
||||||
|
s.platform = :osx, '10.11' |
||||||
|
s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES' } |
||||||
|
s.swift_version = '5.0' |
||||||
|
end |
@ -0,0 +1,147 @@ |
|||||||
|
# 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.5.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.1.0" |
||||||
|
charcode: |
||||||
|
dependency: transitive |
||||||
|
description: |
||||||
|
name: charcode |
||||||
|
url: "https://pub.dartlang.org" |
||||||
|
source: hosted |
||||||
|
version: "1.2.0" |
||||||
|
clock: |
||||||
|
dependency: transitive |
||||||
|
description: |
||||||
|
name: clock |
||||||
|
url: "https://pub.dartlang.org" |
||||||
|
source: hosted |
||||||
|
version: "1.1.0" |
||||||
|
collection: |
||||||
|
dependency: transitive |
||||||
|
description: |
||||||
|
name: collection |
||||||
|
url: "https://pub.dartlang.org" |
||||||
|
source: hosted |
||||||
|
version: "1.15.0" |
||||||
|
fake_async: |
||||||
|
dependency: transitive |
||||||
|
description: |
||||||
|
name: fake_async |
||||||
|
url: "https://pub.dartlang.org" |
||||||
|
source: hosted |
||||||
|
version: "1.2.0" |
||||||
|
flutter: |
||||||
|
dependency: "direct main" |
||||||
|
description: flutter |
||||||
|
source: sdk |
||||||
|
version: "0.0.0" |
||||||
|
flutter_test: |
||||||
|
dependency: "direct dev" |
||||||
|
description: flutter |
||||||
|
source: sdk |
||||||
|
version: "0.0.0" |
||||||
|
matcher: |
||||||
|
dependency: transitive |
||||||
|
description: |
||||||
|
name: matcher |
||||||
|
url: "https://pub.dartlang.org" |
||||||
|
source: hosted |
||||||
|
version: "0.12.10" |
||||||
|
meta: |
||||||
|
dependency: transitive |
||||||
|
description: |
||||||
|
name: meta |
||||||
|
url: "https://pub.dartlang.org" |
||||||
|
source: hosted |
||||||
|
version: "1.3.0" |
||||||
|
path: |
||||||
|
dependency: transitive |
||||||
|
description: |
||||||
|
name: path |
||||||
|
url: "https://pub.dartlang.org" |
||||||
|
source: hosted |
||||||
|
version: "1.8.0" |
||||||
|
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.8.1" |
||||||
|
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.0" |
||||||
|
term_glyph: |
||||||
|
dependency: transitive |
||||||
|
description: |
||||||
|
name: term_glyph |
||||||
|
url: "https://pub.dartlang.org" |
||||||
|
source: hosted |
||||||
|
version: "1.2.0" |
||||||
|
test_api: |
||||||
|
dependency: transitive |
||||||
|
description: |
||||||
|
name: test_api |
||||||
|
url: "https://pub.dartlang.org" |
||||||
|
source: hosted |
||||||
|
version: "0.2.19" |
||||||
|
typed_data: |
||||||
|
dependency: transitive |
||||||
|
description: |
||||||
|
name: typed_data |
||||||
|
url: "https://pub.dartlang.org" |
||||||
|
source: hosted |
||||||
|
version: "1.3.0" |
||||||
|
vector_math: |
||||||
|
dependency: transitive |
||||||
|
description: |
||||||
|
name: vector_math |
||||||
|
url: "https://pub.dartlang.org" |
||||||
|
source: hosted |
||||||
|
version: "2.1.0" |
||||||
|
sdks: |
||||||
|
dart: ">=2.12.0-0.0 <3.0.0" |
||||||
|
flutter: ">=1.20.0" |
@ -0,0 +1,71 @@ |
|||||||
|
name: esse_core |
||||||
|
description: A new flutter plugin project. |
||||||
|
version: 0.0.1 |
||||||
|
author: |
||||||
|
homepage: |
||||||
|
|
||||||
|
environment: |
||||||
|
sdk: ">=2.7.0 <3.0.0" |
||||||
|
flutter: ">=1.20.0" |
||||||
|
|
||||||
|
dependencies: |
||||||
|
flutter: |
||||||
|
sdk: flutter |
||||||
|
|
||||||
|
dev_dependencies: |
||||||
|
flutter_test: |
||||||
|
sdk: flutter |
||||||
|
|
||||||
|
# For information on the generic Dart part of this file, see the |
||||||
|
# following page: https://dart.dev/tools/pub/pubspec |
||||||
|
|
||||||
|
# The following section is specific to Flutter. |
||||||
|
flutter: |
||||||
|
# This section identifies this Flutter project as a plugin project. |
||||||
|
# The 'pluginClass' and Android 'package' identifiers should not ordinarily |
||||||
|
# be modified. They are used by the tooling to maintain consistency when |
||||||
|
# adding or updating assets for this project. |
||||||
|
plugin: |
||||||
|
platforms: |
||||||
|
android: |
||||||
|
package: com.esse_core.esse_core |
||||||
|
pluginClass: EsseCorePlugin |
||||||
|
ios: |
||||||
|
pluginClass: EsseCorePlugin |
||||||
|
linux: |
||||||
|
pluginClass: EsseCorePlugin |
||||||
|
macos: |
||||||
|
pluginClass: EsseCorePlugin |
||||||
|
windows: |
||||||
|
pluginClass: EsseCorePlugin |
||||||
|
|
||||||
|
# To add assets to your plugin package, add an assets section, like this: |
||||||
|
# assets: |
||||||
|
# - images/a_dot_burr.jpeg |
||||||
|
# - images/a_dot_ham.jpeg |
||||||
|
# |
||||||
|
# For details regarding assets in packages, see |
||||||
|
# https://flutter.dev/assets-and-images/#from-packages |
||||||
|
# |
||||||
|
# An image asset can refer to one or more resolution-specific "variants", see |
||||||
|
# https://flutter.dev/assets-and-images/#resolution-aware. |
||||||
|
|
||||||
|
# To add custom fonts to your plugin package, add a fonts section here, |
||||||
|
# in this "flutter" section. Each entry in this list should have a |
||||||
|
# "family" key with the font family name, and a "fonts" key with a |
||||||
|
# list giving the asset and other descriptors for the font. For |
||||||
|
# example: |
||||||
|
# fonts: |
||||||
|
# - family: Schyler |
||||||
|
# fonts: |
||||||
|
# - asset: fonts/Schyler-Regular.ttf |
||||||
|
# - asset: fonts/Schyler-Italic.ttf |
||||||
|
# style: italic |
||||||
|
# - family: Trajan Pro |
||||||
|
# fonts: |
||||||
|
# - asset: fonts/TrajanPro.ttf |
||||||
|
# - asset: fonts/TrajanPro_Bold.ttf |
||||||
|
# weight: 700 |
||||||
|
# |
||||||
|
# For details regarding fonts in packages, see |
||||||
|
# https://flutter.dev/custom-fonts/#from-packages |
@ -0,0 +1,23 @@ |
|||||||
|
import 'package:flutter/services.dart'; |
||||||
|
import 'package:flutter_test/flutter_test.dart'; |
||||||
|
import 'package:esse_core/esse_core.dart'; |
||||||
|
|
||||||
|
void main() { |
||||||
|
const MethodChannel channel = MethodChannel('esse_core'); |
||||||
|
|
||||||
|
TestWidgetsFlutterBinding.ensureInitialized(); |
||||||
|
|
||||||
|
setUp(() { |
||||||
|
channel.setMockMethodCallHandler((MethodCall methodCall) async { |
||||||
|
return '42'; |
||||||
|
}); |
||||||
|
}); |
||||||
|
|
||||||
|
tearDown(() { |
||||||
|
channel.setMockMethodCallHandler(null); |
||||||
|
}); |
||||||
|
|
||||||
|
test('getPlatformVersion', () async { |
||||||
|
expect(await EsseCore.platformVersion, '42'); |
||||||
|
}); |
||||||
|
} |
@ -0,0 +1,17 @@ |
|||||||
|
flutter/ |
||||||
|
|
||||||
|
# Visual Studio user-specific files. |
||||||
|
*.suo |
||||||
|
*.user |
||||||
|
*.userosscache |
||||||
|
*.sln.docstates |
||||||
|
|
||||||
|
# Visual Studio build-related files. |
||||||
|
x64/ |
||||||
|
x86/ |
||||||
|
|
||||||
|
# Visual Studio cache files |
||||||
|
# files ending in .cache can be ignored |
||||||
|
*.[Cc]ache |
||||||
|
# but keep track of directories ending in .cache |
||||||
|
!*.[Cc]ache/ |
@ -0,0 +1,30 @@ |
|||||||
|
cmake_minimum_required(VERSION 3.15) |
||||||
|
set(PROJECT_NAME "esse_core") |
||||||
|
project(${PROJECT_NAME} LANGUAGES CXX) |
||||||
|
|
||||||
|
# This value is used when generating builds using this plugin, so it must |
||||||
|
# not be changed |
||||||
|
set(PLUGIN_NAME "esse_core_plugin") |
||||||
|
|
||||||
|
add_library(${PLUGIN_NAME} SHARED |
||||||
|
"esse_core_plugin.cpp" |
||||||
|
) |
||||||
|
apply_standard_settings(${PLUGIN_NAME}) |
||||||
|
set_target_properties(${PLUGIN_NAME} PROPERTIES |
||||||
|
CXX_VISIBILITY_PRESET hidden) |
||||||
|
target_compile_definitions(${PLUGIN_NAME} PRIVATE FLUTTER_PLUGIN_IMPL) |
||||||
|
target_include_directories(${PLUGIN_NAME} INTERFACE |
||||||
|
"${CMAKE_CURRENT_SOURCE_DIR}/include") |
||||||
|
target_include_directories(${PLUGIN_NAME} INTERFACE |
||||||
|
"${CMAKE_CURRENT_SOURCE_DIR}/share") |
||||||
|
|
||||||
|
target_link_libraries(${PLUGIN_NAME} PRIVATE flutter flutter_wrapper_plugin) |
||||||
|
|
||||||
|
target_link_libraries(${PLUGIN_NAME} PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/share/esse.dll.lib") |
||||||
|
|
||||||
|
# List of absolute paths to libraries that should be bundled with the plugin |
||||||
|
set(esse_core_bundled_libraries |
||||||
|
"${CMAKE_CURRENT_SOURCE_DIR}/share/esse.dll.lib" |
||||||
|
"${CMAKE_CURRENT_SOURCE_DIR}/share/esse.dll" |
||||||
|
PARENT_SCOPE |
||||||
|
) |
@ -0,0 +1,108 @@ |
|||||||
|
#include "include/esse_core/esse_core_plugin.h" |
||||||
|
#include "share/esse.h" |
||||||
|
|
||||||
|
// This must be included before many other Windows headers.
|
||||||
|
#include <windows.h> |
||||||
|
|
||||||
|
// For getPlatformVersion; remove unless needed for your plugin implementation.
|
||||||
|
#include <VersionHelpers.h> |
||||||
|
|
||||||
|
#include <flutter/method_channel.h> |
||||||
|
#include <flutter/plugin_registrar_windows.h> |
||||||
|
#include <flutter/standard_method_codec.h> |
||||||
|
|
||||||
|
#include <map> |
||||||
|
#include <memory> |
||||||
|
#include <sstream> |
||||||
|
#include <thread> |
||||||
|
|
||||||
|
namespace { |
||||||
|
|
||||||
|
using flutter::EncodableMap; |
||||||
|
using flutter::EncodableValue; |
||||||
|
|
||||||
|
static void StartDaemon(std::string path) |
||||||
|
{ |
||||||
|
start(path.c_str()); |
||||||
|
} |
||||||
|
|
||||||
|
class EsseCorePlugin : public flutter::Plugin { |
||||||
|
public: |
||||||
|
static void RegisterWithRegistrar(flutter::PluginRegistrarWindows *registrar); |
||||||
|
|
||||||
|
EsseCorePlugin(); |
||||||
|
|
||||||
|
virtual ~EsseCorePlugin(); |
||||||
|
|
||||||
|
private: |
||||||
|
// Called when a method is called on this plugin's channel from Dart.
|
||||||
|
void HandleMethodCall( |
||||||
|
const flutter::MethodCall<flutter::EncodableValue> &method_call, |
||||||
|
std::unique_ptr<flutter::MethodResult<flutter::EncodableValue>> result); |
||||||
|
}; |
||||||
|
|
||||||
|
// static
|
||||||
|
void EsseCorePlugin::RegisterWithRegistrar( |
||||||
|
flutter::PluginRegistrarWindows *registrar) { |
||||||
|
auto channel = |
||||||
|
std::make_unique<flutter::MethodChannel<flutter::EncodableValue>>( |
||||||
|
registrar->messenger(), "esse_core", |
||||||
|
&flutter::StandardMethodCodec::GetInstance()); |
||||||
|
|
||||||
|
auto plugin = std::make_unique<EsseCorePlugin>(); |
||||||
|
|
||||||
|
channel->SetMethodCallHandler( |
||||||
|
[plugin_pointer = plugin.get()](const auto &call, auto result) { |
||||||
|
plugin_pointer->HandleMethodCall(call, std::move(result)); |
||||||
|
}); |
||||||
|
|
||||||
|
registrar->AddPlugin(std::move(plugin)); |
||||||
|
} |
||||||
|
|
||||||
|
EsseCorePlugin::EsseCorePlugin() {} |
||||||
|
|
||||||
|
EsseCorePlugin::~EsseCorePlugin() {} |
||||||
|
|
||||||
|
void EsseCorePlugin::HandleMethodCall( |
||||||
|
const flutter::MethodCall<flutter::EncodableValue> &method_call, |
||||||
|
std::unique_ptr<flutter::MethodResult<flutter::EncodableValue>> result) { |
||||||
|
if (method_call.method_name().compare("getPlatformVersion") == 0) { |
||||||
|
std::ostringstream version_stream; |
||||||
|
version_stream << "Windows "; |
||||||
|
if (IsWindows10OrGreater()) { |
||||||
|
version_stream << "10+"; |
||||||
|
} else if (IsWindows8OrGreater()) { |
||||||
|
version_stream << "8"; |
||||||
|
} else if (IsWindows7OrGreater()) { |
||||||
|
version_stream << "7"; |
||||||
|
} |
||||||
|
result->Success(flutter::EncodableValue(version_stream.str())); |
||||||
|
} else if (method_call.method_name().compare("daemon") == 0) { |
||||||
|
std::string path; |
||||||
|
const auto* arguments = std::get_if<EncodableMap>(method_call.arguments()); |
||||||
|
if (arguments) { |
||||||
|
auto path_it = arguments->find(EncodableValue("path")); |
||||||
|
if (path_it != arguments->end()) { |
||||||
|
path = std::get<std::string>(path_it->second); |
||||||
|
} |
||||||
|
} |
||||||
|
if (path.empty()) { |
||||||
|
result->Success(flutter::EncodableValue("Missing path")); |
||||||
|
return; |
||||||
|
} |
||||||
|
auto thread1 = std::thread(StartDaemon, path); |
||||||
|
thread1.detach(); |
||||||
|
result->Success(flutter::EncodableValue("Daemon success")); |
||||||
|
} else { |
||||||
|
result->NotImplemented(); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
} // namespace
|
||||||
|
|
||||||
|
void EsseCorePluginRegisterWithRegistrar( |
||||||
|
FlutterDesktopPluginRegistrarRef registrar) { |
||||||
|
EsseCorePlugin::RegisterWithRegistrar( |
||||||
|
flutter::PluginRegistrarManager::GetInstance() |
||||||
|
->GetRegistrar<flutter::PluginRegistrarWindows>(registrar)); |
||||||
|
} |
@ -0,0 +1,23 @@ |
|||||||
|
#ifndef FLUTTER_PLUGIN_ESSE_CORE_PLUGIN_H_ |
||||||
|
#define FLUTTER_PLUGIN_ESSE_CORE_PLUGIN_H_ |
||||||
|
|
||||||
|
#include <flutter_plugin_registrar.h> |
||||||
|
|
||||||
|
#ifdef FLUTTER_PLUGIN_IMPL |
||||||
|
#define FLUTTER_PLUGIN_EXPORT __declspec(dllexport) |
||||||
|
#else |
||||||
|
#define FLUTTER_PLUGIN_EXPORT __declspec(dllimport) |
||||||
|
#endif |
||||||
|
|
||||||
|
#if defined(__cplusplus) |
||||||
|
extern "C" { |
||||||
|
#endif |
||||||
|
|
||||||
|
FLUTTER_PLUGIN_EXPORT void EsseCorePluginRegisterWithRegistrar( |
||||||
|
FlutterDesktopPluginRegistrarRef registrar); |
||||||
|
|
||||||
|
#if defined(__cplusplus) |
||||||
|
} // extern "C"
|
||||||
|
#endif |
||||||
|
|
||||||
|
#endif // FLUTTER_PLUGIN_ESSE_CORE_PLUGIN_H_
|
@ -0,0 +1 @@ |
|||||||
|
extern "C" void start(const char *db_path); |
@ -0,0 +1,36 @@ |
|||||||
|
// This is a basic Flutter integration test. |
||||||
|
// |
||||||
|
// To perform an interaction with a widget in your test, use the WidgetTester |
||||||
|
// utility that Flutter provides. 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:integration_test/integration_test.dart'; |
||||||
|
|
||||||
|
import 'package:esse/main.dart' as app; |
||||||
|
|
||||||
|
void main() => run(_testMain); |
||||||
|
|
||||||
|
void _testMain() { |
||||||
|
testWidgets('Counter increments smoke test', (WidgetTester tester) async { |
||||||
|
// Build our app and trigger a frame. |
||||||
|
app.main(); |
||||||
|
|
||||||
|
// Trigger a frame. |
||||||
|
await tester.pumpAndSettle(); |
||||||
|
|
||||||
|
// Verify that our counter starts at 0. |
||||||
|
expect(find.text('0'), findsOneWidget); |
||||||
|
expect(find.text('1'), findsNothing); |
||||||
|
|
||||||
|
// Tap the '+' icon and trigger a frame. |
||||||
|
await tester.tap(find.byIcon(Icons.add)); |
||||||
|
await tester.pump(); |
||||||
|
|
||||||
|
// Verify that our counter has incremented. |
||||||
|
expect(find.text('0'), findsNothing); |
||||||
|
expect(find.text('1'), findsOneWidget); |
||||||
|
}); |
||||||
|
} |
@ -0,0 +1,8 @@ |
|||||||
|
// This file is provided as a convenience for running integration tests via the |
||||||
|
// flutter drive command. |
||||||
|
// |
||||||
|
// flutter drive --driver integration_test/driver.dart --target integration_test/app_test.dart |
||||||
|
|
||||||
|
import 'package:integration_test/integration_test_driver.dart'; |
||||||
|
|
||||||
|
Future<void> main() => integrationDriver(); |
@ -0,0 +1,32 @@ |
|||||||
|
*.mode1v3 |
||||||
|
*.mode2v3 |
||||||
|
*.moved-aside |
||||||
|
*.pbxuser |
||||||
|
*.perspectivev3 |
||||||
|
**/*sync/ |
||||||
|
.sconsign.dblite |
||||||
|
.tags* |
||||||
|
**/.vagrant/ |
||||||
|
**/DerivedData/ |
||||||
|
Icon? |
||||||
|
**/Pods/ |
||||||
|
**/.symlinks/ |
||||||
|
profile |
||||||
|
xcuserdata |
||||||
|
**/.generated/ |
||||||
|
Flutter/App.framework |
||||||
|
Flutter/Flutter.framework |
||||||
|
Flutter/Flutter.podspec |
||||||
|
Flutter/Generated.xcconfig |
||||||
|
Flutter/app.flx |
||||||
|
Flutter/app.zip |
||||||
|
Flutter/flutter_assets/ |
||||||
|
Flutter/flutter_export_environment.sh |
||||||
|
ServiceDefinitions.json |
||||||
|
Runner/GeneratedPluginRegistrant.* |
||||||
|
|
||||||
|
# Exceptions to above rules. |
||||||
|
!default.mode1v3 |
||||||
|
!default.mode2v3 |
||||||
|
!default.pbxuser |
||||||
|
!default.perspectivev3 |
@ -0,0 +1,26 @@ |
|||||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||||
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> |
||||||
|
<plist version="1.0"> |
||||||
|
<dict> |
||||||
|
<key>CFBundleDevelopmentRegion</key> |
||||||
|
<string>en</string> |
||||||
|
<key>CFBundleExecutable</key> |
||||||
|
<string>App</string> |
||||||
|
<key>CFBundleIdentifier</key> |
||||||
|
<string>io.flutter.flutter.app</string> |
||||||
|
<key>CFBundleInfoDictionaryVersion</key> |
||||||
|
<string>6.0</string> |
||||||
|
<key>CFBundleName</key> |
||||||
|
<string>App</string> |
||||||
|
<key>CFBundlePackageType</key> |
||||||
|
<string>FMWK</string> |
||||||
|
<key>CFBundleShortVersionString</key> |
||||||
|
<string>1.0</string> |
||||||
|
<key>CFBundleSignature</key> |
||||||
|
<string>????</string> |
||||||
|
<key>CFBundleVersion</key> |
||||||
|
<string>1.0</string> |
||||||
|
<key>MinimumOSVersion</key> |
||||||
|
<string>8.0</string> |
||||||
|
</dict> |
||||||
|
</plist> |
@ -0,0 +1,3 @@ |
|||||||
|
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" |
||||||
|
#include "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" |
||||||
|
#include "Generated.xcconfig" |