From a6743af103b1415d6d5cf33835bfc26e14ee4bb1 Mon Sep 17 00:00:00 2001 From: Sarah Jamie Lewis Date: Sun, 19 Dec 2021 12:44:04 -0800 Subject: [PATCH] IndexFailure + Android Change Password Fixups --- .../kotlin/im/cwtch/flwtch/FlwtchWorker.kt | 7 ++++++ lib/cwtch/cwtchNotifier.dart | 24 ++----------------- 2 files changed, 9 insertions(+), 22 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 ed5283d8..19965a88 100644 --- a/android/app/src/main/kotlin/im/cwtch/flwtch/FlwtchWorker.kt +++ b/android/app/src/main/kotlin/im/cwtch/flwtch/FlwtchWorker.kt @@ -180,6 +180,13 @@ class FlwtchWorker(context: Context, parameters: WorkerParameters) : val pass = (a.get("pass") as? String) ?: "" Cwtch.loadProfiles(pass) } + "ChangePassword" -> { + val profile = (a.get("ProfileOnion") as? String) ?: "" + val pass = (a.get("OldPass") as? String) ?: "" + val passNew = (a.get("NewPass") as? String) ?: "" + val passNew2 = (a.get("NewPassAgain") as? String) ?: "" + Cwtch.changePassword(profile, pass, passNew, passNew2) + } "GetMessage" -> { val profile = (a.get("ProfileOnion") as? String) ?: "" val conversation = a.getInt("conversation").toLong() diff --git a/lib/cwtch/cwtchNotifier.dart b/lib/cwtch/cwtchNotifier.dart index c284d08d..3c433904 100644 --- a/lib/cwtch/cwtchNotifier.dart +++ b/lib/cwtch/cwtchNotifier.dart @@ -229,14 +229,9 @@ class CwtchNotifier { EnvironmentConfig.debugLog("new message from group from yourself - this should not happen"); } break; - case "SendMessageToPeerError": - // Ignore dealt with by IndexedFailure - break; - case "SendMessageToGroupError": - // Ignore dealt with by IndexedFailure - break; case "IndexedFailure": - var contact = profileCN.getProfile(data["ProfileOnion"])?.contactList.findContact(data["RemotePeer"]); + var identifier = int.parse(data["ConversationID"]); + var contact = profileCN.getProfile(data["ProfileOnion"])?.contactList.getContact(identifier); var idx = int.parse(data["Index"]); var key = contact?.getMessageKeyOrFail(contact.identifier, idx); if (key != null) { @@ -315,21 +310,6 @@ class CwtchNotifier { }); profileCN.getProfile(data["ProfileOnion"])?.contactList.resort(); break; - case "SetPeerAttribute": - if (data["Key"] == "local.name") { - if (profileCN.getProfile(data["ProfileOnion"])?.contactList.getContact(data["RemotePeer"]) != null) { - profileCN.getProfile(data["ProfileOnion"])?.contactList.getContact(data["RemotePeer"])!.nickname = data["Data"]; - } - } else if (data["Key"] == "local.archived") { - if (profileCN.getProfile(data["ProfileOnion"])?.contactList.getContact(data["RemotePeer"]) != null) { - profileCN.getProfile(data["ProfileOnion"])?.contactList.getContact(data["RemotePeer"])!.isArchived = data["Data"] == "true"; - } - } else if (data["Key"] == "LastKnowSignature") { - // group syncing information that isn't relevant to the UI... - } else { - EnvironmentConfig.debugLog("unhandled set peer attribute event: ${data['Key']}"); - } - break; case "NewRetValMessageFromPeer": if (data["Path"] == "profile.name") { if (data["Data"].toString().trim().length > 0) {