feat(profile): profile photo or seed-illustration avatar
Profiles had only a coloured-initial disc. Now each person can set an avatar — a real photo OR one of our own seed illustrations (so pseudonymity stays the default; no photo required). - ui/avatar.dart: the one-string value scheme carried in the kind:0 'picture' — a 'data:' photo thumbnail, a 'tane:seed:<glyph>' token, or empty. The Nostr ProfileTransport already published 'picture'. - Photos ride inline as a tiny thumbnail (reuses offerThumbnailDataUri, 24 KB cap) — no media server, like offer photos. - avatar_edit.dart: pick/take a photo, choose a seed illustration, or remove; ProfileStore stores it; ProfileScreen shows a big editable avatar and publishes it. - PeerAvatar renders photo / illustration / initial fallback. - ProfileCache gains picture/setPicture; the inbox caches peers' avatars alongside their names. - i18n avatar block (en/es/pt/ast). Tests: value scheme + PeerAvatar render modes, store + cache round-trips. Follow-up: render peers' avatars in chat/market/your-people (thread the cached picture into PeerAvatar at each call site).
This commit is contained in:
parent
74c7edaecd
commit
ec56819fbf
19 changed files with 375 additions and 12 deletions
|
|
@ -15,6 +15,14 @@ void main() {
|
|||
expect(await cache.name('abc'), 'Alicia');
|
||||
});
|
||||
|
||||
test('picture caches independently of name', () async {
|
||||
final cache = ProfileCache(InMemorySecretStore());
|
||||
expect(await cache.picture('abc'), isNull);
|
||||
await cache.setPicture('abc', ' tane:seed:jars ');
|
||||
expect(await cache.picture('abc'), 'tane:seed:jars');
|
||||
expect(await cache.name('abc'), isNull); // name untouched
|
||||
});
|
||||
|
||||
test('shortPubkey abbreviates long keys, keeps short ones', () {
|
||||
expect(shortPubkey('abcdef1234567890'), 'abcdef…7890');
|
||||
expect(shortPubkey('short'), 'short');
|
||||
|
|
|
|||
|
|
@ -17,4 +17,10 @@ void main() {
|
|||
expect(await store.name(), 'Alicia');
|
||||
expect(await store.about(), 'tomate rosa');
|
||||
});
|
||||
|
||||
test('avatar defaults empty and round-trips', () async {
|
||||
expect(await store.avatar(), '');
|
||||
await store.save(name: 'A', about: '', avatar: 'tane:seed:jars');
|
||||
expect(await store.avatar(), 'tane:seed:jars');
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue