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

refactor!(ui, llc): Attachments refactor. #1667

Merged
merged 12 commits into from
Sep 7, 2023
Merged

Conversation

xsahil03x
Copy link
Contributor

@xsahil03x xsahil03x commented Jul 11, 2023

Fixes: #1621, #1545

Before After
Screen.Recording.2023-07-11.at.3.59.26.PM.mov
New.Attachments.mov

@xsahil03x xsahil03x changed the base branch from develop to v7.0.0 July 12, 2023 10:08
@xsahil03x xsahil03x marked this pull request as ready for review July 26, 2023 20:38
@codecov-commenter
Copy link

codecov-commenter commented Jul 26, 2023

Codecov Report

Patch coverage: 38.70% and project coverage change: +0.07% 🎉

Comparison is base (0e93e12) 58.47% compared to head (eeb957f) 58.55%.
Report is 35 commits behind head on v7.0.0.

❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more.

Additional details and impacted files
@@            Coverage Diff             @@
##           v7.0.0    #1667      +/-   ##
==========================================
+ Coverage   58.47%   58.55%   +0.07%     
==========================================
  Files         290      310      +20     
  Lines       17652    17772     +120     
==========================================
+ Hits        10322    10406      +84     
- Misses       7330     7366      +36     
Files Changed Coverage Δ
packages/stream_chat/lib/src/client/client.dart 88.77% <ø> (ø)
...kages/stream_chat/lib/src/client/retry_policy.dart 100.00% <ø> (ø)
...ackages/stream_chat/lib/src/core/api/requests.dart 86.84% <ø> (ø)
...eam_chat/lib/src/core/error/stream_chat_error.dart 87.03% <ø> (ø)
...hat/lib/src/core/models/attachment_giphy_info.dart 0.00% <0.00%> (ø)
...ckages/stream_chat/lib/src/core/models/member.dart 61.11% <ø> (ø)
...tream_chat/lib/src/db/chat_persistence_client.dart 91.26% <ø> (ø)
packages/stream_chat/lib/src/ws/timer_helper.dart 100.00% <ø> (ø)
...rc/attachment/attachment_upload_state_builder.dart 20.73% <ø> (ø)
.../lib/src/attachment/attachment_widget_catalog.dart 0.00% <0.00%> (ø)
... and 93 more

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

Signed-off-by: xsahil03x <xdsahil@gmail.com>
Signed-off-by: xsahil03x <xdsahil@gmail.com>
Signed-off-by: xsahil03x <xdsahil@gmail.com>
Signed-off-by: xsahil03x <xdsahil@gmail.com>
Signed-off-by: xsahil03x <xdsahil@gmail.com>
Signed-off-by: xsahil03x <xdsahil@gmail.com>
Signed-off-by: xsahil03x <xdsahil@gmail.com>
Signed-off-by: xsahil03x <xdsahil@gmail.com>
@xsahil03x xsahil03x requested review from deven98 and kanat July 28, 2023 17:58
@xsahil03x xsahil03x changed the title refactor!(ui): Attachments refactor. refactor!(ui, llc): Attachments refactor. Jul 28, 2023
Signed-off-by: xsahil03x <xdsahil@gmail.com>
Signed-off-by: xsahil03x <xdsahil@gmail.com>
Comment on lines +99 to +100
// If the attachment contains titleLink but is not of type giphy, we
// consider it as a urlPreview.
Copy link
Contributor

Choose a reason for hiding this comment

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

This comment just duplicates the code below.
Could we put the reason why we're doing this instead (why we consider it as urlPreview)? 🙂

MediaType? get mimeType => name?.mimeType;
MediaType? get mediaType => name?.mediaType;
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this a breaking change?
Should we do the deprecation cycle before replacing it with mediaType?

/// {@template giphy_info}
/// A class that contains extra information about a Giphy attachment.
/// {@endtemplate}
class GiphyInfo {
Copy link
Contributor

Choose a reason for hiding this comment

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

Just curious if need Equatable here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

not needed. Used just to store some values.

extension GiphyInfoX on Attachment {
/// Returns the [GiphyInfo] for the given [type].
GiphyInfo? giphyInfo(GiphyInfoType type) {
final giphy = extraData['giphy'] as Map<String, Object?>?;
Copy link
Contributor

Choose a reason for hiding this comment

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

Could we extract 'giphy' as shared const or enum?
Is this the only place where we use hardcoded 'giphy' value?

Copy link
Contributor

Choose a reason for hiding this comment

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

Is this a breaking change?
It looks like this was an exported class.

@@ -256,7 +251,8 @@ class MessageInputMediaAttachments extends StatelessWidget {
height: 104,
child: ListView(
scrollDirection: Axis.horizontal,
padding: const EdgeInsets.symmetric(horizontal: 8),
padding: const EdgeInsets.symmetric(vertical: 2, horizontal: 8),
cacheExtent: 104 * 10, // Cache 10 items ahead.
Copy link
Contributor

Choose a reason for hiding this comment

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

Curious where the magic number 104 comes from

Copy link
Contributor Author

Choose a reason for hiding this comment

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

figma design

Copy link
Contributor

Choose a reason for hiding this comment

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

Is it a breaking change?

Comment on lines +104 to +116
// attachmentBuilders = {
// // Add all default builders
// 'image': (context, message, attachments) {
// final color = StreamChatTheme.of(context).colorTheme.borders;
// final border = RoundedRectangleBorder(
// side: attachmentBorderSide ?? BorderSide(color: color),
// borderRadius: attachmentBorderRadiusGeometry ?? BorderRadius.zero,
// );
//
// if (attachments.length > 1) {
// return WrapAttachmentWidget(
// attachmentShape: border,
// attachmentWidget: Material(
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we still need this commented out section?

Comment on lines -51 to +54
this.attachmentShape,
this.borderSide,
this.attachmentBorderSide,
this.borderRadiusGeometry,
this.attachmentBorderRadiusGeometry,
this.attachmentShape,
Copy link
Contributor

Choose a reason for hiding this comment

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

Possible breaking change?

Comment on lines +48 to +55
required this.video,
this.headers,
this.imageFormat = ImageFormat.PNG,
this.maxHeight = 0,
this.maxWidth = 0,
this.timeMs = 0,
this.quality = 10,
this.scale = 1.0,
Copy link
Contributor

Choose a reason for hiding this comment

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

Seems like a breaking change as well.

@xsahil03x
Copy link
Contributor Author

@kanat yes, this PR will be part of V7 of the SDK. We need to write migration guides and docs along with it.

# Conflicts:
#	packages/stream_chat_flutter/lib/src/fullscreen_media/full_screen_media.dart
#	packages/stream_chat_flutter/lib/src/fullscreen_media/full_screen_media_desktop.dart
#	packages/stream_chat_flutter/pubspec.yaml
Signed-off-by: Sahil Kumar <xdsahil@gmail.com>
Copy link
Contributor

@kanat kanat left a comment

Choose a reason for hiding this comment

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

LGTM

@xsahil03x xsahil03x merged commit 687475b into v7.0.0 Sep 7, 2023
6 checks passed
@xsahil03x xsahil03x deleted the refactor/attachments branch September 7, 2023 10:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants