From 68d367cf234cedd59cc546356d76ec72141234a3 Mon Sep 17 00:00:00 2001 From: klopez4212 Date: Thu, 19 Nov 2026 16:38:55 +0000 Subject: [PATCH] fix(mobile): align channel indicators and Duo section menus (#9703) Align the mobile channel-list indicators to one trailing column. The unread dot stays at the right, with the temporary clock and mute indicator to its left when present. Duo's native menus for built-in and custom sections now place their ellipsis in the same 20-point slot while preserving the full 44-point tap target and native menu behavior. Validation: full mobile suite (5,098 passed, 71 skipped), 27 crypto tests, clean Flutter analysis, native UIKit menu geometry/hit-target checks, and a successful iOS release build. Installed on iPhone Air and Duo using existing saved state; inspected the Duo's native section-menu placement. Regression coverage checks row alignment, clock ordering, native bridge geometry, and the full menu hit area. --------- Signed-off-by: kenny lopez Co-authored-by: Terp <5856f6900e8e0a4e0ea1f4f8d2ee33e4753d2119bc122f94ecafc660b46c0511@buzz.block.builderlab.xyz> --- .../SettingMenuSelectionTests.swift | 16 +++++ .../channels/channels_page/channel_tile.dart | 39 ++++++----- .../channels/channels_page/sections.dart | 2 + .../widgets/ios_message_create_button.dart | 10 ++- .../features/channels/channels_page_test.dart | 67 +++++++++++++++++++ .../ios_message_create_button_test.dart | 35 ++++++++++ 6 files changed, 150 insertions(+), 19 deletions(-) create mode 100644 mobile/test/shared/widgets/ios_message_create_button_test.dart diff --git a/mobile/ios/NativeControlTests/SettingMenuSelectionTests.swift b/mobile/ios/NativeControlTests/SettingMenuSelectionTests.swift index 0f88c4f4ef..6450bd1b95 100644 --- a/mobile/ios/NativeControlTests/SettingMenuSelectionTests.swift +++ b/mobile/ios/NativeControlTests/SettingMenuSelectionTests.swift @@ -38,6 +38,22 @@ struct SettingMenuSelectionTests { precondition(merging.leftSurface.alpha == 1 && merging.rightSurface.alpha == 1) UIView.setAnimationsEnabled(true) + let aligned = NavigationGlassButtonPlatformView( + frame: CGRect(x: 0, y: 0, width: 44, height: 44), + viewIdentifier: 22, + arguments: ["plain": true, "icon": "more", "iconSize": 14, + "buttonCenterX": 34, "controlWidth": 20, "controlSize": 44, + "hitTargetWidth": 44, "hitTargetHeight": 44], + messenger: SettingMenuMessenger() + ) + let alignedButton = aligned.view().subviews.compactMap { $0 as? NavigationGlassButton }.first! + aligned.view().layoutIfNeeded() + precondition(alignedButton.center.x == 34) + for x in [CGFloat(1), 22, 43] { + let point = alignedButton.convert(CGPoint(x: x, y: 22), from: aligned.view()) + precondition(alignedButton.point(inside: point, with: nil)) + } + for deferred in [false, true] { let messenger = SettingMenuMessenger() let view = NavigationGlassButtonPlatformView( diff --git a/mobile/lib/features/channels/channels_page/channel_tile.dart b/mobile/lib/features/channels/channels_page/channel_tile.dart index 263fb17a35..2411e8730a 100644 --- a/mobile/lib/features/channels/channels_page/channel_tile.dart +++ b/mobile/lib/features/channels/channels_page/channel_tile.dart @@ -113,23 +113,6 @@ class _ChannelTile extends ConsumerWidget { ], ), ), - if (hasAttention) ...[ - const SizedBox(width: Grid.xxs), - // The dot is the only sign of this state, so name it for - // screen readers; it merges into the row's label. - Semantics( - label: 'Needs your attention', - child: Container( - key: ValueKey('channel-attention-dot-${channel.id}'), - width: 6, - height: 6, - decoration: BoxDecoration( - shape: BoxShape.circle, - color: context.colors.primary, - ), - ), - ), - ], if (channel.isEphemeral) ...[ const SizedBox(width: Grid.xxs), _EphemeralBadge(channel: channel), @@ -147,6 +130,28 @@ class _ChannelTile extends ConsumerWidget { ), ), ], + if (hasAttention) ...[ + const SizedBox(width: Grid.xxs), + // The dot is the only sign of this state, so name it for + // screen readers; it merges into the row's label. + Semantics( + label: 'Needs your attention', + child: SizedBox( + width: _kChannelIconSize, + child: Center( + child: Container( + key: ValueKey('channel-attention-dot-${channel.id}'), + width: 6, + height: 6, + decoration: BoxDecoration( + shape: BoxShape.circle, + color: context.colors.primary, + ), + ), + ), + ), + ), + ], if (!channel.isMember && !channel.isDm) Padding( padding: const EdgeInsets.only(right: Grid.xxs), diff --git a/mobile/lib/features/channels/channels_page/sections.dart b/mobile/lib/features/channels/channels_page/sections.dart index 2b64a7d34e..ce023ae2f6 100644 --- a/mobile/lib/features/channels/channels_page/sections.dart +++ b/mobile/lib/features/channels/channels_page/sections.dart @@ -156,6 +156,7 @@ class _CustomSectionHeader extends StatelessWidget { IosMessageCreateButton( key: ValueKey('section-menu-${section.id}'), icon: 'more', + trailingIconSlotWidth: _kChannelIconSize, accessibilityLabel: '${section.name} options', width: 44, height: 44, @@ -494,6 +495,7 @@ class _SectionHeader extends StatelessWidget { IosMessageCreateButton( key: ValueKey('sort-menu-$label'), icon: 'more', + trailingIconSlotWidth: _kChannelIconSize, accessibilityLabel: '$label options', width: 44, height: 44, diff --git a/mobile/lib/shared/widgets/ios_message_create_button.dart b/mobile/lib/shared/widgets/ios_message_create_button.dart index 02bc15aa21..ed4935d78e 100644 --- a/mobile/lib/shared/widgets/ios_message_create_button.dart +++ b/mobile/lib/shared/widgets/ios_message_create_button.dart @@ -26,6 +26,7 @@ class IosMessageCreateButton extends HookConsumerWidget { this.sectionTitles = const {}, this.icon = 'plus', this.iconSize, + this.trailingIconSlotWidth, this.foregroundColor, this.accessibilityLabel = 'Create', this.width = 64, @@ -50,6 +51,9 @@ class IosMessageCreateButton extends HookConsumerWidget { final String? avatarUrl, avatarInitial; final String icon; final double? iconSize; + + /// Right-aligned visual slot inside the unchanged full-width hit target. + final double? trailingIconSlotWidth; final Color? foregroundColor; final String accessibilityLabel; final double width, height; @@ -222,10 +226,12 @@ class IosMessageCreateButton extends HookConsumerWidget { ...content, 'plain': plain, 'fillWidth': fillWidth, - 'buttonCenterX': width / 2, + 'buttonCenterX': trailingIconSlotWidth == null + ? width / 2 + : width - trailingIconSlotWidth! / 2, 'controlWidth': mergingNavigation && navigationAxis == Axis.horizontal ? 112.0 - : width, + : trailingIconSlotWidth ?? width, 'mergingNavigation': mergingNavigation, 'menuAbove': mergingNavigation && diff --git a/mobile/test/features/channels/channels_page_test.dart b/mobile/test/features/channels/channels_page_test.dart index e8f81e98c8..5f41811012 100644 --- a/mobile/test/features/channels/channels_page_test.dart +++ b/mobile/test/features/channels/channels_page_test.dart @@ -623,6 +623,73 @@ void main() { ); }); + testWidgets( + 'unread dots align with trailing icons and follow the temporary clock', + (tester) async { + final temporary = Channel( + id: 'temporary', + name: 'temporary', + channelType: 'stream', + visibility: 'open', + description: '', + createdBy: 'abc', + createdAt: DateTime(2025), + memberCount: 1, + isMember: true, + ttlSeconds: 3600, + ); + await tester.pumpWidget( + buildTestable( + overrides: [ + channelsProvider.overrideWith( + () => _FakeNotifier( + [temporary, testChannels.first], + observedEventsByChannel: { + for (final id in ['temporary', testChannels.first.id]) + id: [ + _observed( + id: 'mention-$id', + createdAt: 20, + highPriority: true, + ), + ], + }, + ), + ), + readStateProvider.overrideWith( + () => _FakeReadStateNotifier( + const ReadStateState( + isReady: true, + pubkey: 'pk', + contexts: {}, + version: 0, + ), + ), + ), + ], + ), + ); + await tester.pumpAndSettle(); + final ellipsis = find.descendant( + of: find.byTooltip('Channels options'), + matching: find.byIcon(BuzzIcons.ellipsis), + ); + final clock = tester.getCenter( + find.byKey(const Key('channel-ephemeral-temporary')), + ); + final dot = tester.getCenter( + find.byKey(const ValueKey('channel-attention-dot-temporary')), + ); + final otherDot = tester.getCenter( + find.byKey(ValueKey('channel-attention-dot-${testChannels.first.id}')), + ); + expect(dot.dx, closeTo(tester.getCenter(ellipsis).dx, 0.01)); + expect(dot.dx, closeTo(otherDot.dx, 0.01)); + expect(clock.dx, lessThan(dot.dx)); + expect(clock.dy, closeTo(dot.dy, 0.01)); + }, + ); + testWidgets('shows channel visibility icons and excludes Solo chats', ( tester, ) async { diff --git a/mobile/test/shared/widgets/ios_message_create_button_test.dart b/mobile/test/shared/widgets/ios_message_create_button_test.dart new file mode 100644 index 0000000000..fca9545559 --- /dev/null +++ b/mobile/test/shared/widgets/ios_message_create_button_test.dart @@ -0,0 +1,35 @@ +import 'package:buzz/shared/theme/theme.dart'; +import 'package:buzz/shared/widgets/ios_message_create_button.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:hooks_riverpod/hooks_riverpod.dart'; + +void main() { + testWidgets('trailing icon slot preserves the full native hit target', ( + tester, + ) async { + await tester.pumpWidget( + ProviderScope( + child: MaterialApp( + theme: AppTheme.light(), + home: const Scaffold( + body: IosMessageCreateButton( + icon: 'more', + width: 44, + height: 44, + trailingIconSlotWidth: 20, + actions: [], + ), + ), + ), + ), + ); + final view = tester.widget(find.byType(UiKitView)); + final params = view.creationParams as Map; + expect(tester.getSize(find.byType(UiKitView)), const Size(44, 44)); + expect(params['buttonCenterX'], 34); + expect(params['controlWidth'], 20); + expect(params['hitTargetWidth'], 44); + expect(params['hitTargetHeight'], 44); + }); +}