From 0ba6f013572d4806b45cada1ccec8d5a8318094f Mon Sep 17 00:00:00 2001 From: Sahil Kumar Date: Thu, 22 Jun 2023 14:30:17 +0530 Subject: [PATCH 01/54] chore(repo): bump example sdk constraints for `dart 3.0`. Signed-off-by: xsahil03x --- packages/stream_chat/example/pubspec.yaml | 6 +++--- packages/stream_chat_flutter/example/pubspec.yaml | 15 ++++----------- .../stream_chat_flutter_core/example/pubspec.yaml | 4 ++-- .../example/pubspec.yaml | 15 ++++----------- .../stream_chat_persistence/example/pubspec.yaml | 6 +++--- 5 files changed, 16 insertions(+), 30 deletions(-) diff --git a/packages/stream_chat/example/pubspec.yaml b/packages/stream_chat/example/pubspec.yaml index b8a852eb..dfedc5b2 100644 --- a/packages/stream_chat/example/pubspec.yaml +++ b/packages/stream_chat/example/pubspec.yaml @@ -5,14 +5,14 @@ publish_to: "none" version: 1.0.0+1 environment: - sdk: '>=2.17.0 <3.0.0' + sdk: '>=2.17.0 <4.0.0' flutter: ">=1.17.0" dependencies: - cupertino_icons: ^1.0.0 + cupertino_icons: ^1.0.5 flutter: sdk: flutter - stream_chat: ^6.0.0 + stream_chat: ^6.4.0 dev_dependencies: flutter_test: diff --git a/packages/stream_chat_flutter/example/pubspec.yaml b/packages/stream_chat_flutter/example/pubspec.yaml index 7e051f96..dfc36a08 100644 --- a/packages/stream_chat_flutter/example/pubspec.yaml +++ b/packages/stream_chat_flutter/example/pubspec.yaml @@ -18,7 +18,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev version: 1.0.0+1 environment: - sdk: '>=2.17.0 <3.0.0' + sdk: '>=2.17.0 <4.0.0' flutter: ">=1.17.0" dependencies: @@ -29,21 +29,14 @@ dependencies: flutter: sdk: flutter responsive_builder: ^0.7.0 - stream_chat_flutter: - path: ../ - stream_chat_localizations: - path: ../../stream_chat_localizations - stream_chat_persistence: - path: ../../stream_chat_persistence + stream_chat_flutter: ^6.4.0 + stream_chat_localizations: ^5.4.0 + stream_chat_persistence: ^6.4.0 dev_dependencies: flutter_test: sdk: flutter -dependency_overrides: - stream_chat_flutter: - path: ../ - # For information on the generic Dart part of this file, see the # following page: https://dart.dev/tools/pub/pubspec diff --git a/packages/stream_chat_flutter_core/example/pubspec.yaml b/packages/stream_chat_flutter_core/example/pubspec.yaml index 0abc0cdc..a67d6c9b 100644 --- a/packages/stream_chat_flutter_core/example/pubspec.yaml +++ b/packages/stream_chat_flutter_core/example/pubspec.yaml @@ -18,7 +18,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev version: 1.0.0+1 environment: - sdk: '>=2.17.0 <3.0.0' + sdk: '>=2.17.0 <4.0.0' flutter: ">=1.17.0" dependencies: @@ -27,7 +27,7 @@ dependencies: cupertino_icons: ^1.0.3 flutter: sdk: flutter - stream_chat_flutter_core: ^5.1.0 + stream_chat_flutter_core: ^6.4.0 dev_dependencies: flutter_test: diff --git a/packages/stream_chat_localizations/example/pubspec.yaml b/packages/stream_chat_localizations/example/pubspec.yaml index 5fcac8de..0d98bfa7 100644 --- a/packages/stream_chat_localizations/example/pubspec.yaml +++ b/packages/stream_chat_localizations/example/pubspec.yaml @@ -1,25 +1,18 @@ name: stream_chat_localizations_example description: A new Flutter project. -publish_to: 'none' +publish_to: 'none' version: 1.0.0+1 environment: - sdk: '>=2.17.0 <3.0.0' + sdk: '>=2.17.0 <4.0.0' dependencies: cupertino_icons: ^1.0.3 flutter: sdk: flutter - stream_chat_flutter: - path: ../../stream_chat_flutter - stream_chat_localizations: - path: ../ - - -dependency_overrides: - stream_chat_flutter: - path: ../../stream_chat_flutter + stream_chat_flutter: ^6.4.0 + stream_chat_localizations: ^5.4.0 dev_dependencies: flutter_test: diff --git a/packages/stream_chat_persistence/example/pubspec.yaml b/packages/stream_chat_persistence/example/pubspec.yaml index 80a35fc7..4f20ad85 100644 --- a/packages/stream_chat_persistence/example/pubspec.yaml +++ b/packages/stream_chat_persistence/example/pubspec.yaml @@ -5,15 +5,15 @@ publish_to: 'none' version: 1.0.0+1 environment: - sdk: '>=2.17.0 <3.0.0' + sdk: '>=2.17.0 <4.0.0' flutter: ">=1.17.0" dependencies: cupertino_icons: ^1.0.3 flutter: sdk: flutter - stream_chat: ^5.1.0 - stream_chat_persistence: ^5.1.0 + stream_chat: ^6.4.0 + stream_chat_persistence: ^6.4.0 dev_dependencies: flutter_test: From 13d9ad396123aec28216251b643800d384787df9 Mon Sep 17 00:00:00 2001 From: Sahil Kumar Date: Fri, 23 Jun 2023 17:17:08 +0530 Subject: [PATCH 02/54] feat(ui): Swipeable v2, migrate message widget. Signed-off-by: xsahil03x --- .../message_list_view/message_list_view.dart | 94 ++- .../misc/animated_circle_border_painter.dart | 72 +++ .../lib/src/misc/swipeable.dart | 547 ++++++++++++++---- 3 files changed, 565 insertions(+), 148 deletions(-) create mode 100644 packages/stream_chat_flutter/lib/src/misc/animated_circle_border_painter.dart diff --git a/packages/stream_chat_flutter/lib/src/message_list_view/message_list_view.dart b/packages/stream_chat_flutter/lib/src/message_list_view/message_list_view.dart index 8863c991..c1ad1b04 100644 --- a/packages/stream_chat_flutter/lib/src/message_list_view/message_list_view.dart +++ b/packages/stream_chat_flutter/lib/src/message_list_view/message_list_view.dart @@ -1,5 +1,7 @@ // ignore_for_file: lines_longer_than_80_chars import 'dart:async'; +import 'dart:math' as math; +import 'dart:ui'; import 'package:collection/collection.dart'; import 'package:flutter/material.dart'; @@ -10,6 +12,7 @@ import 'package:stream_chat_flutter/src/message_list_view/loading_indicator.dart import 'package:stream_chat_flutter/src/message_list_view/mlv_utils.dart'; import 'package:stream_chat_flutter/src/message_list_view/thread_separator.dart'; import 'package:stream_chat_flutter/src/message_list_view/unread_messages_separator.dart'; +import 'package:stream_chat_flutter/src/misc/animated_circle_border_painter.dart'; import 'package:stream_chat_flutter/src/misc/swipeable.dart'; import 'package:stream_chat_flutter/stream_chat_flutter.dart'; @@ -1226,26 +1229,6 @@ class _StreamMessageListViewState extends State { } var child = messageWidget; - if (!message.isDeleted && - !message.isSystem && - !message.isEphemeral && - widget.onMessageSwiped != null) { - child = Container( - decoration: const BoxDecoration(), - clipBehavior: Clip.hardEdge, - child: Swipeable( - onSwipeEnd: () { - FocusScope.of(context).unfocus(); - widget.onMessageSwiped?.call(message); - }, - backgroundIcon: StreamSvgIcon.reply( - color: _streamTheme.colorTheme.accentPrimary, - ), - child: child, - ), - ); - } - if (!initialMessageHighlightComplete && widget.highlightInitialMessage && isInitialMessage(message.id, streamChannel)) { @@ -1269,6 +1252,77 @@ class _StreamMessageListViewState extends State { ), ); } + + // Add swipeable if the callback is provided and the message is not deleted, + // system or ephemeral. + final onMessageSwiped = widget.onMessageSwiped; + if (onMessageSwiped != null && + !message.isDeleted && + !message.isSystem && + !message.isEphemeral) { + // The threshold after which the message is considered swiped. + const threshold = 0.2; + + // The direction in which the message can be swiped. + final swipeDirection = isMyMessage + ? SwipeDirection.endToStart // + : SwipeDirection.startToEnd; + + child = Swipeable( + key: ValueKey(message.id), + direction: swipeDirection, + swipeThreshold: threshold, + onSwiped: (_) => onMessageSwiped(message), + backgroundBuilder: (context, details) { + // The alignment of the swipe action. + final alignment = isMyMessage + ? Alignment.centerRight // + : Alignment.centerLeft; + + // The progress of the swipe action. + final progress = math.min(details.progress, threshold) / threshold; + + // The offset for the reply icon. + var offset = Offset.lerp( + const Offset(-24, 0), + const Offset(12, 0), + progress, + )!; + + // If the message is mine, we need to flip the offset. + if (isMyMessage) { + offset = Offset(-offset.dx, -offset.dy); + } + + return Align( + alignment: alignment, + child: Transform.translate( + offset: offset, + child: Opacity( + opacity: progress, + child: SizedBox.square( + dimension: 30, + child: CustomPaint( + painter: AnimatedCircleBorderPainter( + progress: progress, + color: _streamTheme.colorTheme.borders, + ), + child: Center( + child: StreamSvgIcon.reply( + size: lerpDouble(0, 18, progress), + color: _streamTheme.colorTheme.accentPrimary, + ), + ), + ), + ), + ), + ), + ); + }, + child: child, + ); + } + return child; } diff --git a/packages/stream_chat_flutter/lib/src/misc/animated_circle_border_painter.dart b/packages/stream_chat_flutter/lib/src/misc/animated_circle_border_painter.dart new file mode 100644 index 00000000..bd02678f --- /dev/null +++ b/packages/stream_chat_flutter/lib/src/misc/animated_circle_border_painter.dart @@ -0,0 +1,72 @@ +import 'dart:math' as math; + +import 'package:flutter/widgets.dart'; + +/// A custom painter that animates a circle border or fills it based on a +/// progress value. +/// +/// This painter draws a circle with a border that can be animated to fill the +/// circle or stroke its outline based on a given progress value. The progress +/// value is a double between 0.0 and 1.0, representing the completion of the +/// animation. +/// +/// When the progress is 0.0, the circle is completely empty, and when the +/// progress is 1.0, the circle is fully filled or stroked. +/// +/// The color of the arc/circle can be customized by providing a [color]. +/// +/// Example usage: +/// ```dart +/// AnimatedCircleBorderPainter painter = AnimatedCircleBorderPainter( +/// progress: 0.5, +/// color: Colors.blue, +/// ); +/// +/// CustomPaint( +/// painter: painter, +/// size: Size(200, 200), +/// // ... other properties +/// ) +/// ``` +class AnimatedCircleBorderPainter extends CustomPainter { + /// Creates an [AnimatedCircleBorderPainter] with the specified [progress] + /// and [color]. + const AnimatedCircleBorderPainter({ + required this.progress, + required this.color, + }); + + /// The progress of the animation, as a value between 0.0 and 1.0. + final double progress; + + /// The color of the arc/circle. + final Color color; + + @override + void paint(Canvas canvas, Size size) { + final style = progress == 1.0 ? PaintingStyle.fill : PaintingStyle.stroke; + + final arcPaint = Paint() + ..style = style + ..color = color + ..strokeWidth = 2.0 + ..strokeCap = StrokeCap.round; + + final radius = size.width / 2; + final center = Offset(size.width / 2, size.height / 2); + final sweepAngle = math.pi * 2 * progress; + + canvas.drawArc( + Rect.fromCircle(center: center, radius: radius), + -math.pi / 2, + sweepAngle, + false, + arcPaint, + ); + } + + @override + bool shouldRepaint(AnimatedCircleBorderPainter oldPainter) { + return oldPainter.progress != progress || oldPainter.color != color; + } +} diff --git a/packages/stream_chat_flutter/lib/src/misc/swipeable.dart b/packages/stream_chat_flutter/lib/src/misc/swipeable.dart index ded8520b..45b9b2dc 100644 --- a/packages/stream_chat_flutter/lib/src/misc/swipeable.dart +++ b/packages/stream_chat_flutter/lib/src/misc/swipeable.dart @@ -1,173 +1,464 @@ import 'dart:math' as math; +import 'package:flutter/gestures.dart'; import 'package:flutter/material.dart'; -import 'package:stream_chat_flutter/stream_chat_flutter.dart'; -/// {@template swipeable} -/// A swipeable tile in a list. Swiping on the tile will reveal actions that -/// can be taken. -/// {@endtemplate} -class Swipeable extends StatefulWidget { - /// {@macro swipeable} - const Swipeable({ - super.key, - required this.child, - required this.backgroundIcon, - this.onSwipeStart, - this.onSwipeCancel, - this.onSwipeEnd, - this.threshold = 82.0, - }); +/// Signature used by [swipeable] to indicate that it has been swiped in +/// the given `direction`. +/// +/// Used by [Swipeable.onSwiped]. +typedef SwipeDirectionCallback = void Function(SwipeDirection direction); - /// Child to make swipeable - final Widget child; +/// Signature for a function that builds a widget given the progress of the +/// dismissing action. +/// +/// Used by [Swipeable.backgroundBuilder]. +typedef BackgroundWidgetBuilder = Widget Function( + BuildContext context, + SwipeUpdateDetails details, +); - /// Background icon after swipe - final Widget backgroundIcon; +/// The direction in which a [Swipeable] can be swiped. +enum SwipeDirection { + /// The [Swipeable] can be swiped by dragging either left or right. + horizontal, - /// The action to perform when the swipe starts - final VoidCallback? onSwipeStart; + /// The [Swipeable] can be swiped by dragging in the reverse of the + /// reading direction (e.g., from right to left in left-to-right languages). + endToStart, - /// The action to perform when the swipe is cancelled - final VoidCallback? onSwipeCancel; + /// The [Swipeable] can be swiped by dragging in the reading direction + /// (e.g., from left to right in left-to-right languages). + startToEnd, - /// The action to perform when the swipe ends - final VoidCallback? onSwipeEnd; - - /// Threshold for swipe - final double threshold; - - @override - State createState() => _SwipeableState(); + /// The [Swipeable] cannot be swiped by dragging. + none } -class _SwipeableState extends State with TickerProviderStateMixin { - double _dragExtent = 0; - late AnimationController _moveController; - late AnimationController _iconMoveController; - late Animation _moveAnimation; - late Animation _iconTransitionAnimation; - late Animation _iconFadeAnimation; - bool _pastThreshold = false; +/// A widget that can be swiped in a specified direction. +/// +/// The `Swipeable` widget allows its child to be swiped by the user in a +/// specified direction. +/// +/// It provides options for customizing the swipe behavior, including the +/// ability to specify a background widget that appears during the swipe, +/// callbacks for handling swipe completion, and more. +/// +/// Example usage: +/// ```dart +/// Swipeable( +/// child: Container( +/// height: 100, +/// width: 200, +/// color: Colors.blue, +/// child: Center( +/// child: Text('Swipe me'), +/// ), +/// ), +/// backgroundBuilder: (context, details) { +/// final direction = details.direction; +/// return Container( +/// color: Colors.red, +/// child: Center( +/// child: Text( +/// direction == SwipeDirection.left ? 'Swipe left' : 'Swipe right', +/// style: TextStyle( +/// color: Colors.white, +/// fontWeight: FontWeight.bold, +/// ), +/// ), +/// ), +/// ); +/// }, +/// onSwiped: (direction) { +/// if (direction == SwipeDirection.left) { +/// // Handle left swipe +/// } else if (direction == SwipeDirection.right) { +/// // Handle right swipe +/// } +/// }, +/// direction: SwipeDirection.horizontal, +/// swipeThreshold: 0.4, +/// movementDuration: Duration(milliseconds: 200), +/// ) +/// ``` +class Swipeable extends StatefulWidget { + /// Creates a widget that can be swiped . + const Swipeable({ + required super.key, + required this.child, + this.backgroundBuilder, + this.onSwiped, + this.direction = SwipeDirection.horizontal, + this.swipeThreshold = 0.4, + this.movementDuration = const Duration(milliseconds: 200), + this.dragStartBehavior = DragStartBehavior.start, + this.behavior = HitTestBehavior.opaque, + }) : assert( + swipeThreshold >= 0.0 && swipeThreshold <= 1.0, + 'swipeThreshold must be between 0.0 and 1.0', + ); - final _animationDuration = const Duration(milliseconds: 200); + /// The widget below this widget in the tree. + /// + /// {@macro flutter.widgets.ProxyWidget.child} + final Widget child; + /// A widget that is stacked behind the child. If secondaryBackground is also + /// specified then this widget only appears when the child has been dragged + /// down or to the right. + final BackgroundWidgetBuilder? backgroundBuilder; + + /// Called when the widget has been successfully swiped based on the + /// [direction] and [swipeThreshold]. + final SwipeDirectionCallback? onSwiped; + + /// The direction in which the widget can be swiped. + final SwipeDirection direction; + + /// The offset threshold the item has to be dragged in order to be considered + /// swiped. + /// + /// Represented as a fraction, e.g. if it is 0.4 (the default), then the item + /// has to be dragged at least 40% towards one direction to be considered + /// swiped. + /// + /// See also: + /// + /// * [direction], which controls the directions in which the items can + /// be swiped. + final double swipeThreshold; + + /// Defines the duration for card to come back to original position. + final Duration movementDuration; + + /// Determines the way that drag start behavior is handled. + /// + /// If set to [DragStartBehavior.start], the drag gesture used to dismiss a + /// swipeable will begin at the position where the drag gesture won the + /// arena. + /// + /// If set to [DragStartBehavior.down] it will begin at the position where + /// a down event is first detected. + /// + /// In general, setting this to [DragStartBehavior.start] will make drag + /// animation smoother and setting it to [DragStartBehavior.down] will make + /// drag behavior feel slightly more reactive. + /// + /// By default, the drag start behavior is [DragStartBehavior.start]. + /// + /// See also: + /// + /// * [DragGestureRecognizer.dragStartBehavior], which gives an example for + /// the different behaviors. + final DragStartBehavior dragStartBehavior; + + /// How to behave during hit tests. + /// + /// This defaults to [HitTestBehavior.opaque]. + final HitTestBehavior behavior; + + @override + _SwipeableState createState() => _SwipeableState(); +} + +/// Details for [DismissUpdateCallback]. +/// +/// See also: +/// +/// * [swipeable.onUpdate], which receives this information. +class SwipeUpdateDetails { + /// Create a new instance of [SwipeUpdateDetails]. + SwipeUpdateDetails({ + this.direction = SwipeDirection.horizontal, + this.reached = false, + this.previousReached = false, + this.progress = 0.0, + }); + + /// The direction that the swipeable is being dragged. + final SwipeDirection direction; + + /// Whether the swipe threshold is currently reached. + final bool reached; + + /// Whether the swipe threshold was reached the last time this callback was + /// invoked. + /// + /// This can be used in conjunction with [SwipeUpdateDetails.reached] to catch + /// the moment that the [Swipeable] is dragged across the threshold. + final bool previousReached; + + /// The offset ratio of the swipeable in its parent container. + /// + /// A value of 0.0 represents the normal position and 1.0 means the child is + /// completely outside its parent. + /// + /// This can be used to synchronize other elements to what the swipeable is + /// doing on screen, e.g. using this value to set the opacity thereby fading + /// swipeable as it's dragged offscreen. + final double progress; +} + +class _SwipeableClipper extends CustomClipper { + _SwipeableClipper({ + required this.moveAnimation, + }) : super(reclip: moveAnimation); + + final Animation moveAnimation; + + @override + Rect getClip(Size size) { + final offset = moveAnimation.value.dx * size.width; + if (offset < 0) { + return Rect.fromLTRB(size.width + offset, 0, size.width, size.height); + } + return Rect.fromLTRB(0, 0, offset, size.height); + } + + @override + Rect getApproximateClipRect(Size size) => getClip(size); + + @override + bool shouldReclip(_SwipeableClipper oldClipper) { + return oldClipper.moveAnimation.value != moveAnimation.value; + } +} + +class _SwipeableState extends State + with SingleTickerProviderStateMixin, AutomaticKeepAliveClientMixin { @override void initState() { super.initState(); - _moveController = - AnimationController(duration: _animationDuration, vsync: this); - _iconMoveController = - AnimationController(duration: _animationDuration, vsync: this); - _moveAnimation = Tween(begin: Offset.zero, end: const Offset(1, 0)) - .animate(_moveController); - _iconTransitionAnimation = - Tween(begin: const Offset(-0.1, 0), end: const Offset(0.4, 0)) - .animate(_moveController); - _iconFadeAnimation = - Tween(begin: 0.7, end: 1).animate(_iconMoveController); - - const controllerValue = 0.0; - _moveController.animateTo(controllerValue); - _iconMoveController.animateTo(controllerValue); + _moveController = AnimationController( + duration: widget.movementDuration, + vsync: this, + )..addStatusListener((_) => updateKeepAlive()); + _updateMoveAnimation(); } + AnimationController? _moveController; + late Animation _moveAnimation; + + double _dragExtent = 0; + bool _dragUnderway = false; + bool _swipeThresholdReached = false; + + final GlobalKey _contentKey = GlobalKey(); + + @override + bool get wantKeepAlive => _moveController?.isAnimating ?? false; + @override void dispose() { - _moveController.dispose(); - _iconMoveController.dispose(); + _moveController?.dispose(); super.dispose(); } + SwipeDirection _extentToDirection(double extent) { + if (extent == 0.0) { + return SwipeDirection.none; + } + switch (Directionality.of(context)) { + case TextDirection.rtl: + return extent < 0 + ? SwipeDirection.startToEnd + : SwipeDirection.endToStart; + case TextDirection.ltr: + return extent > 0 + ? SwipeDirection.startToEnd + : SwipeDirection.endToStart; + } + } + + SwipeDirection get _swipeDirection => _extentToDirection(_dragExtent); + + bool get _isActive => _dragUnderway || _moveController!.isAnimating; + + double get _overallDragAxisExtent => context.size!.width; + void _handleDragStart(DragStartDetails details) { - widget.onSwipeStart?.call(); + _dragUnderway = true; + if (_moveController!.isAnimating) { + _dragExtent = + _moveController!.value * _overallDragAxisExtent * _dragExtent.sign; + _moveController!.stop(); + } else { + _dragExtent = 0.0; + _moveController!.value = 0.0; + } + setState(_updateMoveAnimation); } void _handleDragUpdate(DragUpdateDetails details) { + if (!_isActive || _moveController!.isAnimating) { + return; + } + final delta = details.primaryDelta!; - _dragExtent += delta; - - if (_dragExtent.isNegative) return; - - final movePastThresholdPixels = widget.threshold; - var newPos = _dragExtent.abs() / context.size!.width; - - if (_dragExtent.abs() > movePastThresholdPixels) { - // how many "thresholds" past the threshold we are. 1 = the threshold 2 - // = two thresholds. - final n = _dragExtent.abs() / movePastThresholdPixels; - - // Take the number of thresholds past the threshold, and reduce this - // number - final reducedThreshold = math.pow(n, 0.3); - - final adjustedPixelPos = movePastThresholdPixels * reducedThreshold; - newPos = adjustedPixelPos / context.size!.width; - - if (_dragExtent > 0 && !_pastThreshold) { - _iconMoveController.value = 1; - _pastThreshold = true; - } - } else { - // Send a cancel event if the user has swiped back underneath the - // threshold - if (_pastThreshold && widget.onSwipeCancel != null) { - widget.onSwipeCancel!(); - } - _pastThreshold = false; + final oldDragExtent = _dragExtent; + switch (widget.direction) { + case SwipeDirection.horizontal: + _dragExtent += delta; + break; + case SwipeDirection.endToStart: + switch (Directionality.of(context)) { + case TextDirection.rtl: + if (_dragExtent + delta > 0) { + _dragExtent += delta; + } + break; + case TextDirection.ltr: + if (_dragExtent + delta < 0) { + _dragExtent += delta; + } + break; + } + break; + case SwipeDirection.startToEnd: + switch (Directionality.of(context)) { + case TextDirection.rtl: + if (_dragExtent + delta < 0) { + _dragExtent += delta; + } + break; + case TextDirection.ltr: + if (_dragExtent + delta > 0) { + _dragExtent += delta; + } + break; + } + break; + case SwipeDirection.none: + _dragExtent = 0; + break; } - if (!_pastThreshold || newPos < _moveController.value) { - _iconMoveController.value = newPos; + + if (oldDragExtent.sign != _dragExtent.sign) { + setState(_updateMoveAnimation); } - _moveController.value = newPos; + + if (!_moveController!.isAnimating) { + final currentDragExtent = _dragExtent.abs(); + final overallDragExtent = _overallDragAxisExtent; + final movePastThresholdExtent = widget.swipeThreshold * overallDragExtent; + + final double newPos; + if (currentDragExtent > movePastThresholdExtent) { + // How many "thresholds" past the threshold we are. + final n = currentDragExtent / movePastThresholdExtent; + + // Take the number of thresholds past the threshold, and reduce it by + // the threshold amount, then normalize it to the drag extents. + final reducedThreshold = math.pow(n, 0.3); + final adjustedDragExtent = movePastThresholdExtent * reducedThreshold; + + newPos = adjustedDragExtent / overallDragExtent; + } else { + newPos = currentDragExtent / overallDragExtent; + } + + _moveController!.value = newPos; + } + } + + SwipeUpdateDetails _currentSwipeUpdateDetails() { + final oldSwipeThresholdReached = _swipeThresholdReached; + _swipeThresholdReached = _moveController!.value > widget.swipeThreshold; + + return SwipeUpdateDetails( + direction: _swipeDirection, + reached: _swipeThresholdReached, + previousReached: oldSwipeThresholdReached, + progress: _moveController!.value, + ); + } + + void _updateMoveAnimation() { + final end = _dragExtent.sign; + _moveAnimation = _moveController!.drive( + Tween( + begin: Offset.zero, + end: Offset(end, 0), + ), + ); } void _handleDragEnd(DragEndDetails details) { - _moveController.animateTo(0, duration: _animationDuration); - _iconMoveController.animateTo(0, duration: _animationDuration); - _dragExtent = 0.0; - if (_pastThreshold && widget.onSwipeEnd != null) { - widget.onSwipeEnd!(); + if (!_isActive || _moveController!.isAnimating) return; + _dragUnderway = false; + + // Once dragging ends, animate back to the initial offset. + _moveController!.reverse(); + + // If the threshold was reached, report it. + if (_moveController!.value > widget.swipeThreshold) { + if (widget.onSwiped != null) { + final direction = _swipeDirection; + widget.onSwiped!(direction); + } } } @override Widget build(BuildContext context) { + super.build(context); // See AutomaticKeepAliveClientMixin. + + assert( + debugCheckHasDirectionality(context), + 'Swipeable must be inside of a Directionality widget.', + ); + + Widget? background; + final backgroundBuilder = widget.backgroundBuilder; + if (backgroundBuilder != null) { + background = AnimatedBuilder( + animation: _moveAnimation, + builder: (context, _) { + final updateDetails = _currentSwipeUpdateDetails(); + return backgroundBuilder.call(context, updateDetails); + }, + ); + } + + Widget content = SlideTransition( + position: _moveAnimation, + child: KeyedSubtree(key: _contentKey, child: widget.child), + ); + + if (background != null) { + content = Stack( + fit: StackFit.passthrough, + alignment: Alignment.center, + children: [ + if (!_moveAnimation.isDismissed) + Positioned.fill( + child: ClipRect( + clipper: _SwipeableClipper( + moveAnimation: _moveAnimation, + ), + child: background, + ), + ), + content, + ], + ); + } + + // If the SwipeDirection is none, we do not add drag gestures because the + // content cannot be dragged. + if (widget.direction == SwipeDirection.none) { + return content; + } + + // We are not resizing but we may be being dragging in widget.direction. return GestureDetector( onHorizontalDragStart: _handleDragStart, onHorizontalDragUpdate: _handleDragUpdate, onHorizontalDragEnd: _handleDragEnd, - behavior: HitTestBehavior.opaque, - child: Stack( - alignment: Alignment.center, - fit: StackFit.passthrough, - children: [ - SlideTransition( - position: _iconTransitionAnimation, - child: Row( - children: [ - FadeTransition( - opacity: _iconFadeAnimation, - child: Container( - padding: const EdgeInsets.all(4), - decoration: BoxDecoration( - shape: BoxShape.circle, - border: Border.all( - color: StreamChatTheme.of(context).colorTheme.disabled, - ), - ), - child: widget.backgroundIcon, - ), - ), - ], - ), - ), - SlideTransition( - position: _moveAnimation, - child: widget.child, - ), - ], - ), + behavior: widget.behavior, + dragStartBehavior: widget.dragStartBehavior, + child: content, ); } } From 1890d316f930bae3c3aab60af8713983afdd6e21 Mon Sep 17 00:00:00 2001 From: Sahil Kumar Date: Fri, 23 Jun 2023 17:19:39 +0530 Subject: [PATCH 03/54] feat(ui): export `Swipeable`, `AnimatedCircleBorderPainter`. Signed-off-by: xsahil03x --- packages/stream_chat_flutter/lib/stream_chat_flutter.dart | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/stream_chat_flutter/lib/stream_chat_flutter.dart b/packages/stream_chat_flutter/lib/stream_chat_flutter.dart index e5ca5a1e..50977784 100644 --- a/packages/stream_chat_flutter/lib/stream_chat_flutter.dart +++ b/packages/stream_chat_flutter/lib/stream_chat_flutter.dart @@ -58,6 +58,7 @@ export 'src/message_widget/message_text.dart'; export 'src/message_widget/message_widget.dart'; export 'src/message_widget/reactions/reaction_picker.dart'; export 'src/message_widget/text_bubble.dart'; +export 'src/misc/animated_circle_border_painter.dart'; export 'src/misc/back_button.dart'; export 'src/misc/connection_status_builder.dart'; export 'src/misc/date_divider.dart'; @@ -66,6 +67,7 @@ export 'src/misc/option_list_tile.dart'; export 'src/misc/reaction_icon.dart'; export 'src/misc/stream_neumorphic_button.dart'; export 'src/misc/stream_svg_icon.dart'; +export 'src/misc/swipeable.dart'; export 'src/misc/system_message.dart'; export 'src/misc/thread_header.dart'; export 'src/misc/visible_footnote.dart'; From 92307a270e773d976fd7dac9fcc67660fe63451b Mon Sep 17 00:00:00 2001 From: Sahil Kumar Date: Fri, 23 Jun 2023 17:30:01 +0530 Subject: [PATCH 04/54] chore(ui): deprecate `MessageListView.onMessageSwiped`. Signed-off-by: xsahil03x --- .../lib/src/message_list_view/message_list_view.dart | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/stream_chat_flutter/lib/src/message_list_view/message_list_view.dart b/packages/stream_chat_flutter/lib/src/message_list_view/message_list_view.dart index c1ad1b04..68c19036 100644 --- a/packages/stream_chat_flutter/lib/src/message_list_view/message_list_view.dart +++ b/packages/stream_chat_flutter/lib/src/message_list_view/message_list_view.dart @@ -99,6 +99,10 @@ class StreamMessageListView extends StatefulWidget { this.initialAlignment, this.scrollController, this.itemPositionListener, + @Deprecated( + 'Try wrapping the `MessageWidget` with a `Swipeable`, `Dismissible` or a ' + 'custom widget to achieve the swipe to reply behaviour.', + ) this.onMessageSwiped, this.highlightInitialMessage = false, this.messageHighlightColor, From 59c4307205e84bf9f411e8a73e658368b316b1dc Mon Sep 17 00:00:00 2001 From: Sahil Kumar Date: Fri, 23 Jun 2023 17:52:15 +0530 Subject: [PATCH 05/54] chore: update CHANGELOG.md Signed-off-by: xsahil03x --- packages/stream_chat_flutter/CHANGELOG.md | 51 +++++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/packages/stream_chat_flutter/CHANGELOG.md b/packages/stream_chat_flutter/CHANGELOG.md index 49b324d6..11ca3d09 100644 --- a/packages/stream_chat_flutter/CHANGELOG.md +++ b/packages/stream_chat_flutter/CHANGELOG.md @@ -6,6 +6,9 @@ after overriding the `onConfirmDeleteTap` callback. - [[#1621]](https://github.com/GetStream/stream-chat-flutter/issues/1621) Fixed `createdAtStyle` null check error in `SendingIndicatorBuilder`. +- [[#1069]](https://github.com/GetStream/stream-chat-flutter/issues/1069) Fixed message swipe to reply using same + direction for both current user and other users. It now uses `SwipeDirection.startToEnd` for current user + and `SwipeDirection.endToStart` for other users. ✅ Added @@ -26,6 +29,54 @@ 🔄 Changed - Deprecated `StreamMessageInput.attachmentThumbnailBuilders` in favor of `StreamMessageInput.mediaAttachmentBuilder`. +- Deprecated `StreamMessageListView.onMessageSwiped`. Try wrapping the `MessageWidget` with a `Swipeable`, `Dismissible` + or a custom widget to achieve the swipe to reply behaviour. + + ```dart + // Migration from onMessageSwiped to Swipeable. + StreamMessageListView( + ..., + messageBuilder: (context, messageDetails, messages, defaultWidget) { + // The threshold after which the message should be considered as swiped. + const threshold = 0.2; + + // The direction in which the message should be swiped to reply. + final swipeDirection = messageDetails.isMyMessage + ? SwipeDirection.endToStart // + : SwipeDirection.startToEnd; + + return Swipeable( + key: ValueKey(messageDetails.message.id), + direction: swipeDirection, + swipeThreshold: threshold, + onSwiped: (direction) { + // Handle the swipe action here. + }, + backgroundBuilder: (context, details) { + // The alignment of the swipe action. + final alignment = messageDetails.isMyMessage + ? Alignment.centerRight // + : Alignment.centerLeft; + + // The progress of the swipe action. + final progress = math.min(details.progress, threshold) / threshold; + + return Align( + alignment: alignment, + child: Opacity( + opacity: progress, + child: const Icon( + Icons.reply, + color: Colors.white, + ), + ), + ); + }, + child: defaultWidget, + ); + }, + ) + ``` ## 6.4.0 From a681ebfd683f5ca9810030b6ada78ccdc34ca0e8 Mon Sep 17 00:00:00 2001 From: Sahil Kumar Date: Fri, 23 Jun 2023 18:07:07 +0530 Subject: [PATCH 06/54] chore: fix analysis. Signed-off-by: xsahil03x --- .../stream_chat_flutter/example/lib/main.dart | 83 +++++++++++++++++-- .../message_list_view/message_list_view.dart | 2 - 2 files changed, 75 insertions(+), 10 deletions(-) diff --git a/packages/stream_chat_flutter/example/lib/main.dart b/packages/stream_chat_flutter/example/lib/main.dart index f0acc0fa..332d813b 100644 --- a/packages/stream_chat_flutter/example/lib/main.dart +++ b/packages/stream_chat_flutter/example/lib/main.dart @@ -1,6 +1,8 @@ // ignore_for_file: public_member_api_docs import 'dart:async'; +import 'dart:math' as math; +import 'dart:ui'; import 'package:flutter/material.dart'; import 'package:responsive_builder/responsive_builder.dart'; @@ -277,19 +279,84 @@ class _ChannelPageState extends State { children: [ Expanded( child: StreamMessageListView( - onMessageSwiped: - (CurrentPlatform.isAndroid || CurrentPlatform.isIos) - ? reply - : null, threadBuilder: (context, parent) { return ThreadPage( parent: parent!, ); }, - messageBuilder: - (context, details, messages, defaultWidget) { - return defaultWidget.copyWith( - onReplyTap: reply, + messageBuilder: ( + context, + messageDetails, + messages, + defaultWidget, + ) { + // The threshold after which the message is considered + // swiped. + const threshold = 0.2; + + final isMyMessage = messageDetails.isMyMessage; + + // The direction in which the message can be swiped. + final swipeDirection = isMyMessage + ? SwipeDirection.endToStart // + : SwipeDirection.startToEnd; + + return Swipeable( + key: ValueKey(messageDetails.message.id), + direction: swipeDirection, + swipeThreshold: threshold, + onSwiped: (details) => reply(messageDetails.message), + backgroundBuilder: (context, details) { + // The alignment of the swipe action. + final alignment = isMyMessage + ? Alignment.centerRight // + : Alignment.centerLeft; + + // The progress of the swipe action. + final progress = + math.min(details.progress, threshold) / threshold; + + // The offset for the reply icon. + var offset = Offset.lerp( + const Offset(-24, 0), + const Offset(12, 0), + progress, + )!; + + // If the message is mine, we need to flip the offset. + if (isMyMessage) { + offset = Offset(-offset.dx, -offset.dy); + } + + final _streamTheme = StreamChatTheme.of(context); + + return Align( + alignment: alignment, + child: Transform.translate( + offset: offset, + child: Opacity( + opacity: progress, + child: SizedBox.square( + dimension: 30, + child: CustomPaint( + painter: AnimatedCircleBorderPainter( + progress: progress, + color: _streamTheme.colorTheme.borders, + ), + child: Center( + child: StreamSvgIcon.reply( + size: lerpDouble(0, 18, progress), + color: _streamTheme + .colorTheme.accentPrimary, + ), + ), + ), + ), + ), + ), + ); + }, + child: defaultWidget.copyWith(onReplyTap: reply), ); }, ), diff --git a/packages/stream_chat_flutter/lib/src/message_list_view/message_list_view.dart b/packages/stream_chat_flutter/lib/src/message_list_view/message_list_view.dart index 68c19036..5a5075f8 100644 --- a/packages/stream_chat_flutter/lib/src/message_list_view/message_list_view.dart +++ b/packages/stream_chat_flutter/lib/src/message_list_view/message_list_view.dart @@ -12,8 +12,6 @@ import 'package:stream_chat_flutter/src/message_list_view/loading_indicator.dart import 'package:stream_chat_flutter/src/message_list_view/mlv_utils.dart'; import 'package:stream_chat_flutter/src/message_list_view/thread_separator.dart'; import 'package:stream_chat_flutter/src/message_list_view/unread_messages_separator.dart'; -import 'package:stream_chat_flutter/src/misc/animated_circle_border_painter.dart'; -import 'package:stream_chat_flutter/src/misc/swipeable.dart'; import 'package:stream_chat_flutter/stream_chat_flutter.dart'; /// Spacing Types (These are properties of a message to help inform the decision From 723a7368b545fc9d1afb2eee8543950d2727686a Mon Sep 17 00:00:00 2001 From: Sahil Kumar Date: Tue, 27 Jun 2023 17:14:54 +0530 Subject: [PATCH 07/54] fix(ui): not able to hide reaction picker. Signed-off-by: xsahil03x --- .../message_actions_modal.dart | 18 +- .../src/message_widget/message_widget.dart | 169 ++++++++++++------ .../message_widget_content.dart | 63 ++----- .../reactions/message_reactions_modal.dart | 9 +- .../reactions/reactions_align.dart | 20 +-- .../message_reactions_modal_test.dart | 2 +- 6 files changed, 153 insertions(+), 128 deletions(-) diff --git a/packages/stream_chat_flutter/lib/src/message_actions_modal/message_actions_modal.dart b/packages/stream_chat_flutter/lib/src/message_actions_modal/message_actions_modal.dart index 7fcda8a9..2af8e5e6 100644 --- a/packages/stream_chat_flutter/lib/src/message_actions_modal/message_actions_modal.dart +++ b/packages/stream_chat_flutter/lib/src/message_actions_modal/message_actions_modal.dart @@ -15,7 +15,7 @@ class MessageActionsModal extends StatefulWidget { required this.message, required this.messageWidget, required this.messageTheme, - this.showReactions = true, + this.showReactionPicker = true, this.showDeleteMessage = true, this.showEditMessage = true, this.onReplyTap, @@ -54,8 +54,8 @@ class MessageActionsModal extends StatefulWidget { /// [StreamMessageThemeData] for message final StreamMessageThemeData messageTheme; - /// Flag for showing reactions - final bool showReactions; + /// Flag for showing reaction picker. + final bool showReactionPicker; /// Callback when copy is tapped final OnMessageTap? onCopyTap; @@ -105,6 +105,10 @@ class _MessageActionsModalState extends State { final user = StreamChat.of(context).currentUser; final orientation = mediaQueryData.orientation; + final _userPermissions = StreamChannel.of(context).channel.ownCapabilities; + final hasReactionPermission = + _userPermissions.contains(PermissionType.sendReaction); + final fontSize = widget.messageTheme.messageTextStyle?.fontSize; final streamChatThemeData = StreamChatTheme.of(context); @@ -115,12 +119,10 @@ class _MessageActionsModalState extends State { child: Padding( padding: const EdgeInsets.all(8), child: Column( - crossAxisAlignment: widget.reverse - ? CrossAxisAlignment.end - : CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.stretch, children: [ - if (widget.showReactions && - (widget.message.status == MessageSendingStatus.sent)) + if (widget.showReactionPicker && hasReactionPermission) LayoutBuilder( builder: (context, constraints) { return Align( diff --git a/packages/stream_chat_flutter/lib/src/message_widget/message_widget.dart b/packages/stream_chat_flutter/lib/src/message_widget/message_widget.dart index 963b2ac5..614a0f38 100644 --- a/packages/stream_chat_flutter/lib/src/message_widget/message_widget.dart +++ b/packages/stream_chat_flutter/lib/src/message_widget/message_widget.dart @@ -2,6 +2,7 @@ import 'package:contextmenu/contextmenu.dart'; import 'package:flutter/material.dart' hide ButtonStyle; import 'package:flutter/services.dart'; import 'package:flutter_portal/flutter_portal.dart'; +import 'package:meta/meta.dart'; import 'package:stream_chat_flutter/conditional_parent_builder/conditional_parent_builder.dart'; import 'package:stream_chat_flutter/platform_widget_builder/platform_widget_builder.dart'; import 'package:stream_chat_flutter/src/context_menu_items/context_menu_reaction_picker.dart'; @@ -54,7 +55,10 @@ class StreamMessageWidget extends StatefulWidget { this.attachmentBorderRadiusGeometry, this.onMentionTap, this.onMessageTap, - this.showReactionPickerIndicator = false, + bool? showReactionPicker, + @Deprecated('Use `showReactionPicker` instead') + bool showReactionPickerIndicator = true, + @internal this.showReactionPickerTail = false, this.showUserAvatar = DisplayWidget.show, this.showSendingIndicator = true, this.showThreadReplyIndicator = false, @@ -114,6 +118,7 @@ class StreamMessageWidget extends StatefulWidget { bottomRowBuilder == null || bottomRowBuilderWithDefaultWidget == null, 'You can only use one of the two bottom row builders', ), + showReactionPicker = showReactionPicker ?? showReactionPickerIndicator, attachmentBuilders = { 'image': (context, message, attachments) { final border = RoundedRectangleBorder( @@ -460,10 +465,22 @@ class StreamMessageWidget extends StatefulWidget { /// {@endtemplate} final void Function(String)? onLinkTap; + /// {@template showReactionPicker} + /// Whether or not to show the reaction picker. + /// Used in [StreamMessageReactionsModal] and [MessageActionsModal]. + /// {@endtemplate} + final bool showReactionPicker; + /// {@template showReactionPickerIndicator} /// Used in [StreamMessageReactionsModal] and [MessageActionsModal] + /// {@endtemplate} @Deprecated('Use `showReactionPicker` instead') + bool get showReactionPickerIndicator => showReactionPicker; + + /// {@template showReactionPickerTail} + /// Whether or not to show the reaction picker tail /// {@endtemplate} - final bool showReactionPickerIndicator; + @internal + final bool showReactionPickerTail; /// {@template onShowMessage} /// Callback when show message is tapped @@ -619,7 +636,10 @@ class StreamMessageWidget extends StatefulWidget { bool? showInChannelIndicator, void Function(User)? onUserAvatarTap, void Function(String)? onLinkTap, + bool? showReactionPicker, + @Deprecated('Use `showReactionPicker` instead') bool? showReactionPickerIndicator, + @internal bool? showReactionPickerTail, List? readList, ShowMessageCallback? onShowMessage, bool? showUsername, @@ -703,8 +723,11 @@ class StreamMessageWidget extends StatefulWidget { showInChannelIndicator ?? this.showInChannelIndicator, onUserAvatarTap: onUserAvatarTap ?? this.onUserAvatarTap, onLinkTap: onLinkTap ?? this.onLinkTap, - showReactionPickerIndicator: - showReactionPickerIndicator ?? this.showReactionPickerIndicator, + showReactionPicker: showReactionPicker ?? + showReactionPickerIndicator ?? + this.showReactionPicker, + showReactionPickerTail: + showReactionPickerTail ?? this.showReactionPickerTail, onShowMessage: onShowMessage ?? this.onShowMessage, showUsername: showUsername ?? this.showUsername, showTimestamp: showTimestamp ?? this.showTimestamp, @@ -885,12 +908,12 @@ class _StreamMessageWidgetState extends State if (!widget.message.isDeleted) { return ContextMenuArea( verticalPadding: 0, - builder: (context) => _buildContextMenu(), + builder: (_) => _buildContextMenu(), child: child, ); - } else { - return child; } + + return child; }, child: Material( type: MaterialType.transparency, @@ -963,9 +986,9 @@ class _StreamMessageWidgetState extends State messageWidget: widget, showBottomRow: showBottomRow, showPinHighlight: widget.showPinHighlight, - showReactionPickerIndicator: - widget.showReactionPickerIndicator, + showReactionPickerTail: widget.showReactionPickerTail, showReactions: showReactions, + onReactionsTap: () => _showMessageReactionsModal(context), showUserAvatar: widget.showUserAvatar, streamChat: _streamChat, translateUserAvatar: widget.translateUserAvatar, @@ -996,14 +1019,15 @@ class _StreamMessageWidgetState extends State final channel = StreamChannel.of(context).channel; return [ - StreamChatContextMenuItem( - child: StreamChannel( - channel: channel, - child: ContextMenuReactionPicker( - message: widget.message, + if (widget.showReactionPicker) + StreamChatContextMenuItem( + child: StreamChannel( + channel: channel, + child: ContextMenuReactionPicker( + message: widget.message, + ), ), ), - ), if (shouldShowReplyAction) ...[ StreamChatContextMenuItem( leading: StreamSvgIcon.reply(), @@ -1149,21 +1173,7 @@ class _StreamMessageWidgetState extends State ]; } - void onLongPress(BuildContext context) { - if (widget.message.isEphemeral || - widget.message.status == MessageSendingStatus.sending) { - return; - } - - if (widget.onMessageActions != null) { - widget.onMessageActions!(context, widget.message); - } else { - _showMessageActionModalBottomSheet(context); - } - return; - } - - void _showMessageActionModalBottomSheet(BuildContext context) { + void _showMessageReactionsModal(BuildContext context) { final channel = StreamChannel.of(context).channel; showDialog( @@ -1173,7 +1183,8 @@ class _StreamMessageWidgetState extends State barrierColor: _streamChatTheme.colorTheme.overlay, builder: (context) => StreamChannel( channel: channel, - child: MessageActionsModal( + child: StreamMessageReactionsModal( + showReactionPicker: widget.showReactionPicker, messageWidget: widget.copyWith( key: const Key('MessageWidget'), message: widget.message.copyWith( @@ -1187,37 +1198,93 @@ class _StreamMessageWidgetState extends State translateUserAvatar: false, showSendingIndicator: false, padding: EdgeInsets.zero, - showReactionPickerIndicator: widget.showReactions && - (widget.message.status == MessageSendingStatus.sent), + // Show the tail if the reaction picker is visible. + showReactionPickerTail: widget.showReactionPicker, showPinHighlight: false, showUserAvatar: widget.message.user!.id == channel.client.state.currentUser!.id ? DisplayWidget.gone : DisplayWidget.show, ), - onCopyTap: (message) { - final text = message.text; - if (text != null) Clipboard.setData(ClipboardData(text: text)); - }, + onUserAvatarTap: widget.onUserAvatarTap, messageTheme: widget.messageTheme, reverse: widget.reverse, - showDeleteMessage: shouldShowDeleteAction, - onConfirmDeleteTap: widget.onConfirmDeleteTap, message: widget.message, - editMessageInputBuilder: widget.editMessageInputBuilder, - onReplyTap: widget.onReplyTap, - onThreadReplyTap: widget.onThreadTap, - showResendMessage: shouldShowResendAction, - showCopyMessage: shouldShowCopyAction, - showEditMessage: shouldShowEditAction, - showReactions: widget.showReactions, - showReplyMessage: shouldShowReplyAction, - showThreadReplyMessage: shouldShowThreadReplyAction, - showFlagButton: widget.showFlagButton, - showPinButton: widget.showPinButton, - customActions: widget.customActions, ), ), ); } + + void onLongPress(BuildContext context) { + if (widget.message.isEphemeral || + widget.message.status == MessageSendingStatus.sending) { + return; + } + + if (widget.onMessageActions != null) { + return widget.onMessageActions!(context, widget.message); + } + + return _showMessageActionModalBottomSheet(context); + } + + void _showMessageActionModalBottomSheet(BuildContext context) { + final channel = StreamChannel.of(context).channel; + + showDialog( + useRootNavigator: false, + context: context, + useSafeArea: false, + barrierColor: _streamChatTheme.colorTheme.overlay, + builder: (context) { + return StreamChannel( + channel: channel, + child: MessageActionsModal( + messageWidget: widget.copyWith( + key: const Key('MessageWidget'), + message: widget.message.copyWith( + text: (widget.message.text?.length ?? 0) > 200 + ? '${widget.message.text!.substring(0, 200)}...' + : widget.message.text, + ), + showReactions: false, + showUsername: false, + showTimestamp: false, + translateUserAvatar: false, + showSendingIndicator: false, + padding: EdgeInsets.zero, + // Show both the tail and indicator if the indicator is shown. + showReactionPickerTail: widget.showReactionPickerIndicator, + showPinHighlight: false, + showUserAvatar: widget.message.user!.id == + channel.client.state.currentUser!.id + ? DisplayWidget.gone + : DisplayWidget.show, + ), + onCopyTap: (message) { + final text = message.text; + if (text != null) Clipboard.setData(ClipboardData(text: text)); + }, + messageTheme: widget.messageTheme, + reverse: widget.reverse, + showDeleteMessage: shouldShowDeleteAction, + onConfirmDeleteTap: widget.onConfirmDeleteTap, + message: widget.message, + editMessageInputBuilder: widget.editMessageInputBuilder, + onReplyTap: widget.onReplyTap, + onThreadReplyTap: widget.onThreadTap, + showResendMessage: shouldShowResendAction, + showCopyMessage: shouldShowCopyAction, + showEditMessage: shouldShowEditAction, + showReactionPicker: widget.showReactionPickerIndicator, + showReplyMessage: shouldShowReplyAction, + showThreadReplyMessage: shouldShowThreadReplyAction, + showFlagButton: widget.showFlagButton, + showPinButton: widget.showPinButton, + customActions: widget.customActions, + ), + ); + }, + ); + } } diff --git a/packages/stream_chat_flutter/lib/src/message_widget/message_widget_content.dart b/packages/stream_chat_flutter/lib/src/message_widget/message_widget_content.dart index f8543013..2910ee62 100644 --- a/packages/stream_chat_flutter/lib/src/message_widget/message_widget_content.dart +++ b/packages/stream_chat_flutter/lib/src/message_widget/message_widget_content.dart @@ -1,5 +1,6 @@ import 'package:flutter/material.dart'; import 'package:flutter_portal/flutter_portal.dart'; +import 'package:meta/meta.dart'; import 'package:stream_chat_flutter/src/message_widget/message_widget_content_components.dart'; import 'package:stream_chat_flutter/src/message_widget/reactions/desktop_reactions_builder.dart'; import 'package:stream_chat_flutter/stream_chat_flutter.dart'; @@ -21,6 +22,7 @@ typedef BottomRowBuilderWithDefaultWidget = Widget Function( /// /// Should not be used outside of [MessageWidget. /// {@endtemplate} +@internal class MessageWidgetContent extends StatelessWidget { /// {@macro messageWidgetContent} const MessageWidgetContent({ @@ -33,6 +35,7 @@ class MessageWidgetContent extends StatelessWidget { required this.showUserAvatar, required this.avatarWidth, required this.showReactions, + required this.onReactionsTap, required this.messageTheme, required this.shouldShowReactions, required this.streamChatTheme, @@ -45,7 +48,7 @@ class MessageWidgetContent extends StatelessWidget { required this.attachmentBuilders, required this.attachmentPadding, required this.textPadding, - required this.showReactionPickerIndicator, + required this.showReactionPickerTail, required this.translateUserAvatar, required this.bottomRowPadding, required this.showInChannel, @@ -111,6 +114,11 @@ class MessageWidgetContent extends StatelessWidget { /// {@macro showReactions} final bool showReactions; + /// Callback called when the reactions icon is tapped. + /// + /// Do not confuse this with the tap action on the reactions picker. + final VoidCallback onReactionsTap; + /// {@macro messageTheme} final StreamMessageThemeData messageTheme; @@ -174,8 +182,8 @@ class MessageWidgetContent extends StatelessWidget { /// {@macro quotedMessageBuilder} final Widget Function(BuildContext, Message)? quotedMessageBuilder; - /// {@macro showReactionPickerIndicator} - final bool showReactionPickerIndicator; + /// {@macro showReactionPickerTail} + final bool showReactionPickerTail; /// {@macro translateUserAvatar} final bool translateUserAvatar; @@ -288,9 +296,7 @@ class MessageWidgetContent extends StatelessWidget { ownId: streamChat.currentUser!.id, reverse: reverse, shouldShowReactions: shouldShowReactions, - onTap: () => _showMessageReactionsModal( - context, - ), + onTap: onReactionsTap, ) : null, anchor: Aligned( @@ -363,7 +369,8 @@ class MessageWidgetContent extends StatelessWidget { shape: shape, ), ), - if (showReactionPickerIndicator) + // TODO: Make tail part of the Reaction Picker. + if (showReactionPickerTail) Positioned( right: reverse ? null : 4, left: reverse ? 4 : null, @@ -374,6 +381,7 @@ class MessageWidgetContent extends StatelessWidget { Colors.transparent, Colors.transparent, tailCirclesSpace: 1, + flipTail: !reverse, ), ), ), @@ -434,47 +442,6 @@ class MessageWidgetContent extends StatelessWidget { ); } - void _showMessageReactionsModal(BuildContext context) { - final channel = StreamChannel.of(context).channel; - showDialog( - useRootNavigator: false, - context: context, - useSafeArea: false, - barrierColor: streamChatTheme.colorTheme.overlay, - builder: (context) => StreamChannel( - channel: channel, - child: StreamMessageReactionsModal( - messageWidget: messageWidget.copyWith( - key: const Key('MessageWidget'), - message: message.copyWith( - text: (message.text?.length ?? 0) > 200 - ? '${message.text!.substring(0, 200)}...' - : message.text, - ), - showReactions: false, - showUsername: false, - showTimestamp: false, - translateUserAvatar: false, - showSendingIndicator: false, - padding: EdgeInsets.zero, - showReactionPickerIndicator: - showReactions && (message.status == MessageSendingStatus.sent), - showPinHighlight: false, - showUserAvatar: - message.user!.id == channel.client.state.currentUser!.id - ? DisplayWidget.gone - : DisplayWidget.show, - ), - onUserAvatarTap: onUserAvatarTap, - messageTheme: messageTheme, - reverse: reverse, - message: message, - showReactions: showReactions, - ), - ), - ); - } - Widget _buildBottomRow(BuildContext context) { final defaultWidget = BottomRow( message: message, diff --git a/packages/stream_chat_flutter/lib/src/message_widget/reactions/message_reactions_modal.dart b/packages/stream_chat_flutter/lib/src/message_widget/reactions/message_reactions_modal.dart index cd66d08d..8dadc47d 100644 --- a/packages/stream_chat_flutter/lib/src/message_widget/reactions/message_reactions_modal.dart +++ b/packages/stream_chat_flutter/lib/src/message_widget/reactions/message_reactions_modal.dart @@ -15,7 +15,7 @@ class StreamMessageReactionsModal extends StatelessWidget { required this.message, required this.messageWidget, required this.messageTheme, - this.showReactions, + this.showReactionPicker = true, this.reverse = false, this.onUserAvatarTap, }); @@ -32,8 +32,8 @@ class StreamMessageReactionsModal extends StatelessWidget { /// {@macro reverse} final bool reverse; - /// {@macro showReactions} - final bool? showReactions; + /// Flag for showing reaction picker. + final bool showReactionPicker; /// {@macro onUserAvatarTap} final void Function(User)? onUserAvatarTap; @@ -56,8 +56,7 @@ class StreamMessageReactionsModal extends StatelessWidget { mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.stretch, children: [ - if ((showReactions ?? hasReactionPermission) && - (message.status == MessageSendingStatus.sent)) + if (showReactionPicker && hasReactionPermission) LayoutBuilder( builder: (context, constraints) { return Align( diff --git a/packages/stream_chat_flutter/lib/src/message_widget/reactions/reactions_align.dart b/packages/stream_chat_flutter/lib/src/message_widget/reactions/reactions_align.dart index e4e1ad48..a7baad7e 100644 --- a/packages/stream_chat_flutter/lib/src/message_widget/reactions/reactions_align.dart +++ b/packages/stream_chat_flutter/lib/src/message_widget/reactions/reactions_align.dart @@ -43,19 +43,9 @@ double calculateReactionsHorizontalAlignment( final signal = user?.id == message.user?.id ? 1 : -1; final result = signal * (1 - divFactor * 2.0); - return _capResult(result); -} - -// Ensure reactions don't get pushed past the edge of the screen. -// -// This happens if divFactor is really big. When this happens, we can simply -// move the model all the way to the end of screen. -double _capResult(double result) { - if (result > 1.0) { - return 1; - } else if (result < -1.0) { - return -1; - } else { - return result; - } + // Ensure reactions don't get pushed past the edge of the screen. + // + // This happens if divFactor is really big. When this happens, we can simply + // move the model all the way to the end of screen. + return result.clamp(-1, 1); } diff --git a/packages/stream_chat_flutter/test/src/message_reactions_modal/message_reactions_modal_test.dart b/packages/stream_chat_flutter/test/src/message_reactions_modal/message_reactions_modal_test.dart index 54f3675b..20ecd58e 100644 --- a/packages/stream_chat_flutter/test/src/message_reactions_modal/message_reactions_modal_test.dart +++ b/packages/stream_chat_flutter/test/src/message_reactions_modal/message_reactions_modal_test.dart @@ -104,7 +104,7 @@ void main() { message: message, messageTheme: streamTheme.ownMessageTheme, reverse: true, - showReactions: false, + showReactionPicker: false, onUserAvatarTap: onUserAvatarTap, ), ), From f29774e262e6a565dac01b767401064a4aeb46c0 Mon Sep 17 00:00:00 2001 From: Sahil Kumar Date: Tue, 27 Jun 2023 17:30:57 +0530 Subject: [PATCH 08/54] chore: update CHANGELOG.md Signed-off-by: xsahil03x --- packages/stream_chat_flutter/CHANGELOG.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/packages/stream_chat_flutter/CHANGELOG.md b/packages/stream_chat_flutter/CHANGELOG.md index 11ca3d09..ea75a9c8 100644 --- a/packages/stream_chat_flutter/CHANGELOG.md +++ b/packages/stream_chat_flutter/CHANGELOG.md @@ -9,6 +9,8 @@ - [[#1069]](https://github.com/GetStream/stream-chat-flutter/issues/1069) Fixed message swipe to reply using same direction for both current user and other users. It now uses `SwipeDirection.startToEnd` for current user and `SwipeDirection.endToStart` for other users. +- [[#1590]](https://github.com/GetStream/stream-chat-flutter/issues/1590) + Fixed `StreamMessageWidget.showReactionPickerIndicator` not toggling the reaction picker indicator visibility. ✅ Added @@ -77,6 +79,14 @@ }, ) ``` +- Deprecated `StreamMessageWidget.showReactionPickerIndicator` in favor of `StreamMessageWidget.showReactionPicker`. + + ```diff + StreamMessageWidget( + - showReactionPickerIndicator: true/false, + + showReactionPicker: true/false, + ) + ``` ## 6.4.0 From b6c662ee087965834149d7f34bddaac1a4ac2745 Mon Sep 17 00:00:00 2001 From: Sahil Kumar Date: Tue, 27 Jun 2023 18:01:37 +0530 Subject: [PATCH 09/54] chore: fix deprecation Signed-off-by: xsahil03x --- .../handler/stream_attachment_handler_io.dart | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/packages/stream_chat_flutter/lib/src/attachment/handler/stream_attachment_handler_io.dart b/packages/stream_chat_flutter/lib/src/attachment/handler/stream_attachment_handler_io.dart index 0b04ee61..1df1b411 100644 --- a/packages/stream_chat_flutter/lib/src/attachment/handler/stream_attachment_handler_io.dart +++ b/packages/stream_chat_flutter/lib/src/attachment/handler/stream_attachment_handler_io.dart @@ -29,14 +29,16 @@ class StreamAttachmentHandlerDesktop extends StreamAttachmentHandler { options: options, ); - // Open the native file browser so the user can select the download path. - final path = await getSavePath(suggestedName: data.fileName); - - if (path == null) { + // Open the native file browser so the user can select the save location. + final saveLocation = await getSaveLocation(suggestedName: data.fileName); + if (saveLocation == null) { // Operation was canceled by the user. return null; } + // Get the path to the user's selected location. + final path = saveLocation.path; + // Create an XFile for proper file saving. final file = data.toXFile(path: path); From e1a90ec50c4f624525b8aa3d1089073c220ea6a2 Mon Sep 17 00:00:00 2001 From: Sahil Kumar Date: Tue, 27 Jun 2023 18:22:59 +0530 Subject: [PATCH 10/54] test(ui): add tests for message_input_attachment_list.dart Signed-off-by: xsahil03x --- .../ios/Runner.xcodeproj/project.pbxproj | 1 + .../stream_chat_flutter/example/lib/main.dart | 6 +- .../message_input_attachment_list_test.dart | 190 ++++++++++++++++++ 3 files changed, 196 insertions(+), 1 deletion(-) create mode 100644 packages/stream_chat_flutter/test/src/message_input/message_input_attachment_list_test.dart diff --git a/packages/stream_chat_flutter/example/ios/Runner.xcodeproj/project.pbxproj b/packages/stream_chat_flutter/example/ios/Runner.xcodeproj/project.pbxproj index e5d8f743..4c7de605 100644 --- a/packages/stream_chat_flutter/example/ios/Runner.xcodeproj/project.pbxproj +++ b/packages/stream_chat_flutter/example/ios/Runner.xcodeproj/project.pbxproj @@ -204,6 +204,7 @@ files = ( ); inputPaths = ( + "${TARGET_BUILD_DIR}/${INFOPLIST_PATH}", ); name = "Thin Binary"; outputPaths = ( diff --git a/packages/stream_chat_flutter/example/lib/main.dart b/packages/stream_chat_flutter/example/lib/main.dart index 332d813b..1db7f73e 100644 --- a/packages/stream_chat_flutter/example/lib/main.dart +++ b/packages/stream_chat_flutter/example/lib/main.dart @@ -356,7 +356,11 @@ class _ChannelPageState extends State { ), ); }, - child: defaultWidget.copyWith(onReplyTap: reply), + child: defaultWidget.copyWith( + onReplyTap: reply, + // showReactionPicker: true, + // showReactionPickerIndicator: false, + ), ); }, ), diff --git a/packages/stream_chat_flutter/test/src/message_input/message_input_attachment_list_test.dart b/packages/stream_chat_flutter/test/src/message_input/message_input_attachment_list_test.dart new file mode 100644 index 00000000..a7afeea8 --- /dev/null +++ b/packages/stream_chat_flutter/test/src/message_input/message_input_attachment_list_test.dart @@ -0,0 +1,190 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:stream_chat_flutter/stream_chat_flutter.dart'; + +import '../mocks.dart'; + +Widget wrapWithStreamChat( + Widget child, { + StreamChatClient? client, +}) { + return MaterialApp( + home: StreamChat( + client: client ?? MockClient(), + child: child, + ), + ); +} + +void main() { + group('StreamMessageInputAttachmentList tests', () { + testWidgets( + 'StreamMessageInputAttachmentList should render attachments', + (WidgetTester tester) async { + final attachments = [ + Attachment(type: 'file', id: 'file1'), + Attachment(type: 'file', id: 'file2'), + Attachment(type: 'media', id: 'media1'), + ]; + + await tester.pumpWidget( + wrapWithStreamChat( + StreamMessageInputAttachmentList( + attachments: attachments, + ), + ), + ); + + // Expect 2 file attachments and 1 media attachment + expect(find.byType(MessageInputFileAttachments), findsOneWidget); + expect(find.byType(MessageInputMediaAttachments), findsOneWidget); + }, + ); + + testWidgets( + 'StreamMessageInputAttachmentList should call onRemovePressed callback', + (WidgetTester tester) async { + Attachment? removedAttachment; + + final attachments = [ + Attachment(type: 'file', id: 'file1'), + Attachment(type: 'file', id: 'file2'), + ]; + + await tester.pumpWidget( + wrapWithStreamChat( + StreamMessageInputAttachmentList( + attachments: attachments, + onRemovePressed: (attachment) { + removedAttachment = attachment; + }, + ), + ), + ); + + final removeButtons = find.byType(RemoveAttachmentButton); + + // Tap the first remove button + await tester.tap(removeButtons.first); + await tester.pump(); + + // Expect the onRemovePressed callback to be called with the second + // attachment as they are reversed in the UI. + expect(removedAttachment, attachments[1]); + }, + ); + + testWidgets( + '''StreamMessageInputAttachmentList should display empty box if no attachments''', + (WidgetTester tester) async { + final attachments = []; + + await tester.pumpWidget( + wrapWithStreamChat( + StreamMessageInputAttachmentList( + attachments: attachments, + ), + ), + ); + + // Expect an empty box + expect(find.byType(SizedBox), findsOneWidget); + }, + ); + }); + + group('MessageInputFileAttachments tests', () { + testWidgets( + 'MessageInputFileAttachments should render file attachments', + (WidgetTester tester) async { + final attachments = [ + Attachment(type: 'file', id: 'file1'), + Attachment(type: 'file', id: 'file2'), + ]; + + await tester.pumpWidget( + wrapWithStreamChat( + MessageInputFileAttachments( + attachments: attachments, + ), + ), + ); + + // Expect 2 file attachments + expect(find.byType(ClipRRect), findsNWidgets(2)); + }, + ); + + testWidgets( + 'MessageInputFileAttachments should call onRemovePressed callback', + (WidgetTester tester) async { + Attachment? removedAttachment; + + final attachments = [ + Attachment(type: 'file', id: 'file1'), + ]; + + await tester.pumpWidget( + wrapWithStreamChat( + MessageInputFileAttachments( + attachments: attachments, + onRemovePressed: (attachment) { + removedAttachment = attachment; + }, + ), + ), + ); + + final removeButton = find.byType(RemoveAttachmentButton); + + // Tap the remove button + await tester.tap(removeButton); + await tester.pump(); + + // Expect the onRemovePressed callback to be called with the attachment + expect(removedAttachment, attachments.first); + }, + ); + }); + + group('MessageInputMediaAttachments tests', () { + testWidgets( + 'MessageInputMediaAttachments should render media attachments', + (WidgetTester tester) async { + final attachments = [ + Attachment(type: 'media', id: 'media1'), + Attachment(type: 'media', id: 'media2'), + ]; + + await tester.pumpWidget( + wrapWithStreamChat( + MessageInputMediaAttachments( + attachments: attachments, + ), + ), + ); + + // Expect 2 media attachments + expect(find.byType(Stack), findsNWidgets(2)); + }, + ); + + testWidgets( + 'MessageInputMediaAttachments should display empty box if no attachments', + (WidgetTester tester) async { + final attachments = []; + + await tester.pumpWidget( + wrapWithStreamChat( + MessageInputMediaAttachments( + attachments: attachments, + ), + ), + ); + + // Expect an empty box + expect(find.byType(SizedBox), findsOneWidget); + }, + ); + }); +} From 5171d9c208d36746e205164ee13c40f069ef1719 Mon Sep 17 00:00:00 2001 From: Sahil Kumar Date: Tue, 27 Jun 2023 18:46:26 +0530 Subject: [PATCH 11/54] chore(ui): revert example changes Signed-off-by: xsahil03x --- .../example/ios/Runner.xcodeproj/project.pbxproj | 1 - packages/stream_chat_flutter/example/lib/main.dart | 6 +----- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/packages/stream_chat_flutter/example/ios/Runner.xcodeproj/project.pbxproj b/packages/stream_chat_flutter/example/ios/Runner.xcodeproj/project.pbxproj index 4c7de605..e5d8f743 100644 --- a/packages/stream_chat_flutter/example/ios/Runner.xcodeproj/project.pbxproj +++ b/packages/stream_chat_flutter/example/ios/Runner.xcodeproj/project.pbxproj @@ -204,7 +204,6 @@ files = ( ); inputPaths = ( - "${TARGET_BUILD_DIR}/${INFOPLIST_PATH}", ); name = "Thin Binary"; outputPaths = ( diff --git a/packages/stream_chat_flutter/example/lib/main.dart b/packages/stream_chat_flutter/example/lib/main.dart index 1db7f73e..332d813b 100644 --- a/packages/stream_chat_flutter/example/lib/main.dart +++ b/packages/stream_chat_flutter/example/lib/main.dart @@ -356,11 +356,7 @@ class _ChannelPageState extends State { ), ); }, - child: defaultWidget.copyWith( - onReplyTap: reply, - // showReactionPicker: true, - // showReactionPickerIndicator: false, - ), + child: defaultWidget.copyWith(onReplyTap: reply), ); }, ), From f6c11b39794d5f870ea5235fe1e1aceebceb88d4 Mon Sep 17 00:00:00 2001 From: Sahil Kumar Date: Wed, 28 Jun 2023 14:28:00 +0530 Subject: [PATCH 12/54] fix(ui): save attachments to gallery. Signed-off-by: xsahil03x --- .../handler/stream_attachment_handler_io.dart | 22 +++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/packages/stream_chat_flutter/lib/src/attachment/handler/stream_attachment_handler_io.dart b/packages/stream_chat_flutter/lib/src/attachment/handler/stream_attachment_handler_io.dart index 1df1b411..e4d0b35e 100644 --- a/packages/stream_chat_flutter/lib/src/attachment/handler/stream_attachment_handler_io.dart +++ b/packages/stream_chat_flutter/lib/src/attachment/handler/stream_attachment_handler_io.dart @@ -2,6 +2,7 @@ import 'dart:io'; import 'package:file_picker/file_picker.dart'; import 'package:file_selector/file_selector.dart'; +import 'package:image_gallery_saver/image_gallery_saver.dart'; import 'package:image_picker/image_picker.dart'; import 'package:path_provider/path_provider.dart'; import 'package:stream_chat_flutter/src/attachment/handler/common.dart'; @@ -142,7 +143,6 @@ class StreamAttachmentHandler extends StreamAttachmentHandlerBase { final tempFilePath = tempPath .resolve(fileName!) .toFilePath(windows: CurrentPlatform.isWindows); - print(tempFilePath); final attachmentFileBytes = attachmentFile.bytes; if (attachmentFileBytes == null) { @@ -191,8 +191,26 @@ class StreamAttachmentHandler extends StreamAttachmentHandlerBase { // Create an XFile for proper file saving. final file = data.toXFile(path: path); - // Save the file to the user's selected path. + // Save the file to a temporary location. await file.saveTo(path); + + // Now that the file is saved, we need to copy it to the user's gallery + // because the gallery only shows files that are in the gallery folder. + await ImageGallerySaver.saveFile(path); + + // Once the file is copied to the gallery, we can delete the temporary file. + await file.delete(); + return path; } } + +extension on XFile { + /// Deletes this xfile from the file system. + Future delete() async { + final file = File(path); + if (file.existsSync()) { + await file.delete(); + } + } +} From 18e5b5406888061872e9ad50edacde51a07e2360 Mon Sep 17 00:00:00 2001 From: Sahil Kumar Date: Wed, 28 Jun 2023 14:42:08 +0530 Subject: [PATCH 13/54] chore: update CHANGELOG.md Signed-off-by: xsahil03x --- packages/stream_chat_flutter/CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packages/stream_chat_flutter/CHANGELOG.md b/packages/stream_chat_flutter/CHANGELOG.md index ea75a9c8..d2ca7e28 100644 --- a/packages/stream_chat_flutter/CHANGELOG.md +++ b/packages/stream_chat_flutter/CHANGELOG.md @@ -11,6 +11,11 @@ and `SwipeDirection.endToStart` for other users. - [[#1590]](https://github.com/GetStream/stream-chat-flutter/issues/1590) Fixed `StreamMessageWidget.showReactionPickerIndicator` not toggling the reaction picker indicator visibility. +- [[#1639]](https://github.com/GetStream/stream-chat-flutter/issues/1639) Fixed attachments not showing in gallery view + even after saving them to the device. + > **Note** + > This fix depends on the [image_gallery_saver](https://pub.dev/packages/image_gallery_saver) plugin. Make sure to add + necessary permissions in your App as per the plugin documentation. ✅ Added @@ -79,6 +84,7 @@ }, ) ``` + - Deprecated `StreamMessageWidget.showReactionPickerIndicator` in favor of `StreamMessageWidget.showReactionPicker`. ```diff From 4f1a2029946063880a0bfeef50c5faee1a341ce9 Mon Sep 17 00:00:00 2001 From: Sahil Kumar Date: Wed, 28 Jun 2023 16:26:24 +0530 Subject: [PATCH 14/54] doc: remove incorrect info. Signed-off-by: xsahil03x --- .../05-push-notifications/adding_push_notifications_v2.mdx | 6 ------ 1 file changed, 6 deletions(-) diff --git a/docusaurus/docs/Flutter/05-guides/05-push-notifications/adding_push_notifications_v2.mdx b/docusaurus/docs/Flutter/05-guides/05-push-notifications/adding_push_notifications_v2.mdx index c0678e3b..c440daaf 100644 --- a/docusaurus/docs/Flutter/05-guides/05-push-notifications/adding_push_notifications_v2.mdx +++ b/docusaurus/docs/Flutter/05-guides/05-push-notifications/adding_push_notifications_v2.mdx @@ -40,12 +40,6 @@ Push message delivery behaves according to these rules: - The message doesn't contain the flag `skip_push` as true. - `push_notifications` is enabled (default) on the channel type for message is sent. -:::info - -If you would like get push notifications only when users are offline, please contact support. - -::: - :::caution Push notifications require membership. Watching a channel isn't enough. From a311463cab9df4a28ff6ac173c68d577d69c9bb1 Mon Sep 17 00:00:00 2001 From: Sahil Kumar Date: Thu, 29 Jun 2023 16:23:16 +0530 Subject: [PATCH 15/54] fix(ui): fix `MessageWidget.widthFactor` not working on web/desktop. Signed-off-by: xsahil03x --- .../lib/src/message_widget/message_card.dart | 23 ++++++++----------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/packages/stream_chat_flutter/lib/src/message_widget/message_card.dart b/packages/stream_chat_flutter/lib/src/message_widget/message_card.dart index 5cd93efc..9491b0da 100644 --- a/packages/stream_chat_flutter/lib/src/message_widget/message_card.dart +++ b/packages/stream_chat_flutter/lib/src/message_widget/message_card.dart @@ -188,19 +188,16 @@ class _MessageCardState extends State { attachmentPadding: widget.attachmentPadding, ), if (!widget.isGiphy) - ConstrainedBox( - constraints: BoxConstraints.loose(const Size.fromWidth(500)), - child: TextBubble( - messageTheme: widget.messageTheme, - message: widget.message, - textPadding: widget.textPadding, - textBuilder: widget.textBuilder, - isOnlyEmoji: widget.isOnlyEmoji, - hasQuotedMessage: widget.hasQuotedMessage, - hasUrlAttachments: widget.hasUrlAttachments, - onLinkTap: widget.onLinkTap, - onMentionTap: widget.onMentionTap, - ), + TextBubble( + messageTheme: widget.messageTheme, + message: widget.message, + textPadding: widget.textPadding, + textBuilder: widget.textBuilder, + isOnlyEmoji: widget.isOnlyEmoji, + hasQuotedMessage: widget.hasQuotedMessage, + hasUrlAttachments: widget.hasUrlAttachments, + onLinkTap: widget.onLinkTap, + onMentionTap: widget.onMentionTap, ), if (widget.hasUrlAttachments && !widget.hasQuotedMessage) _buildUrlAttachment(), From cb22267c7181a69f91974335a40e07bfe3b73f72 Mon Sep 17 00:00:00 2001 From: Sahil Kumar Date: Thu, 29 Jun 2023 16:24:44 +0530 Subject: [PATCH 16/54] chore: update CHANGELOG.md Signed-off-by: xsahil03x --- packages/stream_chat_flutter/CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/stream_chat_flutter/CHANGELOG.md b/packages/stream_chat_flutter/CHANGELOG.md index d2ca7e28..ceaf1683 100644 --- a/packages/stream_chat_flutter/CHANGELOG.md +++ b/packages/stream_chat_flutter/CHANGELOG.md @@ -16,6 +16,8 @@ > **Note** > This fix depends on the [image_gallery_saver](https://pub.dev/packages/image_gallery_saver) plugin. Make sure to add necessary permissions in your App as per the plugin documentation. +- [[#1642]](https://github.com/GetStream/stream-chat-flutter/issues/1642) Fixed `StreamMessageWidget.widthFactor` not + working on web and desktop platforms. ✅ Added From 4359538c041bf60981f51b30e29365a8ce649f16 Mon Sep 17 00:00:00 2001 From: Sahil Kumar Date: Fri, 30 Jun 2023 12:18:23 +0530 Subject: [PATCH 17/54] feat(repo): add dependabot --- .github/dependabot.yml | 31 +++++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index fbe1ab13..e6183303 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -1,11 +1,26 @@ -# To get started with Dependabot version updates, you'll need to specify which -# package ecosystems to update and where the package manifests are located. -# Please see the documentation for all configuration options: -# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates - version: 2 updates: - - package-ecosystem: "pub" # See documentation for possible values - directory: "/" # Location of package manifests + - package-ecosystem: "github-actions" + directory: "/" schedule: - interval: "weekly" + interval: "daily" + - package-ecosystem: "pub" + directory: "/packages/stream_chat" + schedule: + interval: "daily" + - package-ecosystem: "pub" + directory: "/packages/stream_chat_flutter_core" + schedule: + interval: "daily" + - package-ecosystem: "pub" + directory: "/packages/stream_chat_flutter" + schedule: + interval: "daily" + - package-ecosystem: "pub" + directory: "/packages/stream_chat_persistence" + schedule: + interval: "daily" + - package-ecosystem: "pub" + directory: "/packages/stream_chat_localizations" + schedule: + interval: "daily" From ca1f937e5bb3d13f4d4a09a9b50857905230ce88 Mon Sep 17 00:00:00 2001 From: Sahil Kumar Date: Fri, 30 Jun 2023 13:11:12 +0530 Subject: [PATCH 18/54] Update dependabot.yml --- .github/dependabot.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index e6183303..508508a7 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -3,24 +3,24 @@ updates: - package-ecosystem: "github-actions" directory: "/" schedule: - interval: "daily" + interval: "weekly" - package-ecosystem: "pub" directory: "/packages/stream_chat" schedule: - interval: "daily" + interval: "weekly" - package-ecosystem: "pub" directory: "/packages/stream_chat_flutter_core" schedule: - interval: "daily" + interval: "weekly" - package-ecosystem: "pub" directory: "/packages/stream_chat_flutter" schedule: - interval: "daily" + interval: "weekly" - package-ecosystem: "pub" directory: "/packages/stream_chat_persistence" schedule: - interval: "daily" + interval: "weekly" - package-ecosystem: "pub" directory: "/packages/stream_chat_localizations" schedule: - interval: "daily" + interval: "weekly" From 7121a87f77e20b994a91c5a880c4e87b1967c7f5 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 30 Jun 2023 07:42:51 +0000 Subject: [PATCH 19/54] chore(deps): bump benc-uk/workflow-dispatch from 1 to 121 Bumps [benc-uk/workflow-dispatch](https://github.com/benc-uk/workflow-dispatch) from 1 to 121. - [Release notes](https://github.com/benc-uk/workflow-dispatch/releases) - [Commits](https://github.com/benc-uk/workflow-dispatch/compare/v1...v121) --- updated-dependencies: - dependency-name: benc-uk/workflow-dispatch dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/dispatch_workflows.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/dispatch_workflows.yml b/.github/workflows/dispatch_workflows.yml index 6d626fdb..afd04f99 100644 --- a/.github/workflows/dispatch_workflows.yml +++ b/.github/workflows/dispatch_workflows.yml @@ -14,7 +14,7 @@ jobs: if: github.ref == 'refs/heads/develop' runs-on: ubuntu-latest steps: - - uses: benc-uk/workflow-dispatch@v1 + - uses: benc-uk/workflow-dispatch@v121 with: workflow: build_nightly repo: GetStream/flutter-samples @@ -23,7 +23,7 @@ jobs: if: github.ref == 'refs/heads/main' runs-on: ubuntu-latest steps: - - uses: benc-uk/workflow-dispatch@v1 + - uses: benc-uk/workflow-dispatch@v121 with: repo: GetStream/flutter-samples workflow: build From 46a1eecf50cf5a2e391409042362e116d0bbb079 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 30 Jun 2023 07:47:15 +0000 Subject: [PATCH 20/54] chore(deps): bump codecov/codecov-action from 1 to 3 Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 1 to 3. - [Release notes](https://github.com/codecov/codecov-action/releases) - [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md) - [Commits](https://github.com/codecov/codecov-action/compare/v1...v3) --- updated-dependencies: - dependency-name: codecov/codecov-action dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/stream_flutter_workflow.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/stream_flutter_workflow.yml b/.github/workflows/stream_flutter_workflow.yml index e42174ad..d5792295 100644 --- a/.github/workflows/stream_flutter_workflow.yml +++ b/.github/workflows/stream_flutter_workflow.yml @@ -100,7 +100,7 @@ jobs: - name: "Collect Coverage" run: melos run coverage:ignore-file --no-select - name: "Upload Coverage" - uses: codecov/codecov-action@v1 + uses: codecov/codecov-action@v3 with: token: ${{secrets.CODECOV_TOKEN}} files: packages/*/coverage/lcov.info From 2d1e07f6b01c1e402c5e3e33c0702106c5d67321 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 30 Jun 2023 06:51:36 +0000 Subject: [PATCH 21/54] chore(deps): bump amannn/action-semantic-pull-request Bumps [amannn/action-semantic-pull-request](https://github.com/amannn/action-semantic-pull-request) from 3.4.0 to 5.2.0. - [Release notes](https://github.com/amannn/action-semantic-pull-request/releases) - [Changelog](https://github.com/amannn/action-semantic-pull-request/blob/main/CHANGELOG.md) - [Commits](https://github.com/amannn/action-semantic-pull-request/compare/v3.4.0...v5.2.0) --- updated-dependencies: - dependency-name: amannn/action-semantic-pull-request dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/pr_title.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr_title.yml b/.github/workflows/pr_title.yml index bd4e36cb..20b3f60e 100644 --- a/.github/workflows/pr_title.yml +++ b/.github/workflows/pr_title.yml @@ -16,7 +16,7 @@ jobs: conventional_pr_title: runs-on: ubuntu-latest steps: - - uses: amannn/action-semantic-pull-request@v3.4.0 + - uses: amannn/action-semantic-pull-request@v5.2.0 with: scopes: | llc From 2d48391ff6638ee81ebfc7ee06eb33d22b936abc Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 30 Jun 2023 06:51:32 +0000 Subject: [PATCH 22/54] chore(deps): bump VeryGoodOpenSource/very_good_coverage Bumps [VeryGoodOpenSource/very_good_coverage](https://github.com/verygoodopensource/very_good_coverage) from 1.1.1 to 2.1.0. - [Release notes](https://github.com/verygoodopensource/very_good_coverage/releases) - [Changelog](https://github.com/VeryGoodOpenSource/very_good_coverage/blob/main/CHANGELOG.md) - [Commits](https://github.com/verygoodopensource/very_good_coverage/compare/v1.1.1...v2.1.0) --- updated-dependencies: - dependency-name: VeryGoodOpenSource/very_good_coverage dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/stream_flutter_workflow.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/stream_flutter_workflow.yml b/.github/workflows/stream_flutter_workflow.yml index d5792295..d1a47955 100644 --- a/.github/workflows/stream_flutter_workflow.yml +++ b/.github/workflows/stream_flutter_workflow.yml @@ -105,27 +105,27 @@ jobs: token: ${{secrets.CODECOV_TOKEN}} files: packages/*/coverage/lcov.info - name: "Stream Chat Coverage Check" - uses: VeryGoodOpenSource/very_good_coverage@v1.1.1 + uses: VeryGoodOpenSource/very_good_coverage@v2.1.0 with: path: packages/stream_chat/coverage/lcov.info min_coverage: 79 - name: "Stream Chat Persistence Coverage Check" - uses: VeryGoodOpenSource/very_good_coverage@v1.1.1 + uses: VeryGoodOpenSource/very_good_coverage@v2.1.0 with: path: packages/stream_chat_localizations/coverage/lcov.info min_coverage: 88 - name: "Stream Chat Persistence Coverage Check" - uses: VeryGoodOpenSource/very_good_coverage@v1.1.1 + uses: VeryGoodOpenSource/very_good_coverage@v2.1.0 with: path: packages/stream_chat_persistence/coverage/lcov.info min_coverage: 95 - name: "Stream Chat Flutter Core Coverage Check" - uses: VeryGoodOpenSource/very_good_coverage@v1.1.1 + uses: VeryGoodOpenSource/very_good_coverage@v2.1.0 with: path: packages/stream_chat_flutter_core/coverage/lcov.info min_coverage: 30 - name: "Stream Chat Flutter Coverage Check" - uses: VeryGoodOpenSource/very_good_coverage@v1.1.1 + uses: VeryGoodOpenSource/very_good_coverage@v2.1.0 with: path: packages/stream_chat_flutter/coverage/lcov.info min_coverage: 44 From eebdc5a20aa5a80b71b8b013771bd5275ab113f3 Mon Sep 17 00:00:00 2001 From: Sahil Kumar Date: Fri, 30 Jun 2023 13:33:41 +0530 Subject: [PATCH 23/54] Update stream_flutter_workflow.yml --- .github/workflows/stream_flutter_workflow.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/stream_flutter_workflow.yml b/.github/workflows/stream_flutter_workflow.yml index d1a47955..3b8b6f44 100644 --- a/.github/workflows/stream_flutter_workflow.yml +++ b/.github/workflows/stream_flutter_workflow.yml @@ -8,6 +8,7 @@ on: pull_request: paths: - 'packages/**' + - '.github/workflows/stream_flutter_workflow.yml' types: - opened - reopened @@ -137,4 +138,4 @@ jobs: steps: - name: Run a one-line script - run: echo Draft PR, you are good. \ No newline at end of file + run: echo Draft PR, you are good. From 8850a684a6da259ce9ca34deaa9460f9f5eff410 Mon Sep 17 00:00:00 2001 From: Sahil Kumar Date: Fri, 30 Jun 2023 13:49:45 +0530 Subject: [PATCH 24/54] chore(localization): update translations_test.dart --- packages/stream_chat_localizations/test/translations_test.dart | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/stream_chat_localizations/test/translations_test.dart b/packages/stream_chat_localizations/test/translations_test.dart index 4004994a..c59b0762 100644 --- a/packages/stream_chat_localizations/test/translations_test.dart +++ b/packages/stream_chat_localizations/test/translations_test.dart @@ -14,6 +14,7 @@ void main() { expect(localizations.launchUrlError, isNotNull); expect(localizations.loadingUsersError, isNotNull); expect(localizations.noUsersLabel, isNotNull); + expect(localizations.noPhotoOrVideoLabel, isNotNull); expect(localizations.retryLabel, isNotNull); expect(localizations.userLastOnlineText, isNotNull); expect(localizations.userOnlineText, isNotNull); From 2900e5f3a2cdd51a0b15301d0f03eec08ad7e6a9 Mon Sep 17 00:00:00 2001 From: Sahil Kumar Date: Fri, 30 Jun 2023 13:51:02 +0530 Subject: [PATCH 25/54] chore: update stream_flutter_workflow.yml --- .github/workflows/stream_flutter_workflow.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/stream_flutter_workflow.yml b/.github/workflows/stream_flutter_workflow.yml index 3b8b6f44..99312316 100644 --- a/.github/workflows/stream_flutter_workflow.yml +++ b/.github/workflows/stream_flutter_workflow.yml @@ -110,11 +110,11 @@ jobs: with: path: packages/stream_chat/coverage/lcov.info min_coverage: 79 - - name: "Stream Chat Persistence Coverage Check" + - name: "Stream Chat Localizations Coverage Check" uses: VeryGoodOpenSource/very_good_coverage@v2.1.0 with: path: packages/stream_chat_localizations/coverage/lcov.info - min_coverage: 88 + min_coverage: 100 - name: "Stream Chat Persistence Coverage Check" uses: VeryGoodOpenSource/very_good_coverage@v2.1.0 with: From eddd8a3d125c027495efe5ff0027e0bba7bb740c Mon Sep 17 00:00:00 2001 From: Sahil Kumar Date: Fri, 30 Jun 2023 14:20:40 +0530 Subject: [PATCH 26/54] chore(ui): bump and migrate video_player to 2.7.0. Signed-off-by: xsahil03x --- .../lib/src/fullscreen_media/full_screen_media.dart | 8 ++++++-- .../lib/src/message_input/quoted_message_widget.dart | 5 +++-- packages/stream_chat_flutter/pubspec.yaml | 2 +- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/packages/stream_chat_flutter/lib/src/fullscreen_media/full_screen_media.dart b/packages/stream_chat_flutter/lib/src/fullscreen_media/full_screen_media.dart index a6feaa5e..2a791954 100644 --- a/packages/stream_chat_flutter/lib/src/fullscreen_media/full_screen_media.dart +++ b/packages/stream_chat_flutter/lib/src/fullscreen_media/full_screen_media.dart @@ -446,8 +446,12 @@ class VideoPackage { }) : _showControls = showControls, _autoInitialize = autoInitialize, _videoPlayerController = _attachment.localUri != null - ? VideoPlayerController.file(File.fromUri(_attachment.localUri!)) - : VideoPlayerController.network(_attachment.assetUrl!); + ? VideoPlayerController.file( + File.fromUri(_attachment.localUri!), + ) + : VideoPlayerController.networkUrl( + Uri.parse(_attachment.assetUrl!), + ); final Attachment _attachment; final bool _showControls; diff --git a/packages/stream_chat_flutter/lib/src/message_input/quoted_message_widget.dart b/packages/stream_chat_flutter/lib/src/message_input/quoted_message_widget.dart index ab90710a..3bec1975 100644 --- a/packages/stream_chat_flutter/lib/src/message_input/quoted_message_widget.dart +++ b/packages/stream_chat_flutter/lib/src/message_input/quoted_message_widget.dart @@ -382,8 +382,9 @@ class _VideoAttachmentThumbnailState extends State<_VideoAttachmentThumbnail> { @override void initState() { super.initState(); - _controller = VideoPlayerController.network(widget.attachment.assetUrl!) - ..initialize().then((_) { + _controller = VideoPlayerController.networkUrl( + Uri.parse(widget.attachment.assetUrl!), + )..initialize().then((_) { // ignore: no-empty-block setState(() {}); //when your thumbnail will show. }); diff --git a/packages/stream_chat_flutter/pubspec.yaml b/packages/stream_chat_flutter/pubspec.yaml index 45f43a5f..c67b8f60 100644 --- a/packages/stream_chat_flutter/pubspec.yaml +++ b/packages/stream_chat_flutter/pubspec.yaml @@ -42,7 +42,7 @@ dependencies: synchronized: ^3.0.0 thumblr: ^0.0.4 url_launcher: ^6.1.0 - video_player: ^2.4.5 + video_player: ^2.7.0 video_player_macos: ^2.0.1 video_thumbnail: ^0.5.0 From af1de4c311e4d3d38fbb654044922f236dacfb9a Mon Sep 17 00:00:00 2001 From: Sahil Kumar Date: Fri, 30 Jun 2023 14:23:21 +0530 Subject: [PATCH 27/54] chore: update CHANGELOG.md Signed-off-by: xsahil03x --- packages/stream_chat_flutter/CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/stream_chat_flutter/CHANGELOG.md b/packages/stream_chat_flutter/CHANGELOG.md index ceaf1683..50b976c6 100644 --- a/packages/stream_chat_flutter/CHANGELOG.md +++ b/packages/stream_chat_flutter/CHANGELOG.md @@ -86,7 +86,6 @@ }, ) ``` - - Deprecated `StreamMessageWidget.showReactionPickerIndicator` in favor of `StreamMessageWidget.showReactionPicker`. ```diff @@ -95,6 +94,7 @@ + showReactionPicker: true/false, ) ``` +- Updated `video_player` dependency to `^2.7.0`. ## 6.4.0 From cbce833804f1fc1e485731935b12e8f7e4791cbb Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 30 Jun 2023 07:00:23 +0000 Subject: [PATCH 28/54] chore(deps): bump image_picker in /packages/stream_chat_flutter Bumps [image_picker](https://github.com/flutter/packages/tree/main/packages/image_picker) from 0.8.9 to 1.0.0. - [Release notes](https://github.com/flutter/packages/releases) - [Commits](https://github.com/flutter/packages/commits/image_picker-v1.0.0/packages/image_picker) --- updated-dependencies: - dependency-name: image_picker dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- packages/stream_chat_flutter/pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/stream_chat_flutter/pubspec.yaml b/packages/stream_chat_flutter/pubspec.yaml index c67b8f60..b4131a9f 100644 --- a/packages/stream_chat_flutter/pubspec.yaml +++ b/packages/stream_chat_flutter/pubspec.yaml @@ -28,7 +28,7 @@ dependencies: flutter_svg: ^2.0.4 http_parser: ^4.0.0 image_gallery_saver: ^2.0.1 - image_picker: ^0.8.2 + image_picker: ">=0.8.2 <2.0.0" jiffy: ^5.0.0 lottie: ^2.0.0 meta: ^1.8.0 From d7715ea9dcb08c9885c1197d9fc368e55b2e44f5 Mon Sep 17 00:00:00 2001 From: Sahil Kumar Date: Fri, 30 Jun 2023 14:41:48 +0530 Subject: [PATCH 29/54] Revert "feat(ui): add support for `StreamMessageInput.contentInsertionConfiguration`." --- packages/stream_chat_flutter/CHANGELOG.md | 15 --------------- .../src/message_input/stream_message_input.dart | 6 ------ .../message_input/stream_message_text_field.dart | 8 -------- 3 files changed, 29 deletions(-) diff --git a/packages/stream_chat_flutter/CHANGELOG.md b/packages/stream_chat_flutter/CHANGELOG.md index 50b976c6..9ac7a0c7 100644 --- a/packages/stream_chat_flutter/CHANGELOG.md +++ b/packages/stream_chat_flutter/CHANGELOG.md @@ -178,21 +178,6 @@ ) ``` -- Added support for `StreamMessageInput.contentInsertionConfiguration` to specify the content insertion configuration. - [#1613](https://github.com/GetStream/stream-chat-flutter/issues/1613) - - ```dart - StreamMessageInput( - ..., - contentInsertionConfiguration: ContentInsertionConfiguration( - onContentInserted: (content) { - // Do something with the content. - controller.addAttachment(...); - }, - ), - ) - ``` - ## 6.3.0 🐞 Fixed diff --git a/packages/stream_chat_flutter/lib/src/message_input/stream_message_input.dart b/packages/stream_chat_flutter/lib/src/message_input/stream_message_input.dart index e8ce137e..ad5790b4 100644 --- a/packages/stream_chat_flutter/lib/src/message_input/stream_message_input.dart +++ b/packages/stream_chat_flutter/lib/src/message_input/stream_message_input.dart @@ -147,7 +147,6 @@ class StreamMessageInput extends StatefulWidget { _defaultClearQuotedMessageKeyPredicate, this.ogPreviewFilter = _defaultOgPreviewFilter, this.hintGetter = _defaultHintGetter, - this.contentInsertionConfiguration, }); /// The predicate used to send a message on desktop/web @@ -341,9 +340,6 @@ class StreamMessageInput extends StatefulWidget { /// Returns the hint text for the message input. final HintGetter hintGetter; - /// {@macro flutter.widgets.editableText.contentInsertionConfiguration} - final ContentInsertionConfiguration? contentInsertionConfiguration; - static String? _defaultHintGetter( BuildContext context, HintType type, @@ -909,8 +905,6 @@ class StreamMessageInputState extends State decoration: _getInputDecoration(context), textCapitalization: widget.textCapitalization, autocorrect: widget.autoCorrect, - contentInsertionConfiguration: - widget.contentInsertionConfiguration, ), ), ), diff --git a/packages/stream_chat_flutter/lib/src/message_input/stream_message_text_field.dart b/packages/stream_chat_flutter/lib/src/message_input/stream_message_text_field.dart index 292c9141..a04ab829 100644 --- a/packages/stream_chat_flutter/lib/src/message_input/stream_message_text_field.dart +++ b/packages/stream_chat_flutter/lib/src/message_input/stream_message_text_field.dart @@ -120,7 +120,6 @@ class StreamMessageTextField extends StatefulWidget { this.restorationId, this.scribbleEnabled = true, this.enableIMEPersonalizedLearning = true, - this.contentInsertionConfiguration, }) : assert(obscuringCharacter.length == 1, ''), smartDashesType = smartDashesType ?? (obscureText ? SmartDashesType.disabled : SmartDashesType.enabled), @@ -527,9 +526,6 @@ class StreamMessageTextField extends StatefulWidget { /// {@macro flutter.services.TextInputConfiguration.enableIMEPersonalizedLearning} final bool enableIMEPersonalizedLearning; - /// {@macro flutter.widgets.editableText.contentInsertionConfiguration} - final ContentInsertionConfiguration? contentInsertionConfiguration; - @override _StreamMessageTextFieldState createState() => _StreamMessageTextFieldState(); @@ -626,9 +622,6 @@ class StreamMessageTextField extends StatefulWidget { properties.add(DiagnosticsProperty( 'enableIMEPersonalizedLearning', enableIMEPersonalizedLearning, defaultValue: true)); - properties.add(DiagnosticsProperty( - 'contentInsertionConfiguration', contentInsertionConfiguration, - defaultValue: null)); } } @@ -734,7 +727,6 @@ class _StreamMessageTextFieldState extends State restorationId: widget.restorationId, scribbleEnabled: widget.scribbleEnabled, enableIMEPersonalizedLearning: widget.enableIMEPersonalizedLearning, - contentInsertionConfiguration: widget.contentInsertionConfiguration, ); @override From 3b09837f61ad07df981478355fa8284a997a6b15 Mon Sep 17 00:00:00 2001 From: Sahil Kumar Date: Tue, 4 Jul 2023 14:25:55 +0530 Subject: [PATCH 30/54] chore(repo): remove dart-code-metrics. Signed-off-by: xsahil03x --- .github/workflows/dart_code_metrics.yaml | 74 ------------------- analysis_options.yaml | 23 +----- packages/stream_chat/pubspec.yaml | 1 - packages/stream_chat_flutter/pubspec.yaml | 1 - .../stream_chat_flutter_core/pubspec.yaml | 1 - .../stream_chat_localizations/pubspec.yaml | 1 - packages/stream_chat_persistence/pubspec.yaml | 1 - 7 files changed, 1 insertion(+), 101 deletions(-) delete mode 100644 .github/workflows/dart_code_metrics.yaml diff --git a/.github/workflows/dart_code_metrics.yaml b/.github/workflows/dart_code_metrics.yaml deleted file mode 100644 index 504173f3..00000000 --- a/.github/workflows/dart_code_metrics.yaml +++ /dev/null @@ -1,74 +0,0 @@ -name: Dart Code Metrics - -env: - flutter_version: "3.10.4" - folders: "lib, test" - -on: - pull_request: - paths: - - 'packages/**' - push: - branches: - - master - - develop - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true - -jobs: - check: - name: dart-code-metrics - runs-on: ubuntu-latest - steps: - - name: "Git Checkout" - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - - name: "Install Flutter" - uses: subosito/flutter-action@v2 - with: - cache: true - flutter-version: ${{ env.flutter_version }} - - - name: "Install Tools" - run: flutter pub global activate melos - - name: "Bootstrap Workspace" - run: melos bootstrap - - - name: "Stream Chat Metrics" - uses: dart-code-checker/dart-code-metrics-action@v3 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - relative_path: 'packages/stream_chat' - folders: ${{ env.folders }} - - - name: "Stream Chat Flutter Core Metrics" - uses: dart-code-checker/dart-code-metrics-action@v3 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - relative_path: 'packages/stream_chat_flutter_core' - folders: ${{ env.folders }} - - - name: "Stream Chat Flutter Metrics" - uses: dart-code-checker/dart-code-metrics-action@v3 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - relative_path: 'packages/stream_chat_flutter' - folders: ${{ env.folders }} - - - name: "Stream Chat Localizations Metrics" - uses: dart-code-checker/dart-code-metrics-action@v3 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - relative_path: 'packages/stream_chat_localizations' - folders: ${{ env.folders }} - - - name: "Stream Chat Persistence Metrics" - uses: dart-code-checker/dart-code-metrics-action@v3 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - relative_path: 'packages/stream_chat_persistence' - folders: ${{ env.folders }} diff --git a/analysis_options.yaml b/analysis_options.yaml index 6386f168..abb5d979 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -1,6 +1,4 @@ analyzer: - plugins: - - dart_code_metrics exclude: - packages/*/lib/**/*.g.dart - packages/*/lib/scrollable_positioned_list/** @@ -159,23 +157,4 @@ linter: - unnecessary_overrides - prefer_null_aware_method_calls - use_named_constants - - use_raw_strings - -# https://dartcodemetrics.dev/docs/getting-started/introduction -dart_code_metrics: - rules: - # Dart Specific - - binary-expression-operand-order - - double-literal-format - - no-boolean-literal-compare - - no-equal-then-else - - no-empty-block: - exclude: - - packages/*/test/** - - prefer-trailing-comma: - exclude: - - packages/*/test/** - - # Flutter specific - - always-remove-listener - - avoid-unnecessary-setstate \ No newline at end of file + - use_raw_strings \ No newline at end of file diff --git a/packages/stream_chat/pubspec.yaml b/packages/stream_chat/pubspec.yaml index 3bd6b49a..7156199c 100644 --- a/packages/stream_chat/pubspec.yaml +++ b/packages/stream_chat/pubspec.yaml @@ -28,7 +28,6 @@ dependencies: dev_dependencies: build_runner: ^2.3.3 - dart_code_metrics: ^5.7.2 freezed: ^2.3.2 json_serializable: ^6.6.1 mocktail: ^0.3.0 diff --git a/packages/stream_chat_flutter/pubspec.yaml b/packages/stream_chat_flutter/pubspec.yaml index b4131a9f..5514cd34 100644 --- a/packages/stream_chat_flutter/pubspec.yaml +++ b/packages/stream_chat_flutter/pubspec.yaml @@ -70,7 +70,6 @@ flutter: uses-material-design: true dev_dependencies: - dart_code_metrics: ^5.7.2 flutter_test: sdk: flutter golden_toolkit: ^0.15.0 diff --git a/packages/stream_chat_flutter_core/pubspec.yaml b/packages/stream_chat_flutter_core/pubspec.yaml index 852b0afc..b3448b07 100644 --- a/packages/stream_chat_flutter_core/pubspec.yaml +++ b/packages/stream_chat_flutter_core/pubspec.yaml @@ -21,7 +21,6 @@ dependencies: dev_dependencies: build_runner: ^2.3.3 - dart_code_metrics: ^5.7.2 fake_async: ^1.2.0 flutter_test: sdk: flutter diff --git a/packages/stream_chat_localizations/pubspec.yaml b/packages/stream_chat_localizations/pubspec.yaml index ecd1ae78..10fef73f 100644 --- a/packages/stream_chat_localizations/pubspec.yaml +++ b/packages/stream_chat_localizations/pubspec.yaml @@ -17,7 +17,6 @@ dependencies: stream_chat_flutter: ^6.4.0 dev_dependencies: - dart_code_metrics: ^5.7.2 flutter_test: sdk: flutter diff --git a/packages/stream_chat_persistence/pubspec.yaml b/packages/stream_chat_persistence/pubspec.yaml index b4dfa792..cb76edad 100644 --- a/packages/stream_chat_persistence/pubspec.yaml +++ b/packages/stream_chat_persistence/pubspec.yaml @@ -22,7 +22,6 @@ dependencies: dev_dependencies: build_runner: ^2.3.3 - dart_code_metrics: ^5.7.2 drift_dev: ^2.7.0 flutter_test: sdk: flutter From 7f6cfda9bc33b6ecc19a5b0c2fdc0f50472f01ea Mon Sep 17 00:00:00 2001 From: Sahil Kumar Date: Mon, 3 Jul 2023 22:54:59 +0530 Subject: [PATCH 31/54] chore(ui): bump chewie to ^1.6.0 Signed-off-by: xsahil03x --- packages/stream_chat_flutter/pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/stream_chat_flutter/pubspec.yaml b/packages/stream_chat_flutter/pubspec.yaml index 5514cd34..b6e26a18 100644 --- a/packages/stream_chat_flutter/pubspec.yaml +++ b/packages/stream_chat_flutter/pubspec.yaml @@ -11,7 +11,7 @@ environment: dependencies: cached_network_image: ^3.0.0 - chewie: ^1.3.4 + chewie: ^1.6.0 collection: ^1.17.0 contextmenu: ^3.0.0 dart_vlc: ^0.4.0 From be9d82827e6a32c8282c32c6acc0e692f5b3302b Mon Sep 17 00:00:00 2001 From: Sahil Kumar Date: Mon, 3 Jul 2023 22:55:46 +0530 Subject: [PATCH 32/54] chore(ui): bump share_plus to ^7.0.2 Signed-off-by: xsahil03x --- packages/stream_chat_flutter/pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/stream_chat_flutter/pubspec.yaml b/packages/stream_chat_flutter/pubspec.yaml index b6e26a18..027a8844 100644 --- a/packages/stream_chat_flutter/pubspec.yaml +++ b/packages/stream_chat_flutter/pubspec.yaml @@ -36,7 +36,7 @@ dependencies: photo_manager: ^2.5.2 photo_view: ^0.14.0 rxdart: ^0.27.0 - share_plus: ^6.3.0 + share_plus: ^7.0.2 shimmer: ^3.0.0 stream_chat_flutter_core: ^6.4.0 synchronized: ^3.0.0 From 4e19f077325159ac3ddebb428178aef7bea823fc Mon Sep 17 00:00:00 2001 From: Sahil Kumar Date: Mon, 3 Jul 2023 22:56:09 +0530 Subject: [PATCH 33/54] chore: update CHANGELOG.md Signed-off-by: xsahil03x --- packages/stream_chat_flutter/CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/stream_chat_flutter/CHANGELOG.md b/packages/stream_chat_flutter/CHANGELOG.md index 9ac7a0c7..0d3d4e73 100644 --- a/packages/stream_chat_flutter/CHANGELOG.md +++ b/packages/stream_chat_flutter/CHANGELOG.md @@ -95,6 +95,8 @@ ) ``` - Updated `video_player` dependency to `^2.7.0`. +- Updated `chewie` dependency to `^1.6.0`. +- Updated `share_plus` dependency to `^7.0.2`. ## 6.4.0 From 79faac57e5761296f0bf93719a57985758db9629 Mon Sep 17 00:00:00 2001 From: Sahil Kumar Date: Thu, 22 Jun 2023 13:37:58 +0530 Subject: [PATCH 34/54] chore(ui): bump jiffy to v6.2.1 Signed-off-by: xsahil03x --- .gitignore | 1 + .../lib/src/channel/channel_info.dart | 3 ++- .../lib/src/channel/channel_preview.dart | 6 ++--- .../lib/src/localization/translations.dart | 8 ++++--- .../message_list_view/message_list_view.dart | 22 +++++++++++++------ .../lib/src/message_widget/bottom_row.dart | 2 +- .../lib/src/misc/date_divider.dart | 12 +++++----- .../stream_channel_list_tile.dart | 6 ++--- .../stream_message_search_list_tile.dart | 4 ++-- .../stream_user_list_tile.dart | 3 ++- .../lib/src/stream_chat.dart | 4 ++-- .../lib/src/user/user_item.dart | 4 +++- packages/stream_chat_flutter/pubspec.yaml | 2 +- 13 files changed, 46 insertions(+), 31 deletions(-) diff --git a/.gitignore b/.gitignore index 8f4fc629..c3f33953 100644 --- a/.gitignore +++ b/.gitignore @@ -8,6 +8,7 @@ coverage .pub/ .dart_tool/ pubspec.lock +pubspec_overrides.yaml flutter_export_environment.sh examples/all_plugins/pubspec.yaml diff --git a/packages/stream_chat_flutter/lib/src/channel/channel_info.dart b/packages/stream_chat_flutter/lib/src/channel/channel_info.dart index 5c32d278..abab5ad9 100644 --- a/packages/stream_chat_flutter/lib/src/channel/channel_info.dart +++ b/packages/stream_chat_flutter/lib/src/channel/channel_info.dart @@ -106,9 +106,10 @@ class _ConnectedTitleState extends StatelessWidget { style: textStyle, ); } else { + final lastActive = otherMember.user?.lastActive ?? DateTime.now(); alternativeWidget = Text( '${context.translations.userLastOnlineText} ' - '${Jiffy(otherMember.user?.lastActive).fromNow()}', + '${Jiffy.parseFromDateTime(lastActive).fromNow()}', style: textStyle, ); } diff --git a/packages/stream_chat_flutter/lib/src/channel/channel_preview.dart b/packages/stream_chat_flutter/lib/src/channel/channel_preview.dart index ae6247ea..f64b9dc9 100644 --- a/packages/stream_chat_flutter/lib/src/channel/channel_preview.dart +++ b/packages/stream_chat_flutter/lib/src/channel/channel_preview.dart @@ -349,16 +349,16 @@ class _Date extends StatelessWidget { if (lastMessageAt.millisecondsSinceEpoch >= startOfDay.millisecondsSinceEpoch) { - stringDate = Jiffy(lastMessageAt.toLocal()).jm; + stringDate = Jiffy.parseFromDateTime(lastMessageAt.toLocal()).jm; } else if (lastMessageAt.millisecondsSinceEpoch >= startOfDay .subtract(const Duration(days: 1)) .millisecondsSinceEpoch) { stringDate = context.translations.yesterdayLabel; } else if (startOfDay.difference(lastMessageAt).inDays < 7) { - stringDate = Jiffy(lastMessageAt.toLocal()).EEEE; + stringDate = Jiffy.parseFromDateTime(lastMessageAt.toLocal()).EEEE; } else { - stringDate = Jiffy(lastMessageAt.toLocal()).yMd; + stringDate = Jiffy.parseFromDateTime(lastMessageAt.toLocal()).yMd; } return Text( diff --git a/packages/stream_chat_flutter/lib/src/localization/translations.dart b/packages/stream_chat_flutter/lib/src/localization/translations.dart index 61c3441a..9863fbbc 100644 --- a/packages/stream_chat_flutter/lib/src/localization/translations.dart +++ b/packages/stream_chat_flutter/lib/src/localization/translations.dart @@ -611,13 +611,15 @@ class DefaultTranslations implements Translations { } else if (date == yesterday) { return 'yesterday'; } else { - return 'on ${Jiffy(date).MMMd}'; + return 'on ${Jiffy.parseFromDateTime(date).MMMd}'; } } @override - String sentAtText({required DateTime date, required DateTime time}) => - 'Sent ${_getDay(date)} at ${Jiffy(time.toLocal()).format('HH:mm')}'; + String sentAtText({required DateTime date, required DateTime time}) { + final atTime = Jiffy.parseFromDateTime(time.toLocal()); + return 'Sent ${_getDay(date)} at ${atTime.format(pattern: 'HH:mm')}'; + } @override String get todayLabel => 'Today'; diff --git a/packages/stream_chat_flutter/lib/src/message_list_view/message_list_view.dart b/packages/stream_chat_flutter/lib/src/message_list_view/message_list_view.dart index 5a5075f8..f9de1787 100644 --- a/packages/stream_chat_flutter/lib/src/message_list_view/message_list_view.dart +++ b/packages/stream_chat_flutter/lib/src/message_list_view/message_list_view.dart @@ -669,14 +669,20 @@ class _StreamMessageListViewState extends State { final isPartOfThread = message.replyCount! > 0 || message.showInChannel == true; - final createdAt = message.createdAt.toLocal(); - final nextCreatedAt = nextMessage.createdAt.toLocal(); - if (!Jiffy(createdAt).isSame(nextCreatedAt, Units.DAY)) { + final createdAt = Jiffy.parseFromDateTime( + message.createdAt.toLocal(), + ); + + final nextCreatedAt = Jiffy.parseFromDateTime( + nextMessage.createdAt.toLocal(), + ); + + if (!createdAt.isSame(nextCreatedAt, unit: Unit.day)) { separator = _buildDateDivider(nextMessage); } else { - final hasTimeDiff = !Jiffy(createdAt).isSame( + final hasTimeDiff = !createdAt.isSame( nextCreatedAt, - Units.MINUTE, + unit: Unit.minute, ); final isNextUserSame = @@ -1071,10 +1077,12 @@ class _StreamMessageListViewState extends State { var hasTimeDiff = false; if (nextMessage != null) { - hasTimeDiff = !Jiffy(message.createdAt.toLocal()).isSame( + final createdAt = Jiffy.parseFromDateTime(message.createdAt.toLocal()); + final nextCreatedAt = Jiffy.parseFromDateTime( nextMessage.createdAt.toLocal(), - Units.MINUTE, ); + + hasTimeDiff = !createdAt.isSame(nextCreatedAt, unit: Unit.minute); } final hasFileAttachment = diff --git a/packages/stream_chat_flutter/lib/src/message_widget/bottom_row.dart b/packages/stream_chat_flutter/lib/src/message_widget/bottom_row.dart index 5ca2462a..7092dadf 100644 --- a/packages/stream_chat_flutter/lib/src/message_widget/bottom_row.dart +++ b/packages/stream_chat_flutter/lib/src/message_widget/bottom_row.dart @@ -191,7 +191,7 @@ class BottomRow extends StatelessWidget { ), if (showTimeStamp) Text( - Jiffy(message.createdAt.toLocal()).jm, + Jiffy.parseFromDateTime(message.createdAt.toLocal()).jm, style: messageTheme.createdAtStyle, ), if (showSendingIndicator) diff --git a/packages/stream_chat_flutter/lib/src/misc/date_divider.dart b/packages/stream_chat_flutter/lib/src/misc/date_divider.dart index 24af4f3f..24c0c9a7 100644 --- a/packages/stream_chat_flutter/lib/src/misc/date_divider.dart +++ b/packages/stream_chat_flutter/lib/src/misc/date_divider.dart @@ -20,17 +20,17 @@ class StreamDateDivider extends StatelessWidget { @override Widget build(BuildContext context) { - final createdAt = Jiffy(dateTime); - final now = Jiffy(DateTime.now()); + final createdAt = Jiffy.parseFromDateTime(dateTime); + final now = Jiffy.parseFromDateTime(DateTime.now()); var dayInfo = createdAt.MMMd; - if (createdAt.isSame(now, Units.DAY)) { + if (createdAt.isSame(now, unit: Unit.day)) { dayInfo = context.translations.todayLabel; - } else if (createdAt.isSame(now.subtract(days: 1), Units.DAY)) { + } else if (createdAt.isSame(now.subtract(days: 1), unit: Unit.day)) { dayInfo = context.translations.yesterdayLabel; - } else if (createdAt.isAfter(now.subtract(days: 7), Units.DAY)) { + } else if (createdAt.isAfter(now.subtract(days: 7), unit: Unit.day)) { dayInfo = createdAt.EEEE; - } else if (createdAt.isAfter(now.subtract(years: 1), Units.DAY)) { + } else if (createdAt.isAfter(now.subtract(years: 1), unit: Unit.day)) { dayInfo = createdAt.MMMd; } diff --git a/packages/stream_chat_flutter/lib/src/scroll_view/channel_scroll_view/stream_channel_list_tile.dart b/packages/stream_chat_flutter/lib/src/scroll_view/channel_scroll_view/stream_channel_list_tile.dart index 6b2a9b4f..b5261802 100644 --- a/packages/stream_chat_flutter/lib/src/scroll_view/channel_scroll_view/stream_channel_list_tile.dart +++ b/packages/stream_chat_flutter/lib/src/scroll_view/channel_scroll_view/stream_channel_list_tile.dart @@ -287,16 +287,16 @@ class ChannelLastMessageDate extends StatelessWidget { if (lastMessageAt.millisecondsSinceEpoch >= startOfDay.millisecondsSinceEpoch) { - stringDate = Jiffy(lastMessageAt.toLocal()).jm; + stringDate = Jiffy.parseFromDateTime(lastMessageAt.toLocal()).jm; } else if (lastMessageAt.millisecondsSinceEpoch >= startOfDay .subtract(const Duration(days: 1)) .millisecondsSinceEpoch) { stringDate = context.translations.yesterdayLabel; } else if (startOfDay.difference(lastMessageAt).inDays < 7) { - stringDate = Jiffy(lastMessageAt.toLocal()).EEEE; + stringDate = Jiffy.parseFromDateTime(lastMessageAt.toLocal()).EEEE; } else { - stringDate = Jiffy(lastMessageAt.toLocal()).yMd; + stringDate = Jiffy.parseFromDateTime(lastMessageAt.toLocal()).yMd; } return Text( diff --git a/packages/stream_chat_flutter/lib/src/scroll_view/message_search_scroll_view/stream_message_search_list_tile.dart b/packages/stream_chat_flutter/lib/src/scroll_view/message_search_scroll_view/stream_message_search_list_tile.dart index 5aab3b2d..3eb03aec 100644 --- a/packages/stream_chat_flutter/lib/src/scroll_view/message_search_scroll_view/stream_message_search_list_tile.dart +++ b/packages/stream_chat_flutter/lib/src/scroll_view/message_search_scroll_view/stream_message_search_list_tile.dart @@ -227,9 +227,9 @@ class MessageSearchTileMessageDate extends StatelessWidget { if (now.year != createdAt.year || now.month != createdAt.month || now.day != createdAt.day) { - stringDate = Jiffy(createdAt.toLocal()).yMd; + stringDate = Jiffy.parseFromDateTime(createdAt.toLocal()).yMd; } else { - stringDate = Jiffy(createdAt.toLocal()).jm; + stringDate = Jiffy.parseFromDateTime(createdAt.toLocal()).jm; } return Text( diff --git a/packages/stream_chat_flutter/lib/src/scroll_view/user_scroll_view/stream_user_list_tile.dart b/packages/stream_chat_flutter/lib/src/scroll_view/user_scroll_view/stream_user_list_tile.dart index 5ee49dcc..1b0251f6 100644 --- a/packages/stream_chat_flutter/lib/src/scroll_view/user_scroll_view/stream_user_list_tile.dart +++ b/packages/stream_chat_flutter/lib/src/scroll_view/user_scroll_view/stream_user_list_tile.dart @@ -176,11 +176,12 @@ class UserLastActive extends StatelessWidget { @override Widget build(BuildContext context) { final chatTheme = StreamChatTheme.of(context); + final lastActive = user.lastActive ?? DateTime.now(); return Text( user.online ? context.translations.userOnlineText : '${context.translations.userLastOnlineText} ' - '${Jiffy(user.lastActive).fromNow()}', + '${Jiffy.parseFromDateTime(lastActive).fromNow()}', style: chatTheme.textTheme.footnote.copyWith( color: chatTheme.colorTheme.textHighEmphasis.withOpacity(0.5), ), diff --git a/packages/stream_chat_flutter/lib/src/stream_chat.dart b/packages/stream_chat_flutter/lib/src/stream_chat.dart index 73a0d0a0..6b0d0e60 100644 --- a/packages/stream_chat_flutter/lib/src/stream_chat.dart +++ b/packages/stream_chat_flutter/lib/src/stream_chat.dart @@ -165,9 +165,9 @@ class StreamChatState extends State { @override void didChangeDependencies() { final currentLocale = Localizations.localeOf(context).toString(); - final availableLocales = Jiffy.getAllAvailableLocales(); + final availableLocales = Jiffy.getSupportedLocales(); if (availableLocales.contains(currentLocale)) { - Jiffy.locale(currentLocale); + Jiffy.setLocale(currentLocale); } super.didChangeDependencies(); } diff --git a/packages/stream_chat_flutter/lib/src/user/user_item.dart b/packages/stream_chat_flutter/lib/src/user/user_item.dart index 85d12a99..0c13d95e 100644 --- a/packages/stream_chat_flutter/lib/src/user/user_item.dart +++ b/packages/stream_chat_flutter/lib/src/user/user_item.dart @@ -14,6 +14,7 @@ import 'package:stream_chat_flutter/stream_chat_flutter.dart'; /// [StreamChatTheme]. /// Modify it to change the widget's appearance. /// {@endtemplate} +@Deprecated('Use `StreamUserListTile` instead.') class StreamUserItem extends StatelessWidget { /// {@macro streamUserItem} const StreamUserItem({ @@ -73,11 +74,12 @@ class StreamUserItem extends StatelessWidget { Widget _buildLastActive(BuildContext context) { final chatTheme = StreamChatTheme.of(context); + final lastActive = user.lastActive ?? DateTime.now(); return Text( user.online ? context.translations.userOnlineText : '${context.translations.userLastOnlineText} ' - '${Jiffy(user.lastActive).fromNow()}', + '${Jiffy.parseFromDateTime(lastActive).fromNow()}', style: chatTheme.textTheme.footnote.copyWith( color: chatTheme.colorTheme.textHighEmphasis.withOpacity(0.5), ), diff --git a/packages/stream_chat_flutter/pubspec.yaml b/packages/stream_chat_flutter/pubspec.yaml index 027a8844..f4b079d5 100644 --- a/packages/stream_chat_flutter/pubspec.yaml +++ b/packages/stream_chat_flutter/pubspec.yaml @@ -29,7 +29,7 @@ dependencies: http_parser: ^4.0.0 image_gallery_saver: ^2.0.1 image_picker: ">=0.8.2 <2.0.0" - jiffy: ^5.0.0 + jiffy: ^6.2.1 lottie: ^2.0.0 meta: ^1.8.0 path_provider: ^2.0.9 From 677b71e728b095e6f2088aa1a694846c26bcdb7e Mon Sep 17 00:00:00 2001 From: Sahil Kumar Date: Thu, 22 Jun 2023 14:12:29 +0530 Subject: [PATCH 35/54] chore(localization): bump stream_chat_flutter Signed-off-by: xsahil03x --- .../example/lib/add_new_lang.dart | 8 +++++--- .../lib/src/stream_chat_localizations_ca.dart | 8 +++++--- .../lib/src/stream_chat_localizations_de.dart | 8 +++++--- .../lib/src/stream_chat_localizations_en.dart | 8 +++++--- .../lib/src/stream_chat_localizations_es.dart | 8 +++++--- .../lib/src/stream_chat_localizations_fr.dart | 8 +++++--- .../lib/src/stream_chat_localizations_hi.dart | 8 +++++--- .../lib/src/stream_chat_localizations_it.dart | 8 +++++--- .../lib/src/stream_chat_localizations_ja.dart | 8 +++++--- .../lib/src/stream_chat_localizations_ko.dart | 8 +++++--- .../lib/src/stream_chat_localizations_no.dart | 8 +++++--- .../lib/src/stream_chat_localizations_pt.dart | 8 +++++--- 12 files changed, 60 insertions(+), 36 deletions(-) diff --git a/packages/stream_chat_localizations/example/lib/add_new_lang.dart b/packages/stream_chat_localizations/example/lib/add_new_lang.dart index bab8101b..e1d1335a 100644 --- a/packages/stream_chat_localizations/example/lib/add_new_lang.dart +++ b/packages/stream_chat_localizations/example/lib/add_new_lang.dart @@ -270,13 +270,15 @@ class NnStreamChatLocalizations extends GlobalStreamChatLocalizations { } else if (date == yesterday) { return 'yesterday'; } else { - return 'on ${Jiffy(date).MMMd}'; + return 'on ${Jiffy.parseFromDateTime(date).MMMd}'; } } @override - String sentAtText({required DateTime date, required DateTime time}) => - 'Sent ${_getDay(date)} at ${Jiffy(time.toLocal()).format('HH:mm')}'; + String sentAtText({required DateTime date, required DateTime time}) { + final atTime = Jiffy.parseFromDateTime(time.toLocal()); + return 'Sent ${_getDay(date)} at ${atTime.jm}'; + } @override String get todayLabel => 'Today'; diff --git a/packages/stream_chat_localizations/lib/src/stream_chat_localizations_ca.dart b/packages/stream_chat_localizations/lib/src/stream_chat_localizations_ca.dart index 3c471e05..ed2d3d7e 100644 --- a/packages/stream_chat_localizations/lib/src/stream_chat_localizations_ca.dart +++ b/packages/stream_chat_localizations/lib/src/stream_chat_localizations_ca.dart @@ -249,13 +249,15 @@ class StreamChatLocalizationsCa extends GlobalStreamChatLocalizations { } else if (date == yesterday) { return 'ahir'; } else { - return 'el ${Jiffy(date).MMMd}'; + return 'el ${Jiffy.parseFromDateTime(date).MMMd}'; } } @override - String sentAtText({required DateTime date, required DateTime time}) => - '''Enviat el ${_getDay(date)} a les ${Jiffy(time.toLocal()).format('HH:mm')}'''; + String sentAtText({required DateTime date, required DateTime time}) { + final atTime = Jiffy.parseFromDateTime(time.toLocal()); + return 'Enviat el ${_getDay(date)} a les ${atTime.jm}'; + } @override String get todayLabel => 'Avui'; diff --git a/packages/stream_chat_localizations/lib/src/stream_chat_localizations_de.dart b/packages/stream_chat_localizations/lib/src/stream_chat_localizations_de.dart index df2a7766..fe95f0f7 100644 --- a/packages/stream_chat_localizations/lib/src/stream_chat_localizations_de.dart +++ b/packages/stream_chat_localizations/lib/src/stream_chat_localizations_de.dart @@ -239,13 +239,15 @@ class StreamChatLocalizationsDe extends GlobalStreamChatLocalizations { } else if (date == yesterday) { return 'Gestern'; } else { - return 'am ${Jiffy(date).MMMd}'; + return 'am ${Jiffy.parseFromDateTime(date).MMMd}'; } } @override - String sentAtText({required DateTime date, required DateTime time}) => - 'Gesendet ${_getDay(date)} am ${Jiffy(time.toLocal()).format('HH:mm')}'; + String sentAtText({required DateTime date, required DateTime time}) { + final atTime = Jiffy.parseFromDateTime(time.toLocal()); + return 'Gesendet ${_getDay(date)} am ${atTime.jm}'; + } @override String get todayLabel => 'Heute'; diff --git a/packages/stream_chat_localizations/lib/src/stream_chat_localizations_en.dart b/packages/stream_chat_localizations/lib/src/stream_chat_localizations_en.dart index c55bbf49..a744ff2a 100644 --- a/packages/stream_chat_localizations/lib/src/stream_chat_localizations_en.dart +++ b/packages/stream_chat_localizations/lib/src/stream_chat_localizations_en.dart @@ -246,13 +246,15 @@ class StreamChatLocalizationsEn extends GlobalStreamChatLocalizations { } else if (date == yesterday) { return 'yesterday'; } else { - return 'on ${Jiffy(date).MMMd}'; + return 'on ${Jiffy.parseFromDateTime(date).MMMd}'; } } @override - String sentAtText({required DateTime date, required DateTime time}) => - 'Sent ${_getDay(date)} at ${Jiffy(time.toLocal()).format('HH:mm')}'; + String sentAtText({required DateTime date, required DateTime time}) { + final atTime = Jiffy.parseFromDateTime(time.toLocal()); + return 'Sent ${_getDay(date)} at ${atTime.jm}'; + } @override String get todayLabel => 'Today'; diff --git a/packages/stream_chat_localizations/lib/src/stream_chat_localizations_es.dart b/packages/stream_chat_localizations/lib/src/stream_chat_localizations_es.dart index 107e2616..2d75b102 100644 --- a/packages/stream_chat_localizations/lib/src/stream_chat_localizations_es.dart +++ b/packages/stream_chat_localizations/lib/src/stream_chat_localizations_es.dart @@ -250,13 +250,15 @@ class StreamChatLocalizationsEs extends GlobalStreamChatLocalizations { } else if (date == yesterday) { return 'ayer'; } else { - return 'el ${Jiffy(date).MMMd}'; + return 'el ${Jiffy.parseFromDateTime(date).MMMd}'; } } @override - String sentAtText({required DateTime date, required DateTime time}) => - '''Enviado el ${_getDay(date)} a las ${Jiffy(time.toLocal()).format('HH:mm')}'''; + String sentAtText({required DateTime date, required DateTime time}) { + final atTime = Jiffy.parseFromDateTime(time.toLocal()); + return 'Enviado el ${_getDay(date)} a las ${atTime.jm}'; + } @override String get todayLabel => 'Hoy'; diff --git a/packages/stream_chat_localizations/lib/src/stream_chat_localizations_fr.dart b/packages/stream_chat_localizations/lib/src/stream_chat_localizations_fr.dart index 8b501184..6a474b8a 100644 --- a/packages/stream_chat_localizations/lib/src/stream_chat_localizations_fr.dart +++ b/packages/stream_chat_localizations/lib/src/stream_chat_localizations_fr.dart @@ -249,13 +249,15 @@ class StreamChatLocalizationsFr extends GlobalStreamChatLocalizations { } else if (date == yesterday) { return 'hier'; } else { - return 'le ${Jiffy(date).MMMd}'; + return 'le ${Jiffy.parseFromDateTime(date).MMMd}'; } } @override - String sentAtText({required DateTime date, required DateTime time}) => - 'Envoyé ${_getDay(date)} à ${Jiffy(time.toLocal()).format('HH:mm')}'; + String sentAtText({required DateTime date, required DateTime time}) { + final atTime = Jiffy.parseFromDateTime(time.toLocal()); + return 'Envoyé ${_getDay(date)} à ${atTime.jm}'; + } @override String get todayLabel => "Aujourd'hui"; diff --git a/packages/stream_chat_localizations/lib/src/stream_chat_localizations_hi.dart b/packages/stream_chat_localizations/lib/src/stream_chat_localizations_hi.dart index 4f27717a..4e056ab2 100644 --- a/packages/stream_chat_localizations/lib/src/stream_chat_localizations_hi.dart +++ b/packages/stream_chat_localizations/lib/src/stream_chat_localizations_hi.dart @@ -243,13 +243,15 @@ class StreamChatLocalizationsHi extends GlobalStreamChatLocalizations { } else if (date == yesterday) { return 'कल'; } else { - return '${Jiffy(date).MMMd} को'; + return '${Jiffy.parseFromDateTime(date).MMMd} को'; } } @override - String sentAtText({required DateTime date, required DateTime time}) => - '${_getDay(date)} ${Jiffy(time.toLocal()).format('HH:mm')} बजे भेजा गया'; + String sentAtText({required DateTime date, required DateTime time}) { + final atTime = Jiffy.parseFromDateTime(time.toLocal()); + return '${_getDay(date)} ${atTime.jm} बजे भेजा गया'; + } @override String get todayLabel => 'आज'; diff --git a/packages/stream_chat_localizations/lib/src/stream_chat_localizations_it.dart b/packages/stream_chat_localizations/lib/src/stream_chat_localizations_it.dart index b407629d..51a80897 100644 --- a/packages/stream_chat_localizations/lib/src/stream_chat_localizations_it.dart +++ b/packages/stream_chat_localizations/lib/src/stream_chat_localizations_it.dart @@ -252,13 +252,15 @@ Il file è troppo grande per essere caricato. Il limite è di $limitInMB MB.'''; } else if (date == yesterday) { return 'ieri'; } else { - return 'il ${Jiffy(date).MMMd}'; + return 'il ${Jiffy.parseFromDateTime(date).MMMd}'; } } @override - String sentAtText({required DateTime date, required DateTime time}) => - "Inviato ${_getDay(date)} alle ${Jiffy(time.toLocal()).format('HH:mm')}"; + String sentAtText({required DateTime date, required DateTime time}) { + final atTime = Jiffy.parseFromDateTime(time.toLocal()); + return 'Inviato ${_getDay(date)} alle ${atTime.jm}'; + } @override String get todayLabel => 'Oggi'; diff --git a/packages/stream_chat_localizations/lib/src/stream_chat_localizations_ja.dart b/packages/stream_chat_localizations/lib/src/stream_chat_localizations_ja.dart index 26a5e8b3..17285f6a 100644 --- a/packages/stream_chat_localizations/lib/src/stream_chat_localizations_ja.dart +++ b/packages/stream_chat_localizations/lib/src/stream_chat_localizations_ja.dart @@ -236,13 +236,15 @@ class StreamChatLocalizationsJa extends GlobalStreamChatLocalizations { } else if (date == yesterday) { return '昨日'; } else { - return '${Jiffy(date).MMMd}に'; + return '${Jiffy.parseFromDateTime(date).MMMd}に'; } } @override - String sentAtText({required DateTime date, required DateTime time}) => - '${_getDay(date)}の${Jiffy(time.toLocal()).format('HH:mm')}に送信しました '; + String sentAtText({required DateTime date, required DateTime time}) { + final atTime = Jiffy.parseFromDateTime(time.toLocal()); + return '${_getDay(date)}の${atTime.jm}に送信しました '; + } @override String get todayLabel => '今日'; diff --git a/packages/stream_chat_localizations/lib/src/stream_chat_localizations_ko.dart b/packages/stream_chat_localizations/lib/src/stream_chat_localizations_ko.dart index 7b907584..acf1f79f 100644 --- a/packages/stream_chat_localizations/lib/src/stream_chat_localizations_ko.dart +++ b/packages/stream_chat_localizations/lib/src/stream_chat_localizations_ko.dart @@ -235,13 +235,15 @@ class StreamChatLocalizationsKo extends GlobalStreamChatLocalizations { } else if (date == yesterday) { return '어제'; } else { - return '${Jiffy(date).MMMd}에'; + return '${Jiffy.parseFromDateTime(date).MMMd}에'; } } @override - String sentAtText({required DateTime date, required DateTime time}) => - '${_getDay(date)} ${Jiffy(time.toLocal()).format('HH:mm')}에 보냈습니다'; + String sentAtText({required DateTime date, required DateTime time}) { + final atTime = Jiffy.parseFromDateTime(time.toLocal()); + return '${_getDay(date)} ${atTime.jm}에 보냈습니다'; + } @override String get todayLabel => '오늘'; diff --git a/packages/stream_chat_localizations/lib/src/stream_chat_localizations_no.dart b/packages/stream_chat_localizations/lib/src/stream_chat_localizations_no.dart index 88350979..8a6c4db3 100644 --- a/packages/stream_chat_localizations/lib/src/stream_chat_localizations_no.dart +++ b/packages/stream_chat_localizations/lib/src/stream_chat_localizations_no.dart @@ -242,13 +242,15 @@ class StreamChatLocalizationsNo extends GlobalStreamChatLocalizations { } else if (date == yesterday) { return 'i går'; } else { - return 'på ${Jiffy(date).MMMd}'; + return 'på ${Jiffy.parseFromDateTime(date).MMMd}'; } } @override - String sentAtText({required DateTime date, required DateTime time}) => - 'Sent ${_getDay(date)} kl. ${Jiffy(time.toLocal()).format('HH:mm')}'; + String sentAtText({required DateTime date, required DateTime time}) { + final atTime = Jiffy.parseFromDateTime(time.toLocal()); + return 'Sent ${_getDay(date)} kl. ${atTime.jm}'; + } @override String get todayLabel => 'I dag'; diff --git a/packages/stream_chat_localizations/lib/src/stream_chat_localizations_pt.dart b/packages/stream_chat_localizations/lib/src/stream_chat_localizations_pt.dart index 874eb118..f359808b 100644 --- a/packages/stream_chat_localizations/lib/src/stream_chat_localizations_pt.dart +++ b/packages/stream_chat_localizations/lib/src/stream_chat_localizations_pt.dart @@ -244,13 +244,15 @@ class StreamChatLocalizationsPt extends GlobalStreamChatLocalizations { } else if (date == yesterday) { return 'Ontem'; } else { - return 'o ${Jiffy(date).MMMd}'; + return 'o ${Jiffy.parseFromDateTime(date).MMMd}'; } } @override - String sentAtText({required DateTime date, required DateTime time}) => - '''Enviado ${_getDay(date)} às ${Jiffy(time.toLocal()).format('HH:mm')}'''; + String sentAtText({required DateTime date, required DateTime time}) { + final atTime = Jiffy.parseFromDateTime(time.toLocal()); + return 'Enviado ${_getDay(date)} às ${atTime.jm}'; + } @override String get todayLabel => 'Hoje'; From 4312687d15b1947b839cacd9e2b98fcb380c9559 Mon Sep 17 00:00:00 2001 From: Sahil Kumar Date: Thu, 22 Jun 2023 14:14:52 +0530 Subject: [PATCH 36/54] chore: update CHANGELOG.md Signed-off-by: xsahil03x --- packages/stream_chat_flutter/CHANGELOG.md | 2 ++ packages/stream_chat_localizations/CHANGELOG.md | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/packages/stream_chat_flutter/CHANGELOG.md b/packages/stream_chat_flutter/CHANGELOG.md index 0d3d4e73..717045bd 100644 --- a/packages/stream_chat_flutter/CHANGELOG.md +++ b/packages/stream_chat_flutter/CHANGELOG.md @@ -97,6 +97,8 @@ - Updated `video_player` dependency to `^2.7.0`. - Updated `chewie` dependency to `^1.6.0`. - Updated `share_plus` dependency to `^7.0.2`. +- Deprecated `StreamUserItem` in favor of `StreamUserListTile`. +- Updated `jiffy` dependency to `^6.2.1`. ## 6.4.0 diff --git a/packages/stream_chat_localizations/CHANGELOG.md b/packages/stream_chat_localizations/CHANGELOG.md index 628f82dc..79aefad6 100644 --- a/packages/stream_chat_localizations/CHANGELOG.md +++ b/packages/stream_chat_localizations/CHANGELOG.md @@ -1,3 +1,7 @@ +## Upcoming + +* Updated `stream_chat_flutter` dependency to [`Upcoming`](https://pub.dev/packages/stream_chat_flutter/changelog). + ## 5.4.0 * Updated `stream_chat_flutter` dependency to [`6.4.0`](https://pub.dev/packages/stream_chat_flutter/changelog). From d1ce69d539f10207d6e14c62c6b56df096e0ad19 Mon Sep 17 00:00:00 2001 From: Sahil Kumar Date: Thu, 22 Jun 2023 14:18:41 +0530 Subject: [PATCH 37/54] chore: minor change. Signed-off-by: xsahil03x --- .../stream_chat_flutter/lib/src/localization/translations.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/stream_chat_flutter/lib/src/localization/translations.dart b/packages/stream_chat_flutter/lib/src/localization/translations.dart index 9863fbbc..e6bb87d9 100644 --- a/packages/stream_chat_flutter/lib/src/localization/translations.dart +++ b/packages/stream_chat_flutter/lib/src/localization/translations.dart @@ -618,7 +618,7 @@ class DefaultTranslations implements Translations { @override String sentAtText({required DateTime date, required DateTime time}) { final atTime = Jiffy.parseFromDateTime(time.toLocal()); - return 'Sent ${_getDay(date)} at ${atTime.format(pattern: 'HH:mm')}'; + return 'Sent ${_getDay(date)} at ${atTime.jm}'; } @override From 4b2a7be3eba36e029c50cc748dd2a85ba3db5b9f Mon Sep 17 00:00:00 2001 From: Sahil Kumar Date: Wed, 5 Jul 2023 15:15:48 +0530 Subject: [PATCH 38/54] chore(repo): prepare for release. Signed-off-by: xsahil03x --- packages/stream_chat_flutter/CHANGELOG.md | 2 +- packages/stream_chat_flutter/pubspec.yaml | 2 +- packages/stream_chat_localizations/CHANGELOG.md | 4 ++-- packages/stream_chat_localizations/pubspec.yaml | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/stream_chat_flutter/CHANGELOG.md b/packages/stream_chat_flutter/CHANGELOG.md index 717045bd..8705e9c6 100644 --- a/packages/stream_chat_flutter/CHANGELOG.md +++ b/packages/stream_chat_flutter/CHANGELOG.md @@ -1,4 +1,4 @@ -## Upcoming +## 6.5.0 🐞 Fixed diff --git a/packages/stream_chat_flutter/pubspec.yaml b/packages/stream_chat_flutter/pubspec.yaml index f4b079d5..3d298d83 100644 --- a/packages/stream_chat_flutter/pubspec.yaml +++ b/packages/stream_chat_flutter/pubspec.yaml @@ -1,7 +1,7 @@ name: stream_chat_flutter homepage: https://github.com/GetStream/stream-chat-flutter description: Stream Chat official Flutter SDK. Build your own chat experience using Dart and Flutter. -version: 6.4.0 +version: 6.5.0 repository: https://github.com/GetStream/stream-chat-flutter issue_tracker: https://github.com/GetStream/stream-chat-flutter/issues diff --git a/packages/stream_chat_localizations/CHANGELOG.md b/packages/stream_chat_localizations/CHANGELOG.md index 79aefad6..86b6a739 100644 --- a/packages/stream_chat_localizations/CHANGELOG.md +++ b/packages/stream_chat_localizations/CHANGELOG.md @@ -1,6 +1,6 @@ -## Upcoming +## 5.5.0 -* Updated `stream_chat_flutter` dependency to [`Upcoming`](https://pub.dev/packages/stream_chat_flutter/changelog). +* Updated `stream_chat_flutter` dependency to [`6.5.0`](https://pub.dev/packages/stream_chat_flutter/changelog). ## 5.4.0 diff --git a/packages/stream_chat_localizations/pubspec.yaml b/packages/stream_chat_localizations/pubspec.yaml index 10fef73f..85a2cd4d 100644 --- a/packages/stream_chat_localizations/pubspec.yaml +++ b/packages/stream_chat_localizations/pubspec.yaml @@ -1,6 +1,6 @@ name: stream_chat_localizations description: The Official localizations for Stream Chat Flutter, a service for building chat applications -version: 5.4.0 +version: 5.5.0 homepage: https://github.com/GetStream/stream-chat-flutter repository: https://github.com/GetStream/stream-chat-flutter issue_tracker: https://github.com/GetStream/stream-chat-flutter/issues @@ -14,7 +14,7 @@ dependencies: sdk: flutter flutter_localizations: sdk: flutter - stream_chat_flutter: ^6.4.0 + stream_chat_flutter: ^6.5.0 dev_dependencies: flutter_test: From 44b53611a0350f3d17ca6a089b14cd7eb1f41c24 Mon Sep 17 00:00:00 2001 From: Sahil Kumar Date: Thu, 6 Jul 2023 02:44:15 +0530 Subject: [PATCH 39/54] chore(llc, core, persistence, ui, localization): updated minimum supported `SDK` version to Flutter 3.3/Dart 2.18 Signed-off-by: xsahil03x --- packages/stream_chat/CHANGELOG.md | 6 ++++++ packages/stream_chat/example/pubspec.yaml | 4 ++-- packages/stream_chat/pubspec.yaml | 2 +- packages/stream_chat_flutter/CHANGELOG.md | 6 ++++++ packages/stream_chat_flutter/example/pubspec.yaml | 4 ++-- packages/stream_chat_flutter/pubspec.yaml | 4 ++-- packages/stream_chat_flutter_core/CHANGELOG.md | 4 ++++ packages/stream_chat_flutter_core/example/pubspec.yaml | 4 ++-- packages/stream_chat_flutter_core/pubspec.yaml | 4 ++-- packages/stream_chat_localizations/CHANGELOG.md | 4 ++++ packages/stream_chat_localizations/example/pubspec.yaml | 3 ++- packages/stream_chat_localizations/pubspec.yaml | 4 ++-- packages/stream_chat_persistence/CHANGELOG.md | 4 ++++ packages/stream_chat_persistence/example/pubspec.yaml | 4 ++-- packages/stream_chat_persistence/pubspec.yaml | 4 ++-- 15 files changed, 43 insertions(+), 18 deletions(-) diff --git a/packages/stream_chat/CHANGELOG.md b/packages/stream_chat/CHANGELOG.md index 573e21f8..e8f5c67c 100644 --- a/packages/stream_chat/CHANGELOG.md +++ b/packages/stream_chat/CHANGELOG.md @@ -1,3 +1,9 @@ +## Upcoming + +🔄 Changed + +- Updated minimum supported `SDK` version to Dart 2.18 + ## 6.4.0 🐞 Fixed diff --git a/packages/stream_chat/example/pubspec.yaml b/packages/stream_chat/example/pubspec.yaml index dfedc5b2..725c0549 100644 --- a/packages/stream_chat/example/pubspec.yaml +++ b/packages/stream_chat/example/pubspec.yaml @@ -5,8 +5,8 @@ publish_to: "none" version: 1.0.0+1 environment: - sdk: '>=2.17.0 <4.0.0' - flutter: ">=1.17.0" + sdk: '>=2.18.0 <4.0.0' + flutter: ">=3.3.0" dependencies: cupertino_icons: ^1.0.5 diff --git a/packages/stream_chat/pubspec.yaml b/packages/stream_chat/pubspec.yaml index 7156199c..ebd77c17 100644 --- a/packages/stream_chat/pubspec.yaml +++ b/packages/stream_chat/pubspec.yaml @@ -6,7 +6,7 @@ repository: https://github.com/GetStream/stream-chat-flutter issue_tracker: https://github.com/GetStream/stream-chat-flutter/issues environment: - sdk: '>=2.17.0 <4.0.0' + sdk: '>=2.18.0 <4.0.0' dependencies: async: ^2.10.0 diff --git a/packages/stream_chat_flutter/CHANGELOG.md b/packages/stream_chat_flutter/CHANGELOG.md index 8705e9c6..0e27b8f1 100644 --- a/packages/stream_chat_flutter/CHANGELOG.md +++ b/packages/stream_chat_flutter/CHANGELOG.md @@ -1,3 +1,9 @@ +## Upcoming + +🔄 Changed + +- Updated minimum supported `SDK` version to Flutter 3.3/Dart 2.18 + ## 6.5.0 🐞 Fixed diff --git a/packages/stream_chat_flutter/example/pubspec.yaml b/packages/stream_chat_flutter/example/pubspec.yaml index dfc36a08..b367a66a 100644 --- a/packages/stream_chat_flutter/example/pubspec.yaml +++ b/packages/stream_chat_flutter/example/pubspec.yaml @@ -18,8 +18,8 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev version: 1.0.0+1 environment: - sdk: '>=2.17.0 <4.0.0' - flutter: ">=1.17.0" + sdk: ">=2.18.0 <4.0.0" + flutter: ">=3.3.0" dependencies: # The following adds the Cupertino Icons font to your application. diff --git a/packages/stream_chat_flutter/pubspec.yaml b/packages/stream_chat_flutter/pubspec.yaml index 3d298d83..fcd24a0f 100644 --- a/packages/stream_chat_flutter/pubspec.yaml +++ b/packages/stream_chat_flutter/pubspec.yaml @@ -6,8 +6,8 @@ repository: https://github.com/GetStream/stream-chat-flutter issue_tracker: https://github.com/GetStream/stream-chat-flutter/issues environment: - sdk: ">=2.17.0 <4.0.0" - flutter: ">=1.20.0" + sdk: ">=2.18.0 <4.0.0" + flutter: ">=3.3.0" dependencies: cached_network_image: ^3.0.0 diff --git a/packages/stream_chat_flutter_core/CHANGELOG.md b/packages/stream_chat_flutter_core/CHANGELOG.md index dbab9611..0cc5486a 100644 --- a/packages/stream_chat_flutter_core/CHANGELOG.md +++ b/packages/stream_chat_flutter_core/CHANGELOG.md @@ -1,3 +1,7 @@ +## Upcoming + +- Updated minimum supported `SDK` version to Flutter 3.3/Dart 2.18 + ## 6.4.0 - Updated `stream_chat` dependency to [`6.4.0`](https://pub.dev/packages/stream_chat/changelog). diff --git a/packages/stream_chat_flutter_core/example/pubspec.yaml b/packages/stream_chat_flutter_core/example/pubspec.yaml index a67d6c9b..e61f872a 100644 --- a/packages/stream_chat_flutter_core/example/pubspec.yaml +++ b/packages/stream_chat_flutter_core/example/pubspec.yaml @@ -18,8 +18,8 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev version: 1.0.0+1 environment: - sdk: '>=2.17.0 <4.0.0' - flutter: ">=1.17.0" + sdk: ">=2.18.0 <4.0.0" + flutter: ">=3.3.0" dependencies: # The following adds the Cupertino Icons font to your application. diff --git a/packages/stream_chat_flutter_core/pubspec.yaml b/packages/stream_chat_flutter_core/pubspec.yaml index b3448b07..4d01809a 100644 --- a/packages/stream_chat_flutter_core/pubspec.yaml +++ b/packages/stream_chat_flutter_core/pubspec.yaml @@ -6,8 +6,8 @@ repository: https://github.com/GetStream/stream-chat-flutter issue_tracker: https://github.com/GetStream/stream-chat-flutter/issues environment: - sdk: '>=2.17.0 <4.0.0' - flutter: ">=1.17.0" + sdk: ">=2.18.0 <4.0.0" + flutter: ">=3.3.0" dependencies: collection: ^1.17.0 diff --git a/packages/stream_chat_localizations/CHANGELOG.md b/packages/stream_chat_localizations/CHANGELOG.md index 86b6a739..f2ad2fd8 100644 --- a/packages/stream_chat_localizations/CHANGELOG.md +++ b/packages/stream_chat_localizations/CHANGELOG.md @@ -1,3 +1,7 @@ +## Upcoming + +- Updated minimum supported `SDK` version to Flutter 3.3/Dart 2.18 + ## 5.5.0 * Updated `stream_chat_flutter` dependency to [`6.5.0`](https://pub.dev/packages/stream_chat_flutter/changelog). diff --git a/packages/stream_chat_localizations/example/pubspec.yaml b/packages/stream_chat_localizations/example/pubspec.yaml index 0d98bfa7..bded0187 100644 --- a/packages/stream_chat_localizations/example/pubspec.yaml +++ b/packages/stream_chat_localizations/example/pubspec.yaml @@ -5,7 +5,8 @@ publish_to: 'none' version: 1.0.0+1 environment: - sdk: '>=2.17.0 <4.0.0' + sdk: ">=2.18.0 <4.0.0" + flutter: ">=3.3.0" dependencies: cupertino_icons: ^1.0.3 diff --git a/packages/stream_chat_localizations/pubspec.yaml b/packages/stream_chat_localizations/pubspec.yaml index 85a2cd4d..d9d07664 100644 --- a/packages/stream_chat_localizations/pubspec.yaml +++ b/packages/stream_chat_localizations/pubspec.yaml @@ -6,8 +6,8 @@ repository: https://github.com/GetStream/stream-chat-flutter issue_tracker: https://github.com/GetStream/stream-chat-flutter/issues environment: - sdk: '>=2.17.0 <4.0.0' - flutter: ">=1.20.0" + sdk: ">=2.18.0 <4.0.0" + flutter: ">=3.3.0" dependencies: flutter: diff --git a/packages/stream_chat_persistence/CHANGELOG.md b/packages/stream_chat_persistence/CHANGELOG.md index 152ed256..393a17ef 100644 --- a/packages/stream_chat_persistence/CHANGELOG.md +++ b/packages/stream_chat_persistence/CHANGELOG.md @@ -1,3 +1,7 @@ +## Upcoming + +- Updated minimum supported `SDK` version to Flutter 3.3/Dart 2.18 + ## 6.4.0 - Updated `stream_chat` dependency to [`6.4.0`](https://pub.dev/packages/stream_chat/changelog). diff --git a/packages/stream_chat_persistence/example/pubspec.yaml b/packages/stream_chat_persistence/example/pubspec.yaml index 4f20ad85..a288d679 100644 --- a/packages/stream_chat_persistence/example/pubspec.yaml +++ b/packages/stream_chat_persistence/example/pubspec.yaml @@ -5,8 +5,8 @@ publish_to: 'none' version: 1.0.0+1 environment: - sdk: '>=2.17.0 <4.0.0' - flutter: ">=1.17.0" + sdk: ">=2.18.0 <4.0.0" + flutter: ">=3.3.0" dependencies: cupertino_icons: ^1.0.3 diff --git a/packages/stream_chat_persistence/pubspec.yaml b/packages/stream_chat_persistence/pubspec.yaml index cb76edad..2cc62b15 100644 --- a/packages/stream_chat_persistence/pubspec.yaml +++ b/packages/stream_chat_persistence/pubspec.yaml @@ -6,8 +6,8 @@ repository: https://github.com/GetStream/stream-chat-flutter issue_tracker: https://github.com/GetStream/stream-chat-flutter/issues environment: - sdk: '>=2.17.0 <4.0.0' - flutter: ">=1.17.0" + sdk: ">=2.18.0 <4.0.0" + flutter: ">=3.3.0" dependencies: drift: ^2.7.0 From bb38fd384ff2ba2a47d59c1e7b18940f7b68789c Mon Sep 17 00:00:00 2001 From: Sahil Kumar Date: Thu, 6 Jul 2023 03:22:12 +0530 Subject: [PATCH 40/54] ci(repo): add legacy_version_analyze.yml Signed-off-by: xsahil03x --- .github/workflows/legacy_version_analyze.yml | 57 ++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 .github/workflows/legacy_version_analyze.yml diff --git a/.github/workflows/legacy_version_analyze.yml b/.github/workflows/legacy_version_analyze.yml new file mode 100644 index 00000000..fa196935 --- /dev/null +++ b/.github/workflows/legacy_version_analyze.yml @@ -0,0 +1,57 @@ +name: legacy_version_analyze + +on: + push: + branches: + - master + - develop + paths: + - 'packages/**' + - '.github/workflows/legacy_version_analyze.yml' + pull_request: + branches: + - master + - develop + paths: + - 'packages/**' + - '.github/workflows/legacy_version_analyze.yml' + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + # Does a sanity check that packages at least pass analysis on the N-1 and N-2 + # versions of Flutter stable if the package claims to support that version. + # This is to minimize accidentally making changes that break old versions + # (which we don't commit to supporting, but don't want to actively break) + # without updating the constraints. + analyze_legacy_versions: + timeout-minutes: 15 + if: github.event.pull_request.draft == false + runs-on: ubuntu-latest + + # Note: The versions below should be manually updated after a new stable + # version comes out. + strategy: + matrix: + flutter_version: + - "3.7.12" + - "3.3.10" + + steps: + - name: "Git Checkout" + uses: actions/checkout@v3 + with: + fetch-depth: 0 + - name: "Install Flutter" + uses: subosito/flutter-action@v2 + with: + cache: true + flutter-version: ${{ matrix.flutter_version }} + - name: "Install Tools" + run: flutter pub global activate melos + - name: "Bootstrap Workspace" + run: melos bootstrap --verbose + - name: "Dart Analyze" + run: melos run analyze \ No newline at end of file From e76f3e922717cd31fb6a631a9fd679687e87cf12 Mon Sep 17 00:00:00 2001 From: Sahil Kumar Date: Thu, 6 Jul 2023 03:35:56 +0530 Subject: [PATCH 41/54] chore: remove flutter test deps from examples. Signed-off-by: xsahil03x --- packages/stream_chat/example/pubspec.yaml | 4 -- .../stream_chat_flutter/example/pubspec.yaml | 59 +----------------- .../example/pubspec.yaml | 61 +------------------ .../example/pubspec.yaml | 4 -- .../example/pubspec.yaml | 5 -- 5 files changed, 2 insertions(+), 131 deletions(-) diff --git a/packages/stream_chat/example/pubspec.yaml b/packages/stream_chat/example/pubspec.yaml index 725c0549..b2855d2a 100644 --- a/packages/stream_chat/example/pubspec.yaml +++ b/packages/stream_chat/example/pubspec.yaml @@ -14,9 +14,5 @@ dependencies: sdk: flutter stream_chat: ^6.4.0 -dev_dependencies: - flutter_test: - sdk: flutter - flutter: uses-material-design: true diff --git a/packages/stream_chat_flutter/example/pubspec.yaml b/packages/stream_chat_flutter/example/pubspec.yaml index b367a66a..1b42acec 100644 --- a/packages/stream_chat_flutter/example/pubspec.yaml +++ b/packages/stream_chat_flutter/example/pubspec.yaml @@ -1,20 +1,6 @@ name: stream_chat_flutter_example description: A new Flutter project. - -# The following line prevents the package from being accidentally published to -# pub.dev using `pub publish`. This is preferred for private packages. -publish_to: 'none' # Remove this line if you wish to publish to pub.dev - -# The following defines the version and build number for your application. -# A version number is three numbers separated by dots, like 1.2.43 -# followed by an optional build number separated by a +. -# Both the version and the builder number may be overridden in flutter -# build by specifying --build-name and --build-number, respectively. -# In Android, build-name is used as versionName while build-number used as versionCode. -# Read more about Android versioning at https://developer.android.com/studio/publish/versioning -# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. -# Read more about iOS versioning at -# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html +publish_to: 'none' version: 1.0.0+1 environment: @@ -22,8 +8,6 @@ environment: flutter: ">=3.3.0" dependencies: - # The following adds the Cupertino Icons font to your application. - # Use with the CupertinoIcons class for iOS style icons. collection: ^1.15.0 cupertino_icons: ^1.0.4 flutter: @@ -33,48 +17,7 @@ dependencies: stream_chat_localizations: ^5.4.0 stream_chat_persistence: ^6.4.0 -dev_dependencies: - flutter_test: - sdk: flutter - -# For information on the generic Dart part of this file, see the -# following page: https://dart.dev/tools/pub/pubspec - -# The following section is specific to Flutter. flutter: - - # The following line ensures that the Material Icons font is - # included with your application, so that you can use the icons in - # the material Icons class. uses-material-design: true - - # To add assets to your application, add an assets section, like this: assets: - assets/background_doodle.png - # - images/a_dot_ham.jpeg - - # An image asset can refer to one or more resolution-specific "variants", see - # https://flutter.dev/assets-and-images/#resolution-aware. - - # For details regarding adding assets from package dependencies, see - # https://flutter.dev/assets-and-images/#from-packages - - # To add custom fonts to your application, add a fonts section here, - # in this "flutter" section. Each entry in this list should have a - # "family" key with the font family name, and a "fonts" key with a - # list giving the asset and other descriptors for the font. For - # example: - # fonts: - # - family: Schyler - # fonts: - # - asset: fonts/Schyler-Regular.ttf - # - asset: fonts/Schyler-Italic.ttf - # style: italic - # - family: Trajan Pro - # fonts: - # - asset: fonts/TrajanPro.ttf - # - asset: fonts/TrajanPro_Bold.ttf - # weight: 700 - # - # For details regarding fonts from package dependencies, - # see https://flutter.dev/custom-fonts/#from-packages diff --git a/packages/stream_chat_flutter_core/example/pubspec.yaml b/packages/stream_chat_flutter_core/example/pubspec.yaml index e61f872a..ed9e59b6 100644 --- a/packages/stream_chat_flutter_core/example/pubspec.yaml +++ b/packages/stream_chat_flutter_core/example/pubspec.yaml @@ -1,20 +1,6 @@ name: stream_chat_flutter_core_example description: Example app for testing stream_chat_flutter_core - -# The following line prevents the package from being accidentally published to -# pub.dev using `pub publish`. This is preferred for private packages. -publish_to: 'none' # Remove this line if you wish to publish to pub.dev - -# The following defines the version and build number for your application. -# A version number is three numbers separated by dots, like 1.2.43 -# followed by an optional build number separated by a +. -# Both the version and the builder number may be overridden in flutter -# build by specifying --build-name and --build-number, respectively. -# In Android, build-name is used as versionName while build-number used as versionCode. -# Read more about Android versioning at https://developer.android.com/studio/publish/versioning -# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. -# Read more about iOS versioning at -# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html +publish_to: 'none' version: 1.0.0+1 environment: @@ -22,55 +8,10 @@ environment: flutter: ">=3.3.0" dependencies: - # The following adds the Cupertino Icons font to your application. - # Use with the CupertinoIcons class for iOS style icons. cupertino_icons: ^1.0.3 flutter: sdk: flutter stream_chat_flutter_core: ^6.4.0 -dev_dependencies: - flutter_test: - sdk: flutter - -# For information on the generic Dart part of this file, see the -# following page: https://dart.dev/tools/pub/pubspec - -# The following section is specific to Flutter. flutter: - - # The following line ensures that the Material Icons font is - # included with your application, so that you can use the icons in - # the material Icons class. uses-material-design: true - - # To add assets to your application, add an assets section, like this: - # assets: - # - images/a_dot_burr.jpeg - # - images/a_dot_ham.jpeg - - # An image asset can refer to one or more resolution-specific "variants", see - # https://flutter.dev/assets-and-images/#resolution-aware. - - # For details regarding adding assets from package dependencies, see - # https://flutter.dev/assets-and-images/#from-packages - - # To add custom fonts to your application, add a fonts section here, - # in this "flutter" section. Each entry in this list should have a - # "family" key with the font family name, and a "fonts" key with a - # list giving the asset and other descriptors for the font. For - # example: - # fonts: - # - family: Schyler - # fonts: - # - asset: fonts/Schyler-Regular.ttf - # - asset: fonts/Schyler-Italic.ttf - # style: italic - # - family: Trajan Pro - # fonts: - # - asset: fonts/TrajanPro.ttf - # - asset: fonts/TrajanPro_Bold.ttf - # weight: 700 - # - # For details regarding fonts from package dependencies, - # see https://flutter.dev/custom-fonts/#from-packages diff --git a/packages/stream_chat_localizations/example/pubspec.yaml b/packages/stream_chat_localizations/example/pubspec.yaml index bded0187..252b0b6f 100644 --- a/packages/stream_chat_localizations/example/pubspec.yaml +++ b/packages/stream_chat_localizations/example/pubspec.yaml @@ -15,9 +15,5 @@ dependencies: stream_chat_flutter: ^6.4.0 stream_chat_localizations: ^5.4.0 -dev_dependencies: - flutter_test: - sdk: flutter - flutter: uses-material-design: true \ No newline at end of file diff --git a/packages/stream_chat_persistence/example/pubspec.yaml b/packages/stream_chat_persistence/example/pubspec.yaml index a288d679..e7cb4a8d 100644 --- a/packages/stream_chat_persistence/example/pubspec.yaml +++ b/packages/stream_chat_persistence/example/pubspec.yaml @@ -1,6 +1,5 @@ name: stream_chat_persistence_example description: A new Flutter project. - publish_to: 'none' version: 1.0.0+1 @@ -15,9 +14,5 @@ dependencies: stream_chat: ^6.4.0 stream_chat_persistence: ^6.4.0 -dev_dependencies: - flutter_test: - sdk: flutter - flutter: uses-material-design: true \ No newline at end of file From 7ac020bc0ac127c9328fd938cb17943c6c60f37e Mon Sep 17 00:00:00 2001 From: xsahil03x Date: Thu, 6 Jul 2023 15:25:39 +0530 Subject: [PATCH 42/54] Revert "ci(repo): add legacy_version_analyze.yml" This reverts commit bb38fd384ff2ba2a47d59c1e7b18940f7b68789c. --- .github/workflows/legacy_version_analyze.yml | 57 -------------------- 1 file changed, 57 deletions(-) delete mode 100644 .github/workflows/legacy_version_analyze.yml diff --git a/.github/workflows/legacy_version_analyze.yml b/.github/workflows/legacy_version_analyze.yml deleted file mode 100644 index fa196935..00000000 --- a/.github/workflows/legacy_version_analyze.yml +++ /dev/null @@ -1,57 +0,0 @@ -name: legacy_version_analyze - -on: - push: - branches: - - master - - develop - paths: - - 'packages/**' - - '.github/workflows/legacy_version_analyze.yml' - pull_request: - branches: - - master - - develop - paths: - - 'packages/**' - - '.github/workflows/legacy_version_analyze.yml' - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true - -jobs: - # Does a sanity check that packages at least pass analysis on the N-1 and N-2 - # versions of Flutter stable if the package claims to support that version. - # This is to minimize accidentally making changes that break old versions - # (which we don't commit to supporting, but don't want to actively break) - # without updating the constraints. - analyze_legacy_versions: - timeout-minutes: 15 - if: github.event.pull_request.draft == false - runs-on: ubuntu-latest - - # Note: The versions below should be manually updated after a new stable - # version comes out. - strategy: - matrix: - flutter_version: - - "3.7.12" - - "3.3.10" - - steps: - - name: "Git Checkout" - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - name: "Install Flutter" - uses: subosito/flutter-action@v2 - with: - cache: true - flutter-version: ${{ matrix.flutter_version }} - - name: "Install Tools" - run: flutter pub global activate melos - - name: "Bootstrap Workspace" - run: melos bootstrap --verbose - - name: "Dart Analyze" - run: melos run analyze \ No newline at end of file From 6dc6fdc116c2462ac6d70c5cbd391e2a205c54cb Mon Sep 17 00:00:00 2001 From: Sahil Kumar Date: Tue, 11 Jul 2023 18:46:12 +0530 Subject: [PATCH 43/54] chore(repo): updated minimum supported SDK version to Flutter 3.7/Dart 2.19 Signed-off-by: xsahil03x --- .github/workflows/legacy_version_analyze.yml | 53 +++++++++++++++++++ packages/stream_chat/pubspec.yaml | 18 +++---- .../stream_message_input_attachment_list.dart | 2 +- packages/stream_chat_flutter/pubspec.yaml | 46 ++++++++-------- .../stream_chat_flutter_core/pubspec.yaml | 14 ++--- packages/stream_chat_persistence/pubspec.yaml | 14 ++--- 6 files changed, 100 insertions(+), 47 deletions(-) create mode 100644 .github/workflows/legacy_version_analyze.yml diff --git a/.github/workflows/legacy_version_analyze.yml b/.github/workflows/legacy_version_analyze.yml new file mode 100644 index 00000000..2454e09c --- /dev/null +++ b/.github/workflows/legacy_version_analyze.yml @@ -0,0 +1,53 @@ +name: legacy_version_analyze + +env: + # Note: The versions below should be manually updated after a new stable + # version comes out. + flutter_version: "3.7.12" + +on: + push: + branches: + - master + - develop + paths: + - 'packages/**' + - '.github/workflows/legacy_version_analyze.yml' + pull_request: + branches: + - master + - develop + paths: + - 'packages/**' + - '.github/workflows/legacy_version_analyze.yml' + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + # Does a sanity check that packages at least pass analysis on the N-1 + # versions of Flutter stable if the package claims to support that version. + # This is to minimize accidentally making changes that break old versions + # (which we don't commit to supporting, but don't want to actively break) + # without updating the constraints. + analyze_legacy_versions: + timeout-minutes: 15 + if: github.event.pull_request.draft == false + runs-on: ubuntu-latest + steps: + - name: "Git Checkout" + uses: actions/checkout@v3 + with: + fetch-depth: 0 + - name: "Install Flutter" + uses: subosito/flutter-action@v2 + with: + cache: true + flutter-version: ${{ env.flutter_version }} + - name: "Install Tools" + run: flutter pub global activate melos + - name: "Bootstrap Workspace" + run: melos bootstrap --verbose + - name: "Dart Analyze" + run: melos run analyze \ No newline at end of file diff --git a/packages/stream_chat/pubspec.yaml b/packages/stream_chat/pubspec.yaml index ebd77c17..b52f7bfd 100644 --- a/packages/stream_chat/pubspec.yaml +++ b/packages/stream_chat/pubspec.yaml @@ -6,29 +6,29 @@ repository: https://github.com/GetStream/stream-chat-flutter issue_tracker: https://github.com/GetStream/stream-chat-flutter/issues environment: - sdk: '>=2.18.0 <4.0.0' + sdk: '>=2.19.0 <4.0.0' dependencies: async: ^2.10.0 collection: ^1.17.0 - dio: ^5.2.0 + dio: ^5.2.1+1 equatable: ^2.0.5 freezed_annotation: ^2.2.0 http_parser: ^4.0.2 jose: ^0.3.3 - json_annotation: ^4.8.0 - logging: ^1.1.1 + json_annotation: ^4.8.1 + logging: ^1.2.0 meta: ^1.8.0 mime: ^1.0.4 rate_limiter: ^1.0.0 rxdart: ^0.27.7 - synchronized: ^3.0.0 + synchronized: ^3.1.0 uuid: ^3.0.7 - web_socket_channel: ^2.3.0 + web_socket_channel: ^2.4.0 dev_dependencies: build_runner: ^2.3.3 - freezed: ^2.3.2 - json_serializable: ^6.6.1 + freezed: ^2.4.0 + json_serializable: ^6.6.2 mocktail: ^0.3.0 - test: ^1.24.1 + test: ^1.24.3 diff --git a/packages/stream_chat_flutter/lib/src/message_input/stream_message_input_attachment_list.dart b/packages/stream_chat_flutter/lib/src/message_input/stream_message_input_attachment_list.dart index a849bffc..46ebbd85 100644 --- a/packages/stream_chat_flutter/lib/src/message_input/stream_message_input_attachment_list.dart +++ b/packages/stream_chat_flutter/lib/src/message_input/stream_message_input_attachment_list.dart @@ -208,7 +208,7 @@ class MessageInputFileAttachments extends StatelessWidget { message: Message(), // dummy message attachment: attachment, constraints: BoxConstraints.loose(Size( - MediaQuery.sizeOf(context).width * 0.65, + MediaQuery.of(context).size.width * 0.65, 56, )), trailing: Padding( diff --git a/packages/stream_chat_flutter/pubspec.yaml b/packages/stream_chat_flutter/pubspec.yaml index fcd24a0f..6b022c11 100644 --- a/packages/stream_chat_flutter/pubspec.yaml +++ b/packages/stream_chat_flutter/pubspec.yaml @@ -6,45 +6,45 @@ repository: https://github.com/GetStream/stream-chat-flutter issue_tracker: https://github.com/GetStream/stream-chat-flutter/issues environment: - sdk: ">=2.18.0 <4.0.0" - flutter: ">=3.3.0" + sdk: ">=2.19.0 <4.0.0" + flutter: ">=3.7.0" dependencies: - cached_network_image: ^3.0.0 - chewie: ^1.6.0 + cached_network_image: ^3.2.3 + chewie: ^1.7.0 collection: ^1.17.0 contextmenu: ^3.0.0 dart_vlc: ^0.4.0 - desktop_drop: ^0.4.0 - diacritic: ^0.1.3 - dio: ^5.2.0 + desktop_drop: ^0.4.1 + diacritic: ^0.1.4 + dio: ^5.2.1+1 ezanimation: ^0.6.0 - file_picker: ^5.2.4 - file_selector: ^0.9.0 + file_picker: ^5.3.1 + file_selector: ^1.0.0 flutter: sdk: flutter - flutter_markdown: ^0.6.1 - flutter_portal: ^1.0.0 - flutter_svg: ^2.0.4 - http_parser: ^4.0.0 - image_gallery_saver: ^2.0.1 - image_picker: ">=0.8.2 <2.0.0" + flutter_markdown: ^0.6.15 + flutter_portal: ^1.1.4 + flutter_svg: ^2.0.5 + http_parser: ^4.0.2 + image_gallery_saver: ^2.0.3 + image_picker: ^1.0.0 jiffy: ^6.2.1 - lottie: ^2.0.0 + lottie: ^2.3.2 meta: ^1.8.0 - path_provider: ^2.0.9 - photo_manager: ^2.5.2 + path_provider: ^2.0.15 + photo_manager: ^2.6.0 photo_view: ^0.14.0 - rxdart: ^0.27.0 + rxdart: ^0.27.7 share_plus: ^7.0.2 shimmer: ^3.0.0 stream_chat_flutter_core: ^6.4.0 - synchronized: ^3.0.0 + synchronized: ^3.1.0 thumblr: ^0.0.4 - url_launcher: ^6.1.0 + url_launcher: ^6.1.11 video_player: ^2.7.0 video_player_macos: ^2.0.1 - video_thumbnail: ^0.5.0 + video_thumbnail: ^0.5.3 flutter: plugin: @@ -74,4 +74,4 @@ dev_dependencies: sdk: flutter golden_toolkit: ^0.15.0 mocktail: ^0.3.0 - path: ^1.8.2 + path: ^1.8.3 diff --git a/packages/stream_chat_flutter_core/pubspec.yaml b/packages/stream_chat_flutter_core/pubspec.yaml index 4d01809a..16902a1c 100644 --- a/packages/stream_chat_flutter_core/pubspec.yaml +++ b/packages/stream_chat_flutter_core/pubspec.yaml @@ -6,24 +6,24 @@ repository: https://github.com/GetStream/stream-chat-flutter issue_tracker: https://github.com/GetStream/stream-chat-flutter/issues environment: - sdk: ">=2.18.0 <4.0.0" - flutter: ">=3.3.0" + sdk: ">=2.19.0 <4.0.0" + flutter: ">=3.7.0" dependencies: collection: ^1.17.0 - connectivity_plus: ^4.0.0 + connectivity_plus: ^4.0.1 flutter: sdk: flutter - freezed_annotation: ^2.0.3 + freezed_annotation: ^2.2.0 meta: ^1.8.0 - rxdart: ^0.27.0 + rxdart: ^0.27.7 stream_chat: ^6.4.0 dev_dependencies: build_runner: ^2.3.3 - fake_async: ^1.2.0 + fake_async: ^1.3.1 flutter_test: sdk: flutter - freezed: ^2.3.2 + freezed: ^2.4.0 mocktail: ^0.3.0 diff --git a/packages/stream_chat_persistence/pubspec.yaml b/packages/stream_chat_persistence/pubspec.yaml index 2cc62b15..6ff7ac15 100644 --- a/packages/stream_chat_persistence/pubspec.yaml +++ b/packages/stream_chat_persistence/pubspec.yaml @@ -6,23 +6,23 @@ repository: https://github.com/GetStream/stream-chat-flutter issue_tracker: https://github.com/GetStream/stream-chat-flutter/issues environment: - sdk: ">=2.18.0 <4.0.0" - flutter: ">=3.3.0" + sdk: ">=2.19.0 <4.0.0" + flutter: ">=3.7.0" dependencies: - drift: ^2.7.0 + drift: ^2.8.0 flutter: sdk: flutter - logging: ^1.0.1 + logging: ^1.2.0 meta: ^1.8.0 path: ^1.8.2 - path_provider: ^2.0.1 - sqlite3_flutter_libs: ^0.5.0 + path_provider: ^2.0.15 + sqlite3_flutter_libs: ^0.5.15 stream_chat: ^6.4.0 dev_dependencies: build_runner: ^2.3.3 - drift_dev: ^2.7.0 + drift_dev: ^2.8.3 flutter_test: sdk: flutter mocktail: ^0.3.0 From 58891a4da04c493e33cb150a6271fba399f7a42c Mon Sep 17 00:00:00 2001 From: Sahil Kumar Date: Tue, 11 Jul 2023 18:54:54 +0530 Subject: [PATCH 44/54] chore(ui): remove path dev dependency. Signed-off-by: xsahil03x --- packages/stream_chat_flutter/pubspec.yaml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/stream_chat_flutter/pubspec.yaml b/packages/stream_chat_flutter/pubspec.yaml index 6b022c11..c78d7dba 100644 --- a/packages/stream_chat_flutter/pubspec.yaml +++ b/packages/stream_chat_flutter/pubspec.yaml @@ -73,5 +73,4 @@ dev_dependencies: flutter_test: sdk: flutter golden_toolkit: ^0.15.0 - mocktail: ^0.3.0 - path: ^1.8.3 + mocktail: ^0.3.0 \ No newline at end of file From 0e3eef7e1b6a029c0cda01c7c118841d0a994f3f Mon Sep 17 00:00:00 2001 From: Sahil Kumar Date: Tue, 11 Jul 2023 19:21:57 +0530 Subject: [PATCH 45/54] chore(ui, localization): revert "bump jiffy to v6.2.1" Signed-off-by: xsahil03x --- packages/stream_chat_flutter/CHANGELOG.md | 1 - .../lib/src/channel/channel_info.dart | 3 +-- .../lib/src/channel/channel_preview.dart | 6 ++--- .../lib/src/localization/translations.dart | 8 +++---- .../message_list_view/message_list_view.dart | 22 ++++++------------- .../lib/src/message_widget/bottom_row.dart | 2 +- .../lib/src/misc/date_divider.dart | 12 +++++----- .../stream_channel_list_tile.dart | 6 ++--- .../stream_message_search_list_tile.dart | 4 ++-- .../stream_user_list_tile.dart | 3 +-- .../lib/src/stream_chat.dart | 4 ++-- packages/stream_chat_flutter/pubspec.yaml | 2 +- .../example/lib/add_new_lang.dart | 8 +++---- .../lib/src/stream_chat_localizations_ca.dart | 8 +++---- .../lib/src/stream_chat_localizations_de.dart | 8 +++---- .../lib/src/stream_chat_localizations_en.dart | 8 +++---- .../lib/src/stream_chat_localizations_es.dart | 8 +++---- .../lib/src/stream_chat_localizations_fr.dart | 8 +++---- .../lib/src/stream_chat_localizations_hi.dart | 8 +++---- .../lib/src/stream_chat_localizations_it.dart | 8 +++---- .../lib/src/stream_chat_localizations_ja.dart | 8 +++---- .../lib/src/stream_chat_localizations_ko.dart | 8 +++---- .../lib/src/stream_chat_localizations_no.dart | 8 +++---- .../lib/src/stream_chat_localizations_pt.dart | 8 +++---- 24 files changed, 66 insertions(+), 103 deletions(-) diff --git a/packages/stream_chat_flutter/CHANGELOG.md b/packages/stream_chat_flutter/CHANGELOG.md index 0e27b8f1..00e97bd8 100644 --- a/packages/stream_chat_flutter/CHANGELOG.md +++ b/packages/stream_chat_flutter/CHANGELOG.md @@ -104,7 +104,6 @@ - Updated `chewie` dependency to `^1.6.0`. - Updated `share_plus` dependency to `^7.0.2`. - Deprecated `StreamUserItem` in favor of `StreamUserListTile`. -- Updated `jiffy` dependency to `^6.2.1`. ## 6.4.0 diff --git a/packages/stream_chat_flutter/lib/src/channel/channel_info.dart b/packages/stream_chat_flutter/lib/src/channel/channel_info.dart index abab5ad9..5c32d278 100644 --- a/packages/stream_chat_flutter/lib/src/channel/channel_info.dart +++ b/packages/stream_chat_flutter/lib/src/channel/channel_info.dart @@ -106,10 +106,9 @@ class _ConnectedTitleState extends StatelessWidget { style: textStyle, ); } else { - final lastActive = otherMember.user?.lastActive ?? DateTime.now(); alternativeWidget = Text( '${context.translations.userLastOnlineText} ' - '${Jiffy.parseFromDateTime(lastActive).fromNow()}', + '${Jiffy(otherMember.user?.lastActive).fromNow()}', style: textStyle, ); } diff --git a/packages/stream_chat_flutter/lib/src/channel/channel_preview.dart b/packages/stream_chat_flutter/lib/src/channel/channel_preview.dart index f64b9dc9..ae6247ea 100644 --- a/packages/stream_chat_flutter/lib/src/channel/channel_preview.dart +++ b/packages/stream_chat_flutter/lib/src/channel/channel_preview.dart @@ -349,16 +349,16 @@ class _Date extends StatelessWidget { if (lastMessageAt.millisecondsSinceEpoch >= startOfDay.millisecondsSinceEpoch) { - stringDate = Jiffy.parseFromDateTime(lastMessageAt.toLocal()).jm; + stringDate = Jiffy(lastMessageAt.toLocal()).jm; } else if (lastMessageAt.millisecondsSinceEpoch >= startOfDay .subtract(const Duration(days: 1)) .millisecondsSinceEpoch) { stringDate = context.translations.yesterdayLabel; } else if (startOfDay.difference(lastMessageAt).inDays < 7) { - stringDate = Jiffy.parseFromDateTime(lastMessageAt.toLocal()).EEEE; + stringDate = Jiffy(lastMessageAt.toLocal()).EEEE; } else { - stringDate = Jiffy.parseFromDateTime(lastMessageAt.toLocal()).yMd; + stringDate = Jiffy(lastMessageAt.toLocal()).yMd; } return Text( diff --git a/packages/stream_chat_flutter/lib/src/localization/translations.dart b/packages/stream_chat_flutter/lib/src/localization/translations.dart index e6bb87d9..61c3441a 100644 --- a/packages/stream_chat_flutter/lib/src/localization/translations.dart +++ b/packages/stream_chat_flutter/lib/src/localization/translations.dart @@ -611,15 +611,13 @@ class DefaultTranslations implements Translations { } else if (date == yesterday) { return 'yesterday'; } else { - return 'on ${Jiffy.parseFromDateTime(date).MMMd}'; + return 'on ${Jiffy(date).MMMd}'; } } @override - String sentAtText({required DateTime date, required DateTime time}) { - final atTime = Jiffy.parseFromDateTime(time.toLocal()); - return 'Sent ${_getDay(date)} at ${atTime.jm}'; - } + String sentAtText({required DateTime date, required DateTime time}) => + 'Sent ${_getDay(date)} at ${Jiffy(time.toLocal()).format('HH:mm')}'; @override String get todayLabel => 'Today'; diff --git a/packages/stream_chat_flutter/lib/src/message_list_view/message_list_view.dart b/packages/stream_chat_flutter/lib/src/message_list_view/message_list_view.dart index f9de1787..5a5075f8 100644 --- a/packages/stream_chat_flutter/lib/src/message_list_view/message_list_view.dart +++ b/packages/stream_chat_flutter/lib/src/message_list_view/message_list_view.dart @@ -669,20 +669,14 @@ class _StreamMessageListViewState extends State { final isPartOfThread = message.replyCount! > 0 || message.showInChannel == true; - final createdAt = Jiffy.parseFromDateTime( - message.createdAt.toLocal(), - ); - - final nextCreatedAt = Jiffy.parseFromDateTime( - nextMessage.createdAt.toLocal(), - ); - - if (!createdAt.isSame(nextCreatedAt, unit: Unit.day)) { + final createdAt = message.createdAt.toLocal(); + final nextCreatedAt = nextMessage.createdAt.toLocal(); + if (!Jiffy(createdAt).isSame(nextCreatedAt, Units.DAY)) { separator = _buildDateDivider(nextMessage); } else { - final hasTimeDiff = !createdAt.isSame( + final hasTimeDiff = !Jiffy(createdAt).isSame( nextCreatedAt, - unit: Unit.minute, + Units.MINUTE, ); final isNextUserSame = @@ -1077,12 +1071,10 @@ class _StreamMessageListViewState extends State { var hasTimeDiff = false; if (nextMessage != null) { - final createdAt = Jiffy.parseFromDateTime(message.createdAt.toLocal()); - final nextCreatedAt = Jiffy.parseFromDateTime( + hasTimeDiff = !Jiffy(message.createdAt.toLocal()).isSame( nextMessage.createdAt.toLocal(), + Units.MINUTE, ); - - hasTimeDiff = !createdAt.isSame(nextCreatedAt, unit: Unit.minute); } final hasFileAttachment = diff --git a/packages/stream_chat_flutter/lib/src/message_widget/bottom_row.dart b/packages/stream_chat_flutter/lib/src/message_widget/bottom_row.dart index 7092dadf..5ca2462a 100644 --- a/packages/stream_chat_flutter/lib/src/message_widget/bottom_row.dart +++ b/packages/stream_chat_flutter/lib/src/message_widget/bottom_row.dart @@ -191,7 +191,7 @@ class BottomRow extends StatelessWidget { ), if (showTimeStamp) Text( - Jiffy.parseFromDateTime(message.createdAt.toLocal()).jm, + Jiffy(message.createdAt.toLocal()).jm, style: messageTheme.createdAtStyle, ), if (showSendingIndicator) diff --git a/packages/stream_chat_flutter/lib/src/misc/date_divider.dart b/packages/stream_chat_flutter/lib/src/misc/date_divider.dart index 24c0c9a7..24af4f3f 100644 --- a/packages/stream_chat_flutter/lib/src/misc/date_divider.dart +++ b/packages/stream_chat_flutter/lib/src/misc/date_divider.dart @@ -20,17 +20,17 @@ class StreamDateDivider extends StatelessWidget { @override Widget build(BuildContext context) { - final createdAt = Jiffy.parseFromDateTime(dateTime); - final now = Jiffy.parseFromDateTime(DateTime.now()); + final createdAt = Jiffy(dateTime); + final now = Jiffy(DateTime.now()); var dayInfo = createdAt.MMMd; - if (createdAt.isSame(now, unit: Unit.day)) { + if (createdAt.isSame(now, Units.DAY)) { dayInfo = context.translations.todayLabel; - } else if (createdAt.isSame(now.subtract(days: 1), unit: Unit.day)) { + } else if (createdAt.isSame(now.subtract(days: 1), Units.DAY)) { dayInfo = context.translations.yesterdayLabel; - } else if (createdAt.isAfter(now.subtract(days: 7), unit: Unit.day)) { + } else if (createdAt.isAfter(now.subtract(days: 7), Units.DAY)) { dayInfo = createdAt.EEEE; - } else if (createdAt.isAfter(now.subtract(years: 1), unit: Unit.day)) { + } else if (createdAt.isAfter(now.subtract(years: 1), Units.DAY)) { dayInfo = createdAt.MMMd; } diff --git a/packages/stream_chat_flutter/lib/src/scroll_view/channel_scroll_view/stream_channel_list_tile.dart b/packages/stream_chat_flutter/lib/src/scroll_view/channel_scroll_view/stream_channel_list_tile.dart index b5261802..6b2a9b4f 100644 --- a/packages/stream_chat_flutter/lib/src/scroll_view/channel_scroll_view/stream_channel_list_tile.dart +++ b/packages/stream_chat_flutter/lib/src/scroll_view/channel_scroll_view/stream_channel_list_tile.dart @@ -287,16 +287,16 @@ class ChannelLastMessageDate extends StatelessWidget { if (lastMessageAt.millisecondsSinceEpoch >= startOfDay.millisecondsSinceEpoch) { - stringDate = Jiffy.parseFromDateTime(lastMessageAt.toLocal()).jm; + stringDate = Jiffy(lastMessageAt.toLocal()).jm; } else if (lastMessageAt.millisecondsSinceEpoch >= startOfDay .subtract(const Duration(days: 1)) .millisecondsSinceEpoch) { stringDate = context.translations.yesterdayLabel; } else if (startOfDay.difference(lastMessageAt).inDays < 7) { - stringDate = Jiffy.parseFromDateTime(lastMessageAt.toLocal()).EEEE; + stringDate = Jiffy(lastMessageAt.toLocal()).EEEE; } else { - stringDate = Jiffy.parseFromDateTime(lastMessageAt.toLocal()).yMd; + stringDate = Jiffy(lastMessageAt.toLocal()).yMd; } return Text( diff --git a/packages/stream_chat_flutter/lib/src/scroll_view/message_search_scroll_view/stream_message_search_list_tile.dart b/packages/stream_chat_flutter/lib/src/scroll_view/message_search_scroll_view/stream_message_search_list_tile.dart index 3eb03aec..5aab3b2d 100644 --- a/packages/stream_chat_flutter/lib/src/scroll_view/message_search_scroll_view/stream_message_search_list_tile.dart +++ b/packages/stream_chat_flutter/lib/src/scroll_view/message_search_scroll_view/stream_message_search_list_tile.dart @@ -227,9 +227,9 @@ class MessageSearchTileMessageDate extends StatelessWidget { if (now.year != createdAt.year || now.month != createdAt.month || now.day != createdAt.day) { - stringDate = Jiffy.parseFromDateTime(createdAt.toLocal()).yMd; + stringDate = Jiffy(createdAt.toLocal()).yMd; } else { - stringDate = Jiffy.parseFromDateTime(createdAt.toLocal()).jm; + stringDate = Jiffy(createdAt.toLocal()).jm; } return Text( diff --git a/packages/stream_chat_flutter/lib/src/scroll_view/user_scroll_view/stream_user_list_tile.dart b/packages/stream_chat_flutter/lib/src/scroll_view/user_scroll_view/stream_user_list_tile.dart index 1b0251f6..5ee49dcc 100644 --- a/packages/stream_chat_flutter/lib/src/scroll_view/user_scroll_view/stream_user_list_tile.dart +++ b/packages/stream_chat_flutter/lib/src/scroll_view/user_scroll_view/stream_user_list_tile.dart @@ -176,12 +176,11 @@ class UserLastActive extends StatelessWidget { @override Widget build(BuildContext context) { final chatTheme = StreamChatTheme.of(context); - final lastActive = user.lastActive ?? DateTime.now(); return Text( user.online ? context.translations.userOnlineText : '${context.translations.userLastOnlineText} ' - '${Jiffy.parseFromDateTime(lastActive).fromNow()}', + '${Jiffy(user.lastActive).fromNow()}', style: chatTheme.textTheme.footnote.copyWith( color: chatTheme.colorTheme.textHighEmphasis.withOpacity(0.5), ), diff --git a/packages/stream_chat_flutter/lib/src/stream_chat.dart b/packages/stream_chat_flutter/lib/src/stream_chat.dart index 6b0d0e60..73a0d0a0 100644 --- a/packages/stream_chat_flutter/lib/src/stream_chat.dart +++ b/packages/stream_chat_flutter/lib/src/stream_chat.dart @@ -165,9 +165,9 @@ class StreamChatState extends State { @override void didChangeDependencies() { final currentLocale = Localizations.localeOf(context).toString(); - final availableLocales = Jiffy.getSupportedLocales(); + final availableLocales = Jiffy.getAllAvailableLocales(); if (availableLocales.contains(currentLocale)) { - Jiffy.setLocale(currentLocale); + Jiffy.locale(currentLocale); } super.didChangeDependencies(); } diff --git a/packages/stream_chat_flutter/pubspec.yaml b/packages/stream_chat_flutter/pubspec.yaml index c78d7dba..bacecae3 100644 --- a/packages/stream_chat_flutter/pubspec.yaml +++ b/packages/stream_chat_flutter/pubspec.yaml @@ -29,7 +29,7 @@ dependencies: http_parser: ^4.0.2 image_gallery_saver: ^2.0.3 image_picker: ^1.0.0 - jiffy: ^6.2.1 + jiffy: ^5.0.0 lottie: ^2.3.2 meta: ^1.8.0 path_provider: ^2.0.15 diff --git a/packages/stream_chat_localizations/example/lib/add_new_lang.dart b/packages/stream_chat_localizations/example/lib/add_new_lang.dart index e1d1335a..bab8101b 100644 --- a/packages/stream_chat_localizations/example/lib/add_new_lang.dart +++ b/packages/stream_chat_localizations/example/lib/add_new_lang.dart @@ -270,15 +270,13 @@ class NnStreamChatLocalizations extends GlobalStreamChatLocalizations { } else if (date == yesterday) { return 'yesterday'; } else { - return 'on ${Jiffy.parseFromDateTime(date).MMMd}'; + return 'on ${Jiffy(date).MMMd}'; } } @override - String sentAtText({required DateTime date, required DateTime time}) { - final atTime = Jiffy.parseFromDateTime(time.toLocal()); - return 'Sent ${_getDay(date)} at ${atTime.jm}'; - } + String sentAtText({required DateTime date, required DateTime time}) => + 'Sent ${_getDay(date)} at ${Jiffy(time.toLocal()).format('HH:mm')}'; @override String get todayLabel => 'Today'; diff --git a/packages/stream_chat_localizations/lib/src/stream_chat_localizations_ca.dart b/packages/stream_chat_localizations/lib/src/stream_chat_localizations_ca.dart index ed2d3d7e..3c471e05 100644 --- a/packages/stream_chat_localizations/lib/src/stream_chat_localizations_ca.dart +++ b/packages/stream_chat_localizations/lib/src/stream_chat_localizations_ca.dart @@ -249,15 +249,13 @@ class StreamChatLocalizationsCa extends GlobalStreamChatLocalizations { } else if (date == yesterday) { return 'ahir'; } else { - return 'el ${Jiffy.parseFromDateTime(date).MMMd}'; + return 'el ${Jiffy(date).MMMd}'; } } @override - String sentAtText({required DateTime date, required DateTime time}) { - final atTime = Jiffy.parseFromDateTime(time.toLocal()); - return 'Enviat el ${_getDay(date)} a les ${atTime.jm}'; - } + String sentAtText({required DateTime date, required DateTime time}) => + '''Enviat el ${_getDay(date)} a les ${Jiffy(time.toLocal()).format('HH:mm')}'''; @override String get todayLabel => 'Avui'; diff --git a/packages/stream_chat_localizations/lib/src/stream_chat_localizations_de.dart b/packages/stream_chat_localizations/lib/src/stream_chat_localizations_de.dart index fe95f0f7..df2a7766 100644 --- a/packages/stream_chat_localizations/lib/src/stream_chat_localizations_de.dart +++ b/packages/stream_chat_localizations/lib/src/stream_chat_localizations_de.dart @@ -239,15 +239,13 @@ class StreamChatLocalizationsDe extends GlobalStreamChatLocalizations { } else if (date == yesterday) { return 'Gestern'; } else { - return 'am ${Jiffy.parseFromDateTime(date).MMMd}'; + return 'am ${Jiffy(date).MMMd}'; } } @override - String sentAtText({required DateTime date, required DateTime time}) { - final atTime = Jiffy.parseFromDateTime(time.toLocal()); - return 'Gesendet ${_getDay(date)} am ${atTime.jm}'; - } + String sentAtText({required DateTime date, required DateTime time}) => + 'Gesendet ${_getDay(date)} am ${Jiffy(time.toLocal()).format('HH:mm')}'; @override String get todayLabel => 'Heute'; diff --git a/packages/stream_chat_localizations/lib/src/stream_chat_localizations_en.dart b/packages/stream_chat_localizations/lib/src/stream_chat_localizations_en.dart index a744ff2a..c55bbf49 100644 --- a/packages/stream_chat_localizations/lib/src/stream_chat_localizations_en.dart +++ b/packages/stream_chat_localizations/lib/src/stream_chat_localizations_en.dart @@ -246,15 +246,13 @@ class StreamChatLocalizationsEn extends GlobalStreamChatLocalizations { } else if (date == yesterday) { return 'yesterday'; } else { - return 'on ${Jiffy.parseFromDateTime(date).MMMd}'; + return 'on ${Jiffy(date).MMMd}'; } } @override - String sentAtText({required DateTime date, required DateTime time}) { - final atTime = Jiffy.parseFromDateTime(time.toLocal()); - return 'Sent ${_getDay(date)} at ${atTime.jm}'; - } + String sentAtText({required DateTime date, required DateTime time}) => + 'Sent ${_getDay(date)} at ${Jiffy(time.toLocal()).format('HH:mm')}'; @override String get todayLabel => 'Today'; diff --git a/packages/stream_chat_localizations/lib/src/stream_chat_localizations_es.dart b/packages/stream_chat_localizations/lib/src/stream_chat_localizations_es.dart index 2d75b102..107e2616 100644 --- a/packages/stream_chat_localizations/lib/src/stream_chat_localizations_es.dart +++ b/packages/stream_chat_localizations/lib/src/stream_chat_localizations_es.dart @@ -250,15 +250,13 @@ class StreamChatLocalizationsEs extends GlobalStreamChatLocalizations { } else if (date == yesterday) { return 'ayer'; } else { - return 'el ${Jiffy.parseFromDateTime(date).MMMd}'; + return 'el ${Jiffy(date).MMMd}'; } } @override - String sentAtText({required DateTime date, required DateTime time}) { - final atTime = Jiffy.parseFromDateTime(time.toLocal()); - return 'Enviado el ${_getDay(date)} a las ${atTime.jm}'; - } + String sentAtText({required DateTime date, required DateTime time}) => + '''Enviado el ${_getDay(date)} a las ${Jiffy(time.toLocal()).format('HH:mm')}'''; @override String get todayLabel => 'Hoy'; diff --git a/packages/stream_chat_localizations/lib/src/stream_chat_localizations_fr.dart b/packages/stream_chat_localizations/lib/src/stream_chat_localizations_fr.dart index 6a474b8a..8b501184 100644 --- a/packages/stream_chat_localizations/lib/src/stream_chat_localizations_fr.dart +++ b/packages/stream_chat_localizations/lib/src/stream_chat_localizations_fr.dart @@ -249,15 +249,13 @@ class StreamChatLocalizationsFr extends GlobalStreamChatLocalizations { } else if (date == yesterday) { return 'hier'; } else { - return 'le ${Jiffy.parseFromDateTime(date).MMMd}'; + return 'le ${Jiffy(date).MMMd}'; } } @override - String sentAtText({required DateTime date, required DateTime time}) { - final atTime = Jiffy.parseFromDateTime(time.toLocal()); - return 'Envoyé ${_getDay(date)} à ${atTime.jm}'; - } + String sentAtText({required DateTime date, required DateTime time}) => + 'Envoyé ${_getDay(date)} à ${Jiffy(time.toLocal()).format('HH:mm')}'; @override String get todayLabel => "Aujourd'hui"; diff --git a/packages/stream_chat_localizations/lib/src/stream_chat_localizations_hi.dart b/packages/stream_chat_localizations/lib/src/stream_chat_localizations_hi.dart index 4e056ab2..4f27717a 100644 --- a/packages/stream_chat_localizations/lib/src/stream_chat_localizations_hi.dart +++ b/packages/stream_chat_localizations/lib/src/stream_chat_localizations_hi.dart @@ -243,15 +243,13 @@ class StreamChatLocalizationsHi extends GlobalStreamChatLocalizations { } else if (date == yesterday) { return 'कल'; } else { - return '${Jiffy.parseFromDateTime(date).MMMd} को'; + return '${Jiffy(date).MMMd} को'; } } @override - String sentAtText({required DateTime date, required DateTime time}) { - final atTime = Jiffy.parseFromDateTime(time.toLocal()); - return '${_getDay(date)} ${atTime.jm} बजे भेजा गया'; - } + String sentAtText({required DateTime date, required DateTime time}) => + '${_getDay(date)} ${Jiffy(time.toLocal()).format('HH:mm')} बजे भेजा गया'; @override String get todayLabel => 'आज'; diff --git a/packages/stream_chat_localizations/lib/src/stream_chat_localizations_it.dart b/packages/stream_chat_localizations/lib/src/stream_chat_localizations_it.dart index 51a80897..b407629d 100644 --- a/packages/stream_chat_localizations/lib/src/stream_chat_localizations_it.dart +++ b/packages/stream_chat_localizations/lib/src/stream_chat_localizations_it.dart @@ -252,15 +252,13 @@ Il file è troppo grande per essere caricato. Il limite è di $limitInMB MB.'''; } else if (date == yesterday) { return 'ieri'; } else { - return 'il ${Jiffy.parseFromDateTime(date).MMMd}'; + return 'il ${Jiffy(date).MMMd}'; } } @override - String sentAtText({required DateTime date, required DateTime time}) { - final atTime = Jiffy.parseFromDateTime(time.toLocal()); - return 'Inviato ${_getDay(date)} alle ${atTime.jm}'; - } + String sentAtText({required DateTime date, required DateTime time}) => + "Inviato ${_getDay(date)} alle ${Jiffy(time.toLocal()).format('HH:mm')}"; @override String get todayLabel => 'Oggi'; diff --git a/packages/stream_chat_localizations/lib/src/stream_chat_localizations_ja.dart b/packages/stream_chat_localizations/lib/src/stream_chat_localizations_ja.dart index 17285f6a..26a5e8b3 100644 --- a/packages/stream_chat_localizations/lib/src/stream_chat_localizations_ja.dart +++ b/packages/stream_chat_localizations/lib/src/stream_chat_localizations_ja.dart @@ -236,15 +236,13 @@ class StreamChatLocalizationsJa extends GlobalStreamChatLocalizations { } else if (date == yesterday) { return '昨日'; } else { - return '${Jiffy.parseFromDateTime(date).MMMd}に'; + return '${Jiffy(date).MMMd}に'; } } @override - String sentAtText({required DateTime date, required DateTime time}) { - final atTime = Jiffy.parseFromDateTime(time.toLocal()); - return '${_getDay(date)}の${atTime.jm}に送信しました '; - } + String sentAtText({required DateTime date, required DateTime time}) => + '${_getDay(date)}の${Jiffy(time.toLocal()).format('HH:mm')}に送信しました '; @override String get todayLabel => '今日'; diff --git a/packages/stream_chat_localizations/lib/src/stream_chat_localizations_ko.dart b/packages/stream_chat_localizations/lib/src/stream_chat_localizations_ko.dart index acf1f79f..7b907584 100644 --- a/packages/stream_chat_localizations/lib/src/stream_chat_localizations_ko.dart +++ b/packages/stream_chat_localizations/lib/src/stream_chat_localizations_ko.dart @@ -235,15 +235,13 @@ class StreamChatLocalizationsKo extends GlobalStreamChatLocalizations { } else if (date == yesterday) { return '어제'; } else { - return '${Jiffy.parseFromDateTime(date).MMMd}에'; + return '${Jiffy(date).MMMd}에'; } } @override - String sentAtText({required DateTime date, required DateTime time}) { - final atTime = Jiffy.parseFromDateTime(time.toLocal()); - return '${_getDay(date)} ${atTime.jm}에 보냈습니다'; - } + String sentAtText({required DateTime date, required DateTime time}) => + '${_getDay(date)} ${Jiffy(time.toLocal()).format('HH:mm')}에 보냈습니다'; @override String get todayLabel => '오늘'; diff --git a/packages/stream_chat_localizations/lib/src/stream_chat_localizations_no.dart b/packages/stream_chat_localizations/lib/src/stream_chat_localizations_no.dart index 8a6c4db3..88350979 100644 --- a/packages/stream_chat_localizations/lib/src/stream_chat_localizations_no.dart +++ b/packages/stream_chat_localizations/lib/src/stream_chat_localizations_no.dart @@ -242,15 +242,13 @@ class StreamChatLocalizationsNo extends GlobalStreamChatLocalizations { } else if (date == yesterday) { return 'i går'; } else { - return 'på ${Jiffy.parseFromDateTime(date).MMMd}'; + return 'på ${Jiffy(date).MMMd}'; } } @override - String sentAtText({required DateTime date, required DateTime time}) { - final atTime = Jiffy.parseFromDateTime(time.toLocal()); - return 'Sent ${_getDay(date)} kl. ${atTime.jm}'; - } + String sentAtText({required DateTime date, required DateTime time}) => + 'Sent ${_getDay(date)} kl. ${Jiffy(time.toLocal()).format('HH:mm')}'; @override String get todayLabel => 'I dag'; diff --git a/packages/stream_chat_localizations/lib/src/stream_chat_localizations_pt.dart b/packages/stream_chat_localizations/lib/src/stream_chat_localizations_pt.dart index f359808b..874eb118 100644 --- a/packages/stream_chat_localizations/lib/src/stream_chat_localizations_pt.dart +++ b/packages/stream_chat_localizations/lib/src/stream_chat_localizations_pt.dart @@ -244,15 +244,13 @@ class StreamChatLocalizationsPt extends GlobalStreamChatLocalizations { } else if (date == yesterday) { return 'Ontem'; } else { - return 'o ${Jiffy.parseFromDateTime(date).MMMd}'; + return 'o ${Jiffy(date).MMMd}'; } } @override - String sentAtText({required DateTime date, required DateTime time}) { - final atTime = Jiffy.parseFromDateTime(time.toLocal()); - return 'Enviado ${_getDay(date)} às ${atTime.jm}'; - } + String sentAtText({required DateTime date, required DateTime time}) => + '''Enviado ${_getDay(date)} às ${Jiffy(time.toLocal()).format('HH:mm')}'''; @override String get todayLabel => 'Hoje'; From 45f06fc0a17750a4b40d2142f94ab74c38803b64 Mon Sep 17 00:00:00 2001 From: Sahil Kumar Date: Tue, 11 Jul 2023 19:24:45 +0530 Subject: [PATCH 46/54] chore: more revert. Signed-off-by: xsahil03x --- packages/stream_chat_flutter/lib/src/user/user_item.dart | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/stream_chat_flutter/lib/src/user/user_item.dart b/packages/stream_chat_flutter/lib/src/user/user_item.dart index 0c13d95e..019322d9 100644 --- a/packages/stream_chat_flutter/lib/src/user/user_item.dart +++ b/packages/stream_chat_flutter/lib/src/user/user_item.dart @@ -74,12 +74,11 @@ class StreamUserItem extends StatelessWidget { Widget _buildLastActive(BuildContext context) { final chatTheme = StreamChatTheme.of(context); - final lastActive = user.lastActive ?? DateTime.now(); return Text( user.online ? context.translations.userOnlineText : '${context.translations.userLastOnlineText} ' - '${Jiffy.parseFromDateTime(lastActive).fromNow()}', + '${Jiffy(user.lastActive).fromNow()}', style: chatTheme.textTheme.footnote.copyWith( color: chatTheme.colorTheme.textHighEmphasis.withOpacity(0.5), ), From f312cd20366c6bc4516426d167ac771a64b9734c Mon Sep 17 00:00:00 2001 From: Sahil Kumar Date: Tue, 11 Jul 2023 19:25:48 +0530 Subject: [PATCH 47/54] chore(localization): bump min flutter version to 3.7 Signed-off-by: xsahil03x --- packages/stream_chat_localizations/pubspec.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/stream_chat_localizations/pubspec.yaml b/packages/stream_chat_localizations/pubspec.yaml index d9d07664..c72032ea 100644 --- a/packages/stream_chat_localizations/pubspec.yaml +++ b/packages/stream_chat_localizations/pubspec.yaml @@ -6,8 +6,8 @@ repository: https://github.com/GetStream/stream-chat-flutter issue_tracker: https://github.com/GetStream/stream-chat-flutter/issues environment: - sdk: ">=2.18.0 <4.0.0" - flutter: ">=3.3.0" + sdk: ">=2.19.0 <4.0.0" + flutter: ">=3.7.0" dependencies: flutter: From 857542536e49baf24677b1bdd8ef786b60e04138 Mon Sep 17 00:00:00 2001 From: Sahil Kumar Date: Tue, 11 Jul 2023 20:09:31 +0530 Subject: [PATCH 48/54] chore: fix analysis. Signed-off-by: xsahil03x --- .github/workflows/legacy_version_analyze.yml | 22 +++++++++++++++++-- .../lib/src/utils/typedefs.dart | 2 +- pubspec.yaml | 4 ++-- 3 files changed, 23 insertions(+), 5 deletions(-) diff --git a/.github/workflows/legacy_version_analyze.yml b/.github/workflows/legacy_version_analyze.yml index 2454e09c..3c5954bb 100644 --- a/.github/workflows/legacy_version_analyze.yml +++ b/.github/workflows/legacy_version_analyze.yml @@ -40,14 +40,32 @@ jobs: uses: actions/checkout@v3 with: fetch-depth: 0 + - name: "Install Flutter" uses: subosito/flutter-action@v2 with: cache: true flutter-version: ${{ env.flutter_version }} + - name: "Install Tools" run: flutter pub global activate melos + - name: "Bootstrap Workspace" run: melos bootstrap --verbose - - name: "Dart Analyze" - run: melos run analyze \ No newline at end of file + + # Only analyze lib/; non-client code doesn't need to work on + # all supported legacy version. + - name: "Stream Chat Analyze" + run: cd packages/stream_chat/lib && dart analyze --fatal-infos . + + - name: "Stream Chat Flutter Core Analyze" + run: cd packages/stream_chat_core/lib && dart analyze --fatal-infos . + + - name: "Stream Chat Flutter Analyze" + run: cd packages/stream_chat_flutter/lib && dart analyze --fatal-infos . + + - name: "Stream Chat Persistence Analyze" + run: cd packages/stream_chat_persistence/lib && dart analyze --fatal-infos . + + - name: "Stream Chat Localizations Analyze" + run: cd packages/stream_chat_localizations/lib && dart analyze --fatal-infos . \ No newline at end of file diff --git a/packages/stream_chat_flutter/lib/src/utils/typedefs.dart b/packages/stream_chat_flutter/lib/src/utils/typedefs.dart index 17cab820..64f18e1a 100644 --- a/packages/stream_chat_flutter/lib/src/utils/typedefs.dart +++ b/packages/stream_chat_flutter/lib/src/utils/typedefs.dart @@ -88,7 +88,7 @@ typedef ChannelTapCallback = void Function(Channel, Widget?); typedef ChannelInfoCallback = void Function(Channel); /// {@template channelPreviewBuilder} -/// Builder used to create a custom [ChannelPreview] for a [Channel] +/// Builder used to create a custom ChannelPreview for a [Channel] /// {@endtemplate} @Deprecated('Use StreamChannelListViewIndexedWidgetBuilder instead') typedef ChannelPreviewBuilder = Widget Function(BuildContext, Channel); diff --git a/pubspec.yaml b/pubspec.yaml index 9016fa8f..cf418d76 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,7 +1,7 @@ name: stream_chat_flutter_workspace environment: - sdk: '>=2.18.0 <3.0.0' + sdk: '>=2.19.0 <4.0.0' dev_dependencies: - melos: ^3.0.0 + melos: ^3.1.0 From b96475920c319797dbf2d2afe6a2a87c7dfddf8c Mon Sep 17 00:00:00 2001 From: Sahil Kumar Date: Tue, 11 Jul 2023 20:12:29 +0530 Subject: [PATCH 49/54] chore: fix legacy workflow Signed-off-by: xsahil03x --- .github/workflows/legacy_version_analyze.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/legacy_version_analyze.yml b/.github/workflows/legacy_version_analyze.yml index 3c5954bb..89c195df 100644 --- a/.github/workflows/legacy_version_analyze.yml +++ b/.github/workflows/legacy_version_analyze.yml @@ -59,7 +59,7 @@ jobs: run: cd packages/stream_chat/lib && dart analyze --fatal-infos . - name: "Stream Chat Flutter Core Analyze" - run: cd packages/stream_chat_core/lib && dart analyze --fatal-infos . + run: cd packages/stream_chat_flutter_core/lib && dart analyze --fatal-infos . - name: "Stream Chat Flutter Analyze" run: cd packages/stream_chat_flutter/lib && dart analyze --fatal-infos . From 3a9f0b01478f42b5bf8f2ee85e7a77af38e96870 Mon Sep 17 00:00:00 2001 From: Sahil Kumar Date: Tue, 11 Jul 2023 20:24:01 +0530 Subject: [PATCH 50/54] chore: update CHANGELOG.md Signed-off-by: xsahil03x --- packages/stream_chat/CHANGELOG.md | 2 +- packages/stream_chat_flutter/CHANGELOG.md | 2 +- packages/stream_chat_flutter_core/CHANGELOG.md | 2 +- packages/stream_chat_localizations/CHANGELOG.md | 2 +- packages/stream_chat_persistence/CHANGELOG.md | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/stream_chat/CHANGELOG.md b/packages/stream_chat/CHANGELOG.md index e8f5c67c..21f6caa5 100644 --- a/packages/stream_chat/CHANGELOG.md +++ b/packages/stream_chat/CHANGELOG.md @@ -2,7 +2,7 @@ 🔄 Changed -- Updated minimum supported `SDK` version to Dart 2.18 +- Updated minimum supported `SDK` version to Dart 2.19 ## 6.4.0 diff --git a/packages/stream_chat_flutter/CHANGELOG.md b/packages/stream_chat_flutter/CHANGELOG.md index 00e97bd8..e00716ed 100644 --- a/packages/stream_chat_flutter/CHANGELOG.md +++ b/packages/stream_chat_flutter/CHANGELOG.md @@ -2,7 +2,7 @@ 🔄 Changed -- Updated minimum supported `SDK` version to Flutter 3.3/Dart 2.18 +- Updated minimum supported `SDK` version to Flutter 3.7/Dart 2.19 ## 6.5.0 diff --git a/packages/stream_chat_flutter_core/CHANGELOG.md b/packages/stream_chat_flutter_core/CHANGELOG.md index 0cc5486a..fd21268b 100644 --- a/packages/stream_chat_flutter_core/CHANGELOG.md +++ b/packages/stream_chat_flutter_core/CHANGELOG.md @@ -1,6 +1,6 @@ ## Upcoming -- Updated minimum supported `SDK` version to Flutter 3.3/Dart 2.18 +- Updated minimum supported `SDK` version to Flutter 3.7/Dart 2.19 ## 6.4.0 diff --git a/packages/stream_chat_localizations/CHANGELOG.md b/packages/stream_chat_localizations/CHANGELOG.md index f2ad2fd8..f6ff4939 100644 --- a/packages/stream_chat_localizations/CHANGELOG.md +++ b/packages/stream_chat_localizations/CHANGELOG.md @@ -1,6 +1,6 @@ ## Upcoming -- Updated minimum supported `SDK` version to Flutter 3.3/Dart 2.18 +- Updated minimum supported `SDK` version to Flutter 3.7/Dart 2.19 ## 5.5.0 diff --git a/packages/stream_chat_persistence/CHANGELOG.md b/packages/stream_chat_persistence/CHANGELOG.md index 393a17ef..76623ba7 100644 --- a/packages/stream_chat_persistence/CHANGELOG.md +++ b/packages/stream_chat_persistence/CHANGELOG.md @@ -1,6 +1,6 @@ ## Upcoming -- Updated minimum supported `SDK` version to Flutter 3.3/Dart 2.18 +- Updated minimum supported `SDK` version to Flutter 3.7/Dart 2.19 ## 6.4.0 From 99c656be1f4c85f1e7a5d2ba684dbafdf6916f7b Mon Sep 17 00:00:00 2001 From: Sahil Kumar Date: Wed, 12 Jul 2023 15:50:55 +0530 Subject: [PATCH 51/54] chore(repo): prepare for release. Signed-off-by: xsahil03x --- packages/stream_chat/CHANGELOG.md | 2 +- packages/stream_chat/lib/version.dart | 2 +- packages/stream_chat/pubspec.yaml | 2 +- packages/stream_chat_flutter/CHANGELOG.md | 2 +- packages/stream_chat_flutter/pubspec.yaml | 4 ++-- packages/stream_chat_flutter_core/CHANGELOG.md | 2 +- packages/stream_chat_flutter_core/pubspec.yaml | 4 ++-- packages/stream_chat_localizations/CHANGELOG.md | 2 +- packages/stream_chat_localizations/pubspec.yaml | 4 ++-- packages/stream_chat_persistence/CHANGELOG.md | 2 +- packages/stream_chat_persistence/pubspec.yaml | 4 ++-- 11 files changed, 15 insertions(+), 15 deletions(-) diff --git a/packages/stream_chat/CHANGELOG.md b/packages/stream_chat/CHANGELOG.md index 21f6caa5..6be503a3 100644 --- a/packages/stream_chat/CHANGELOG.md +++ b/packages/stream_chat/CHANGELOG.md @@ -1,4 +1,4 @@ -## Upcoming +## 6.5.0 🔄 Changed diff --git a/packages/stream_chat/lib/version.dart b/packages/stream_chat/lib/version.dart index a2fb6fe6..6b1c214d 100644 --- a/packages/stream_chat/lib/version.dart +++ b/packages/stream_chat/lib/version.dart @@ -3,4 +3,4 @@ import 'package:stream_chat/src/client/client.dart'; /// Current package version /// Used in [StreamChatClient] to build the `x-stream-client` header // ignore: constant_identifier_names -const PACKAGE_VERSION = '6.4.0'; +const PACKAGE_VERSION = '6.5.0'; diff --git a/packages/stream_chat/pubspec.yaml b/packages/stream_chat/pubspec.yaml index b52f7bfd..469f6b19 100644 --- a/packages/stream_chat/pubspec.yaml +++ b/packages/stream_chat/pubspec.yaml @@ -1,7 +1,7 @@ name: stream_chat homepage: https://getstream.io/ description: The official Dart client for Stream Chat, a service for building chat applications. -version: 6.4.0 +version: 6.5.0 repository: https://github.com/GetStream/stream-chat-flutter issue_tracker: https://github.com/GetStream/stream-chat-flutter/issues diff --git a/packages/stream_chat_flutter/CHANGELOG.md b/packages/stream_chat_flutter/CHANGELOG.md index e00716ed..1263c4fe 100644 --- a/packages/stream_chat_flutter/CHANGELOG.md +++ b/packages/stream_chat_flutter/CHANGELOG.md @@ -1,4 +1,4 @@ -## Upcoming +## 6.6.0 🔄 Changed diff --git a/packages/stream_chat_flutter/pubspec.yaml b/packages/stream_chat_flutter/pubspec.yaml index bacecae3..8bf55582 100644 --- a/packages/stream_chat_flutter/pubspec.yaml +++ b/packages/stream_chat_flutter/pubspec.yaml @@ -1,7 +1,7 @@ name: stream_chat_flutter homepage: https://github.com/GetStream/stream-chat-flutter description: Stream Chat official Flutter SDK. Build your own chat experience using Dart and Flutter. -version: 6.5.0 +version: 6.6.0 repository: https://github.com/GetStream/stream-chat-flutter issue_tracker: https://github.com/GetStream/stream-chat-flutter/issues @@ -38,7 +38,7 @@ dependencies: rxdart: ^0.27.7 share_plus: ^7.0.2 shimmer: ^3.0.0 - stream_chat_flutter_core: ^6.4.0 + stream_chat_flutter_core: ^6.5.0 synchronized: ^3.1.0 thumblr: ^0.0.4 url_launcher: ^6.1.11 diff --git a/packages/stream_chat_flutter_core/CHANGELOG.md b/packages/stream_chat_flutter_core/CHANGELOG.md index fd21268b..edb10b9a 100644 --- a/packages/stream_chat_flutter_core/CHANGELOG.md +++ b/packages/stream_chat_flutter_core/CHANGELOG.md @@ -1,4 +1,4 @@ -## Upcoming +## 6.5.0 - Updated minimum supported `SDK` version to Flutter 3.7/Dart 2.19 diff --git a/packages/stream_chat_flutter_core/pubspec.yaml b/packages/stream_chat_flutter_core/pubspec.yaml index 16902a1c..5f30475c 100644 --- a/packages/stream_chat_flutter_core/pubspec.yaml +++ b/packages/stream_chat_flutter_core/pubspec.yaml @@ -1,7 +1,7 @@ name: stream_chat_flutter_core homepage: https://github.com/GetStream/stream-chat-flutter description: Stream Chat official Flutter SDK Core. Build your own chat experience using Dart and Flutter. -version: 6.4.0 +version: 6.5.0 repository: https://github.com/GetStream/stream-chat-flutter issue_tracker: https://github.com/GetStream/stream-chat-flutter/issues @@ -17,7 +17,7 @@ dependencies: freezed_annotation: ^2.2.0 meta: ^1.8.0 rxdart: ^0.27.7 - stream_chat: ^6.4.0 + stream_chat: ^6.5.0 dev_dependencies: build_runner: ^2.3.3 diff --git a/packages/stream_chat_localizations/CHANGELOG.md b/packages/stream_chat_localizations/CHANGELOG.md index f6ff4939..85d39196 100644 --- a/packages/stream_chat_localizations/CHANGELOG.md +++ b/packages/stream_chat_localizations/CHANGELOG.md @@ -1,4 +1,4 @@ -## Upcoming +## 5.6.0 - Updated minimum supported `SDK` version to Flutter 3.7/Dart 2.19 diff --git a/packages/stream_chat_localizations/pubspec.yaml b/packages/stream_chat_localizations/pubspec.yaml index c72032ea..a933f492 100644 --- a/packages/stream_chat_localizations/pubspec.yaml +++ b/packages/stream_chat_localizations/pubspec.yaml @@ -1,6 +1,6 @@ name: stream_chat_localizations description: The Official localizations for Stream Chat Flutter, a service for building chat applications -version: 5.5.0 +version: 5.6.0 homepage: https://github.com/GetStream/stream-chat-flutter repository: https://github.com/GetStream/stream-chat-flutter issue_tracker: https://github.com/GetStream/stream-chat-flutter/issues @@ -14,7 +14,7 @@ dependencies: sdk: flutter flutter_localizations: sdk: flutter - stream_chat_flutter: ^6.5.0 + stream_chat_flutter: ^6.6.0 dev_dependencies: flutter_test: diff --git a/packages/stream_chat_persistence/CHANGELOG.md b/packages/stream_chat_persistence/CHANGELOG.md index 76623ba7..245797b7 100644 --- a/packages/stream_chat_persistence/CHANGELOG.md +++ b/packages/stream_chat_persistence/CHANGELOG.md @@ -1,4 +1,4 @@ -## Upcoming +## 6.5.0 - Updated minimum supported `SDK` version to Flutter 3.7/Dart 2.19 diff --git a/packages/stream_chat_persistence/pubspec.yaml b/packages/stream_chat_persistence/pubspec.yaml index 6ff7ac15..aa4ae55f 100644 --- a/packages/stream_chat_persistence/pubspec.yaml +++ b/packages/stream_chat_persistence/pubspec.yaml @@ -1,7 +1,7 @@ name: stream_chat_persistence homepage: https://github.com/GetStream/stream-chat-flutter description: Official Stream Chat Persistence library. Build your own chat experience using Dart and Flutter. -version: 6.4.0 +version: 6.5.0 repository: https://github.com/GetStream/stream-chat-flutter issue_tracker: https://github.com/GetStream/stream-chat-flutter/issues @@ -18,7 +18,7 @@ dependencies: path: ^1.8.2 path_provider: ^2.0.15 sqlite3_flutter_libs: ^0.5.15 - stream_chat: ^6.4.0 + stream_chat: ^6.5.0 dev_dependencies: build_runner: ^2.3.3 From aff7c3b62b49df01f904a7600a9b245f09aff7e0 Mon Sep 17 00:00:00 2001 From: Sahil Kumar Date: Wed, 12 Jul 2023 15:53:34 +0530 Subject: [PATCH 52/54] chore: bump example min version. Signed-off-by: xsahil03x --- packages/stream_chat/example/pubspec.yaml | 4 ++-- packages/stream_chat_flutter/example/pubspec.yaml | 4 ++-- packages/stream_chat_flutter_core/example/pubspec.yaml | 4 ++-- packages/stream_chat_localizations/example/pubspec.yaml | 4 ++-- packages/stream_chat_persistence/example/pubspec.yaml | 4 ++-- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/packages/stream_chat/example/pubspec.yaml b/packages/stream_chat/example/pubspec.yaml index b2855d2a..16362f02 100644 --- a/packages/stream_chat/example/pubspec.yaml +++ b/packages/stream_chat/example/pubspec.yaml @@ -5,8 +5,8 @@ publish_to: "none" version: 1.0.0+1 environment: - sdk: '>=2.18.0 <4.0.0' - flutter: ">=3.3.0" + sdk: '>=2.19.0 <4.0.0' + flutter: ">=3.7.0" dependencies: cupertino_icons: ^1.0.5 diff --git a/packages/stream_chat_flutter/example/pubspec.yaml b/packages/stream_chat_flutter/example/pubspec.yaml index 1b42acec..075e8132 100644 --- a/packages/stream_chat_flutter/example/pubspec.yaml +++ b/packages/stream_chat_flutter/example/pubspec.yaml @@ -4,8 +4,8 @@ publish_to: 'none' version: 1.0.0+1 environment: - sdk: ">=2.18.0 <4.0.0" - flutter: ">=3.3.0" + sdk: '>=2.19.0 <4.0.0' + flutter: ">=3.7.0" dependencies: collection: ^1.15.0 diff --git a/packages/stream_chat_flutter_core/example/pubspec.yaml b/packages/stream_chat_flutter_core/example/pubspec.yaml index ed9e59b6..c92a4fc6 100644 --- a/packages/stream_chat_flutter_core/example/pubspec.yaml +++ b/packages/stream_chat_flutter_core/example/pubspec.yaml @@ -4,8 +4,8 @@ publish_to: 'none' version: 1.0.0+1 environment: - sdk: ">=2.18.0 <4.0.0" - flutter: ">=3.3.0" + sdk: '>=2.19.0 <4.0.0' + flutter: ">=3.7.0" dependencies: cupertino_icons: ^1.0.3 diff --git a/packages/stream_chat_localizations/example/pubspec.yaml b/packages/stream_chat_localizations/example/pubspec.yaml index 252b0b6f..c23b28b1 100644 --- a/packages/stream_chat_localizations/example/pubspec.yaml +++ b/packages/stream_chat_localizations/example/pubspec.yaml @@ -5,8 +5,8 @@ publish_to: 'none' version: 1.0.0+1 environment: - sdk: ">=2.18.0 <4.0.0" - flutter: ">=3.3.0" + sdk: '>=2.19.0 <4.0.0' + flutter: ">=3.7.0" dependencies: cupertino_icons: ^1.0.3 diff --git a/packages/stream_chat_persistence/example/pubspec.yaml b/packages/stream_chat_persistence/example/pubspec.yaml index e7cb4a8d..f67961aa 100644 --- a/packages/stream_chat_persistence/example/pubspec.yaml +++ b/packages/stream_chat_persistence/example/pubspec.yaml @@ -4,8 +4,8 @@ publish_to: 'none' version: 1.0.0+1 environment: - sdk: ">=2.18.0 <4.0.0" - flutter: ">=3.3.0" + sdk: '>=2.19.0 <4.0.0' + flutter: ">=3.7.0" dependencies: cupertino_icons: ^1.0.3 From 8f84c843d5fadf56e2092ab7ef896a38c2014a2d Mon Sep 17 00:00:00 2001 From: Sahil Kumar Date: Wed, 12 Jul 2023 16:15:15 +0530 Subject: [PATCH 53/54] chore: add path in dev deps. Signed-off-by: xsahil03x --- packages/stream_chat_flutter/pubspec.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/stream_chat_flutter/pubspec.yaml b/packages/stream_chat_flutter/pubspec.yaml index 8bf55582..a308ca6d 100644 --- a/packages/stream_chat_flutter/pubspec.yaml +++ b/packages/stream_chat_flutter/pubspec.yaml @@ -73,4 +73,5 @@ dev_dependencies: flutter_test: sdk: flutter golden_toolkit: ^0.15.0 - mocktail: ^0.3.0 \ No newline at end of file + mocktail: ^0.3.0 + path: ^1.8.3 \ No newline at end of file From c742abce5e500952a0ce764d3061a208c35709b2 Mon Sep 17 00:00:00 2001 From: Sahil Kumar Date: Wed, 12 Jul 2023 16:17:59 +0530 Subject: [PATCH 54/54] chore: reduce path dev version to 1.8.2 Signed-off-by: xsahil03x --- packages/stream_chat_flutter/pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/stream_chat_flutter/pubspec.yaml b/packages/stream_chat_flutter/pubspec.yaml index a308ca6d..f120f931 100644 --- a/packages/stream_chat_flutter/pubspec.yaml +++ b/packages/stream_chat_flutter/pubspec.yaml @@ -74,4 +74,4 @@ dev_dependencies: sdk: flutter golden_toolkit: ^0.15.0 mocktail: ^0.3.0 - path: ^1.8.3 \ No newline at end of file + path: ^1.8.2 \ No newline at end of file