Fix QR contact import replay guard, type fallback and rescan loops

- Pass the existing contact's advert timestamp (0 for new contacts) so the
  firmware replay guard does not drop the node's real adverts.
- Leave a missing/invalid QR type unset and fall back to the existing
  contact's type instead of rewriting repeaters/rooms as Companion.
- Show a failed state with Retry instead of reopening the camera, which
  rescanned the same QR and resent the frame in a loop.
- Keep the processing flag set after a successful import so the closing
  route cannot restart the camera, import again and pop twice.
This commit is contained in:
zjs81 committed 2026-09-27 12:04:05 -07:00
1 parent fba97b9628
commit 3c971705bd
5 files changed
+111 -19

No files matched your search

+4 -4
View File
@@ -21,24 +21,24 @@ void main() {
expect(result.type, 2);
});
test('missing type defaults to 1', () {
test('missing type is left unset', () {
final key = 'ab' * 32;
final result = parseContactQr(
'meshcore://contact/add?name=Bob&public_key=$key',
);
expect(result, isNotNull);
expect(result!.type, 1);
expect(result!.type, isNull);
});
test('garbage type falls back to 1', () {
test('garbage type is left unset', () {
final key = 'ab' * 32;
final result = parseContactQr(
'meshcore://contact/add?name=Bob&public_key=$key&type=nope',
);
expect(result, isNotNull);
expect(result!.type, 1);
expect(result!.type, isNull);
});
test('uppercase hex public key is accepted', () {