mirror of
https://github.com/block/buzz.git
synced 2026-12-01 05:32:24 +00:00
## Summary Unify mobile conversations in Messages with All / Solo / Team filters, a collapsing header, and separate Search, New, and default-agent shortcuts. Move workspace actions into the community menu and keep collapsed sections intact across filters. Align Inbox and list typography, spacing, and muted controls. Preserve native glass layering through navigation and give every filtered list enough clearance above the footer. The default-agent shortcut reads the shared encrypted preference and opens an existing chat immediately. When unset, it opens Agents; a star action selects the default through a production signed, self-encrypted preference writer. Save failures remain visible and retryable. Android now uses rounded navigation controls and filters, optically balanced search icons, and expanding New/community menus with leading Tabler icons matching iOS. Preset avatars retain transparent WebM animation through an Android WebView renderer, with lifecycle pausing and poster fallback. ### Related issue None found in searches for mobile navigation issues and open PRs. ### Testing - Android follow-up: ARM64 debug build, Dart analysis, and emulator checks passed for menu placement, selection, icon alignment, search, and avatar playback/pause/resume. The avatar implementation passed 3,840 Flutter tests and native Android tests before subsequent styling iterations. Automated tests for the later menu/icon iterations were skipped at the author’s request; those earlier results do not cover the final styling changes. - Mobile formatting/analysis and full test suite (3,838 passed, 23 skipped, plus 4 push-configuration tests); regression journey covers filtering, collapse retention, and scrolling the last Solo row above the footer. - iPhone 18 Pro simulator (Honeycomb): filters, menus, Inbox, Invite/Back, Switch Community, and default-agent chat/Back exercised. iOS release build and Pairing Preview install/launch passed during iteration, preserving the saved profile. - P1 follow-up: production writer-to-reader widget journey covers selection, publish failure/retry, and the unset footer opening Agents. Simulator Agents open/close passes; its saved community has no selectable agents, so live selection was not verified there. - Independent agent review completed; its Solo footer-clearance finding is fixed. The final clearance adjustment is covered by widget tests; physical-device acceptance of that adjustment and hosted CI remain pending. Final Messages layout:  Switcher layering during iteration (before → after): | Before: filter edge showing through | After: Home hidden behind switcher | | --- | --- | |  |  | --------- Signed-off-by: kenny lopez <klopez4212@gmail.com> Co-authored-by: Terp <5856f6900e8e0a4e0ea1f4f8d2ee33e4753d2119bc122f94ecafc660b46c0511@buzz.block.builderlab.xyz>
120 lines
3.8 KiB
Dart
120 lines
3.8 KiB
Dart
import 'dart:async';
|
|
|
|
import 'package:flutter/foundation.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter_hooks/flutter_hooks.dart';
|
|
import 'package:video_player/video_player.dart';
|
|
|
|
import '../animated_avatar.dart';
|
|
import 'avatar_image.dart';
|
|
import 'android_transparent_avatar.dart';
|
|
|
|
/// Plays the transparent video paired with a bundled character poster.
|
|
class PresetAgentAvatar extends HookWidget {
|
|
const PresetAgentAvatar({
|
|
super.key,
|
|
required this.imageUrl,
|
|
required this.size,
|
|
required this.fallback,
|
|
});
|
|
|
|
final String imageUrl;
|
|
final double size;
|
|
final Widget fallback;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final poster = parseAnimatedAvatarUrl(imageUrl)?.posterUrl ?? imageUrl;
|
|
final uri = Uri.tryParse(poster);
|
|
final canPlay =
|
|
RegExp(
|
|
r'^/avatars/[A-Za-z0-9_-]+/poster/[A-Za-z0-9_-]+/[A-Za-z0-9_-]+\.png$',
|
|
).hasMatch(uri?.path ?? '') &&
|
|
uri?.host == 'dwwgwmfqqjotj.cloudfront.net' &&
|
|
!MediaQuery.disableAnimationsOf(context);
|
|
final isIos = defaultTargetPlatform == TargetPlatform.iOS;
|
|
final isAndroid = defaultTargetPlatform == TargetPlatform.android;
|
|
final videoUrl = canPlay
|
|
? uri!.replace(
|
|
path: uri.path
|
|
.replaceFirst('/poster/', isIos ? '/hevc/' : '/webm/')
|
|
.replaceFirst(RegExp(r'\.png$'), isIos ? '.mp4' : '.webm'),
|
|
)
|
|
: null;
|
|
final controller = useMemoized(
|
|
() => videoUrl == null || isAndroid
|
|
? null
|
|
: VideoPlayerController.networkUrl(
|
|
videoUrl,
|
|
// Let AVPlayerLayer composite HEVC alpha directly on iOS.
|
|
viewType: isIos
|
|
? VideoViewType.platformView
|
|
: VideoViewType.textureView,
|
|
videoPlayerOptions: VideoPlayerOptions(mixWithOthers: true),
|
|
),
|
|
[videoUrl, isAndroid],
|
|
);
|
|
final ready = useState<VideoPlayerController?>(null);
|
|
final lifecycle = useAppLifecycleState();
|
|
final playing =
|
|
TickerMode.valuesOf(context).enabled &&
|
|
(lifecycle == null || lifecycle == AppLifecycleState.resumed);
|
|
useEffect(() {
|
|
if (controller == null) return null;
|
|
var active = true;
|
|
Future<void> initialize() async {
|
|
try {
|
|
await controller.initialize();
|
|
if (!active) return;
|
|
await controller.setVolume(0);
|
|
await controller.setLooping(true);
|
|
if (!active) return;
|
|
ready.value = controller;
|
|
} catch (_) {
|
|
// Keep the poster if the video is unavailable or unsupported.
|
|
}
|
|
}
|
|
|
|
unawaited(initialize());
|
|
return () {
|
|
active = false;
|
|
unawaited(controller.dispose().catchError((Object _) {}));
|
|
};
|
|
}, [controller]);
|
|
useEffect(() {
|
|
if (controller != null && ready.value == controller) {
|
|
unawaited(
|
|
(playing ? controller.play() : controller.pause()).catchError((
|
|
Object _,
|
|
) {
|
|
if (context.mounted && ready.value == controller) {
|
|
ready.value = null;
|
|
}
|
|
}),
|
|
);
|
|
}
|
|
return null;
|
|
}, [controller, ready.value, playing]);
|
|
|
|
return SizedBox.square(
|
|
dimension: size,
|
|
child: Transform.scale(
|
|
scale: animatedAvatarArtworkScale,
|
|
child: isAndroid && videoUrl != null
|
|
? AndroidTransparentAvatar(
|
|
key: ValueKey(videoUrl),
|
|
url: videoUrl,
|
|
playing: playing,
|
|
fallback: AvatarImageContent(
|
|
imageUrl: poster,
|
|
fallback: fallback,
|
|
),
|
|
)
|
|
: controller != null && ready.value == controller
|
|
? VideoPlayer(controller)
|
|
: AvatarImageContent(imageUrl: poster, fallback: fallback),
|
|
),
|
|
);
|
|
}
|
|
}
|