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
40
apps/app_seeds/lib/ui/avatar.dart
Normal file
40
apps/app_seeds/lib/ui/avatar.dart
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
import 'seed_glyph.dart';
|
||||
|
||||
/// A profile avatar is carried in one string (stored locally and published as
|
||||
/// the NIP-01 kind:0 `picture`), in one of three shapes:
|
||||
/// - `data:image/jpeg;base64,…` — a tiny photo thumbnail (rides inline, no
|
||||
/// media server, like offer photos);
|
||||
/// - `tane:seed:<name>` — one of our own seed illustrations (for people who'd
|
||||
/// rather not put a real photo — pseudonymity stays the default);
|
||||
/// - empty — the deterministic coloured disc with the name's initial.
|
||||
const avatarGlyphPrefix = 'tane:seed:';
|
||||
|
||||
/// The seed illustrations offered as ready-made avatars. Names are the stable
|
||||
/// storage key (appended to [avatarGlyphPrefix]); the glyphs already ship in
|
||||
/// [SeedGlyphs]. Order is the picker order.
|
||||
const avatarGlyphNames = <String>[
|
||||
'jars',
|
||||
'sack',
|
||||
'jar',
|
||||
'scattered',
|
||||
'pouring',
|
||||
'mug',
|
||||
'bigSpoon',
|
||||
'smallSpoon',
|
||||
];
|
||||
|
||||
/// The glyph char for an avatar illustration [name], or null if unknown.
|
||||
String? avatarGlyphChar(String name) => switch (name) {
|
||||
'jars' => SeedGlyphs.jars,
|
||||
'sack' => SeedGlyphs.sack,
|
||||
'jar' => SeedGlyphs.jar,
|
||||
'scattered' => SeedGlyphs.scattered,
|
||||
'pouring' => SeedGlyphs.pouring,
|
||||
'mug' => SeedGlyphs.mug,
|
||||
'bigSpoon' => SeedGlyphs.bigSpoon,
|
||||
'smallSpoon' => SeedGlyphs.smallSpoon,
|
||||
_ => null,
|
||||
};
|
||||
|
||||
/// The token that selects illustration [name] (e.g. `tane:seed:jars`).
|
||||
String avatarGlyphToken(String name) => '$avatarGlyphPrefix$name';
|
||||
Loading…
Add table
Add a link
Reference in a new issue