feat(block2): show contact names (resolve peers' published profiles)
Closes the profile loop — peers now appear by name, not a raw key. - ProfileCache: keystore-backed cache of peers' published display names (works offline) + shortPubkey() fallback. - Chat: the app bar shows the peer's name (cached first, then freshened from their kind:0 over the session); falls back to a short key. - Inbox: each conversation shows the cached name, and missing names are resolved over one session and cached. - Wired via DI + TaneApp(profileCache). Analyzer clean; ProfileCache covered by a plain test.
This commit is contained in:
parent
b96b6e45cc
commit
9cc1a5e171
7 changed files with 149 additions and 13 deletions
22
apps/app_seeds/test/services/profile_cache_test.dart
Normal file
22
apps/app_seeds/test/services/profile_cache_test.dart
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:tane/services/profile_cache.dart';
|
||||
|
||||
import '../support/test_support.dart';
|
||||
|
||||
void main() {
|
||||
test('unknown pubkey has no cached name', () async {
|
||||
final cache = ProfileCache(InMemorySecretStore());
|
||||
expect(await cache.name('abc'), isNull);
|
||||
});
|
||||
|
||||
test('setName then name round-trips (trimmed)', () async {
|
||||
final cache = ProfileCache(InMemorySecretStore());
|
||||
await cache.setName('abc', ' Alicia ');
|
||||
expect(await cache.name('abc'), 'Alicia');
|
||||
});
|
||||
|
||||
test('shortPubkey abbreviates long keys, keeps short ones', () {
|
||||
expect(shortPubkey('abcdef1234567890'), 'abcdef…7890');
|
||||
expect(shortPubkey('short'), 'short');
|
||||
});
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue