|
|
@ -105,6 +105,14 @@ class CwtchNotifier { |
|
|
|
} |
|
|
|
profileCN.getProfile(data["ProfileOnion"])?.contactList.getContact(data["RemotePeer"])!.totalMessages++; |
|
|
|
profileCN.getProfile(data["ProfileOnion"])?.contactList.updateLastMessageTime(data["RemotePeer"], DateTime.now()); |
|
|
|
|
|
|
|
// We only ever see messages from authenticated peers. |
|
|
|
// If the contact is marked as offline then override this - can happen when the contact is removed from the front |
|
|
|
// end during syncing. |
|
|
|
if (profileCN.getProfile(data["ProfileOnion"])?.contactList.getContact(data["RemotePeer"])!.isOnline() == false) { |
|
|
|
profileCN.getProfile(data["ProfileOnion"])?.contactList.getContact(data["RemotePeer"])!.status = "Authenticated"; |
|
|
|
} |
|
|
|
|
|
|
|
break; |
|
|
|
case "PeerAcknowledgement": |
|
|
|
// We don't use these anymore, IndexedAcknowledgement is more suited to the UI front end... |
|
|
@ -118,6 +126,12 @@ class CwtchNotifier { |
|
|
|
try { |
|
|
|
var message = Provider.of<MessageMetadata>(key.currentContext!, listen: false); |
|
|
|
if (message == null) break; |
|
|
|
// We only ever see acks from authenticated peers. |
|
|
|
// If the contact is marked as offline then override this - can happen when the contact is removed from the front |
|
|
|
// end during syncing. |
|
|
|
if (profileCN.getProfile(data["ProfileOnion"])?.contactList.getContact(data["RemotePeer"])!.isOnline() == false) { |
|
|
|
profileCN.getProfile(data["ProfileOnion"])?.contactList.getContact(data["RemotePeer"])!.status = "Authenticated"; |
|
|
|
} |
|
|
|
message.ackd = true; |
|
|
|
} catch (e) { |
|
|
|
// ignore, we received an ack for a message that hasn't loaded onto the screen yet... |
|
|
@ -136,7 +150,7 @@ class CwtchNotifier { |
|
|
|
} else { |
|
|
|
// from me (already displayed - do not update counter) |
|
|
|
var idx = data["Signature"]; |
|
|
|
var key = profileCN.getProfile(data["ProfileOnion"])?.contactList.getContact(data["GroupID"])!.getMessageKey(idx); |
|
|
|
var key = profileCN.getProfile(data["ProfileOnion"])?.contactList.getContact(data["GroupID"])?.getMessageKey(idx); |
|
|
|
if (key == null) break; |
|
|
|
try { |
|
|
|
var message = Provider.of<MessageMetadata>(key.currentContext!, listen: false); |
|
|
@ -155,7 +169,7 @@ class CwtchNotifier { |
|
|
|
case "IndexedFailure": |
|
|
|
EnvironmentConfig.debugLog("IndexedFailure"); |
|
|
|
var idx = data["Index"]; |
|
|
|
var key = profileCN.getProfile(data["ProfileOnion"])?.contactList.getContact(data["RemotePeer"])!.getMessageKey(idx); |
|
|
|
var key = profileCN.getProfile(data["ProfileOnion"])?.contactList.getContact(data["RemotePeer"])?.getMessageKey(idx); |
|
|
|
try { |
|
|
|
var message = Provider.of<MessageMetadata>(key!.currentContext!, listen: false); |
|
|
|
message.error = true; |
|
|
@ -163,6 +177,20 @@ class CwtchNotifier { |
|
|
|
// ignore, we likely have an old key that has been replaced with an actual signature |
|
|
|
} |
|
|
|
break; |
|
|
|
case "SendMessageToPeerError": |
|
|
|
// from me (already displayed - do not update counter) |
|
|
|
EnvironmentConfig.debugLog("SendMessageToPeerError"); |
|
|
|
var idx = data["EventID"]; |
|
|
|
var key = profileCN.getProfile(data["ProfileOnion"])?.contactList.getContact(data["RemotePeer"])!.getMessageKey(idx); |
|
|
|
if (key == null) break; |
|
|
|
try { |
|
|
|
var message = Provider.of<MessageMetadata>(key.currentContext!, listen: false); |
|
|
|
if (message == null) break; |
|
|
|
message.error = true; |
|
|
|
} catch (e) { |
|
|
|
// ignore, we likely have an old key that has been replaced with an actual signature |
|
|
|
} |
|
|
|
break; |
|
|
|
case "SendMessageToGroupError": |
|
|
|
// from me (already displayed - do not update counter) |
|
|
|
EnvironmentConfig.debugLog("SendMessageToGroupError"); |
|
|
|