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_reject": "Failed to reject contact 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_password": "Contact invitation is protected with a password",
"invalid_pin": "Invalid PIN",

View File

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

View File

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

View File

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