diff --git a/apps/app_seeds/lib/ui/avatar.dart b/apps/app_seeds/lib/ui/avatar.dart index e816286..29d9461 100644 --- a/apps/app_seeds/lib/ui/avatar.dart +++ b/apps/app_seeds/lib/ui/avatar.dart @@ -1,29 +1,19 @@ 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: +/// the NIP-01 kind:0 `picture`), in one of two shapes: /// - `data:image/jpeg;base64,…` — a tiny photo thumbnail (rides inline, no /// media server, like offer photos); -/// - `tane:seed:` — one of our own seed illustrations (for people who'd -/// rather not put a real photo — pseudonymity stays the default); /// - empty — a DiceBear "thumbs" face generated deterministically from the pubkey. +/// +/// A legacy `tane:seed:` value (a seed illustration, no longer offered in +/// the picker) is still rendered for anyone who set one before; see +/// [avatarGlyphChar]. 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 = [ - 'jars', - 'sack', - 'jar', - 'scattered', - 'pouring', - 'mug', - 'bigSpoon', - 'smallSpoon', -]; - -/// The glyph char for an avatar illustration [name], or null if unknown. +/// The glyph char for a legacy seed-illustration [name], or null if unknown. +/// Retained only to render `tane:seed:` avatars stored before the picker dropped +/// them; new avatars are photos or the generated default. String? avatarGlyphChar(String name) => switch (name) { 'jars' => SeedGlyphs.jars, 'sack' => SeedGlyphs.sack, @@ -35,6 +25,3 @@ String? avatarGlyphChar(String name) => switch (name) { 'smallSpoon' => SeedGlyphs.smallSpoon, _ => null, }; - -/// The token that selects illustration [name] (e.g. `tane:seed:jars`). -String avatarGlyphToken(String name) => '$avatarGlyphPrefix$name'; diff --git a/apps/app_seeds/lib/ui/avatar_edit.dart b/apps/app_seeds/lib/ui/avatar_edit.dart index 8a839b5..294dd34 100644 --- a/apps/app_seeds/lib/ui/avatar_edit.dart +++ b/apps/app_seeds/lib/ui/avatar_edit.dart @@ -2,16 +2,14 @@ import 'package:flutter/material.dart'; import '../i18n/strings.g.dart'; import '../services/offer_thumbnail.dart' show offerThumbnailDataUri; -import 'avatar.dart'; import 'photo_pick.dart'; -import 'seed_glyph.dart'; import 'theme.dart'; /// Lets the user choose a profile avatar: take/pick a photo (shrunk to a tiny -/// inline thumbnail), pick one of our seed illustrations, or remove it. +/// inline thumbnail) or remove it. With no photo, a generated avatar is used. /// -/// Returns the new avatar value (`data:` thumbnail or `tane:seed:`), -/// an empty string to clear it, or null when cancelled. +/// Returns the new avatar value (a `data:` photo thumbnail), an empty string to +/// clear it (falls back to the generated avatar), or null when cancelled. Future showAvatarPicker( BuildContext context, { required String current, @@ -46,29 +44,6 @@ Future showAvatarPicker( } }, ), - const SizedBox(height: 6), - Text(t.avatar.illustration, - style: const TextStyle(color: seedMuted, fontSize: 13)), - const SizedBox(height: 10), - Wrap( - spacing: 14, - runSpacing: 14, - children: [ - for (final name in avatarGlyphNames) - InkWell( - key: Key('avatar.glyph.$name'), - borderRadius: BorderRadius.circular(40), - onTap: () => Navigator.of(sheetContext) - .pop(avatarGlyphToken(name)), - child: CircleAvatar( - radius: 24, - backgroundColor: seedGreen, - child: SeedGlyph(avatarGlyphChar(name)!, - size: 26, color: Colors.white), - ), - ), - ], - ), if (current.isNotEmpty) ...[ const SizedBox(height: 8), Align( diff --git a/apps/app_seeds/test/ui/peer_avatar_test.dart b/apps/app_seeds/test/ui/peer_avatar_test.dart index 6d89dc7..a19e9e4 100644 --- a/apps/app_seeds/test/ui/peer_avatar_test.dart +++ b/apps/app_seeds/test/ui/peer_avatar_test.dart @@ -9,12 +9,11 @@ import '../support/test_support.dart'; void main() { group('avatar value scheme', () { - test('every offered illustration maps to a glyph; unknown → null', () { - for (final name in avatarGlyphNames) { - expect(avatarGlyphChar(name), isNotNull, reason: name); - } + test('legacy seed-illustration names still map to a glyph; unknown → null', + () { + expect(avatarGlyphChar('jars'), isNotNull); + expect(avatarGlyphChar('sack'), isNotNull); expect(avatarGlyphChar('nope'), isNull); - expect(avatarGlyphToken('jars'), 'tane:seed:jars'); }); });