Skip to content

The ultimate harness for coding agents and beyond. All your agents. All your machines. One command center. Start with code, then follow your curiosity and build across disciplines: CAD, circuits, robots, games and music.

Swarm phone: agents' 👀 ✅ 🚀 reactions, and ✅ in the picker (#2211)

harness-for-autonomous[bot]62863f50a8f2
diff --git a/mobile/integration_test/swarm_reactions_shots_test.dart b/mobile/integration_test/swarm_reactions_shots_test.dart
index bb67e7568..b0912bed3 100644
--- a/mobile/integration_test/swarm_reactions_shots_test.dart
+++ b/mobile/integration_test/swarm_reactions_shots_test.dart
@@ -81,7 +81,18 @@ void main() {
).toUtc().toIso8601String(),
};
List<Map<String, dynamic>> page() => [
- message('m1', 1, 20, 'Where are we on the phone build?', author: me),
+ // Agents acknowledge as Slack bots do: River's ✅ on the question it
+ // answered, Jasper's 👀 on the plan it is starting.
+ message(
+ 'm1',
+ 1,
+ 20,
+ 'Where are we on the phone build?',
+ author: me,
+ reactions: {
+ 'check': [('agent', 'agent-lead')],
+ },
+ ),
message(
'm2',
2,
@@ -107,7 +118,15 @@ void main() {
'eyes': [('person', 'person-diego')],
},
),
- message('m4', 4, 33, 'I will ask you before we ship.'),
+ message(
+ 'm4',
+ 4,
+ 33,
+ 'Jasper: add ✅ to the phone picker next.',
+ reactions: {
+ 'eyes': [('agent', 'agent-jasper')],
+ },
+ ),
];
final fake = FakeSwarm();
diff --git a/mobile/lib/swarm/profile_model.dart b/mobile/lib/swarm/profile_model.dart
index 0443451e2..9c4493c72 100644
--- a/mobile/lib/swarm/profile_model.dart
+++ b/mobile/lib/swarm/profile_model.dart
@@ -112,13 +112,16 @@ const superTabStatusPresets = [
('🤒', 'Out sick'),
];
-/// The reactions a message can carry, in the order counts show.
+/// The reactions a message can carry, in the order counts show (backend
+/// REACTIONS). Agents acknowledge with the last three, as Slack bots do:
+/// 👀 started, ✅ done, 🚀 merged.
enum SuperTabReactionEmoji {
thumbsUp('thumbs_up', '👍'),
tada('tada', '🎉'),
heart('heart', '❤️'),
laugh('laugh', '😄'),
eyes('eyes', '👀'),
+ check('check', '✅'),
rocket('rocket', '🚀');
const SuperTabReactionEmoji(this.key, this.glyph);
diff --git a/mobile/lib/swarm/swarm_reactions.dart b/mobile/lib/swarm/swarm_reactions.dart
index 15d194c64..0a1950180 100644
--- a/mobile/lib/swarm/swarm_reactions.dart
+++ b/mobile/lib/swarm/swarm_reactions.dart
@@ -136,7 +136,7 @@ class _Count extends StatelessWidget {
}
/// Opens the reactions a message can carry in a sheet, with a light tap of
-/// the phone as a long-press gives: Desktop's six, the reader's own marked.
+/// the phone as a long-press gives: Desktop's seven, the reader's own marked.
/// Answers the one picked, or null when the sheet closed without one.
Future<SuperTabReactionEmoji?> showSwarmReactionPicker(
BuildContext context, {
@@ -190,36 +190,43 @@ class _Picker extends StatelessWidget {
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
+ // Seven at 50 points are wider than a 375-point phone's
+ // sheet: each shares the row, never under a finger's 44.
for (final emoji in SuperTabReactionEmoji.values)
- Semantics(
- button: true,
- selected: mine.contains(emoji),
- label:
- '${emoji.key.replaceAll('_', ' ')}'
- '${mine.contains(emoji) ? ', yours' : ''}',
- excludeSemantics: true,
- onTap: () => Navigator.of(context).pop(emoji),
- child: GestureDetector(
- key: ValueKey('swarm-react-${emoji.key}'),
- behavior: HitTestBehavior.opaque,
+ Flexible(
+ child: Semantics(
+ button: true,
+ selected: mine.contains(emoji),
+ label:
+ '${emoji.key.replaceAll('_', ' ')}'
+ '${mine.contains(emoji) ? ', yours' : ''}',
+ excludeSemantics: true,
onTap: () => Navigator.of(context).pop(emoji),
- child: Container(
- width: 50,
- height: 50,
- alignment: Alignment.center,
- decoration: BoxDecoration(
- color: mine.contains(emoji)
- ? accent.withValues(alpha: 0.18)
- : null,
- border: mine.contains(emoji)
- ? Border.all(color: accent)
- : null,
- shape: BoxShape.circle,
- ),
- child: Text(
- emoji.glyph,
- style: const TextStyle(
- fontSize: AppIconSize.standalone,
+ child: GestureDetector(
+ key: ValueKey('swarm-react-${emoji.key}'),
+ behavior: HitTestBehavior.opaque,
+ onTap: () => Navigator.of(context).pop(emoji),
+ child: Container(
+ constraints: const BoxConstraints(
+ maxWidth: 50,
+ minHeight: 50,
+ maxHeight: 50,
+ ),
+ alignment: Alignment.center,
+ decoration: BoxDecoration(
+ color: mine.contains(emoji)
+ ? accent.withValues(alpha: 0.18)
+ : null,
+ border: mine.contains(emoji)
+ ? Border.all(color: accent)
+ : null,
+ shape: BoxShape.circle,
+ ),
+ child: Text(
+ emoji.glyph,
+ style: const TextStyle(
+ fontSize: AppIconSize.standalone,
+ ),
),
),
),
diff --git a/mobile/test/swarm/swarm_reactions_test.dart b/mobile/test/swarm/swarm_reactions_test.dart
index 0d9480865..876598021 100644
--- a/mobile/test/swarm/swarm_reactions_test.dart
+++ b/mobile/test/swarm/swarm_reactions_test.dart
@@ -10,7 +10,7 @@ import 'swarm_fixture.dart';
import '../theme/sheet_shape.dart';
/// Emoji reactions on a Swarm message, as Desktop draws them (backend
-/// reactions.ts): the counts under it, the reader's own marked, and the six
+/// reactions.ts): the counts under it, the reader's own marked, and the seven
/// a long-press offers.
void main() {
group('the reaction counter', () {
@@ -190,6 +190,52 @@ void main() {
);
});
+ testWidgets("an agent's 👀 ✅ 🚀 show in that order, named by the agent; "
+ "an emoji this build does not know is skipped", (tester) async {
+ final semantics = tester.ensureSemantics();
+ await show(
+ tester,
+ SwarmReactionBar(
+ messageId: 'm1',
+ // In the server's order (backend REACTIONS), with one from a newer server.
+ reactions: counts({
+ 'eyes': [('agent', 'agent-lead')],
+ 'check': [('agent', 'agent-lead')],
+ 'skull': [('agent', 'agent-lead')],
+ 'rocket': [('agent', 'agent-lead')],
+ }),
+ readerId: me,
+ nameOf: nameOf,
+ onReact: (_) {},
+ ),
+ );
+
+ final keys = find.byWidgetPredicate(
+ (w) =>
+ w.key is ValueKey<String> &&
+ (w.key! as ValueKey<String>).value.startsWith('swarm-reaction-m1-'),
+ );
+ expect(
+ tester.widgetList(keys).map((w) => (w.key! as ValueKey<String>).value),
+ [
+ 'swarm-reaction-m1-eyes',
+ 'swarm-reaction-m1-check',
+ 'swarm-reaction-m1-rocket',
+ ],
+ );
+ expect(
+ tester.getSemantics(chip(SuperTabReactionEmoji.check)),
+ isSemantics(
+ label: '✅ 1, River',
+ isButton: true,
+ isEnabled: true,
+ isSelected: false,
+ hasTapAction: true,
+ ),
+ );
+ semantics.dispose();
+ });
+
testWidgets('a message with no reactions draws nothing', (tester) async {
await show(
tester,
@@ -248,10 +294,15 @@ void main() {
return picked;
}
- testWidgets("offers Desktop's six emoji with a light tap of the phone, "
+ testWidgets("offers Desktop's seven emoji with a light tap of the phone, "
"each a finger's size, and answers the one picked", (tester) async {
final picked = await open(tester, const []);
+ expect(
+ SuperTabReactionEmoji.values.map((e) => e.glyph).join(),
+ '👍🎉❤️😄👀✅🚀',
+ );
+
expect(haptics, ['HapticFeedbackType.lightImpact']);
for (final emoji in SuperTabReactionEmoji.values) {
final option = find.byKey(ValueKey('swarm-react-${emoji.key}'));
@@ -266,6 +317,25 @@ void main() {
expect(find.byKey(const ValueKey('swarm-react-rocket')), findsNothing);
});
+ testWidgets("fits all seven on a 375-point phone, each still a finger's "
+ 'size', (tester) async {
+ tester.view.physicalSize = const Size(375, 667);
+ tester.view.devicePixelRatio = 1;
+ addTearDown(tester.view.reset);
+ final picked = await open(tester, const []);
+
+ expect(tester.takeException(), isNull);
+ for (final emoji in SuperTabReactionEmoji.values) {
+ final option = find.byKey(ValueKey('swarm-react-${emoji.key}'));
+ expect(tester.getSize(option).width, greaterThanOrEqualTo(44));
+ expect(tester.getSize(option).height, greaterThanOrEqualTo(44));
+ expect(tester.getRect(option).right, lessThanOrEqualTo(375 - 16));
+ }
+ await tester.tap(find.byKey(const ValueKey('swarm-react-check')));
+ await tester.pumpAndSettle();
+ expect(await picked, SuperTabReactionEmoji.check);
+ });
+
testWidgets('dims the page as every sheet does, and draws each emoji at '
"an icon's size, 24 points", (tester) async {
final picked = await open(tester, const []);