IndexFailure + Android Change Password Fixups

This commit is contained in:
Sarah Jamie Lewis 2021-12-19 12:44:04 -08:00
parent d13ded8f50
commit a6743af103
2 changed files with 9 additions and 22 deletions

View File

@ -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()

View File

@ -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) {