Skip to content

Commit 69107dc

Browse files
klopez4212Fast FizzPrincess Donut
authored
Polish mobile message threads and composer (#5645)
## Summary - refine mobile message metadata, search spacing, and Activity filter semantics - add channel-parity Latest navigation and stable tail following to threads - synchronize Android composer/keyboard geometry and keep Latest spacing stable across IME transitions ## Validation - `bin/just mobile-check` - `bin/just mobile-test` (1,276 tests) - Pixel 10 install/launch and channel/thread keyboard, Latest, tail, and back-navigation review - signed iPhone install/launch workflow ## Snapshots See the review snapshots below. --------- Signed-off-by: kenny lopez <[email protected]> Signed-off-by: Kenny Lopez <[email protected]> Signed-off-by: Princess Donut <b238ea756dee4d98afa5883fc7f1de61eeabe65bf700e3a5a5a80db5e42e2c2b@buzz.block.builderlab.xyz> Co-authored-by: Fast Fizz <2df81cb51f05a9d5387ef24d7b9ecb8fcdfcd1c70ffabc67061c9596e1b5b1c4@buzz.block.builderlab.xyz> Co-authored-by: Princess Donut <b238ea756dee4d98afa5883fc7f1de61eeabe65bf700e3a5a5a80db5e42e2c2b@buzz.block.builderlab.xyz>
1 parent 82f7ed1 commit 69107dc

29 files changed

Lines changed: 2644 additions & 1069 deletions

‎mobile/lib/features/activity/activity_page.dart‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,6 @@ class ActivityPage extends HookConsumerWidget {
113113
final readState = ref.watch(readStateProvider);
114114
final localState = ref.watch(inboxLocalStateProvider);
115115
final drafts = ref.watch(composeDraftsProvider);
116-
final dueReminderCount = ref.watch(dueReminderCountProvider);
117116
final allItems = ref.watch(inboxItemsProvider);
118117
final myPk = ref.watch(myPubkeyProvider);
119118

@@ -380,8 +379,6 @@ class ActivityPage extends HookConsumerWidget {
380379
actions: [
381380
_ActivityActionsPill(
382381
filter: filter.value,
383-
dueReminderCount: dueReminderCount,
384-
draftCount: drafts.length,
385382
unreadOnly: unreadOnly.value,
386383
unreadCount: unreadVisibleCount,
387384
onFilterChanged: (f) => filter.value = f,

‎mobile/lib/features/activity/activity_page/header_actions.dart‎

Lines changed: 2 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@ const _filterLabels = <InboxFilter, String>{
1313

1414
class _ActivityActionsPill extends StatelessWidget {
1515
final InboxFilter filter;
16-
final int dueReminderCount;
17-
final int draftCount;
1816
final bool unreadOnly;
1917
final int unreadCount;
2018
final ValueChanged<InboxFilter> onFilterChanged;
@@ -23,8 +21,6 @@ class _ActivityActionsPill extends StatelessWidget {
2321

2422
const _ActivityActionsPill({
2523
required this.filter,
26-
required this.dueReminderCount,
27-
required this.draftCount,
2824
required this.unreadOnly,
2925
required this.unreadCount,
3026
required this.onFilterChanged,
@@ -45,12 +41,7 @@ class _ActivityActionsPill extends StatelessWidget {
4541
child: Row(
4642
mainAxisSize: MainAxisSize.min,
4743
children: [
48-
_FilterMenuButton(
49-
filter: filter,
50-
dueReminderCount: dueReminderCount,
51-
draftCount: draftCount,
52-
onChanged: onFilterChanged,
53-
),
44+
_FilterMenuButton(filter: filter, onChanged: onFilterChanged),
5445
_InboxOptionsButton(
5546
unreadOnly: unreadOnly,
5647
unreadCount: unreadCount,
@@ -68,16 +59,9 @@ class _ActivityActionsPill extends StatelessWidget {
6859
/// inbox filter menu (`FILTER_OPTIONS`).
6960
class _FilterMenuButton extends StatelessWidget {
7061
final InboxFilter filter;
71-
final int dueReminderCount;
72-
final int draftCount;
7362
final ValueChanged<InboxFilter> onChanged;
7463

75-
const _FilterMenuButton({
76-
required this.filter,
77-
required this.dueReminderCount,
78-
required this.draftCount,
79-
required this.onChanged,
80-
});
64+
const _FilterMenuButton({required this.filter, required this.onChanged});
8165

8266
@override
8367
Widget build(BuildContext context) {
@@ -121,12 +105,6 @@ class _FilterMenuButton extends StatelessWidget {
121105
),
122106
),
123107
),
124-
if (entry.key == InboxFilter.reminders &&
125-
dueReminderCount > 0)
126-
_CountBadge(count: dueReminderCount)
127-
else if (entry.key == InboxFilter.drafts &&
128-
draftCount > 0)
129-
_CountBadge(count: draftCount),
130108
],
131109
),
132110
),
@@ -154,17 +132,6 @@ class _FilterMenuButton extends StatelessWidget {
154132
size: 16,
155133
color: navigationPrimaryForeground(context),
156134
),
157-
if (dueReminderCount > 0 || draftCount > 0) ...[
158-
const SizedBox(width: Grid.quarter),
159-
Container(
160-
width: 6,
161-
height: 6,
162-
decoration: BoxDecoration(
163-
shape: BoxShape.circle,
164-
color: context.colors.primary,
165-
),
166-
),
167-
],
168135
],
169136
),
170137
),
@@ -174,33 +141,6 @@ class _FilterMenuButton extends StatelessWidget {
174141
}
175142
}
176143

177-
class _CountBadge extends StatelessWidget {
178-
final int count;
179-
180-
const _CountBadge({required this.count});
181-
182-
@override
183-
Widget build(BuildContext context) {
184-
return Container(
185-
padding: const EdgeInsets.symmetric(
186-
horizontal: Grid.half + Grid.quarter,
187-
vertical: Grid.quarter,
188-
),
189-
decoration: BoxDecoration(
190-
color: navigationPrimaryForeground(context),
191-
borderRadius: BorderRadius.circular(Grid.xxs),
192-
),
193-
child: Text(
194-
'$count',
195-
style: context.textTheme.labelSmall?.copyWith(
196-
color: context.colors.onPrimary,
197-
fontWeight: FontWeight.w600,
198-
),
199-
),
200-
);
201-
}
202-
}
203-
204144
/// Overflow menu with the unread-only toggle and mark-all-read, mirroring
205145
/// desktop's inbox options popover.
206146
class _InboxOptionsButton extends StatelessWidget {

‎mobile/lib/features/activity/activity_page/inbox_row.dart‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ class _InboxRow extends HookConsumerWidget {
244244
nameColor: context.colors.onSurface,
245245
metadataColor: mutedColor,
246246
nameStyle: activityUsernameTextStyle,
247-
metadataStyle:
247+
timestampStyle:
248248
activityTimestampTextStyle,
249249
displayNameKey: ValueKey(
250250
'activity-author-${item.id}',
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import 'dart:math' show max;
2+
3+
import 'package:flutter/foundation.dart';
4+
import 'package:flutter/material.dart';
5+
6+
/// Android keeps the message viewport fixed while the IME animates. Only this
7+
/// small wrapper follows the frame-by-frame inset; timelines apply the final
8+
/// inset once metrics settle.
9+
class AndroidImeLift extends StatelessWidget {
10+
/// The composer subtree that follows the animated Android IME inset.
11+
final Widget child;
12+
13+
/// Creates a wrapper that lifts [child] without resizing its surrounding
14+
/// message viewport on Android.
15+
const AndroidImeLift({super.key, required this.child});
16+
17+
@override
18+
Widget build(BuildContext context) {
19+
if (!usesFixedAndroidImeViewport) return child;
20+
final imeBottom = MediaQuery.viewInsetsOf(context).bottom;
21+
final systemBottom = MediaQuery.viewPaddingOf(context).bottom;
22+
return Padding(
23+
// The composer already reserves [systemBottom]. Android's IME inset
24+
// includes that navigation area, so lifting by the full value leaves a
25+
// second safe-area gap above the keyboard.
26+
padding: EdgeInsets.only(bottom: max(0, imeBottom - systemBottom)),
27+
child: child,
28+
);
29+
}
30+
}
31+
32+
/// Whether channel and thread scaffolds should keep a fixed viewport while
33+
/// Android IME insets animate, with their composer lifted independently.
34+
bool get usesFixedAndroidImeViewport =>
35+
defaultTargetPlatform == TargetPlatform.android;

‎mobile/lib/features/channels/channel_detail_page.dart‎

Lines changed: 47 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import 'dart:async';
22
import 'dart:math' show min;
3-
import 'dart:ui';
43

54
import 'package:flutter/material.dart';
65
import 'package:flutter/rendering.dart' show ScrollDirection;
@@ -27,6 +26,7 @@ import '../profile/profile_provider.dart';
2726
import '../profile/user_cache_provider.dart';
2827
import '../profile/user_profile.dart';
2928
import '../forum/forum_posts_view.dart';
29+
import 'android_ime_lift.dart';
3030
import 'channel.dart';
3131
import 'channel_actions_sheet.dart';
3232
import 'channel_link_navigation.dart';
@@ -44,6 +44,8 @@ import 'date_formatters.dart';
4444
import 'day_divider.dart';
4545
import 'dm_channel_labels.dart';
4646
import 'ephemeral_channel_display.dart';
47+
import 'ime_metrics_settle_observer.dart';
48+
import 'latest_message_button.dart';
4749
import 'members_sheet.dart';
4850
import 'message_actions.dart';
4951
import 'message_long_press_region.dart';
@@ -298,6 +300,8 @@ class ChannelDetailPage extends HookConsumerWidget {
298300
}, [channel.id, readState.isReady, readTimestamp]);
299301

300302
return FrostedScaffold(
303+
resizeToAvoidBottomInset:
304+
!usesFixedAndroidImeViewport || resolvedChannel.isForum,
301305
appBar: FrostedAppBar(
302306
iconColor: context.colors.primary,
303307
titleContentHeight: appBarTitleContentHeight,
@@ -492,46 +496,48 @@ class ChannelDetailPage extends HookConsumerWidget {
492496
],
493497
),
494498
if (showsComposer)
495-
Align(
496-
alignment: Alignment.bottomCenter,
497-
child: ComposerDockSizeReporter(
498-
key: const ValueKey('channel-composer-dock'),
499-
onHeightChanged: (height) {
500-
if ((composerDockHeight.value - height).abs() < 0.5) return;
501-
composerDockHeight.value = height;
502-
},
503-
child: Column(
504-
mainAxisSize: MainAxisSize.min,
505-
children: [
506-
AnimatedSize(
507-
duration: MediaQuery.disableAnimationsOf(context)
508-
? Duration.zero
509-
: const Duration(milliseconds: 180),
510-
curve: Curves.easeOutCubic,
511-
alignment: Alignment.bottomCenter,
512-
child: typingEntries.isEmpty
513-
? const SizedBox.shrink()
514-
: ChannelTypingIndicator(entries: typingEntries),
515-
),
516-
ComposeBar(
517-
channelId: channel.id,
518-
channelName: resolvedChannel.isDm
519-
? ''
520-
: resolvedChannel.name,
521-
onSend:
522-
(
523-
content,
524-
mentionPubkeys, {
525-
mediaTags = const <List<String>>[],
526-
}) => sendMessage.call(
527-
channelId: channel.id,
528-
content: content,
529-
mentionPubkeys: mentionPubkeys,
530-
channel: resolvedChannel,
531-
mediaTags: mediaTags,
532-
),
533-
),
534-
],
499+
AndroidImeLift(
500+
child: Align(
501+
alignment: Alignment.bottomCenter,
502+
child: ComposerDockSizeReporter(
503+
key: const ValueKey('channel-composer-dock'),
504+
onHeightChanged: (height) {
505+
if ((composerDockHeight.value - height).abs() < 0.5) return;
506+
composerDockHeight.value = height;
507+
},
508+
child: Column(
509+
mainAxisSize: MainAxisSize.min,
510+
children: [
511+
AnimatedSize(
512+
duration: MediaQuery.disableAnimationsOf(context)
513+
? Duration.zero
514+
: const Duration(milliseconds: 180),
515+
curve: Curves.easeOutCubic,
516+
alignment: Alignment.bottomCenter,
517+
child: typingEntries.isEmpty
518+
? const SizedBox.shrink()
519+
: ChannelTypingIndicator(entries: typingEntries),
520+
),
521+
ComposeBar(
522+
channelId: channel.id,
523+
channelName: resolvedChannel.isDm
524+
? ''
525+
: resolvedChannel.name,
526+
onSend:
527+
(
528+
content,
529+
mentionPubkeys, {
530+
mediaTags = const <List<String>>[],
531+
}) => sendMessage.call(
532+
channelId: channel.id,
533+
content: content,
534+
mentionPubkeys: mentionPubkeys,
535+
channel: resolvedChannel,
536+
mediaTags: mediaTags,
537+
),
538+
),
539+
],
540+
),
535541
),
536542
),
537543
),

0 commit comments

Comments
 (0)