diff --git a/.gitignore b/.gitignore
index 52c7d44..b9e3cca 100644
--- a/.gitignore
+++ b/.gitignore
@@ -8,3 +8,5 @@ git/
flutter_export_environment.sh
.flutter-plugins-dependencies
+
+*.so
\ No newline at end of file
diff --git a/README.md b/README.md
index 4d5e7f9..43ab853 100644
--- a/README.md
+++ b/README.md
@@ -47,13 +47,11 @@ popd
git clone https://github.com/wownero/cyberwow/
cd cyberwow
-mkdir -p cyberwow/native/output/arm64
-mkdir -p cyberwow/native/output/x86_64
+mkdir -p cyberwow/android/app/src/main/jniLibs/arm64-v8a
# Copy wownerod that we just built
-cp $PATH_TO_WOWNEROD cyberwow/native/output/arm64/
-# Generate a dummy x86_64 bin
-touch cyberwow/native/output/x86_64/wownerod
+cp $PATH_TO_WOWNEROD \
+cyberwow/android/app/src/main/jniLibs/arm64-v8a/libwownerod.so
make build
```
diff --git a/cyberwow/android/app/build.gradle b/cyberwow/android/app/build.gradle
index 50666f1..63160d1 100644
--- a/cyberwow/android/app/build.gradle
+++ b/cyberwow/android/app/build.gradle
@@ -26,7 +26,7 @@ apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
android {
- compileSdkVersion 28
+ compileSdkVersion 29
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
@@ -40,7 +40,7 @@ android {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "org.wownero.cyberwow"
minSdkVersion 26
- targetSdkVersion 28
+ targetSdkVersion 29
versionCode 23
versionName "0.7.0.0-j"
}
diff --git a/cyberwow/android/app/src/main/kotlin/org/wownero/cyberwow/MainActivity.kt b/cyberwow/android/app/src/main/kotlin/org/wownero/cyberwow/MainActivity.kt
index fde116a..1a02d9d 100644
--- a/cyberwow/android/app/src/main/kotlin/org/wownero/cyberwow/MainActivity.kt
+++ b/cyberwow/android/app/src/main/kotlin/org/wownero/cyberwow/MainActivity.kt
@@ -30,6 +30,8 @@ class MainActivity: FlutterActivity() {
call, result ->
if (call.method == "getInitialIntent") {
result.success(initialIntentText)
+ } else if (call.method == "getBinaryDir") {
+ result.success(getApplicationInfo().nativeLibraryDir)
} else {
result.notImplemented()
}
diff --git a/cyberwow/lib/config.dart b/cyberwow/lib/config.dart
index 19e9ab1..49635ab 100644
--- a/cyberwow/lib/config.dart
+++ b/cyberwow/lib/config.dart
@@ -36,4 +36,5 @@ const emuHost = '192.168.10.100';
const host = isEmu ? emuHost : '127.0.0.1';
const stdoutLineBufferSize = 100;
+const bannerShownKey = 'banner-shown';
diff --git a/cyberwow/lib/config/cyberwow.dart b/cyberwow/lib/config/cyberwow.dart
index bb91aa6..689bee5 100644
--- a/cyberwow/lib/config/cyberwow.dart
+++ b/cyberwow/lib/config/cyberwow.dart
@@ -81,7 +81,7 @@ final _theme = ThemeData
final config = CryptoConfig
(
- 'wownerod',
+ 'libwownerod.so',
'wownerod',
'Follow the white rabbit.',
70,
diff --git a/cyberwow/lib/controller/process/deploy.dart b/cyberwow/lib/controller/process/deploy.dart
deleted file mode 100644
index 180d421..0000000
--- a/cyberwow/lib/controller/process/deploy.dart
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
-
-Copyright 2019 fuwa
-
-This file is part of CyberWOW.
-
-CyberWOW is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
-
-CyberWOW is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with CyberWOW. If not, see .
-
-*/
-
-import 'dart:io';
-import 'dart:async';
-import 'dart:convert';
-
-import 'package:flutter/services.dart';
-
-import '../helper.dart';
-
-Stream deployBinary
-(
- final AssetBundle bundle,
- final String path,
- final String name
-) async* {
- final binData = await bundle.load(path);
- final newPath = await getBinaryPath(name);
-
- yield 'output binary path: $newPath\n';
-
- final inputBytes = binData.buffer.asUint8List();
- final outputFile = await new File(newPath).writeAsBytes(inputBytes);
-
- final chmodResult = await Process.run('chmod', ['u+x', newPath]);
- yield chmodResult.stderr + '\n';
-
- final outputStat = await outputFile.stat();
- yield outputStat.toString() + '\n';
-}
diff --git a/cyberwow/lib/controller/process/run.dart b/cyberwow/lib/controller/process/run.dart
index 0733e55..e74490f 100644
--- a/cyberwow/lib/controller/process/run.dart
+++ b/cyberwow/lib/controller/process/run.dart
@@ -29,6 +29,7 @@ import 'dart:convert';
import '../helper.dart';
import '../../config.dart' as config;
import '../../logging.dart';
+import '../../logic/sensor/helper.dart' as helper;
typedef ShouldExit = bool Function();
@@ -40,7 +41,7 @@ Stream runBinary
final List userArgs = const [],
}
) async* {
- final newPath = await getBinaryPath(name);
+ final binPath = await helper.getBinaryPath(name);
final appDocDir = await getApplicationDocumentsDirectory();
final appDocPath = appDocDir.path;
@@ -66,7 +67,7 @@ Stream runBinary
log.info('args: ' + args.toString());
- final outputProcess = await Process.start(newPath, args);
+ final outputProcess = await Process.start(binPath, args);
Future printInput() async {
await for (final line in input) {
diff --git a/cyberwow/lib/logic/sensor/helper.dart b/cyberwow/lib/logic/sensor/helper.dart
new file mode 100644
index 0000000..49742e2
--- /dev/null
+++ b/cyberwow/lib/logic/sensor/helper.dart
@@ -0,0 +1,45 @@
+/*
+
+Copyright 2020 fuwa
+
+This file is part of CyberWOW.
+
+Wowllet is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+Wowllet is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with Wowllet. If not, see .
+
+*/
+
+import 'dart:async';
+import 'dart:io';
+
+import 'package:path_provider/path_provider.dart';
+import 'package:flutter/foundation.dart';
+import 'package:flutter/services.dart';
+
+import '../../logging.dart';
+
+const _methodChannel = const MethodChannel('send-intent');
+
+Future getBinaryDir() async {
+ final _dir = await _methodChannel.invokeMethod('getBinaryDir');
+
+ final _binDir = Directory(_dir);
+ final _bins = _binDir.listSync(recursive: true);
+
+ return _dir;
+}
+
+Future getBinaryPath(final String name) async {
+ final _binaryDir = await getBinaryDir();
+ return _binaryDir + '/' + name;
+}
diff --git a/cyberwow/lib/main.dart b/cyberwow/lib/main.dart
index a6a88fb..a249984 100644
--- a/cyberwow/lib/main.dart
+++ b/cyberwow/lib/main.dart
@@ -28,7 +28,6 @@ import 'dart:io';
import 'dart:async';
import 'config.dart' as config;
-import 'controller/process/deploy.dart' as process;
import 'controller/process/run.dart' as process;
import 'logging.dart';
import 'state.dart' as state;
@@ -118,14 +117,7 @@ class _CyberWOW_PageState extends State with WidgetsBindingObserv
Future buildStateMachine(final state.BlankState _blankState) async {
final loadingText = config.c.splash;
state.LoadingState _loadingState = await _blankState.next(loadingText);
-
-
- final binName = config.c.outputBin;
- final resourcePath = 'native/output/' + describeEnum(config.arch) + '/' + binName;
- final bundle = DefaultAssetBundle.of(context);
- final loading = process.deployBinary(bundle, resourcePath, binName);
-
- state.SyncingState _syncingState = await _loadingState.next(loading);
+ state.SyncingState _syncingState = await _loadingState.next();
final _initialIntent = await getInitialIntent();
final _userArgs = _initialIntent
@@ -141,7 +133,7 @@ class _CyberWOW_PageState extends State with WidgetsBindingObserv
final syncing = process
.runBinary
(
- binName,
+ config.c.outputBin,
input: inputStreamController.stream,
shouldExit: _isExiting,
userArgs: _userArgs,
diff --git a/cyberwow/lib/state/loading.dart b/cyberwow/lib/state/loading.dart
index fa19206..10d7357 100644
--- a/cyberwow/lib/state/loading.dart
+++ b/cyberwow/lib/state/loading.dart
@@ -19,6 +19,8 @@ along with CyberWOW. If not, see .
*/
+import 'package:shared_preferences/shared_preferences.dart';
+
import '../controller/helper.dart';
import '../config.dart' as config;
import '../logging.dart';
@@ -37,8 +39,7 @@ class LoadingState extends AppState {
syncState();
}
-
- Future next(final Stream loadingProgress) async {
+ Future next() async {
Future showBanner() async {
List chars = [];
banner.runes.forEach((int rune) {
@@ -54,20 +55,12 @@ class LoadingState extends AppState {
await Future.delayed(const Duration(seconds: 2), () => "1");
}
- Future load() async {
- log.fine("Loading next");
- await for (final line in loadingProgress) {
- // append(line);
- log.info(line);
- }
- }
+ SharedPreferences _prefs = await SharedPreferences.getInstance();
+ final _bannerShown = await _prefs.getBool(config.bannerShownKey);
- final outputBinExists = await binaryExists(config.c.outputBin);
- if (outputBinExists) {
- await load();
- }
- else {
- await Future.wait([load(), showBanner()]);
+ if (_bannerShown == null) {
+ await showBanner();
+ _prefs.setBool(config.bannerShownKey, true);
}
SyncingState _next = SyncingState(appHook);
diff --git a/cyberwow/pubspec.lock b/cyberwow/pubspec.lock
index 9773afb..1a5481f 100644
--- a/cyberwow/pubspec.lock
+++ b/cyberwow/pubspec.lock
@@ -67,6 +67,11 @@ packages:
description: flutter
source: sdk
version: "0.0.0"
+ flutter_web_plugins:
+ dependency: transitive
+ description: flutter
+ source: sdk
+ version: "0.0.0"
http:
dependency: "direct main"
description:
@@ -158,6 +163,34 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.5"
+ shared_preferences:
+ dependency: "direct main"
+ description:
+ name: shared_preferences
+ url: "https://pub.dartlang.org"
+ source: hosted
+ version: "0.5.6+1"
+ shared_preferences_macos:
+ dependency: transitive
+ description:
+ name: shared_preferences_macos
+ url: "https://pub.dartlang.org"
+ source: hosted
+ version: "0.0.1+4"
+ shared_preferences_platform_interface:
+ dependency: transitive
+ description:
+ name: shared_preferences_platform_interface
+ url: "https://pub.dartlang.org"
+ source: hosted
+ version: "1.0.1"
+ shared_preferences_web:
+ dependency: transitive
+ description:
+ name: shared_preferences_web
+ url: "https://pub.dartlang.org"
+ source: hosted
+ version: "0.1.2+3"
sky_engine:
dependency: transitive
description: flutter
@@ -228,4 +261,4 @@ packages:
version: "3.5.0"
sdks:
dart: ">=2.4.0 <3.0.0"
- flutter: ">=0.1.4 <2.0.0"
+ flutter: ">=1.12.13+hotfix.4 <2.0.0"
diff --git a/cyberwow/pubspec.yaml b/cyberwow/pubspec.yaml
index f12072c..447d4f2 100644
--- a/cyberwow/pubspec.yaml
+++ b/cyberwow/pubspec.yaml
@@ -14,6 +14,7 @@ dependencies:
http: ^0.12.0
logging: ^0.11.3
intl: ^0.16.0
+ shared_preferences: ^0.5.6
dev_dependencies:
flutter_test:
@@ -24,8 +25,6 @@ flutter:
uses-material-design: true
assets:
- - native/output/x86_64/wownerod
- - native/output/arm64/wownerod
- assets/wownero_symbol.png
fonts: