From b48ad6a49bbd8907a5d446ad8feefef7e61fe2de Mon Sep 17 00:00:00 2001 From: Sarah Jamie Lewis Date: Wed, 27 Jan 2021 13:21:08 -0800 Subject: [PATCH] Unlock for Android --- .../com/example/flutter_app/MainActivity.kt | 16 ++++++++++------ lib/cwtch/gomobile.dart | 4 ++-- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/android/app/src/main/kotlin/com/example/flutter_app/MainActivity.kt b/android/app/src/main/kotlin/com/example/flutter_app/MainActivity.kt index bdb1330..6c1c92d 100644 --- a/android/app/src/main/kotlin/com/example/flutter_app/MainActivity.kt +++ b/android/app/src/main/kotlin/com/example/flutter_app/MainActivity.kt @@ -71,11 +71,11 @@ class MainActivity: FlutterActivity() { Log.i("MainActivity.kt", "got event chan: " + eventbus_chan + " launching corouting...") GlobalScope.launch(Dispatchers.IO) { while(true) { - val jsonEvent = Cwtch.getAppBusEvent() - Log.i("MainActivity.kt", "got appbusEvent: " + jsonEvent) - launch(Dispatchers.Main) { - eventbus_chan.invokeMethod("AppbusEvent", jsonEvent) - } + //val jsonEvent = Cwtch.getAppBusEvent() + // Log.i("MainActivity.kt", "got appbusEvent: " + jsonEvent) + // launch(Dispatchers.Main) { + // //eventbus_chan.invokeMethod("AppbusEvent", jsonEvent) + //} } } @@ -90,8 +90,12 @@ class MainActivity: FlutterActivity() { val pass = (call.argument("pass") as? String) ?: ""; Cwtch.createProfile(nick, pass) } + "LoadProfiles" -> { + val pass = (call.argument("pass") as? String) ?: ""; + Cwtch.loadProfiles(pass) + } "GetProfiles" -> result.success(Cwtch.getProfiles()) - "ACNEvents" -> result.success(Cwtch.acnEvents()) + // "ACNEvents" -> result.success(Cwtch.acnEvents()) "ContactEvents" -> result.success(Cwtch.contactEvents()) "GetContacts" -> { val onion = (call.argument("profile") as? String) ?: ""; diff --git a/lib/cwtch/gomobile.dart b/lib/cwtch/gomobile.dart index bd976fa..0570d66 100644 --- a/lib/cwtch/gomobile.dart +++ b/lib/cwtch/gomobile.dart @@ -32,8 +32,8 @@ class CwtchGomobile implements Cwtch { androidHomeDirectory = getApplicationDocumentsDirectory(); androidLibraryDir = appInfoPlatform.invokeMethod('getNativeLibDir'); - final appbusEventChannel = MethodChannel(appbusEventChannelName); - appbusEventChannel.setMethodCallHandler(this._handleAppbusEvent); + // final appbusEventChannel = MethodChannel(appbusEventChannelName); + // appbusEventChannel.setMethodCallHandler(this._handleAppbusEvent); } Future Start() async {