parent
85bb653980
commit
4f3b77f9f3
3 changed files with 16 additions and 12 deletions
4
.gitmodules
vendored
4
.gitmodules
vendored
|
|
@ -1,4 +1,4 @@
|
||||||
[submodule "gomuks"]
|
[submodule "gomuks"]
|
||||||
path = gomuks
|
path = gomuks
|
||||||
url = https://github.com/gomuks/gomuks
|
url = https://github.com/Henry-Hiles/gomuks
|
||||||
branch = main
|
branch = quad/chore/remove-root-set
|
||||||
|
|
|
||||||
2
gomuks
2
gomuks
|
|
@ -1 +1 @@
|
||||||
Subproject commit 0e06c7b74f96d3e29a8101893ca1921d13a90573
|
Subproject commit 9e45ee426cc8be0bfada269f4abc4957c30e994e
|
||||||
|
|
@ -54,8 +54,19 @@ import "package:path_provider/path_provider.dart";
|
||||||
class ClientController extends AsyncNotifier<int> {
|
class ClientController extends AsyncNotifier<int> {
|
||||||
@override
|
@override
|
||||||
Future<int> build() async {
|
Future<int> build() async {
|
||||||
final path = "${(await getApplicationSupportDirectory()).path}/gomuks";
|
if (Platform.isAndroid || Platform.isIOS) {
|
||||||
final handle = await init(path);
|
final env = {
|
||||||
|
"GOMUKS_ROOT": (await getApplicationSupportDirectory()).path,
|
||||||
|
"GOMUKS_CACHE_HOME": (await getApplicationCacheDirectory()).path,
|
||||||
|
};
|
||||||
|
for (final MapEntry(:key, :value) in env.entries) {
|
||||||
|
GomuksSetEnv(
|
||||||
|
key.toNativeUtf8().cast<Char>(),
|
||||||
|
value.toNativeUtf8().cast<Char>(),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
final handle = await Isolate.run(GomuksInit);
|
||||||
|
|
||||||
final callable =
|
final callable =
|
||||||
NativeCallable<
|
NativeCallable<
|
||||||
|
|
@ -152,13 +163,6 @@ class ClientController extends AsyncNotifier<int> {
|
||||||
throw Exception("GomuksStart returned error code $errorCode");
|
throw Exception("GomuksStart returned error code $errorCode");
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<int> init(String path) => Isolate.run(
|
|
||||||
() => GomuksInit(
|
|
||||||
((Platform.isAndroid || Platform.isIOS) ? path.toNativeUtf8() : nullptr)
|
|
||||||
.cast(),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
|
|
||||||
Future<dynamic> callGomuksMethod(
|
Future<dynamic> callGomuksMethod(
|
||||||
Map<String, dynamic> data,
|
Map<String, dynamic> data,
|
||||||
FutureOr<GomuksResponse> Function(int handle, GomuksBorrowedBuffer data)
|
FutureOr<GomuksResponse> Function(int handle, GomuksBorrowedBuffer data)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue