watchvalue fixes

This commit is contained in:
Christien Rioux 2024-04-21 22:16:22 -04:00
parent 37b1717a71
commit 64d0019e6e
4 changed files with 20 additions and 16 deletions

View File

@ -96,6 +96,7 @@
"failed_to_accept": "Failed to accept contact invitation", "failed_to_accept": "Failed to accept contact invitation",
"failed_to_reject": "Failed to reject contact invitation", "failed_to_reject": "Failed to reject contact invitation",
"invalid_invitation": "Invalid invitation", "invalid_invitation": "Invalid invitation",
"try_again_online": "Invitation could not be reached, try again when online",
"protected_with_pin": "Contact invitation is protected with a PIN", "protected_with_pin": "Contact invitation is protected with a PIN",
"protected_with_password": "Contact invitation is protected with a password", "protected_with_password": "Contact invitation is protected with a password",
"invalid_pin": "Invalid PIN", "invalid_pin": "Invalid PIN",

View File

@ -23,13 +23,11 @@ class RenderStateElement {
if (!isLocal) { if (!isLocal) {
return null; return null;
} }
if (reconciled && sent) {
if (!reconciledOffline && !sentOffline) { if (sent && !sentOffline) {
return MessageSendState.delivered; return MessageSendState.delivered;
} }
return MessageSendState.sent; if (reconciled && !reconciledOffline) {
}
if (sent && !sentOffline) {
return MessageSendState.sent; return MessageSendState.sent;
} }
return MessageSendState.sending; return MessageSendState.sending;

View File

@ -224,8 +224,13 @@ class InvitationDialogState extends State<InvitationDialog> {
_validInvitation = null; _validInvitation = null;
widget.onValidationFailed(); widget.onValidationFailed();
}); });
} on VeilidAPIException { } on VeilidAPIException catch (e) {
final errorText = translate('invitation_dialog.invalid_invitation'); late final String errorText;
if (e is VeilidAPIExceptionTryAgain) {
errorText = translate('invitation_dialog.try_again_online');
} else {
errorText = translate('invitation_dialog.invalid_invitation');
}
if (mounted) { if (mounted) {
showErrorToast(context, errorText); showErrorToast(context, errorText);
} }

View File

@ -390,17 +390,17 @@ class DHTRecord {
// range we care about, don't pass it through // range we care about, don't pass it through
final overlappedFirstSubkey = overlappedSubkeys.firstSubkey; final overlappedFirstSubkey = overlappedSubkeys.firstSubkey;
final updateFirstSubkey = subkeys.firstSubkey; final updateFirstSubkey = subkeys.firstSubkey;
final updatedData = (overlappedFirstSubkey != null && if (overlappedFirstSubkey != null && updateFirstSubkey != null) {
updateFirstSubkey != null && final updatedData =
overlappedFirstSubkey == updateFirstSubkey) overlappedFirstSubkey == updateFirstSubkey ? data : null;
? data
: null;
// Report only watched subkeys // Report only watched subkeys
watchController?.add(DHTRecordWatchChange( watchController?.add(DHTRecordWatchChange(
local: local, data: updatedData, subkeys: overlappedSubkeys)); local: local, data: updatedData, subkeys: overlappedSubkeys));
} }
} }
} }
}
void _addLocalValueChange(Uint8List data, int subkey) { void _addLocalValueChange(Uint8List data, int subkey) {
_addValueChange( _addValueChange(