Skip to content

Commit d9a5bdd

Browse files
committed
Scope heart rendering fix to standalone reactions and validate on iOS
Signed-off-by: Tom Brow <[email protected]>
1 parent 57d7692 commit d9a5bdd

9 files changed

Lines changed: 77 additions & 306 deletions

File tree

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ import '../../shared/custom_emoji/custom_emoji_provider.dart';
2727
import '../../shared/custom_emoji/custom_emoji_render.dart';
2828
import '../../shared/emoji/emoji_data_provider.dart';
2929
import '../../shared/emoji/emoji_only.dart';
30-
import '../../shared/emoji/native_emoji_md.dart';
3130
import 'channels_provider.dart';
3231
import 'media_viewer_page.dart';
3332
import 'message_content/link_normalizer.dart';

‎mobile/lib/features/channels/message_content/inline_components.dart‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ List<MarkdownComponent> _useMessageInlineComponents({
6363
channelNames: inputs.channelNames,
6464
onChannelTap: channelTap,
6565
),
66-
NativeEmojiMd(finalContent),
6766
...MarkdownComponent.inlineComponents,
6867
],
6968
[inputs],

‎mobile/lib/shared/emoji/native_emoji_glyph.dart‎

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
import 'package:flutter/foundation.dart';
22
import 'package:flutter/material.dart';
33

4-
import 'native_emoji_style.dart';
5-
64
/// A standalone system emoji whose visual centre matches its surrounding UI.
75
///
86
/// Apple's emoji glyphs sit slightly low inside Flutter's text box. Keep the
@@ -33,7 +31,13 @@ class NativeEmojiGlyph extends StatelessWidget {
3331
maxLines: 1,
3432
softWrap: false,
3533
textScaler: TextScaler.noScaling,
36-
style: nativeEmojiTextStyle.copyWith(fontSize: size, height: 1),
34+
// Inter contains a monochrome heart, so emoji fonts must take priority.
35+
style: TextStyle(
36+
fontFamily: 'Apple Color Emoji',
37+
fontFamilyFallback: const ['Noto Color Emoji', 'Segoe UI Emoji'],
38+
fontSize: size,
39+
height: 1,
40+
),
3741
);
3842
if (defaultTargetPlatform == TargetPlatform.iOS) {
3943
glyph = Transform.translate(offset: const Offset(0, -1), child: glyph);

‎mobile/lib/shared/emoji/native_emoji_md.dart‎

Lines changed: 0 additions & 50 deletions
This file was deleted.

‎mobile/lib/shared/emoji/native_emoji_style.dart‎

Lines changed: 0 additions & 10 deletions
This file was deleted.

‎mobile/test/features/channels/reaction_row_test.dart‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,25 @@ class _FakeUserCacheNotifier extends UserCacheNotifier {
9595

9696
void main() {
9797
group('ReactionRow', () {
98+
testWidgets(
99+
'heart reactions prefer a color font without recoloring counts',
100+
(tester) async {
101+
await _pumpRow(tester, reactions: [_reaction(emoji: '❤️', count: 5)]);
102+
final heart = tester.widget<Text>(find.text('❤️'));
103+
final count = tester.widget<Text>(find.text('5'));
104+
expect(heart.style?.fontFamily, 'Apple Color Emoji');
105+
expect(heart.style?.fontFamilyFallback, [
106+
'Noto Color Emoji',
107+
'Segoe UI Emoji',
108+
]);
109+
expect(count.style?.fontFamily, 'Inter');
110+
expect(
111+
tester.getSize(find.byKey(const ValueKey('reaction-pill-❤️'))).height,
112+
28,
113+
);
114+
},
115+
);
116+
98117
testWidgets('shows the count even at one, matching desktop', (
99118
tester,
100119
) async {

‎mobile/test/shared/emoji/native_emoji_md_test.dart‎

Lines changed: 0 additions & 91 deletions
This file was deleted.

‎mobile/test/visual/heart_rendering_test.dart‎

Lines changed: 0 additions & 150 deletions
This file was deleted.

0 commit comments

Comments
 (0)