Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Chat-NG]: Room messages UI implementation #2388

Merged
merged 17 commits into from
Dec 6, 2024

Conversation

gtalha07
Copy link
Contributor

@gtalha07 gtalha07 commented Nov 27, 2024

  • provider for handling when to show avatar based on messages.
  • message bubble widget for message content rendering.
  • cover basic content types rendering .i.e. text, image, file etc.
  • tests coverage: includes unit test for shouldShowAvatarProvider and copied image message test from older chat version to chat-ng version with updated objects.

Simple previews of messages list with UI:

Mobile:

Screen.Recording.2024-12-04.at.17.02.42.mov

Desktop

Screen.Recording.2024-12-04.at.17.10.07.mov

Copy link

codecov bot commented Nov 27, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 27.26%. Comparing base (cbb17df) to head (a21626c).
Report is 46 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2388      +/-   ##
==========================================
- Coverage   27.42%   27.26%   -0.17%     
==========================================
  Files         635      645      +10     
  Lines       43061    43480     +419     
==========================================
+ Hits        11808    11853      +45     
- Misses      31253    31627     +374     
Flag Coverage Δ
integration-test 36.88% <ø> (-0.01%) ⬇️
unittest 19.51% <ø> (-0.12%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@gtalha07 gtalha07 marked this pull request as ready for review December 4, 2024 12:31
@gtalha07 gtalha07 requested a review from gnunicorn December 4, 2024 12:43
case 'm.room.message':
return _buildMsgEventItem(roomId, messageId, item, isUser, showAvatar);
case 'm.room.redaction':
return ChatBubble(
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the new UI wrapper implemented for message events inner content. Rest of the implementation is same and copied from old chat widgets.

import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:phosphor_flutter/phosphor_flutter.dart';

class ImageMessageEvent extends ConsumerWidget {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The inner implementation is same except that we now access MsgContent and identifiers directly instead of old types.Message

import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:path/path.dart' as p;

class FileMessageEvent extends ConsumerWidget {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as explained in ImageMessageEvent comment.

import 'package:flutter_gen/gen_l10n/l10n.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';

class VideoMessageEvent extends ConsumerWidget {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as explained in ImageMessageEvent file comment

Copy link
Contributor

@gnunicorn gnunicorn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just some minor structural things

Comment on lines 17 to 37
'm.room.encrypted',
'm.policy.rule.room',
'm.policy.rule.server',
'm.policy.rule.user',
'm.room.aliases',
'm.room.avatar',
'm.room.canonical_alias',
'm.room.create',
'm.room.encryption',
'm.room.guest.access',
'm.room.history_visibility',
'm.room.join.rules',
'm.room.name',
'm.room.pinned_events',
'm.room.power_levels',
'm.room.server_acl',
'm.room.third_party_invite',
'm.room.tombstone',
'm.room.topic',
'm.space.child',
'm.space.parent',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd rather we don't add them here until we have a proper support. Like showing a "has changed the topic to XYZ" ... Let's not do the same mistake of just doing brush-of-a-stroke not-really-thought-through rendering please ... rather keep them off screen until we have decent support...

@gtalha07 gtalha07 merged commit 3849fc0 into acterglobal:main Dec 6, 2024
21 of 23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants