From a03a665a6689a96bff47e9b3c7b222582d4891a6 Mon Sep 17 00:00:00 2001 From: erinn Date: Thu, 17 Jun 2021 16:03:54 -0700 Subject: [PATCH] remove deprecated methods --- .../kotlin/im/cwtch/flwtch/FlwtchWorker.kt | 17 ---------- lib/cwtch/cwtch.dart | 6 ---- lib/cwtch/ffi.dart | 34 ------------------- lib/cwtch/gomobile.dart | 16 --------- lib/views/messageview.dart | 6 ---- 5 files changed, 79 deletions(-) diff --git a/android/app/src/main/kotlin/im/cwtch/flwtch/FlwtchWorker.kt b/android/app/src/main/kotlin/im/cwtch/flwtch/FlwtchWorker.kt index b0b2f60..50b94d5 100644 --- a/android/app/src/main/kotlin/im/cwtch/flwtch/FlwtchWorker.kt +++ b/android/app/src/main/kotlin/im/cwtch/flwtch/FlwtchWorker.kt @@ -112,11 +112,6 @@ class FlwtchWorker(context: Context, parameters: WorkerParameters) : val pass = (a.get("pass") as? String) ?: "" Cwtch.loadProfiles(pass) } - "NumMessages" -> { - val profile = (a.get("profile") as? String) ?: "" - val handle = (a.get("contact") as? String) ?: "" - return Result.success(Data.Builder().putLong("result", Cwtch.numMessages(profile, handle)).build()) - } "GetMessage" -> { val profile = (a.get("profile") as? String) ?: "" val handle = (a.get("contact") as? String) ?: "" @@ -124,13 +119,6 @@ class FlwtchWorker(context: Context, parameters: WorkerParameters) : Log.i("FlwtchWorker.kt", "indexI = $indexI") return Result.success(Data.Builder().putString("result", Cwtch.getMessage(profile, handle, indexI.toLong())).build()) } - "GetMessages" -> { - val profile = (a.get("profile") as? String) ?: "" - val handle = (a.get("contact") as? String) ?: "" - val start = (a.get("start") as? Long) ?: 0 - val end = (a.get("end") as? Long) ?: 0 - return Result.success(Data.Builder().putString("result", Cwtch.getMessages(profile, handle, start, end)).build()) - } "UpdateMessageFlags" -> { val profile = (a.get("profile") as? String) ?: "" val handle = (a.get("contact") as? String) ?: "" @@ -148,11 +136,6 @@ class FlwtchWorker(context: Context, parameters: WorkerParameters) : val handle = (a.get("handle") as? String) ?: "" Cwtch.blockContact(profile, handle) } - "DebugResetContact" -> { - val profile = (a.get("ProfileOnion") as? String) ?: "" - val handle = (a.get("handle") as? String) ?: "" - Cwtch.debugResetContact(profile, handle) - } "SendMessage" -> { val profile = (a.get("ProfileOnion") as? String) ?: "" val handle = (a.get("handle") as? String) ?: "" diff --git a/lib/cwtch/cwtch.dart b/lib/cwtch/cwtch.dart index bd31cd1..6d9a303 100644 --- a/lib/cwtch/cwtch.dart +++ b/lib/cwtch/cwtch.dart @@ -28,18 +28,12 @@ abstract class Cwtch { void AcceptContact(String profileOnion, String contactHandle); // ignore: non_constant_identifier_names void BlockContact(String profileOnion, String contactHandle); - // ignore: non_constant_identifier_names - void DebugResetContact(String profileOnion, String contactHandle); - // ignore: non_constant_identifier_names - Future NumMessages(String profile, String handle); // ignore: non_constant_identifier_names Future GetMessage(String profile, String handle, int index); // ignore: non_constant_identifier_names void UpdateMessageFlags(String profile, String handle, int index, int flags); // ignore: non_constant_identifier_names - Future GetMessages(String profile, String handle, int start, int end); - // ignore: non_constant_identifier_names void SendMessage(String profile, String handle, String message); // ignore: non_constant_identifier_names void SendInvitation(String profile, String handle, String target); diff --git a/lib/cwtch/ffi.dart b/lib/cwtch/ffi.dart index 0ee6416..b56799f 100644 --- a/lib/cwtch/ffi.dart +++ b/lib/cwtch/ffi.dart @@ -194,17 +194,6 @@ class CwtchFfi implements Cwtch { LoadProfiles(ut8pass, ut8pass.length); } - // ignore: non_constant_identifier_names - Future NumMessages(String profile, String handle) async { - var numMessagesC = library.lookup>("c_NumMessages"); - // ignore: non_constant_identifier_names - final NumMessages = numMessagesC.asFunction(); - final utf8profile = profile.toNativeUtf8(); - final utf8handle = handle.toNativeUtf8(); - int num = NumMessages(utf8profile, utf8profile.length, utf8handle, utf8handle.length); - return num; - } - // ignore: non_constant_identifier_names Future GetMessage(String profile, String handle, int index) async { var getMessageC = library.lookup>("c_GetMessage"); @@ -217,18 +206,6 @@ class CwtchFfi implements Cwtch { return jsonMessage; } - // ignore: non_constant_identifier_names - Future GetMessages(String profile, String handle, int start, int end) async { - var getMessagesC = library.lookup>("c_GetMessages"); - // ignore: non_constant_identifier_names - final GetMessages = getMessagesC.asFunction(); - final utf8profile = profile.toNativeUtf8(); - final utf8handle = handle.toNativeUtf8(); - Pointer jsonMessagesBytes = GetMessages(utf8profile, utf8profile.length, utf8handle, utf8handle.length, start, end); - String jsonMessages = jsonMessagesBytes.toDartString(); - return jsonMessages; - } - @override // ignore: non_constant_identifier_names void SendProfileEvent(String onion, String json) { @@ -272,17 +249,6 @@ class CwtchFfi implements Cwtch { BlockContact(u1, u1.length, u2, u2.length); } - @override - // ignore: non_constant_identifier_names - void DebugResetContact(String profileOnion, String contactHandle) { - var debugResetContact = library.lookup>("c_DebugResetContact"); - // ignore: non_constant_identifier_names - final DebugResetContact = debugResetContact.asFunction(); - final u1 = profileOnion.toNativeUtf8(); - final u2 = contactHandle.toNativeUtf8(); - DebugResetContact(u1, u1.length, u2, u2.length); - } - @override // ignore: non_constant_identifier_names void SendMessage(String profileOnion, String contactHandle, String message) { diff --git a/lib/cwtch/gomobile.dart b/lib/cwtch/gomobile.dart index a44ec5d..06e3a05 100644 --- a/lib/cwtch/gomobile.dart +++ b/lib/cwtch/gomobile.dart @@ -86,22 +86,12 @@ class CwtchGomobile implements Cwtch { cwtchPlatform.invokeMethod("DeleteProfile", {"onion": onion, "pass": pass}); } - // ignore: non_constant_identifier_names - Future NumMessages(String profile, String handle) { - return cwtchPlatform.invokeMethod("NumMessages", {"profile": profile, "contact": handle}); - } - // ignore: non_constant_identifier_names Future GetMessage(String profile, String handle, int index) { print("gomobile.dart GetMessage " + index.toString()); return cwtchPlatform.invokeMethod("GetMessage", {"profile": profile, "contact": handle, "index": index}); } - // ignore: non_constant_identifier_names - Future GetMessages(String profile, String handle, int start, int end) { - return cwtchPlatform.invokeMethod("GetMessage", {"profile": profile, "contact": handle, "start": start, "end": end}); - } - @override // ignore: non_constant_identifier_names void SendProfileEvent(String onion, String jsonEvent) { @@ -129,12 +119,6 @@ class CwtchGomobile implements Cwtch { cwtchPlatform.invokeMethod("BlockContact", {"ProfileOnion": profileOnion, "handle": contactHandle}); } - @override - // ignore: non_constant_identifier_names - void DebugResetContact(String profileOnion, String contactHandle) { - cwtchPlatform.invokeMethod("DebugResetContact", {"ProfileOnion": profileOnion, "handle": contactHandle}); - } - @override // ignore: non_constant_identifier_names void SendMessage(String profileOnion, String contactHandle, String message) { diff --git a/lib/views/messageview.dart b/lib/views/messageview.dart index f9496b5..c1498e1 100644 --- a/lib/views/messageview.dart +++ b/lib/views/messageview.dart @@ -67,12 +67,6 @@ class _MessageViewState extends State { return true; } - void _debugResetContact() { - Provider.of(context, listen: false) - .cwtch - .DebugResetContact(Provider.of(context, listen: false).profileOnion, Provider.of(context, listen: false).onion); - } - void _pushContactSettings() { Navigator.of(context).push(MaterialPageRoute( builder: (BuildContext bcontext) {