mirror of
https://github.com/block/buzz.git
synced 2026-11-25 18:52:52 +00:00
## Summary - Simplify agent profiles with Message/Bestie actions, relay-authored published instructions (unavailable without a config channel), management details, public-key copying, and a separate final Delete section. - Sort the Agents directory by name and mark the selected Bestie with a muted filled star. - Place Model and Thinking together below Name. Use native iOS Liquid Glass menus and preserve selection callbacks as controls become enabled. Related: #8685. ## Validation Full mobile checks passed. Regression coverage includes relay-author filtering, unavailable instructions, metadata retry, resizing native pickers, accurate deletion state, selection after loading, and Bestie switching. Real iOS simulator taps verified both pickers; the user confirmed the earlier iPhone build works. Review fixes were checked with widget journeys and the native UIKit resize/selection probe. <details> <summary>Previews</summary> Synthetic fixture renders: | Profile | Create agent | Bestie card | | --- | --- | --- | |  |  |  | Native iOS simulator interaction with a synthetic catalog:  </details> --------- Signed-off-by: kenny lopez <klopez4212@gmail.com> Co-authored-by: Terp <5856f6900e8e0a4e0ea1f4f8d2ee33e4753d2119bc122f94ecafc660b46c0511@buzz.block.builderlab.xyz>
55 lines
1.6 KiB
Dart
55 lines
1.6 KiB
Dart
import 'dart:async';
|
|
import 'dart:convert';
|
|
|
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
|
import 'package:http/http.dart' as http;
|
|
|
|
final relayInformationClientProvider = Provider<http.Client>((ref) {
|
|
final client = http.Client();
|
|
ref.onDispose(client.close);
|
|
return client;
|
|
});
|
|
|
|
/// NIP-11 `self` identifies the relay signer; `pubkey` is only a contact key.
|
|
final relayAuthorProvider = FutureProvider.autoDispose.family<String?, String>((
|
|
ref,
|
|
relayUrl,
|
|
) async {
|
|
final source = Uri.parse(relayUrl);
|
|
final uri = source.replace(
|
|
scheme: switch (source.scheme) {
|
|
'wss' => 'https',
|
|
'ws' => 'http',
|
|
final scheme => scheme,
|
|
},
|
|
);
|
|
final client = ref.watch(relayInformationClientProvider);
|
|
final response = await client
|
|
.send(
|
|
http.Request('GET', uri)..headers['Accept'] = 'application/nostr+json',
|
|
)
|
|
.timeout(const Duration(seconds: 3));
|
|
final chunks = StreamIterator(
|
|
response.stream.timeout(const Duration(seconds: 3)),
|
|
);
|
|
final bytes = <int>[];
|
|
try {
|
|
if (response.statusCode != 200) return null;
|
|
await (() async {
|
|
while (await chunks.moveNext()) {
|
|
if (bytes.length + chunks.current.length > 256 * 1024) {
|
|
throw const FormatException('Relay information exceeds size limit');
|
|
}
|
|
bytes.addAll(chunks.current);
|
|
}
|
|
})().timeout(const Duration(seconds: 3));
|
|
} finally {
|
|
await chunks.cancel();
|
|
}
|
|
final info = jsonDecode(utf8.decode(bytes));
|
|
final author = info is Map ? info['self'] : null;
|
|
return author is String && RegExp(r'^[0-9a-f]{64}$').hasMatch(author)
|
|
? author
|
|
: null;
|
|
});
|