From 00bad6b7e8f7fc251cc137864dddf654c806c386 Mon Sep 17 00:00:00 2001 From: Sahil Kumar Date: Fri, 20 May 2022 17:07:49 +0530 Subject: [PATCH 01/45] refactor(llc): remove dio deprecated methods Signed-off-by: xsahil03x --- .../core/http/interceptor/auth_interceptor.dart | 4 +--- .../lib/src/core/http/stream_http_client.dart | 14 -------------- .../http/interceptor/auth_interceptor_test.dart | 14 -------------- 3 files changed, 1 insertion(+), 31 deletions(-) diff --git a/packages/stream_chat/lib/src/core/http/interceptor/auth_interceptor.dart b/packages/stream_chat/lib/src/core/http/interceptor/auth_interceptor.dart index 7748f96f..58db2fe3 100644 --- a/packages/stream_chat/lib/src/core/http/interceptor/auth_interceptor.dart +++ b/packages/stream_chat/lib/src/core/http/interceptor/auth_interceptor.dart @@ -8,7 +8,7 @@ import 'package:stream_chat/src/core/http/token_manager.dart'; /// Authentication interceptor that refreshes the token if /// an auth error is received -class AuthInterceptor extends Interceptor { +class AuthInterceptor extends QueuedInterceptor { /// Initialize a new auth interceptor AuthInterceptor(this._client, this._tokenManager); @@ -57,9 +57,7 @@ class AuthInterceptor extends Interceptor { final error = ErrorResponse.fromJson(data); if (error.code == ChatErrorCode.tokenExpired.code) { if (_tokenManager.isStatic) return handler.next(err); - _client.lock(); await _tokenManager.loadToken(refresh: true); - _client.unlock(); try { final options = err.requestOptions; final response = await _client.request( diff --git a/packages/stream_chat/lib/src/core/http/stream_http_client.dart b/packages/stream_chat/lib/src/core/http/stream_http_client.dart index d977b010..169492a7 100644 --- a/packages/stream_chat/lib/src/core/http/stream_http_client.dart +++ b/packages/stream_chat/lib/src/core/http/stream_http_client.dart @@ -76,20 +76,6 @@ class StreamHttpClient { @visibleForTesting final Dio httpClient; - /// Lock the current [StreamHttpClient] instance. - /// - /// [StreamHttpClient] will enqueue the incoming request tasks instead - /// send them directly when [interceptor.requestOptions] is locked. - void lock() => httpClient.lock(); - - /// Unlock the current [StreamHttpClient] instance. - /// - /// [StreamHttpClient] instance dequeue the request task。 - void unlock() => httpClient.unlock(); - - /// Clear the current [StreamHttpClient] instance waiting queue. - void clear() => httpClient.clear(); - /// Shuts down the [StreamHttpClient]. /// /// If [force] is `false` the [StreamHttpClient] will be kept alive diff --git a/packages/stream_chat/test/src/core/http/interceptor/auth_interceptor_test.dart b/packages/stream_chat/test/src/core/http/interceptor/auth_interceptor_test.dart index 1e88ea1e..44b05141 100644 --- a/packages/stream_chat/test/src/core/http/interceptor/auth_interceptor_test.dart +++ b/packages/stream_chat/test/src/core/http/interceptor/auth_interceptor_test.dart @@ -93,14 +93,10 @@ void main() { when(() => tokenManager.isStatic).thenReturn(false); - when(() => client.lock()).thenReturn(() {}); - final token = Token.development('test-user-id'); when(() => tokenManager.loadToken(refresh: true)) .thenAnswer((_) async => token); - when(() => client.unlock()).thenReturn(() {}); - when(() => client.request( path, data: options.data, @@ -127,12 +123,9 @@ void main() { verify(() => tokenManager.isStatic).called(1); - verify(() => client.lock()).called(1); - verify(() => tokenManager.loadToken(refresh: true)).called(1); verifyNoMoreInteractions(tokenManager); - verify(() => client.unlock()).called(1); verify(() => client.request( path, data: options.data, @@ -163,14 +156,10 @@ void main() { when(() => tokenManager.isStatic).thenReturn(false); - when(() => client.lock()).thenReturn(() {}); - final token = Token.development('test-user-id'); when(() => tokenManager.loadToken(refresh: true)) .thenAnswer((_) async => token); - when(() => client.unlock()).thenReturn(() {}); - when(() => client.request( path, data: options.data, @@ -193,12 +182,9 @@ void main() { verify(() => tokenManager.isStatic).called(1); - verify(() => client.lock()).called(1); - verify(() => tokenManager.loadToken(refresh: true)).called(1); verifyNoMoreInteractions(tokenManager); - verify(() => client.unlock()).called(1); verify(() => client.request( path, data: options.data, From 2fdf3282e6f36cbd74e083957be52298d2529313 Mon Sep 17 00:00:00 2001 From: Sahil Kumar Date: Fri, 20 May 2022 17:24:06 +0530 Subject: [PATCH 02/45] refactor(llc): use `dio.fetch` instead of `dio.request` Signed-off-by: xsahil03x --- .../http/interceptor/auth_interceptor.dart | 25 +------------------ .../lib/src/core/http/stream_http_client.dart | 13 ++++++++++ 2 files changed, 14 insertions(+), 24 deletions(-) diff --git a/packages/stream_chat/lib/src/core/http/interceptor/auth_interceptor.dart b/packages/stream_chat/lib/src/core/http/interceptor/auth_interceptor.dart index 58db2fe3..759e8e79 100644 --- a/packages/stream_chat/lib/src/core/http/interceptor/auth_interceptor.dart +++ b/packages/stream_chat/lib/src/core/http/interceptor/auth_interceptor.dart @@ -60,30 +60,7 @@ class AuthInterceptor extends QueuedInterceptor { await _tokenManager.loadToken(refresh: true); try { final options = err.requestOptions; - final response = await _client.request( - options.path, - cancelToken: options.cancelToken, - data: options.data, - onReceiveProgress: options.onReceiveProgress, - onSendProgress: options.onSendProgress, - queryParameters: options.queryParameters, - options: Options( - method: options.method, - sendTimeout: options.sendTimeout, - receiveTimeout: options.receiveTimeout, - extra: options.extra, - headers: options.headers, - responseType: options.responseType, - contentType: options.contentType, - validateStatus: options.validateStatus, - receiveDataWhenStatusError: options.receiveDataWhenStatusError, - followRedirects: options.followRedirects, - maxRedirects: options.maxRedirects, - requestEncoder: options.requestEncoder, - responseDecoder: options.responseDecoder, - listFormat: options.listFormat, - ), - ); + final response = await _client.fetch(options); return handler.resolve(response); } on DioError catch (error) { return handler.next(error); diff --git a/packages/stream_chat/lib/src/core/http/stream_http_client.dart b/packages/stream_chat/lib/src/core/http/stream_http_client.dart index 169492a7..7052ce38 100644 --- a/packages/stream_chat/lib/src/core/http/stream_http_client.dart +++ b/packages/stream_chat/lib/src/core/http/stream_http_client.dart @@ -266,4 +266,17 @@ class StreamHttpClient { throw _parseError(error); } } + + /// Handy method to make http requests from [RequestOptions] + /// with error parsing. + Future> fetch( + RequestOptions requestOptions, + ) async { + try { + final response = await httpClient.fetch(requestOptions); + return response; + } on DioError catch (error) { + throw _parseError(error); + } + } } From 8b13bcebba5ec43e9ae8b82e5bded22269e65289 Mon Sep 17 00:00:00 2001 From: Sahil Kumar Date: Fri, 20 May 2022 17:49:00 +0530 Subject: [PATCH 03/45] chore(llc): fix lint Signed-off-by: xsahil03x --- packages/stream_chat/test/src/client/client_test.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/stream_chat/test/src/client/client_test.dart b/packages/stream_chat/test/src/client/client_test.dart index 65c0fe26..5317e6c3 100644 --- a/packages/stream_chat/test/src/client/client_test.dart +++ b/packages/stream_chat/test/src/client/client_test.dart @@ -2513,7 +2513,7 @@ void main() { }); test( - 'setting the `currentUser` should also compute and update the unreadCounts', + '''setting the `currentUser` should also compute and update the unreadCounts''', () { final state = client.state; final initialUser = OwnUser.fromUser(user); From 389bd8f295111bf82a90dcf97fadaae2b582ff8b Mon Sep 17 00:00:00 2001 From: Sahil Kumar Date: Fri, 20 May 2022 17:54:26 +0530 Subject: [PATCH 04/45] test(llc): fix tests Signed-off-by: xsahil03x --- .../interceptor/auth_interceptor_test.dart | 40 ++----------------- 1 file changed, 4 insertions(+), 36 deletions(-) diff --git a/packages/stream_chat/test/src/core/http/interceptor/auth_interceptor_test.dart b/packages/stream_chat/test/src/core/http/interceptor/auth_interceptor_test.dart index 44b05141..7bd81ff0 100644 --- a/packages/stream_chat/test/src/core/http/interceptor/auth_interceptor_test.dart +++ b/packages/stream_chat/test/src/core/http/interceptor/auth_interceptor_test.dart @@ -97,15 +97,7 @@ void main() { when(() => tokenManager.loadToken(refresh: true)) .thenAnswer((_) async => token); - when(() => client.request( - path, - data: options.data, - onReceiveProgress: options.onReceiveProgress, - onSendProgress: options.onSendProgress, - queryParameters: options.queryParameters, - cancelToken: options.cancelToken, - options: any(named: 'options'), - )).thenAnswer((_) async => Response( + when(() => client.fetch(options)).thenAnswer((_) async => Response( requestOptions: options, statusCode: 200, )); @@ -126,15 +118,7 @@ void main() { verify(() => tokenManager.loadToken(refresh: true)).called(1); verifyNoMoreInteractions(tokenManager); - verify(() => client.request( - path, - data: options.data, - onReceiveProgress: options.onReceiveProgress, - onSendProgress: options.onSendProgress, - queryParameters: options.queryParameters, - cancelToken: options.cancelToken, - options: any(named: 'options'), - )).called(1); + verify(() => client.fetch(options)).called(1); verifyNoMoreInteractions(client); }); @@ -160,15 +144,7 @@ void main() { when(() => tokenManager.loadToken(refresh: true)) .thenAnswer((_) async => token); - when(() => client.request( - path, - data: options.data, - onReceiveProgress: options.onReceiveProgress, - onSendProgress: options.onSendProgress, - queryParameters: options.queryParameters, - cancelToken: options.cancelToken, - options: any(named: 'options'), - )).thenThrow(err); + when(() => client.fetch(options)).thenThrow(err); authInterceptor.onError(err, handler); @@ -185,15 +161,7 @@ void main() { verify(() => tokenManager.loadToken(refresh: true)).called(1); verifyNoMoreInteractions(tokenManager); - verify(() => client.request( - path, - data: options.data, - onReceiveProgress: options.onReceiveProgress, - onSendProgress: options.onSendProgress, - queryParameters: options.queryParameters, - cancelToken: options.cancelToken, - options: any(named: 'options'), - )).called(1); + verify(() => client.fetch(options)).called(1); verifyNoMoreInteractions(client); }, ); From e7763fca910f003b3130cb613c7a645a40788bfb Mon Sep 17 00:00:00 2001 From: Salvatore Giordano Date: Fri, 20 May 2022 15:06:50 +0200 Subject: [PATCH 05/45] chore(repo): add no-response action --- .github/workflows/no-response.yml | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 .github/workflows/no-response.yml diff --git a/.github/workflows/no-response.yml b/.github/workflows/no-response.yml new file mode 100644 index 00000000..21af2831 --- /dev/null +++ b/.github/workflows/no-response.yml @@ -0,0 +1,27 @@ +name: No Response + +# Both `issue_comment` and `scheduled` event types are required for this Action +# to work properly. +on: + issue_comment: + types: [created] + schedule: + # Schedule for five minutes after the hour, every hour + - cron: '5 * * * *' + +jobs: + noResponse: + runs-on: ubuntu-latest + steps: + - uses: lee-dohm/no-response@v0.5.0 + with: + token: ${{ github.token }} + daysUntilClose: 7 + closeComment: > + Without additional information, we are unfortunately not sure how to + resolve this issue. We are therefore reluctantly going to close this + bug for now. Please don't hesitate to comment on the bug if you have + any more information for us; we will reopen it right away! + Thanks for your contribution. + responseRequiredLabel: "waiting for customer response" + \ No newline at end of file From 5b6721a9d76068b824d45fdbbe36e2cdd9f0048f Mon Sep 17 00:00:00 2001 From: Salvatore Giordano Date: Fri, 20 May 2022 15:07:05 +0200 Subject: [PATCH 06/45] chore(repo): remove previous no response config --- .github/no-response.yml | 15 --------------- 1 file changed, 15 deletions(-) delete mode 100644 .github/no-response.yml diff --git a/.github/no-response.yml b/.github/no-response.yml deleted file mode 100644 index e834903c..00000000 --- a/.github/no-response.yml +++ /dev/null @@ -1,15 +0,0 @@ -# Configuration for probot-no-response - https://github.com/probot/no-response - -# Number of days of inactivity before an issue is closed for lack of response. -daysUntilClose: 7 - -# Label requiring a response. -responseRequiredLabel: "waiting for customer response" - -# Comment to post when closing an Issue for lack of response. Set to `false` to disable -closeComment: > - Without additional information, we are unfortunately not sure how to - resolve this issue. We are therefore reluctantly going to close this - bug for now. Please don't hesitate to comment on the bug if you have - any more information for us; we will reopen it right away! - Thanks for your contribution. \ No newline at end of file From 76fe3f79d2443b3527bd8bacaceeeca0d2cc06bf Mon Sep 17 00:00:00 2001 From: Salvatore Giordano Date: Fri, 20 May 2022 15:22:47 +0200 Subject: [PATCH 07/45] chore(ui): fix doc --- packages/stream_chat_flutter/lib/src/message_input.dart | 2 +- .../lib/src/v4/message_input/stream_message_input.dart | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/stream_chat_flutter/lib/src/message_input.dart b/packages/stream_chat_flutter/lib/src/message_input.dart index 921a54dd..4ade7890 100644 --- a/packages/stream_chat_flutter/lib/src/message_input.dart +++ b/packages/stream_chat_flutter/lib/src/message_input.dart @@ -66,7 +66,7 @@ typedef UserMentionTileBuilder = Widget Function( /// Widget builder for action button. /// /// [defaultActionButton] is the default [IconButton] configuration, -/// use [defaultActionButton.copyWith] to easily customize it. +/// use .copyWith to easily customize it. typedef ActionButtonBuilder = Widget Function( BuildContext context, IconButton defaultActionButton, diff --git a/packages/stream_chat_flutter/lib/src/v4/message_input/stream_message_input.dart b/packages/stream_chat_flutter/lib/src/v4/message_input/stream_message_input.dart index ef0ddffb..3407c3fe 100644 --- a/packages/stream_chat_flutter/lib/src/v4/message_input/stream_message_input.dart +++ b/packages/stream_chat_flutter/lib/src/v4/message_input/stream_message_input.dart @@ -70,7 +70,7 @@ typedef UserMentionTileBuilder = Widget Function( /// Widget builder for action button. /// /// [defaultActionButton] is the default [IconButton] configuration, -/// use [defaultActionButton.copyWith] to easily customize it. +/// use .copyWith to easily customize it. typedef ActionButtonBuilder = Widget Function( BuildContext context, IconButton defaultActionButton, From 525380bddd5805e30a4d023e3b89228d370ab2b6 Mon Sep 17 00:00:00 2001 From: Salvatore Giordano Date: Tue, 31 May 2022 10:45:03 +0200 Subject: [PATCH 08/45] fix(ui): fix file download --- .../app/src/main/kotlin/com/example/example/Application.kt | 4 ++-- packages/stream_chat_flutter/lib/src/utils.dart | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/packages/stream_chat_flutter/example/android/app/src/main/kotlin/com/example/example/Application.kt b/packages/stream_chat_flutter/example/android/app/src/main/kotlin/com/example/example/Application.kt index f1bd7610..97b327c1 100644 --- a/packages/stream_chat_flutter/example/android/app/src/main/kotlin/com/example/example/Application.kt +++ b/packages/stream_chat_flutter/example/android/app/src/main/kotlin/com/example/example/Application.kt @@ -10,8 +10,8 @@ class Application : FlutterApplication(), PluginRegistrantCallback { super.onCreate() } - override fun registerWith(registry: PluginRegistry?) { - PathProviderPlugin.registerWith(registry?.registrarFor( + override fun registerWith(registry: PluginRegistry) { + PathProviderPlugin.registerWith(registry.registrarFor( "io.flutter.plugins.pathprovider.PathProviderPlugin")) } } \ No newline at end of file diff --git a/packages/stream_chat_flutter/lib/src/utils.dart b/packages/stream_chat_flutter/lib/src/utils.dart index 86357803..04800e98 100644 --- a/packages/stream_chat_flutter/lib/src/utils.dart +++ b/packages/stream_chat_flutter/lib/src/utils.dart @@ -9,7 +9,10 @@ import 'package:url_launcher/url_launcher.dart'; /// Launch URL Future launchURL(BuildContext context, String url) async { try { - await launchUrl(Uri.parse(url).withScheme); + await launchUrl( + Uri.parse(url).withScheme, + mode: LaunchMode.externalApplication, + ); } catch (e) { ScaffoldMessenger.of(context).showSnackBar( SnackBar(content: Text(context.translations.launchUrlError)), From a3285c340e0aef7d7abdd10ab319efb077c934cf Mon Sep 17 00:00:00 2001 From: Salvatore Giordano Date: Tue, 31 May 2022 10:46:13 +0200 Subject: [PATCH 09/45] chore(ui): update changelog --- 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 3f9509fb..8aefa739 100644 --- a/packages/stream_chat_flutter/CHANGELOG.md +++ b/packages/stream_chat_flutter/CHANGELOG.md @@ -1,3 +1,9 @@ +## Upcoming + +🐞 Fixed + +-[[#1180]](https://github.com/GetStream/stream-chat-flutter/issues/1180) Fix file download + ## 4.2.0 🐞 Fixed From f3b2926492894e0d667be4d4511e96e5825a2443 Mon Sep 17 00:00:00 2001 From: Salvatore Giordano Date: Tue, 31 May 2022 15:09:12 +0200 Subject: [PATCH 10/45] make workflow run on pr update --- .github/workflows/stream_flutter_workflow.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/stream_flutter_workflow.yml b/.github/workflows/stream_flutter_workflow.yml index e9138e36..8b2d2481 100644 --- a/.github/workflows/stream_flutter_workflow.yml +++ b/.github/workflows/stream_flutter_workflow.yml @@ -7,6 +7,7 @@ env: on: pull_request: + types: [opened, synchronize, reopened, ready_for_review, converted_to_draft] push: branches: - master From a16cb7afab55f68cda900940eb21d57398ef893b Mon Sep 17 00:00:00 2001 From: Salvatore Giordano Date: Wed, 8 Jun 2022 15:06:13 +0200 Subject: [PATCH 11/45] fix(ui): Fix commands resetting the `StreamMessageInputController.value --- .../lib/src/v4/message_input/stream_message_input.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/stream_chat_flutter/lib/src/v4/message_input/stream_message_input.dart b/packages/stream_chat_flutter/lib/src/v4/message_input/stream_message_input.dart index 3407c3fe..770f4744 100644 --- a/packages/stream_chat_flutter/lib/src/v4/message_input/stream_message_input.dart +++ b/packages/stream_chat_flutter/lib/src/v4/message_input/stream_message_input.dart @@ -1221,7 +1221,7 @@ class StreamMessageInputState extends State void _setCommand(Command c) { _effectiveController - ..clear() + ..reset() ..command = c; setState(() { _showCommandsOverlay = false; From 55540e8ef3ebb4d516b43a40debee3911ed45336 Mon Sep 17 00:00:00 2001 From: Salvatore Giordano Date: Wed, 8 Jun 2022 15:07:40 +0200 Subject: [PATCH 12/45] chore(ui): update changelog --- packages/stream_chat_flutter/CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/stream_chat_flutter/CHANGELOG.md b/packages/stream_chat_flutter/CHANGELOG.md index 8aefa739..cb312941 100644 --- a/packages/stream_chat_flutter/CHANGELOG.md +++ b/packages/stream_chat_flutter/CHANGELOG.md @@ -3,6 +3,7 @@ 🐞 Fixed -[[#1180]](https://github.com/GetStream/stream-chat-flutter/issues/1180) Fix file download +- Fix commands resetting the `StreamMessageInputController.value` ## 4.2.0 From a131f3fdd00317b7fff4e7d428bf99a134afb4f3 Mon Sep 17 00:00:00 2001 From: Florian Daniel Date: Wed, 8 Jun 2022 15:56:42 +0200 Subject: [PATCH 13/45] Improve german translations MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit For flagged messages the german word "markieren" only means "marked", while "melden" means "report", which is more suitable in this context. For viewLibrary, it is better to say "öffnen" which means "open" -> as this is what happens when the user clicks this button in the app. --- .../lib/src/stream_chat_localizations_de.dart | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) 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 aa65e81d..71af15fa 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 @@ -163,7 +163,7 @@ class StreamChatLocalizationsDe extends GlobalStreamChatLocalizations { String get allowGalleryAccessMessage => 'Zugang zu Ihrer Galerie gewähren'; @override - String get flagMessageLabel => 'Markierte Nachricht'; + String get flagMessageLabel => 'Nachricht melden'; @override String get flagMessageQuestion => @@ -171,13 +171,13 @@ class StreamChatLocalizationsDe extends GlobalStreamChatLocalizations { '\nModerator für weitere Untersuchungen senden?'; @override - String get flagLabel => 'MARKIEREN'; + String get flagLabel => 'MELDEN'; @override String get cancelLabel => 'ABBRECHEN'; @override - String get flagMessageSuccessfulLabel => 'Nachricht markiert'; + String get flagMessageSuccessfulLabel => 'Nachricht gemeldet'; @override String get flagMessageSuccessfulText => @@ -283,7 +283,7 @@ class StreamChatLocalizationsDe extends GlobalStreamChatLocalizations { String get streamChatLabel => 'Stream Chat'; @override - String get searchingForNetworkText => 'Searching for Network'; + String get searchingForNetworkText => 'Netzwerk wird gesucht'; @override String get offlineLabel => 'Offline...'; @@ -380,5 +380,5 @@ class StreamChatLocalizationsDe extends GlobalStreamChatLocalizations { 'Sie sind nicht berechtigt Nachrichten zu senden'; @override - String get viewLibrary => 'Bibliothek ansehen'; + String get viewLibrary => 'Bibliothek öffnen'; } From c6eb075cee5e08b8b75ae7ad26f4481efe09c584 Mon Sep 17 00:00:00 2001 From: Sahil Kumar Date: Thu, 9 Jun 2022 14:10:01 +0530 Subject: [PATCH 14/45] feat(persistence): save channel.ownCapabilities in db Signed-off-by: xsahil03x --- .../lib/src/db/drift_chat_database.dart | 2 +- .../lib/src/db/drift_chat_database.g.dart | 83 ++++++++++++++++--- .../lib/src/entity/channels.dart | 6 +- .../lib/src/mapper/channel_mapper.dart | 2 + .../test/src/mapper/channel_mapper_test.dart | 5 ++ 5 files changed, 83 insertions(+), 15 deletions(-) diff --git a/packages/stream_chat_persistence/lib/src/db/drift_chat_database.dart b/packages/stream_chat_persistence/lib/src/db/drift_chat_database.dart index 1de78245..f87aecc4 100644 --- a/packages/stream_chat_persistence/lib/src/db/drift_chat_database.dart +++ b/packages/stream_chat_persistence/lib/src/db/drift_chat_database.dart @@ -56,7 +56,7 @@ class DriftChatDatabase extends _$DriftChatDatabase { // you should bump this number whenever you change or add a table definition. @override - int get schemaVersion => 8; + int get schemaVersion => 9; @override MigrationStrategy get migration => MigrationStrategy( diff --git a/packages/stream_chat_persistence/lib/src/db/drift_chat_database.g.dart b/packages/stream_chat_persistence/lib/src/db/drift_chat_database.g.dart index 9c44cb2f..af0dc874 100644 --- a/packages/stream_chat_persistence/lib/src/db/drift_chat_database.g.dart +++ b/packages/stream_chat_persistence/lib/src/db/drift_chat_database.g.dart @@ -6,7 +6,7 @@ part of 'drift_chat_database.dart'; // MoorGenerator // ************************************************************************** -// ignore_for_file: unnecessary_brace_in_string_interps, unnecessary_this +// ignore_for_file: type=lint class ChannelEntity extends DataClass implements Insertable { /// The id of this channel final String id; @@ -17,6 +17,9 @@ class ChannelEntity extends DataClass implements Insertable { /// The cid of this channel final String cid; + /// List of user permissions on this channel + final List? ownCapabilities; + /// The channel configuration data final Map config; @@ -47,6 +50,7 @@ class ChannelEntity extends DataClass implements Insertable { {required this.id, required this.type, required this.cid, + this.ownCapabilities, required this.config, required this.frozen, this.lastMessageAt, @@ -65,7 +69,9 @@ class ChannelEntity extends DataClass implements Insertable { .mapFromDatabaseResponse(data['${effectivePrefix}type'])!, cid: const StringType() .mapFromDatabaseResponse(data['${effectivePrefix}cid'])!, - config: $ChannelsTable.$converter0.mapToDart(const StringType() + ownCapabilities: $ChannelsTable.$converter0.mapToDart(const StringType() + .mapFromDatabaseResponse(data['${effectivePrefix}own_capabilities'])), + config: $ChannelsTable.$converter1.mapToDart(const StringType() .mapFromDatabaseResponse(data['${effectivePrefix}config']))!, frozen: const BoolType() .mapFromDatabaseResponse(data['${effectivePrefix}frozen'])!, @@ -81,7 +87,7 @@ class ChannelEntity extends DataClass implements Insertable { .mapFromDatabaseResponse(data['${effectivePrefix}member_count'])!, createdById: const StringType() .mapFromDatabaseResponse(data['${effectivePrefix}created_by_id']), - extraData: $ChannelsTable.$converter1.mapToDart(const StringType() + extraData: $ChannelsTable.$converter2.mapToDart(const StringType() .mapFromDatabaseResponse(data['${effectivePrefix}extra_data'])), ); } @@ -91,8 +97,13 @@ class ChannelEntity extends DataClass implements Insertable { map['id'] = Variable(id); map['type'] = Variable(type); map['cid'] = Variable(cid); - { + if (!nullToAbsent || ownCapabilities != null) { final converter = $ChannelsTable.$converter0; + map['own_capabilities'] = + Variable(converter.mapToSql(ownCapabilities)); + } + { + final converter = $ChannelsTable.$converter1; map['config'] = Variable(converter.mapToSql(config)!); } map['frozen'] = Variable(frozen); @@ -109,7 +120,7 @@ class ChannelEntity extends DataClass implements Insertable { map['created_by_id'] = Variable(createdById); } if (!nullToAbsent || extraData != null) { - final converter = $ChannelsTable.$converter1; + final converter = $ChannelsTable.$converter2; map['extra_data'] = Variable(converter.mapToSql(extraData)); } return map; @@ -122,6 +133,8 @@ class ChannelEntity extends DataClass implements Insertable { id: serializer.fromJson(json['id']), type: serializer.fromJson(json['type']), cid: serializer.fromJson(json['cid']), + ownCapabilities: + serializer.fromJson?>(json['ownCapabilities']), config: serializer.fromJson>(json['config']), frozen: serializer.fromJson(json['frozen']), lastMessageAt: serializer.fromJson(json['lastMessageAt']), @@ -140,6 +153,7 @@ class ChannelEntity extends DataClass implements Insertable { 'id': serializer.toJson(id), 'type': serializer.toJson(type), 'cid': serializer.toJson(cid), + 'ownCapabilities': serializer.toJson?>(ownCapabilities), 'config': serializer.toJson>(config), 'frozen': serializer.toJson(frozen), 'lastMessageAt': serializer.toJson(lastMessageAt), @@ -156,6 +170,7 @@ class ChannelEntity extends DataClass implements Insertable { {String? id, String? type, String? cid, + Value?> ownCapabilities = const Value.absent(), Map? config, bool? frozen, Value lastMessageAt = const Value.absent(), @@ -169,6 +184,9 @@ class ChannelEntity extends DataClass implements Insertable { id: id ?? this.id, type: type ?? this.type, cid: cid ?? this.cid, + ownCapabilities: ownCapabilities.present + ? ownCapabilities.value + : this.ownCapabilities, config: config ?? this.config, frozen: frozen ?? this.frozen, lastMessageAt: @@ -186,6 +204,7 @@ class ChannelEntity extends DataClass implements Insertable { ..write('id: $id, ') ..write('type: $type, ') ..write('cid: $cid, ') + ..write('ownCapabilities: $ownCapabilities, ') ..write('config: $config, ') ..write('frozen: $frozen, ') ..write('lastMessageAt: $lastMessageAt, ') @@ -200,8 +219,20 @@ class ChannelEntity extends DataClass implements Insertable { } @override - int get hashCode => Object.hash(id, type, cid, config, frozen, lastMessageAt, - createdAt, updatedAt, deletedAt, memberCount, createdById, extraData); + int get hashCode => Object.hash( + id, + type, + cid, + ownCapabilities, + config, + frozen, + lastMessageAt, + createdAt, + updatedAt, + deletedAt, + memberCount, + createdById, + extraData); @override bool operator ==(Object other) => identical(this, other) || @@ -209,6 +240,7 @@ class ChannelEntity extends DataClass implements Insertable { other.id == this.id && other.type == this.type && other.cid == this.cid && + other.ownCapabilities == this.ownCapabilities && other.config == this.config && other.frozen == this.frozen && other.lastMessageAt == this.lastMessageAt && @@ -224,6 +256,7 @@ class ChannelsCompanion extends UpdateCompanion { final Value id; final Value type; final Value cid; + final Value?> ownCapabilities; final Value> config; final Value frozen; final Value lastMessageAt; @@ -237,6 +270,7 @@ class ChannelsCompanion extends UpdateCompanion { this.id = const Value.absent(), this.type = const Value.absent(), this.cid = const Value.absent(), + this.ownCapabilities = const Value.absent(), this.config = const Value.absent(), this.frozen = const Value.absent(), this.lastMessageAt = const Value.absent(), @@ -251,6 +285,7 @@ class ChannelsCompanion extends UpdateCompanion { required String id, required String type, required String cid, + this.ownCapabilities = const Value.absent(), required Map config, this.frozen = const Value.absent(), this.lastMessageAt = const Value.absent(), @@ -268,6 +303,7 @@ class ChannelsCompanion extends UpdateCompanion { Expression? id, Expression? type, Expression? cid, + Expression?>? ownCapabilities, Expression>? config, Expression? frozen, Expression? lastMessageAt, @@ -282,6 +318,7 @@ class ChannelsCompanion extends UpdateCompanion { if (id != null) 'id': id, if (type != null) 'type': type, if (cid != null) 'cid': cid, + if (ownCapabilities != null) 'own_capabilities': ownCapabilities, if (config != null) 'config': config, if (frozen != null) 'frozen': frozen, if (lastMessageAt != null) 'last_message_at': lastMessageAt, @@ -298,6 +335,7 @@ class ChannelsCompanion extends UpdateCompanion { {Value? id, Value? type, Value? cid, + Value?>? ownCapabilities, Value>? config, Value? frozen, Value? lastMessageAt, @@ -311,6 +349,7 @@ class ChannelsCompanion extends UpdateCompanion { id: id ?? this.id, type: type ?? this.type, cid: cid ?? this.cid, + ownCapabilities: ownCapabilities ?? this.ownCapabilities, config: config ?? this.config, frozen: frozen ?? this.frozen, lastMessageAt: lastMessageAt ?? this.lastMessageAt, @@ -335,8 +374,13 @@ class ChannelsCompanion extends UpdateCompanion { if (cid.present) { map['cid'] = Variable(cid.value); } - if (config.present) { + if (ownCapabilities.present) { final converter = $ChannelsTable.$converter0; + map['own_capabilities'] = + Variable(converter.mapToSql(ownCapabilities.value)); + } + if (config.present) { + final converter = $ChannelsTable.$converter1; map['config'] = Variable(converter.mapToSql(config.value)!); } if (frozen.present) { @@ -361,7 +405,7 @@ class ChannelsCompanion extends UpdateCompanion { map['created_by_id'] = Variable(createdById.value); } if (extraData.present) { - final converter = $ChannelsTable.$converter1; + final converter = $ChannelsTable.$converter2; map['extra_data'] = Variable(converter.mapToSql(extraData.value)); } @@ -374,6 +418,7 @@ class ChannelsCompanion extends UpdateCompanion { ..write('id: $id, ') ..write('type: $type, ') ..write('cid: $cid, ') + ..write('ownCapabilities: $ownCapabilities, ') ..write('config: $config, ') ..write('frozen: $frozen, ') ..write('lastMessageAt: $lastMessageAt, ') @@ -409,12 +454,20 @@ class $ChannelsTable extends Channels late final GeneratedColumn cid = GeneratedColumn( 'cid', aliasedName, false, type: const StringType(), requiredDuringInsert: true); + final VerificationMeta _ownCapabilitiesMeta = + const VerificationMeta('ownCapabilities'); + @override + late final GeneratedColumnWithTypeConverter, String?> + ownCapabilities = GeneratedColumn( + 'own_capabilities', aliasedName, true, + type: const StringType(), requiredDuringInsert: false) + .withConverter>($ChannelsTable.$converter0); final VerificationMeta _configMeta = const VerificationMeta('config'); @override late final GeneratedColumnWithTypeConverter, String?> config = GeneratedColumn('config', aliasedName, false, type: const StringType(), requiredDuringInsert: true) - .withConverter>($ChannelsTable.$converter0); + .withConverter>($ChannelsTable.$converter1); final VerificationMeta _frozenMeta = const VerificationMeta('frozen'); @override late final GeneratedColumn frozen = GeneratedColumn( @@ -467,12 +520,13 @@ class $ChannelsTable extends Channels late final GeneratedColumnWithTypeConverter, String?> extraData = GeneratedColumn('extra_data', aliasedName, true, type: const StringType(), requiredDuringInsert: false) - .withConverter>($ChannelsTable.$converter1); + .withConverter>($ChannelsTable.$converter2); @override List get $columns => [ id, type, cid, + ownCapabilities, config, frozen, lastMessageAt, @@ -509,6 +563,7 @@ class $ChannelsTable extends Channels } else if (isInserting) { context.missing(_cidMeta); } + context.handle(_ownCapabilitiesMeta, const VerificationResult.success()); context.handle(_configMeta, const VerificationResult.success()); if (data.containsKey('frozen')) { context.handle(_frozenMeta, @@ -561,9 +616,11 @@ class $ChannelsTable extends Channels return $ChannelsTable(attachedDatabase, alias); } - static TypeConverter, String> $converter0 = + static TypeConverter, String> $converter0 = + ListConverter(); + static TypeConverter, String> $converter1 = MapConverter(); - static TypeConverter, String> $converter1 = + static TypeConverter, String> $converter2 = MapConverter(); } diff --git a/packages/stream_chat_persistence/lib/src/entity/channels.dart b/packages/stream_chat_persistence/lib/src/entity/channels.dart index a685db68..84b16fe6 100644 --- a/packages/stream_chat_persistence/lib/src/entity/channels.dart +++ b/packages/stream_chat_persistence/lib/src/entity/channels.dart @@ -1,6 +1,6 @@ // coverage:ignore-file import 'package:drift/drift.dart'; -import 'package:stream_chat_persistence/src/converter/map_converter.dart'; +import 'package:stream_chat_persistence/src/converter/converter.dart'; /// Represents a [Channels] table in [MoorChatDatabase]. @DataClassName('ChannelEntity') @@ -14,6 +14,10 @@ class Channels extends Table { /// The cid of this channel TextColumn get cid => text()(); + /// List of user permissions on this channel + TextColumn get ownCapabilities => + text().nullable().map(ListConverter())(); + /// The channel configuration data TextColumn get config => text().map(MapConverter())(); diff --git a/packages/stream_chat_persistence/lib/src/mapper/channel_mapper.dart b/packages/stream_chat_persistence/lib/src/mapper/channel_mapper.dart index ef4111f6..18865d82 100644 --- a/packages/stream_chat_persistence/lib/src/mapper/channel_mapper.dart +++ b/packages/stream_chat_persistence/lib/src/mapper/channel_mapper.dart @@ -8,6 +8,7 @@ extension ChannelEntityX on ChannelEntity { final config = ChannelConfig.fromJson(this.config); return ChannelModel( id: id, + ownCapabilities: ownCapabilities, config: config, type: type, frozen: frozen, @@ -46,6 +47,7 @@ extension ChannelModelX on ChannelModel { id: id, type: type, cid: cid, + ownCapabilities: ownCapabilities, config: config.toJson(), frozen: frozen, lastMessageAt: lastMessageAt, diff --git a/packages/stream_chat_persistence/test/src/mapper/channel_mapper_test.dart b/packages/stream_chat_persistence/test/src/mapper/channel_mapper_test.dart index d89687d3..b8bcc2ed 100644 --- a/packages/stream_chat_persistence/test/src/mapper/channel_mapper_test.dart +++ b/packages/stream_chat_persistence/test/src/mapper/channel_mapper_test.dart @@ -14,6 +14,7 @@ void main() { id: 'testId', type: 'testType', cid: 'testCid', + ownCapabilities: ['testCapability'], config: {'max_message_length': 33}, frozen: math.Random().nextBool(), lastMessageAt: DateTime.now(), @@ -29,6 +30,7 @@ void main() { final channelModel = entity.toChannelModel(createdBy: user); expect(channelModel, isA()); expect(channelModel.id, entity.id); + expect(channelModel.ownCapabilities, entity.ownCapabilities); expect(channelModel.config.toJson()['max_message_length'], 33); expect(channelModel.frozen, entity.frozen); expect(channelModel.createdAt, isSameDateAs(entity.createdAt)); @@ -68,6 +70,7 @@ void main() { final channelModel = channelState.channel!; expect(channelModel.id, entity.id); + expect(channelModel.ownCapabilities, entity.ownCapabilities); expect(channelModel.config.toJson()['max_message_length'], 33); expect(channelModel.frozen, entity.frozen); expect(channelModel.createdAt, isSameDateAs(entity.createdAt)); @@ -87,6 +90,7 @@ void main() { id: 'testId', type: 'testType', cid: 'testCid', + ownCapabilities: ['testCapability'], config: ChannelConfig(maxMessageLength: 33), frozen: math.Random().nextBool(), lastMessageAt: DateTime.now(), @@ -101,6 +105,7 @@ void main() { final channelEntity = model.toEntity(); expect(channelEntity, isA()); expect(channelEntity.id, model.id); + expect(channelEntity.ownCapabilities, model.ownCapabilities); expect( channelEntity.config['max_message_length'], model.config.maxMessageLength, From 621daba5e39a5f6d09d5f6b9a134c844292d0b5a Mon Sep 17 00:00:00 2001 From: Sahil Kumar Date: Thu, 9 Jun 2022 14:13:44 +0530 Subject: [PATCH 15/45] chore(persistence): update CHANGELOG.md Signed-off-by: xsahil03x --- packages/stream_chat_persistence/CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/stream_chat_persistence/CHANGELOG.md b/packages/stream_chat_persistence/CHANGELOG.md index fc409305..b3d0e686 100644 --- a/packages/stream_chat_persistence/CHANGELOG.md +++ b/packages/stream_chat_persistence/CHANGELOG.md @@ -1,3 +1,7 @@ +## Upcoming + +- Added support for `Channel.ownCapabilities` + ## 4.1.0 🔄 Changed From 5104e9dbb612416bebc9a0fee4eb7aeb2a6e3c14 Mon Sep 17 00:00:00 2001 From: Ayush Shekhar Date: Fri, 10 Jun 2022 05:02:32 +0530 Subject: [PATCH 16/45] Updated photo_view to 0.14.0 --- packages/stream_chat_flutter/CHANGELOG.md | 2 ++ packages/stream_chat_flutter/pubspec.yaml | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/stream_chat_flutter/CHANGELOG.md b/packages/stream_chat_flutter/CHANGELOG.md index cb312941..0cce92ae 100644 --- a/packages/stream_chat_flutter/CHANGELOG.md +++ b/packages/stream_chat_flutter/CHANGELOG.md @@ -1,5 +1,7 @@ ## Upcoming +- Updated `photo_view` dependency to [`0.14.0`](https://pub.dev/packages/photo_view/changelog). + 🐞 Fixed -[[#1180]](https://github.com/GetStream/stream-chat-flutter/issues/1180) Fix file download diff --git a/packages/stream_chat_flutter/pubspec.yaml b/packages/stream_chat_flutter/pubspec.yaml index 573d08df..774ae477 100644 --- a/packages/stream_chat_flutter/pubspec.yaml +++ b/packages/stream_chat_flutter/pubspec.yaml @@ -32,7 +32,7 @@ dependencies: meta: ^1.3.0 path_provider: ^2.0.1 photo_manager: ^2.0.1 - photo_view: ^0.13.0 + photo_view: ^0.14.0 rxdart: ^0.27.0 share_plus: ^4.0.1 shimmer: ^2.0.0 From a8a09a3ae229503fea293d8184c42000c0ffd8e2 Mon Sep 17 00:00:00 2001 From: Sahil Kumar Date: Fri, 10 Jun 2022 17:34:31 +0530 Subject: [PATCH 17/45] fix(llc): Persistence not removing hidden channels. Signed-off-by: xsahil03x --- packages/stream_chat/CHANGELOG.md | 164 +++++++++++------- .../stream_chat/lib/src/client/client.dart | 13 +- 2 files changed, 104 insertions(+), 73 deletions(-) diff --git a/packages/stream_chat/CHANGELOG.md b/packages/stream_chat/CHANGELOG.md index df797b1d..7700235f 100644 --- a/packages/stream_chat/CHANGELOG.md +++ b/packages/stream_chat/CHANGELOG.md @@ -1,3 +1,10 @@ +## Upcoming + +🐞 Fixed + +- [[#1135]](https://github.com/GetStream/stream-chat-flutter/issues/1135) Persistence was not + removing the hidden channels. + ## 4.2.0 ✅ Added @@ -13,18 +20,20 @@ 🔄 Changed -- Deprecated `PaginationParams.before` and `PaginationParams.after`. Use `PaginationParams.limit` instead. +- Deprecated `PaginationParams.before` and `PaginationParams.after`. Use `PaginationParams.limit` + instead. 🐞 Fixed -- [[#1147]](https://github.com/GetStream/stream-chat-flutter/issues/1147) `channel.unset` not updating the extra data - stream. +- [[#1147]](https://github.com/GetStream/stream-chat-flutter/issues/1147) `channel.unset` not + updating the extra data stream. ## 4.1.0 ✅ Added -- Added support for extra data in attachment file uploader. Thanks, [@rlee1990](https://github.com/rlee1990). +- Added support for extra data in attachment file uploader. + Thanks, [@rlee1990](https://github.com/rlee1990). 🔄 Changed @@ -49,14 +58,14 @@ the [V4 Migration Guide](https://getstream.io/chat/docs/sdk/flutter/guides/migra 🐞 Fixed - Fixed reactions not working for threads in offline mode. -- [[#1046]](https://github.com/GetStream/stream-chat-flutter/issues/1046) After `/mute` command on reload cannot access - any channel. -- [[#1047]](https://github.com/GetStream/stream-chat-flutter/issues/1047) `own_capabilities` extraData missing after - channel update. +- [[#1046]](https://github.com/GetStream/stream-chat-flutter/issues/1046) After `/mute` command on + reload cannot access any channel. +- [[#1047]](https://github.com/GetStream/stream-chat-flutter/issues/1047) `own_capabilities` + extraData missing after channel update. - [[#1054]](https://github.com/GetStream/stream-chat-flutter/issues/1054) Fix `Unsupported operation: Cannot remove from an unmodifiable list`. -- [[#1033]](https://github.com/GetStream/stream-chat-flutter/issues/1033) Hard delete from dashboard does not delete - message from client. +- [[#1033]](https://github.com/GetStream/stream-chat-flutter/issues/1033) Hard delete from dashboard + does not delete message from client. - Send only `user_id` while reconnecting. ✅ Added @@ -78,21 +87,22 @@ the [V4 Migration Guide](https://getstream.io/chat/docs/sdk/flutter/guides/migra 🐞 Fixed -- [[#1081]](https://github.com/GetStream/stream-chat-flutter/issues/1081) Fixed a bug with user reconnection. +- [[#1081]](https://github.com/GetStream/stream-chat-flutter/issues/1081) Fixed a bug with user + reconnection. ## 3.6.0 🐞 Fixed - Fixed reactions not working for threads in offline mode. -- [[#1046]](https://github.com/GetStream/stream-chat-flutter/issues/1046) After `/mute` command on reload cannot access - any channel. -- [[#1047]](https://github.com/GetStream/stream-chat-flutter/issues/1047) `own_capabilities` extraData missing after - channel update. +- [[#1046]](https://github.com/GetStream/stream-chat-flutter/issues/1046) After `/mute` command on + reload cannot access any channel. +- [[#1047]](https://github.com/GetStream/stream-chat-flutter/issues/1047) `own_capabilities` + extraData missing after channel update. - [[#1054]](https://github.com/GetStream/stream-chat-flutter/issues/1054) Fix `Unsupported operation: Cannot remove from an unmodifiable list`. -- [[#1033]](https://github.com/GetStream/stream-chat-flutter/issues/1033) Hard delete from dashboard does not delete - message from client. +- [[#1033]](https://github.com/GetStream/stream-chat-flutter/issues/1033) Hard delete from dashboard + does not delete message from client. - Send only `user_id` while reconnecting. ✅ Added @@ -116,24 +126,26 @@ the [V4 Migration Guide](https://getstream.io/chat/docs/sdk/flutter/guides/migra 🐞 Fixed -- [[#890]](https://github.com/GetStream/stream-chat-flutter/pull/890) Fixed Reactions not updating on thread messages. - Thanks [bstolinski](https://github.com/bstolinski). -- [[#897]](https://github.com/GetStream/stream-chat-flutter/issues/897) Fixed error type mis-match in `AuthInterceptor`. -- [[#891]](https://github.com/GetStream/stream-chat-flutter/pull/891) Fixed reply counter for parent message not - updating correctly after deleting thread message. +- [[#890]](https://github.com/GetStream/stream-chat-flutter/pull/890) Fixed Reactions not updating + on thread messages. Thanks [bstolinski](https://github.com/bstolinski). +- [[#897]](https://github.com/GetStream/stream-chat-flutter/issues/897) Fixed error type mis-match + in `AuthInterceptor`. +- [[#891]](https://github.com/GetStream/stream-chat-flutter/pull/891) Fixed reply counter for parent + message not updating correctly after deleting thread message. - Fix `channelState.copyWith` with respect to pinnedMessages. ## 3.4.0 🐞 Fixed -- [[#857]](https://github.com/GetStream/stream-chat-flutter/issues/857) Channel now listens for member ban/unban and - updates the channel state with the latest data. -- [[#748]](https://github.com/GetStream/stream-chat-flutter/issues/748) `Message.user` is now also included while saving - users in persistence. -- [[#871]](https://github.com/GetStream/stream-chat-flutter/issues/871) Fixed thread message deletion. -- [[#846]](https://github.com/GetStream/stream-chat-flutter/issues/846) Fixed `message.ownReactions` getting truncated - when receiving a reaction event. +- [[#857]](https://github.com/GetStream/stream-chat-flutter/issues/857) Channel now listens for + member ban/unban and updates the channel state with the latest data. +- [[#748]](https://github.com/GetStream/stream-chat-flutter/issues/748) `Message.user` is now also + included while saving users in persistence. +- [[#871]](https://github.com/GetStream/stream-chat-flutter/issues/871) Fixed thread message + deletion. +- [[#846]](https://github.com/GetStream/stream-chat-flutter/issues/846) Fixed `message.ownReactions` + getting truncated when receiving a reaction event. - Add check for invalid image URLs - Fix `channelState.pinnedMessagesStream` getting reset to `0` after a channel update. - Fixed `unreadCount` after removing user from a channel. @@ -141,7 +153,8 @@ the [V4 Migration Guide](https://getstream.io/chat/docs/sdk/flutter/guides/migra 🔄 Changed - `client.location` is now deprecated in favor of the - new [edge server](https://getstream.io/blog/chat-edge-infrastructure) and will be removed in v4.0.0. + new [edge server](https://getstream.io/blog/chat-edge-infrastructure) and will be removed in + v4.0.0. - `channel.banUser`, `channel.unbanUser` is now deprecated in favor of the new `channel.banMember` and `channel.unbanMember`. These deprecated methods will be removed in v4.0.0. - Added `banExpires` property of type `DateTime` on the `Member`, `OwnUser`, and `User` models. @@ -155,8 +168,8 @@ the [V4 Migration Guide](https://getstream.io/chat/docs/sdk/flutter/guides/migra 🐞 Fixed -- [[#799]](https://github.com/GetStream/stream-chat-flutter/issues/799) Fixed `totalUnreadCount` is not updating when - app is resumed from background mode. +- [[#799]](https://github.com/GetStream/stream-chat-flutter/issues/799) Fixed `totalUnreadCount` is + not updating when app is resumed from background mode. - Fix retry mechanism failing in some cases. ## 3.3.0 @@ -171,7 +184,8 @@ the [V4 Migration Guide](https://getstream.io/chat/docs/sdk/flutter/guides/migra - `closeConnection()` now uses `normalClosure` status when closing websocket. - Fixed local unread count indicator increasing for thread replies. - Fixed user presence indicator not updating correctly. -- `ChannelEvent.membersCount` defaults to 0 avoiding parsing errors due to missing `members_count` field. +- `ChannelEvent.membersCount` defaults to 0 avoiding parsing errors due to missing `members_count` + field. ## 3.2.1 @@ -184,7 +198,8 @@ the [V4 Migration Guide](https://getstream.io/chat/docs/sdk/flutter/guides/migra 🐞 Fixed - `markAllRead()` now updates local channel states. -- [[#744]](https://github.com/GetStream/stream-chat-flutter/issues/744) Fixed unread count not updating correctly +- [[#744]](https://github.com/GetStream/stream-chat-flutter/issues/744) Fixed unread count not + updating correctly ## 3.1.1 @@ -194,7 +209,8 @@ the [V4 Migration Guide](https://getstream.io/chat/docs/sdk/flutter/guides/migra 🐞 Fixed -- [[#710]](https://github.com/GetStream/stream-chat-flutter/issues/710) Fixed JWT requiring using `String` as id. +- [[#710]](https://github.com/GetStream/stream-chat-flutter/issues/710) Fixed JWT requiring + using `String` as id. - Fixed expired CDN attachment links not updating correctly. ## 3.0.0 @@ -214,16 +230,19 @@ the [V4 Migration Guide](https://getstream.io/chat/docs/sdk/flutter/guides/migra - Added `Filter.contains` and `Filter.empty` - Added support for `next`, `previous` value pagination in `client.search` , [read more.](https://getstream.io/chat/docs/other-rest/search/#pagination) -- `Attachment` class now has a `fileSize` and `mimeType` property. Setting a `file` will also set the `file_size` +- `Attachment` class now has a `fileSize` and `mimeType` property. Setting a `file` will also set + the `file_size` , `mime_type` key on `extraData`, so `attachment.fileSize`, `attachment.mimetype` and `attachment.extraData['file_size']` , `attachment.extraData['mime_type]` is same respectively. 🐞 Fixed -- [[#659]](https://github.com/GetStream/stream-chat-flutter/issues/659) Fixed unread count not updating correctly. +- [[#659]](https://github.com/GetStream/stream-chat-flutter/issues/659) Fixed unread count not + updating correctly. - Fix `Filter.empty()` json encoding. -- [[#700]](https://github.com/GetStream/stream-chat-flutter/issues/700) Connecting user without providing `name` +- [[#700]](https://github.com/GetStream/stream-chat-flutter/issues/700) Connecting user without + providing `name` uses `id` instead for setting `user.name`. ## 2.2.1 @@ -241,14 +260,14 @@ the [V4 Migration Guide](https://getstream.io/chat/docs/sdk/flutter/guides/migra ✅ Added -- `User` and `OwnUser` classes now have an `image` property. Setting an image will also set the 'image' key - on `extraData`, so `user.image` and `user.extraData['image']` is the same. -- `User` and `OwnUser` classes now have a `name` property. Setting a name will also set the 'name' key on `extraData`, - so `user.name` and `user.extraData['name']` is the same. -- `Channel` class now has extra `image` getter and setter. As well as an `updateImage` to do a partial update after a - channel has been initialized. -- `Channel` class now has extra `name` getter and setter. As well as an `updateName` to do a partial update after a - channel has been initialized. +- `User` and `OwnUser` classes now have an `image` property. Setting an image will also set the ' + image' key on `extraData`, so `user.image` and `user.extraData['image']` is the same. +- `User` and `OwnUser` classes now have a `name` property. Setting a name will also set the 'name' + key on `extraData`, so `user.name` and `user.extraData['name']` is the same. +- `Channel` class now has extra `image` getter and setter. As well as an `updateImage` to do a + partial update after a channel has been initialized. +- `Channel` class now has extra `name` getter and setter. As well as an `updateName` to do a partial + update after a channel has been initialized. - Added slow mode which allows a cooldown period after a user sends a message. ## 2.1.1 @@ -261,7 +280,8 @@ the [V4 Migration Guide](https://getstream.io/chat/docs/sdk/flutter/guides/migra 🛑️ Removed -- The `MessageTranslation` class has been removed. Use the new `i18n` field in the `Message` class instead. +- The `MessageTranslation` class has been removed. Use the new `i18n` field in the `Message` class + instead. ✅ Added @@ -275,7 +295,8 @@ the [V4 Migration Guide](https://getstream.io/chat/docs/sdk/flutter/guides/migra 🐞 Fixed -- [#563](https://github.com/GetStream/stream-chat-flutter/issues/563): `Channel.stopWatching()` not working +- [#563](https://github.com/GetStream/stream-chat-flutter/issues/563): `Channel.stopWatching()` not + working - [#575](https://github.com/GetStream/stream-chat-flutter/issues/575): Wrong `OwnUser.*` ## 2.0.0 @@ -283,7 +304,8 @@ the [V4 Migration Guide](https://getstream.io/chat/docs/sdk/flutter/guides/migra 🛑️ Breaking Changes from `1.5.3` - migrate this package to null safety -- `ConnectUserWithProvider` now requires `tokenProvider` as a required param. (Removed from the constructor) +- `ConnectUserWithProvider` now requires `tokenProvider` as a required param. (Removed from the + constructor) - `client.disconnect()` is now divided into two different functions - `client.closeConnection()` -> for closing user websocket connection. - `client.disconnectUser()` -> for disconnecting user and resetting client state. @@ -303,15 +325,16 @@ the [V4 Migration Guide](https://getstream.io/chat/docs/sdk/flutter/guides/migra 🐞 Fixed -- [#369](https://github.com/GetStream/stream-chat-flutter/issues/369): Client does not return without internet - connection +- [#369](https://github.com/GetStream/stream-chat-flutter/issues/369): Client does not return + without internet connection - several minor fixes - performance improvements ✅ Added - New `Location` enum is introduced for easily changing the client location/baseUrl. -- New `client.openConnection()` and `client.closeConnection()` is introduced to connect/disconnect user ws connection. +- New `client.openConnection()` and `client.closeConnection()` is introduced to connect/disconnect + user ws connection. - New `client.partialUpdateMessage` and `channel.partialUpdateMessage` methods - `connectWebSocket` parameter in connect user calls to use the client in "connection-less" mode. @@ -329,7 +352,8 @@ the [V4 Migration Guide](https://getstream.io/chat/docs/sdk/flutter/guides/migra 🛑️ Breaking Changes from `2.0.0-nullsafety.6` -- `ConnectUserWithProvider` now requires `tokenProvider` as a required param. (Removed from the constructor) +- `ConnectUserWithProvider` now requires `tokenProvider` as a required param. (Removed from the + constructor) - `client.disconnect()` is now divided into two different functions - `client.closeConnection()` -> for closing user websocket connection. - `client.disconnectUser()` -> for disconnecting user and resetting client state. @@ -348,7 +372,8 @@ the [V4 Migration Guide](https://getstream.io/chat/docs/sdk/flutter/guides/migra ✅ Added - New `Location` enum is introduced for easily changing the client location/baseUrl. -- New `client.openConnection()` and `client.closeConnection()` is introduced to connect/disconnect user ws connection. +- New `client.openConnection()` and `client.closeConnection()` is introduced to connect/disconnect + user ws connection. 🔄 Changed @@ -412,14 +437,16 @@ the [V4 Migration Guide](https://getstream.io/chat/docs/sdk/flutter/guides/migra - Save pinned messages in offline storage - Minor fixes -- `StreamClient.QueryChannels` now returns a Stream and fetches the channels from storage before calling the api -- Added `StreamClient.QueryChannelsOnline` and `StreamClient.QueryChannelsOffline` to fetch channels only from online or - offline +- `StreamClient.QueryChannels` now returns a Stream and fetches the channels from storage before + calling the api +- Added `StreamClient.QueryChannelsOnline` and `StreamClient.QueryChannelsOffline` to fetch channels + only from online or offline ## 1.2.0-beta - 🛑 **BREAKING** Changed signature of `StreamClient.search` method -- Added `pinMessage` feature [docs here](https://getstream.io/chat/docs/flutter-dart/pinned_messages/?language=dart) +- Added `pinMessage` + feature [docs here](https://getstream.io/chat/docs/flutter-dart/pinned_messages/?language=dart) - Fixed minor bugs ## 1.1.0-beta @@ -436,7 +463,8 @@ the [V4 Migration Guide](https://getstream.io/chat/docs/sdk/flutter/guides/migra ## 1.0.2-beta -- Deprecated `setUser`, `setGuestUser`, `setUserWithProvider` in favor of `connectUser`, `connectGuestUser` +- Deprecated `setUser`, `setGuestUser`, `setUserWithProvider` in favor of `connectUser` + , `connectGuestUser` , `connectUserWithProvider` - Optimised reaction updates - i.e., Update first call Api later. @@ -449,9 +477,11 @@ the [V4 Migration Guide](https://getstream.io/chat/docs/sdk/flutter/guides/migra - 🛑 **BREAKING** Renamed `Client` to less generic `StreamChatClient` - 🛑 **BREAKING** Segregated the persistence layer into separate package [stream_chat_persistence](https://pub.dev/packages/stream_chat_persistence) -- 🛑 **BREAKING** Moved `Client.backgroundKeepAlive` to [core package](https://pub.dev/packages/stream_chat_core) -- 🛑 **BREAKING** Moved `Client.showLocalNotification` to [core package](https://pub.dev/packages/stream_chat_core) and - renamed it to `StreamChatCore.onBackgroundEventReceived` +- 🛑 **BREAKING** Moved `Client.backgroundKeepAlive` + to [core package](https://pub.dev/packages/stream_chat_core) +- 🛑 **BREAKING** Moved `Client.showLocalNotification` + to [core package](https://pub.dev/packages/stream_chat_core) and renamed it + to `StreamChatCore.onBackgroundEventReceived` - Removed `flutter` dependency. This is now a pure Dart package 🥳 - Minor improvements and bugfixes @@ -475,7 +505,8 @@ the [V4 Migration Guide](https://getstream.io/chat/docs/sdk/flutter/guides/migra ## 0.2.23+2 -- Do not throw an error when calling queryChannels without an active connection if the offline storage is enabled +- Do not throw an error when calling queryChannels without an active connection if the offline + storage is enabled ## 0.2.23+1 @@ -506,8 +537,8 @@ the [V4 Migration Guide](https://getstream.io/chat/docs/sdk/flutter/guides/migra ## 0.2.20 -- Return offline data only if the backend is unreachable. This avoids the glitch of the ChannelListView because we - cannot sort by custom properties. +- Return offline data only if the backend is unreachable. This avoids the glitch of the + ChannelListView because we cannot sort by custom properties. ## 0.2.19 @@ -561,7 +592,8 @@ the [V4 Migration Guide](https://getstream.io/chat/docs/sdk/flutter/guides/migra ## 0.2.12 -- Do not save channels in memory if not being watched. This was leading to some bugs in some specific use-cases. +- Do not save channels in memory if not being watched. This was leading to some bugs in some + specific use-cases. ## 0.2.11 diff --git a/packages/stream_chat/lib/src/client/client.dart b/packages/stream_chat/lib/src/client/client.dart index 0f2781c1..20506912 100644 --- a/packages/stream_chat/lib/src/client/client.dart +++ b/packages/stream_chat/lib/src/client/client.dart @@ -1489,13 +1489,12 @@ class ClientState { } void _listenChannelHidden() { - _subscriptions.add(_client.on(EventType.channelHidden).listen((event) { - final cid = event.cid; - - if (cid != null) { - _client.chatPersistenceClient?.deleteChannels([cid]); - } - channels = channels..removeWhere((cid, ch) => cid == event.cid); + _subscriptions + .add(_client.on(EventType.channelHidden).listen((event) async { + final eventChannel = event.channel!; + await _client.chatPersistenceClient?.deleteChannels([eventChannel.cid]); + channels[eventChannel.cid]?.dispose(); + channels = channels..remove(eventChannel.cid); })); } From 64bf65491ddb273da9372d8280052f6eab0b7177 Mon Sep 17 00:00:00 2001 From: Sahil Kumar Date: Mon, 13 Jun 2022 14:10:21 +0530 Subject: [PATCH 18/45] fix(ui): video breaks bottom photo carousel. Signed-off-by: xsahil03x --- .../lib/src/gallery_footer.dart | 5 +++-- .../lib/src/video_thumbnail_image.dart | 21 ++++++++++++------- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/packages/stream_chat_flutter/lib/src/gallery_footer.dart b/packages/stream_chat_flutter/lib/src/gallery_footer.dart index 1b78f262..6a94f804 100644 --- a/packages/stream_chat_flutter/lib/src/gallery_footer.dart +++ b/packages/stream_chat_flutter/lib/src/gallery_footer.dart @@ -225,11 +225,12 @@ class _StreamGalleryFooterState extends State { if (attachment.type == 'video') { media = InkWell( onTap: () => widget.mediaSelectedCallBack!(index), - child: FittedBox( - fit: BoxFit.cover, + child: AspectRatio( + aspectRatio: 1, child: StreamVideoThumbnailImage( video: (attachment.file?.path ?? attachment.assetUrl)!, + fit: BoxFit.cover, ), ), ); diff --git a/packages/stream_chat_flutter/lib/src/video_thumbnail_image.dart b/packages/stream_chat_flutter/lib/src/video_thumbnail_image.dart index 9f778278..de00d14e 100644 --- a/packages/stream_chat_flutter/lib/src/video_thumbnail_image.dart +++ b/packages/stream_chat_flutter/lib/src/video_thumbnail_image.dart @@ -97,8 +97,9 @@ class _StreamVideoThumbnailImageState extends State { ); } if (!snapshot.hasData) { - return Container( - constraints: const BoxConstraints.expand(), + return SizedBox( + height: double.maxFinite, + width: double.maxFinite, child: widget.placeholderBuilder?.call(context) ?? Shimmer.fromColors( baseColor: _streamChatTheme.colorTheme.disabled, @@ -106,16 +107,22 @@ class _StreamVideoThumbnailImageState extends State { child: Image.asset( 'images/placeholder.png', fit: BoxFit.cover, + height: widget.height, + width: widget.width, package: 'stream_chat_flutter', ), ), ); } - return Image.memory( - snapshot.data!, - fit: widget.fit, - height: widget.height, - width: widget.width, + return SizedBox( + height: double.maxFinite, + width: double.maxFinite, + child: Image.memory( + snapshot.data!, + fit: widget.fit, + height: widget.height, + width: widget.width, + ), ); }, ), From 37d22bdf8564f271b81081839cf06ff2f7dea9c3 Mon Sep 17 00:00:00 2001 From: Sahil Kumar Date: Mon, 13 Jun 2022 14:20:19 +0530 Subject: [PATCH 19/45] chore(ui): update CHANGELOG.md Signed-off-by: xsahil03x --- packages/stream_chat_flutter/CHANGELOG.md | 225 ++++++++++++++-------- 1 file changed, 142 insertions(+), 83 deletions(-) diff --git a/packages/stream_chat_flutter/CHANGELOG.md b/packages/stream_chat_flutter/CHANGELOG.md index 0cce92ae..e6c04e31 100644 --- a/packages/stream_chat_flutter/CHANGELOG.md +++ b/packages/stream_chat_flutter/CHANGELOG.md @@ -4,51 +4,64 @@ 🐞 Fixed --[[#1180]](https://github.com/GetStream/stream-chat-flutter/issues/1180) Fix file download -- Fix commands resetting the `StreamMessageInputController.value` +- [[#1180]](https://github.com/GetStream/stream-chat-flutter/issues/1180) Fix file download. +- Fix commands resetting the `StreamMessageInputController.value`. +- [[#996]](https://github.com/GetStream/stream-chat-flutter/issues/996) Videos break bottom photo + carousal. ## 4.2.0 🐞 Fixed -- [[#1133]](https://github.com/GetStream/stream-chat-flutter/issues/1133) Visibility override flags not being passed to `StreamMessageActionsModal` +- [[#1133]](https://github.com/GetStream/stream-chat-flutter/issues/1133) Visibility override flags + not being passed to `StreamMessageActionsModal` ## 4.1.0 ✅ Added -- [[#1119]](https://github.com/GetStream/stream-chat-flutter/issues/1119) Added an option to disable mentions overlay in `StreamMessageInput` -- Deprecated `disableEmojiSuggestionsOverlay` in favor of `enableEmojiSuggestionsOverlay` in `StreamMessageInput` +- [[#1119]](https://github.com/GetStream/stream-chat-flutter/issues/1119) Added an option to disable + mentions overlay in `StreamMessageInput` +- Deprecated `disableEmojiSuggestionsOverlay` in favor of `enableEmojiSuggestionsOverlay` + in `StreamMessageInput` 🐞 Fixed - Fixed attachment picker ui. - Fixed StreamChannelHeader and StreamThreadHeader subtitle alignment. - Fixed message widget thread indicator in reverse mode. -- [[#1044]](https://github.com/GetStream/stream-chat-flutter/issues/1044): Refactor StreamMessageWidget bottom row to use Text.rich. +- [[#1044]](https://github.com/GetStream/stream-chat-flutter/issues/1044): Refactor + StreamMessageWidget bottom row to use Text.rich. 🔄 Changed -- Removed `isOwner` condition from `ChannelBottomSheet` and `StreamChannelInfoBottomSheet` for delete option tile. +- Removed `isOwner` condition from `ChannelBottomSheet` and `StreamChannelInfoBottomSheet` for + delete option tile. ## 4.0.1 - Minor fixes -- Updated `stream_chat_flutter_core` dependency to [`4.0.1`](https://pub.dev/packages/stream_chat_flutter_core/changelog). +- Updated `stream_chat_flutter_core` dependency + to [`4.0.1`](https://pub.dev/packages/stream_chat_flutter_core/changelog). ## 4.0.0 -For upgrading to V4, please refer to the [V4 Migration Guide](https://getstream.io/chat/docs/sdk/flutter/guides/migration_guide_4_0/) +For upgrading to V4, please refer to +the [V4 Migration Guide](https://getstream.io/chat/docs/sdk/flutter/guides/migration_guide_4_0/) ✅ Added -- [[#1087]](https://github.com/GetStream/stream-chat-flutter/issues/1087): Handle limited access to camera on iOS. -- `centerTitle` and `elevation` properties to `ChannelHeader`, `ThreadHeader` and `ChannelListHeader`. +- [[#1087]](https://github.com/GetStream/stream-chat-flutter/issues/1087): Handle limited access to + camera on iOS. +- `centerTitle` and `elevation` properties to `ChannelHeader`, `ThreadHeader` + and `ChannelListHeader`. 🐞 Fixed -- [[#1067]](https://github.com/GetStream/stream-chat-flutter/issues/1067): Fix name text overflow in reaction card. -- [[#842]](https://github.com/GetStream/stream-chat-flutter/issues/842): show date divider for first message. +- [[#1067]](https://github.com/GetStream/stream-chat-flutter/issues/1067): Fix name text overflow in + reaction card. +- [[#842]](https://github.com/GetStream/stream-chat-flutter/issues/842): show date divider for first + message. - Loosen up url check for attachment download. - Use `ogScrapeUrl` for LinkAttachments. @@ -57,16 +70,20 @@ For upgrading to V4, please refer to the [V4 Migration Guide](https://getstream. ✅ Added - Added support to pass `autoCorrect` to `StreamMessageInput` for the text input field -- Added support to control the visibility of the default emoji suggestions overlay in `StreamMessageInput` +- Added support to control the visibility of the default emoji suggestions overlay + in `StreamMessageInput` - Added support to build custom widget for scrollToBottom in `StreamMessageListView` 🐞 Fixed - Minor fixes and improvements --[[#892]](https://github.com/GetStream/stream-chat-flutter/issues/892): Fix default `initialAlignment` in `MessageListView`. -- Fix `MessageInputTheme.inputBackgroundColor` color not being used in some widgets of `MessageInput` + -[[#892]](https://github.com/GetStream/stream-chat-flutter/issues/892): Fix + default `initialAlignment` in `MessageListView`. +- Fix `MessageInputTheme.inputBackgroundColor` color not being used in some widgets + of `MessageInput` - Removed dependency on `visibility_detector` -- [[#1071]](https://github.com/GetStream/stream-chat-flutter/issues/1071): Fixed the way attachment actions were handled in full screen +- [[#1071]](https://github.com/GetStream/stream-chat-flutter/issues/1071): Fixed the way attachment + actions were handled in full screen ## 4.0.0-beta.1 @@ -79,22 +96,27 @@ For upgrading to V4, please refer to the [V4 Migration Guide](https://getstream. - Deprecated `ChannelAvatar` in favor of `StreamChannelAvatar`. - Deprecated `ChannelName` in favor of `StreamChannelName`. - Deprecated `MessageInput` in favor of `StreamMessageInput`. -- Separated `MessageInput` widget in smaller components. (For example `CountDownButton`, `StreamAttachmentPicker`...) -- Updated `stream_chat_flutter_core` dependency to [`4.0.0-beta.0`](https://pub.dev/packages/stream_chat_flutter_core/changelog). +- Separated `MessageInput` widget in smaller components. (For example `CountDownButton` + , `StreamAttachmentPicker`...) +- Updated `stream_chat_flutter_core` dependency + to [`4.0.0-beta.0`](https://pub.dev/packages/stream_chat_flutter_core/changelog). - Added OpenGraph preview support for links in `StreamMessageInput`. - Removed video compression. ## 3.6.1 -- Updated `stream_chat_flutter_core` dependency to [`3.6.1`](https://pub.dev/packages/stream_chat_flutter_core/changelog). +- Updated `stream_chat_flutter_core` dependency + to [`3.6.1`](https://pub.dev/packages/stream_chat_flutter_core/changelog). ## 3.6.0 🐞 Fixed - Minor fixes and improvements --[[#892]](https://github.com/GetStream/stream-chat-flutter/issues/892): Fix default `initialAlignment` in `MessageListView`. -- Fix `MessageInputTheme.inputBackgroundColor` color not being used in some widgets of `MessageInput` + -[[#892]](https://github.com/GetStream/stream-chat-flutter/issues/892): Fix + default `initialAlignment` in `MessageListView`. +- Fix `MessageInputTheme.inputBackgroundColor` color not being used in some widgets + of `MessageInput` - Removed dependency on `visibility_detector` ## 3.5.1 @@ -107,32 +129,35 @@ For upgrading to V4, please refer to the [V4 Migration Guide](https://getstream. 🐞 Fixed - Mentions overlay now doesn't overflow when there is not enough height available -- Updated `stream_chat_flutter_core` dependency to [`3.5.1`](https://pub.dev/packages/stream_chat_flutter_core/changelog). - +- Updated `stream_chat_flutter_core` dependency + to [`3.5.1`](https://pub.dev/packages/stream_chat_flutter_core/changelog). ✅ Added - `onLinkTap` for `MessageWidget` can now be passed down to `UrlAttachment`. - ## 3.5.0 🐞 Fixed -- [[#888]](https://github.com/GetStream/stream-chat-flutter/issues/888) Fix `unban` command not working in `MessageInput`. -- [[#805]](https://github.com/GetStream/stream-chat-flutter/issues/805) Updated chewie dependency version to 1.3.0 +- [[#888]](https://github.com/GetStream/stream-chat-flutter/issues/888) Fix `unban` command not + working in `MessageInput`. +- [[#805]](https://github.com/GetStream/stream-chat-flutter/issues/805) Updated chewie dependency + version to 1.3.0 - Fix `showScrollToBottom` in `MessageListView` not respecting false value. - Fix default `Channel` route not opening from `ChannelListView` when `ChannelAvatar` is tapped ## 3.4.0 -- Updated `stream_chat_flutter_core` dependency to [`3.4.0`](https://pub.dev/packages/stream_chat_flutter_core/changelog). +- Updated `stream_chat_flutter_core` dependency + to [`3.4.0`](https://pub.dev/packages/stream_chat_flutter_core/changelog). 🐞 Fixed - SVG rendering fixes. - Use file extension instead of mimeType for downloading files. -- [[#860]](https://github.com/GetStream/stream-chat-flutter/issues/860) CastError while compressing Videos. +- [[#860]](https://github.com/GetStream/stream-chat-flutter/issues/860) CastError while compressing + Videos. ✅ Added @@ -145,22 +170,26 @@ For upgrading to V4, please refer to the [V4 Migration Guide](https://getstream. ## 3.3.2 -- Updated `stream_chat_flutter_core` dependency to [`3.3.1`](https://pub.dev/packages/stream_chat_flutter_core/changelog). +- Updated `stream_chat_flutter_core` dependency + to [`3.3.1`](https://pub.dev/packages/stream_chat_flutter_core/changelog). ## 3.3.1 ✅ Added -- `MessageListView` now allows more better control over spacing after messages using `spacingWidgetBuilder`. +- `MessageListView` now allows more better control over spacing after messages + using `spacingWidgetBuilder`. - `StreamChannel` can now fetch messages around a message ID with the `queryAroundMessage` call. - Added `MessageListView.keyboardDismissBehavior` property. 🐞 Fixed -- [[#766]](https://github.com/GetStream/stream-chat-flutter/issues/766) `AttachmentActionsModal` now has customisation options for actions. +- [[#766]](https://github.com/GetStream/stream-chat-flutter/issues/766) `AttachmentActionsModal` now + has customisation options for actions. - Fixed `MessageWidget` null errors associated with `channel.memberCount`. - Fixed adding attachments on web. -- [[#767]](https://github.com/GetStream/stream-chat-flutter/issues/767): Fix `MessageInput` focus behaviour when sending messages. +- [[#767]](https://github.com/GetStream/stream-chat-flutter/issues/767): Fix `MessageInput` focus + behaviour when sending messages. - Fixed user presence indicator not updating correctly. - Do not use `withData: true` in `FilePicker` calls. - Fixed read indicator not updating correctly in specific situations. @@ -168,29 +197,35 @@ For upgrading to V4, please refer to the [V4 Migration Guide](https://getstream. ## 3.2.0 - Updated Dart SDK constraints to `>=2.14.0 <3.0.0`. -- Updated `stream_chat_flutter_core` dependency to [`3.2.0`](https://pub.dev/packages/stream_chat_flutter_core/changelog). +- Updated `stream_chat_flutter_core` dependency + to [`3.2.0`](https://pub.dev/packages/stream_chat_flutter_core/changelog). 🐞 Fixed - Fixed message highlight animation alignment in `MessageListView`. -- [[#491]](https://github.com/GetStream/stream-chat-flutter/issues/491): Fix `MediaListView` showing media in wrong order. +- [[#491]](https://github.com/GetStream/stream-chat-flutter/issues/491): Fix `MediaListView` showing + media in wrong order. - Fixed `MessageListView` initialIndex not working in some cases. - Improved `MessageListView` rendering in case of reordering. - Fix image thumbnail generation when using Stream CDN. ✅ Added -- `MessageListViewThemeData` now accepts a `DecorationImage` as a background image for `MessageListView`. +- `MessageListViewThemeData` now accepts a `DecorationImage` as a background image + for `MessageListView`. ## 3.1.1 -- Updated `stream_chat_flutter_core` dependency to [`3.1.1`](https://pub.dev/packages/stream_chat_flutter_core/changelog). +- Updated `stream_chat_flutter_core` dependency + to [`3.1.1`](https://pub.dev/packages/stream_chat_flutter_core/changelog). - Updated `file_picker`, `image_gallery_saver`, and `video_thumbnail` to the latest versions. 🐞 Fixed -- [[#687]](https://github.com/GetStream/stream-chat-flutter/issues/687): Fix Users losing their place in the conversation after replying in threads. -- Fixed floating date stream subscription causing "Bad state: stream has already been listened.” error. +- [[#687]](https://github.com/GetStream/stream-chat-flutter/issues/687): Fix Users losing their + place in the conversation after replying in threads. +- Fixed floating date stream subscription causing "Bad state: stream has already been listened.” + error. - Fixed `String` capitalize extension not working on empty strings. ✅ Added @@ -198,17 +233,21 @@ For upgrading to V4, please refer to the [V4 Migration Guide](https://getstream. - Added `MessageInput.customOverlays` property to add custom overlays to the message input. - Added `MessageInput.mentionAllAppUsers` property to mention all app users in the message input. - The `MessageInput` now supports local search for channels with less than 100 members. -- Added `MessageListView.paginationLoadingIndicatorBuilder` to override the default loading indicator shown while paginating the message list. -- Added new `linkBackgroundColor` in `MessageTheme` for setting background colors of link attachments. +- Added `MessageListView.paginationLoadingIndicatorBuilder` to override the default loading + indicator shown while paginating the message list. +- Added new `linkBackgroundColor` in `MessageTheme` for setting background colors of link + attachments. ⚠️ Deprecated -- `MessageInput.mentionsTileBuilder` is now deprecated in favor of `MessageInput.userMentionsTileBuilder`. +- `MessageInput.mentionsTileBuilder` is now deprecated in favor + of `MessageInput.userMentionsTileBuilder`. - `MentionTile` is now deprecated in favor of `UserMentionsTile`. ## 3.0.0 -- Updated `stream_chat_flutter_core` dependency to [`3.0.0`](https://pub.dev/packages/stream_chat_flutter_core/changelog). +- Updated `stream_chat_flutter_core` dependency + to [`3.0.0`](https://pub.dev/packages/stream_chat_flutter_core/changelog). 🛑️ Breaking Changes from `2.2.1` @@ -216,16 +255,19 @@ For upgrading to V4, please refer to the [V4 Migration Guide](https://getstream. 🐞 Fixed -- [[#668]](https://github.com/GetStream/stream-chat-flutter/issues/668): Fix `MessageInput` rendering errors in case - there are no actions available to show. -- [[#349]](https://github.com/GetStream/stream-chat-flutter/issues/349): Fix `MessageInput` attachment render overflow error. +- [[#668]](https://github.com/GetStream/stream-chat-flutter/issues/668): Fix `MessageInput` + rendering errors in case there are no actions available to show. +- [[#349]](https://github.com/GetStream/stream-chat-flutter/issues/349): Fix `MessageInput` + attachment render overflow error. - `MessageInput` overlays now follow the `MessageInput` focus. -- [[#674]](https://github.com/GetStream/stream-chat-flutter/issues/674): Check scrollController is attached before calling jump in MessageListView. +- [[#674]](https://github.com/GetStream/stream-chat-flutter/issues/674): Check scrollController is + attached before calling jump in MessageListView. - Fixed `MessageListView` header and footer when `reverse: false`. 🔄 Changed -- Animation curves changed from default `Curves.linear` to `Curves.easeOut` and `Curves.easeIn` for attachment controls. +- Animation curves changed from default `Curves.linear` to `Curves.easeOut` and `Curves.easeIn` for + attachment controls. - Removed default padding in `DateDivider` in `MessageListView` ✅ Added @@ -282,17 +324,20 @@ For upgrading to V4, please refer to the [V4 Migration Guide](https://getstream. ✅ Added - [#516](https://github.com/GetStream/stream-chat-flutter/issues/516): - Added `StreamChatThemeData.placeholderUserImage` for building a widget when the `UserAvatar` image is loading + Added `StreamChatThemeData.placeholderUserImage` for building a widget when the `UserAvatar` image + is loading - Added a `backgroundColor` property to the following widgets: - `ChannelHeader` - `ChannelListHeader` - `GalleryHeader` - `GalleryFooter` - `ThreadHeader` -- Added `MessageInput.attachmentLimit` in order to limit the no. of attachments that can be sent with a single message. -- Added `MessageInput.onAttachmentLimitExceed` callback which will be called when the `attachmentLimit` is exceeded. - This will override the default error alert behaviour. -- Added `MessageInput.attachmentButtonBuilder` and `MessageInput.commandButtonBuilder` for more customizations. +- Added `MessageInput.attachmentLimit` in order to limit the no. of attachments that can be sent + with a single message. +- Added `MessageInput.onAttachmentLimitExceed` callback which will be called when + the `attachmentLimit` is exceeded. This will override the default error alert behaviour. +- Added `MessageInput.attachmentButtonBuilder` and `MessageInput.commandButtonBuilder` for more + customizations. ```dart typedef ActionButtonBuilder = Widget Function( @@ -308,8 +353,9 @@ You can call `.copyWith` to customize just a subset of properties. 🔄 Changed -Theming has been upgraded! Most theme classes now have `InheritedTheme` classes associated with them, and have been -upgraded with some goodies like `lerp` functions. Here's the full naming breakdown: +Theming has been upgraded! Most theme classes now have `InheritedTheme` classes associated with +them, and have been upgraded with some goodies like `lerp` functions. Here's the full naming +breakdown: * `AvatarTheme` is now `AvatarThemeData` * `ChannelHeaderTheme` is now `ChannelHeaderThemeData` @@ -326,18 +372,20 @@ upgraded with some goodies like `lerp` functions. Here's the full naming breakdo 🐞 Fixed -- Fixed `MessageInput` textField case where `input` is not enabled if the file picked from the camera is null. +- Fixed `MessageInput` textField case where `input` is not enabled if the file picked from the + camera is null. - Fixed date dividers position/alignment in non reversed `MessageListView`. -- Fixed `MessageListView` not opening to the right initialMessage if `StreamChannel.initialMessageId` is set. -- Fixed null check errors when accessing `message.text` in `MessageWidget` and `MessageListView`; this occurred when - sending a message with no text. +- Fixed `MessageListView` not opening to the right initialMessage + if `StreamChannel.initialMessageId` is set. +- Fixed null check errors when accessing `message.text` in `MessageWidget` and `MessageListView`; + this occurred when sending a message with no text. ## 2.1.2 🐞 Fixed -- [#590](https://github.com/GetStream/stream-chat-flutter/issues/590): livestream use case, no members when sending - message +- [#590](https://github.com/GetStream/stream-chat-flutter/issues/590): livestream use case, no + members when sending message ## 2.1.1 @@ -355,7 +403,8 @@ upgraded with some goodies like `lerp` functions. Here's the full naming breakdo 🔄 Changed - `StreamChat.of(context).user` is now deprecated in favor of `StreamChat.of(context).currentUser`. -- `StreamChat.of(context).userStream` is now deprecated in favor of `StreamChat.of(context).currentUserStream`. +- `StreamChat.of(context).userStream` is now deprecated in favor + of `StreamChat.of(context).currentUserStream`. 🐞 Fixed @@ -408,7 +457,8 @@ You can call `.copyWith` to customize just a subset of properties - Added video compress options (frame and quality) to `MessageInput` - TypingIndicator now has a property called `parentId` to show typing indicator specific to threads -- [#493](https://github.com/GetStream/stream-chat-flutter/pull/493): add support for messageListView header/footer +- [#493](https://github.com/GetStream/stream-chat-flutter/pull/493): add support for messageListView + header/footer - `MessageWidget` accepts a `userAvatarBuilder` - Added pinMessage ui support - Added `MessageListView.threadSeparatorBuilder` property @@ -417,10 +467,12 @@ You can call `.copyWith` to customize just a subset of properties 🐞 Fixed -- [#483](https://github.com/GetStream/stream-chat-flutter/issues/483): Keyboard covers input text box when editing - message -- Modals are shown using the nearest `Navigator` to make using the SDK easier in a nested navigator use case -- [#484](https://github.com/GetStream/stream-chat-flutter/issues/484): messages don't update without a reload +- [#483](https://github.com/GetStream/stream-chat-flutter/issues/483): Keyboard covers input text + box when editing message +- Modals are shown using the nearest `Navigator` to make using the SDK easier in a nested navigator + use case +- [#484](https://github.com/GetStream/stream-chat-flutter/issues/484): messages don't update without + a reload - `MessageListView` not rendering if the user is not a member of the channel - Fix `MessageInput` overflow when there are no actions - Minor fixes and improvements @@ -473,15 +525,18 @@ You can call `.copyWith` to customize just a subset of properties. ✅ Added - TypingIndicator now has a property called `parentId` to show typing indicator specific to threads -- [#493](https://github.com/GetStream/stream-chat-flutter/pull/493): add support for messageListView header/footer +- [#493](https://github.com/GetStream/stream-chat-flutter/pull/493): add support for messageListView + header/footer - `MessageWidget` accepts a `userAvatarBuilder` 🐞 Fixed -- [#483](https://github.com/GetStream/stream-chat-flutter/issues/483): Keyboard covers input text box when editing - message -- Modals are shown using the nearest `Navigator` to make using the SDK easier in a nested navigator use case -- [#484](https://github.com/GetStream/stream-chat-flutter/issues/484): messages don't update without a reload +- [#483](https://github.com/GetStream/stream-chat-flutter/issues/483): Keyboard covers input text + box when editing message +- Modals are shown using the nearest `Navigator` to make using the SDK easier in a nested navigator + use case +- [#484](https://github.com/GetStream/stream-chat-flutter/issues/484): messages don't update without + a reload - `MessageListView` not rendering if the user is not a member of the channel ## 2.0.0-nullsafety.7 @@ -551,7 +606,8 @@ You can call `.copyWith` to customize just a subset of properties. - Show error messages as system and keep them in the message input - Remove notification badge logic - Use shimmer while loading images -- Polished `StreamChatTheme` adding more options and a new `MessageInputTheme` dedicated to `MessageInput` +- Polished `StreamChatTheme` adding more options and a new `MessageInputTheme` dedicated + to `MessageInput` - Add possibility to specify custom message actions using `MessageWidget.customActions` - Added `MessageListView.onAttachmentTap` callback - Fixed message newline issue @@ -608,7 +664,8 @@ You can call `.copyWith` to customize just a subset of properties. - Improved api documentation - Updated `stream_chat` dependency to `^1.0.0-beta` - Extracted sample app into dedicated [repo](https://github.com/GetStream/flutter-samples) -- Reimplemented existing widgets using [stream_chat_flutter_core](https://pub.dev/packages/stream_chat_flutter_core) +- Reimplemented existing widgets + using [stream_chat_flutter_core](https://pub.dev/packages/stream_chat_flutter_core) ## 0.2.21 @@ -625,8 +682,8 @@ You can call `.copyWith` to customize just a subset of properties. ## 0.2.20+2 -- Added `shouldAddChannel` to ChannelsBloc in order to check if a channel has to be added to the list when a new message - arrives +- Added `shouldAddChannel` to ChannelsBloc in order to check if a channel has to be added to the + list when a new message arrives ## 0.2.20+1 @@ -660,7 +717,8 @@ You can call `.copyWith` to customize just a subset of properties. ## 0.2.16 -- Do not wrap channel preview builder. Users will have to implement they're custom onTap/onLongPress implementation +- Do not wrap channel preview builder. Users will have to implement they're custom onTap/onLongPress + implementation - Make public autofocus field of the TextField of message_input ## 0.2.15 @@ -845,10 +903,11 @@ You can call `.copyWith` to customize just a subset of properties. ## 0.2.1-alpha+1 -- Removed the additional `Navigator` in `StreamChat` widget. It was added to make the app have the `StreamChat` widget - as ancestor in every route. Now the recommended way to add `StreamChat` to your app is using the `builder` property of - your `MaterialApp` widget. Otherwise you can use it in the usual way, but you need to add a `StreamChat` widget to - every route of your app. Read [this issue](https://github.com/GetStream/stream-chat-flutter/issues/47) for more +- Removed the additional `Navigator` in `StreamChat` widget. It was added to make the app have + the `StreamChat` widget as ancestor in every route. Now the recommended way to add `StreamChat` to + your app is using the `builder` property of your `MaterialApp` widget. Otherwise you can use it in + the usual way, but you need to add a `StreamChat` widget to every route of your app. + Read [this issue](https://github.com/GetStream/stream-chat-flutter/issues/47) for more information. ```dart @@ -950,8 +1009,8 @@ Widget build(BuildContext context) { - Add gesture (vertical drag down) to close the keyboard -- Add keyboard type parameters (set it to TextInputType.text to show the submit button that will even close the - keyboard) +- Add keyboard type parameters (set it to TextInputType.text to show the submit button that will + even close the keyboard) The property showVideoFullScreen was added mainly because of this issue brianegan/chewie#261 From 58922ca7eecd767a637bf250f369042e14e89b4b Mon Sep 17 00:00:00 2001 From: Sahil Kumar Date: Mon, 13 Jun 2022 16:48:17 +0530 Subject: [PATCH 20/45] feat(ui): animate pinned message color Signed-off-by: xsahil03x --- .../lib/src/message_widget.dart | 475 +++++++++--------- 1 file changed, 241 insertions(+), 234 deletions(-) diff --git a/packages/stream_chat_flutter/lib/src/message_widget.dart b/packages/stream_chat_flutter/lib/src/message_widget.dart index cebe9318..086145fe 100644 --- a/packages/stream_chat_flutter/lib/src/message_widget.dart +++ b/packages/stream_chat_flutter/lib/src/message_widget.dart @@ -596,240 +596,251 @@ class _StreamMessageWidgetState extends State final showReactions = _shouldShowReactions; + final onMessageTap = widget.onMessageTap; + return Material( - type: widget.message.pinned && widget.showPinHighlight - ? MaterialType.card - : MaterialType.transparency, - color: widget.message.pinned && widget.showPinHighlight - ? _streamChatTheme.colorTheme.highlight - : null, - child: Portal( - child: InkWell( - onTap: () { - widget.onMessageTap!(widget.message); - }, - onLongPress: widget.message.isDeleted && !isFailedState - ? null - : () => onLongPress(context), - child: Padding( - padding: widget.padding ?? const EdgeInsets.all(8), - child: FractionallySizedBox( - alignment: - widget.reverse ? Alignment.centerRight : Alignment.centerLeft, - widthFactor: 0.78, - child: Column( - crossAxisAlignment: widget.reverse - ? CrossAxisAlignment.end - : CrossAxisAlignment.start, - mainAxisSize: MainAxisSize.min, - children: [ - Stack( - clipBehavior: Clip.none, - alignment: widget.reverse - ? AlignmentDirectional.bottomEnd - : AlignmentDirectional.bottomStart, - children: [ - Padding( - padding: EdgeInsets.only( - bottom: - isPinned && widget.showPinHighlight ? 8.0 : 0.0, - ), - child: Column( - crossAxisAlignment: widget.reverse - ? CrossAxisAlignment.end - : CrossAxisAlignment.start, - mainAxisSize: MainAxisSize.min, - children: [ - if (widget.message.pinned && - widget.message.pinnedBy != null && - widget.showPinHighlight) - _buildPinnedMessage(widget.message), - Row( - crossAxisAlignment: CrossAxisAlignment.end, - mainAxisSize: MainAxisSize.min, - children: [ - if (!widget.reverse && - widget.showUserAvatar == - DisplayWidget.show && - widget.message.user != null) ...[ - _buildUserAvatar(), - const SizedBox(width: 4), - ], - if (widget.showUserAvatar == DisplayWidget.hide) - SizedBox(width: avatarWidth + 4), - Flexible( - child: PortalTarget( - visible: showReactions, - portalFollower: showReactions - ? Container( - transform: - Matrix4.translationValues( - widget.reverse ? 12 : -12, - 0, - 0, - ), - constraints: const BoxConstraints( - maxWidth: 22 * 6.0, - ), - child: _buildReactionIndicator( - context, - ), - ) - : null, - anchor: Aligned( - follower: Alignment( - widget.reverse ? 1 : -1, - -1, - ), - target: Alignment( - widget.reverse ? -1 : 1, - -1, - ), - ), - child: Stack( - clipBehavior: Clip.none, - children: [ - Padding( - padding: widget.showReactions - ? EdgeInsets.only( - top: widget - .message - .reactionCounts - ?.isNotEmpty == - true - ? 18 - : 0, - ) - : EdgeInsets.zero, - child: (widget.message.isDeleted && - !isFailedState) - ? Container( - // ignore: lines_longer_than_80_chars - margin: EdgeInsets.symmetric( - horizontal: - // ignore: lines_longer_than_80_chars - widget.showUserAvatar == - // ignore: lines_longer_than_80_chars - DisplayWidget - .gone - ? 0 - : 4.0, - ), - child: StreamDeletedMessage( - borderRadiusGeometry: widget - .borderRadiusGeometry, - borderSide: - widget.borderSide, - shape: widget.shape, - messageTheme: - widget.messageTheme, - ), - ) - : Card( - clipBehavior: Clip.hardEdge, - elevation: 0, - margin: EdgeInsets.symmetric( - horizontal: (isFailedState - ? 15.0 - : 0.0) + - // ignore: lines_longer_than_80_chars - (widget.showUserAvatar == - DisplayWidget - .gone - ? 0 - : 4.0), - ), - shape: widget.shape ?? - RoundedRectangleBorder( - side: widget - .borderSide ?? - BorderSide( - color: widget - // ignore: lines_longer_than_80_chars - .messageTheme - // ignore: lines_longer_than_80_chars - .messageBorderColor ?? - Colors.grey, - ), - borderRadius: widget - // ignore: lines_longer_than_80_chars - .borderRadiusGeometry ?? - BorderRadius.zero, - ), - color: _getBackgroundColor(), - child: Column( - crossAxisAlignment: - CrossAxisAlignment.end, - mainAxisSize: - MainAxisSize.min, - children: [ - if (hasQuotedMessage) - _buildQuotedMessage(), - if (hasNonUrlAttachments) - _parseAttachments(), - if (!isGiphy) - _buildTextBubble(), - ], - ), - ), - ), - if (widget.showReactionPickerIndicator) - Positioned( - right: widget.reverse ? null : 4, - left: widget.reverse ? 4 : null, - top: -8, - child: CustomPaint( - painter: ReactionBubblePainter( - _streamChatTheme - .colorTheme.barsBg, - Colors.transparent, - Colors.transparent, - tailCirclesSpace: 1, - ), - ), - ), - ], - ), - ), - ), - if (widget.reverse && - widget.showUserAvatar == - DisplayWidget.show && - widget.message.user != null) ...[ - _buildUserAvatar(), - const SizedBox(width: 4), - ], - ], - ), - if (showBottomRow) - SizedBox(height: context.textScaleFactor * 18.0), - ], - ), - ), - if (showBottomRow) + type: MaterialType.transparency, + child: AnimatedContainer( + duration: const Duration(seconds: 1), + color: widget.message.pinned && widget.showPinHighlight + ? _streamChatTheme.colorTheme.highlight + : _streamChatTheme.colorTheme.barsBg.withOpacity(0), + child: Portal( + child: InkWell( + onTap: onMessageTap == null + ? null + : () => onMessageTap(widget.message), + onLongPress: widget.message.isDeleted && !isFailedState + ? null + : () => onLongPress(context), + child: Padding( + padding: widget.padding ?? const EdgeInsets.all(8), + child: FractionallySizedBox( + alignment: widget.reverse + ? Alignment.centerRight + : Alignment.centerLeft, + widthFactor: 0.78, + child: Column( + crossAxisAlignment: widget.reverse + ? CrossAxisAlignment.end + : CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + Stack( + clipBehavior: Clip.none, + alignment: widget.reverse + ? AlignmentDirectional.bottomEnd + : AlignmentDirectional.bottomStart, + children: [ Padding( padding: EdgeInsets.only( - left: !widget.reverse ? bottomRowPadding : 0, - right: widget.reverse ? bottomRowPadding : 0, bottom: - isPinned && widget.showPinHighlight ? 6.0 : 0.0, + isPinned && widget.showPinHighlight ? 8.0 : 0.0, + ), + child: Column( + crossAxisAlignment: widget.reverse + ? CrossAxisAlignment.end + : CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + if (widget.message.pinned && + widget.message.pinnedBy != null && + widget.showPinHighlight) + _buildPinnedMessage(widget.message), + Row( + crossAxisAlignment: CrossAxisAlignment.end, + mainAxisSize: MainAxisSize.min, + children: [ + if (!widget.reverse && + widget.showUserAvatar == + DisplayWidget.show && + widget.message.user != null) ...[ + _buildUserAvatar(), + const SizedBox(width: 4), + ], + if (widget.showUserAvatar == + DisplayWidget.hide) + SizedBox(width: avatarWidth + 4), + Flexible( + child: PortalTarget( + visible: showReactions, + portalFollower: showReactions + ? Container( + transform: + Matrix4.translationValues( + widget.reverse ? 12 : -12, + 0, + 0, + ), + constraints: const BoxConstraints( + maxWidth: 22 * 6.0, + ), + child: _buildReactionIndicator( + context, + ), + ) + : null, + anchor: Aligned( + follower: Alignment( + widget.reverse ? 1 : -1, + -1, + ), + target: Alignment( + widget.reverse ? -1 : 1, + -1, + ), + ), + child: Stack( + clipBehavior: Clip.none, + children: [ + Padding( + padding: widget.showReactions + ? EdgeInsets.only( + top: widget + .message + .reactionCounts + ?.isNotEmpty == + true + ? 18 + : 0, + ) + : EdgeInsets.zero, + child: (widget.message.isDeleted && + !isFailedState) + ? Container( + // ignore: lines_longer_than_80_chars + margin: + EdgeInsets.symmetric( + horizontal: + // ignore: lines_longer_than_80_chars + widget.showUserAvatar == + // ignore: lines_longer_than_80_chars + DisplayWidget.gone + ? 0 + : 4.0, + ), + child: StreamDeletedMessage( + borderRadiusGeometry: widget + .borderRadiusGeometry, + borderSide: + widget.borderSide, + shape: widget.shape, + messageTheme: + widget.messageTheme, + ), + ) + : Card( + clipBehavior: Clip.hardEdge, + elevation: 0, + margin: + EdgeInsets.symmetric( + horizontal: (isFailedState + ? 15.0 + : 0.0) + + // ignore: lines_longer_than_80_chars + (widget.showUserAvatar == + DisplayWidget + .gone + ? 0 + : 4.0), + ), + shape: widget.shape ?? + RoundedRectangleBorder( + side: widget + .borderSide ?? + BorderSide( + color: widget + // ignore: lines_longer_than_80_chars + .messageTheme + // ignore: lines_longer_than_80_chars + .messageBorderColor ?? + Colors.grey, + ), + borderRadius: widget + // ignore: lines_longer_than_80_chars + .borderRadiusGeometry ?? + BorderRadius.zero, + ), + color: + _getBackgroundColor(), + child: Column( + crossAxisAlignment: + CrossAxisAlignment + .end, + mainAxisSize: + MainAxisSize.min, + children: [ + if (hasQuotedMessage) + _buildQuotedMessage(), + if (hasNonUrlAttachments) + _parseAttachments(), + if (!isGiphy) + _buildTextBubble(), + ], + ), + ), + ), + if (widget + .showReactionPickerIndicator) + Positioned( + right: widget.reverse ? null : 4, + left: widget.reverse ? 4 : null, + top: -8, + child: CustomPaint( + painter: ReactionBubblePainter( + _streamChatTheme + .colorTheme.barsBg, + Colors.transparent, + Colors.transparent, + tailCirclesSpace: 1, + ), + ), + ), + ], + ), + ), + ), + if (widget.reverse && + widget.showUserAvatar == + DisplayWidget.show && + widget.message.user != null) ...[ + _buildUserAvatar(), + const SizedBox(width: 4), + ], + ], + ), + if (showBottomRow) + SizedBox( + height: context.textScaleFactor * 18.0), + ], ), - child: widget.bottomRowBuilder?.call( - context, - widget.message, - ) ?? - _bottomRow, ), - if (isFailedState) - Positioned( - right: widget.reverse ? 0 : null, - left: widget.reverse ? null : 0, - bottom: showBottomRow ? 18 : -2, - child: StreamSvgIcon.error(size: 20), - ), - ], - ), - ], + if (showBottomRow) + Padding( + padding: EdgeInsets.only( + left: !widget.reverse ? bottomRowPadding : 0, + right: widget.reverse ? bottomRowPadding : 0, + bottom: isPinned && widget.showPinHighlight + ? 6.0 + : 0.0, + ), + child: widget.bottomRowBuilder?.call( + context, + widget.message, + ) ?? + _bottomRow, + ), + if (isFailedState) + Positioned( + right: widget.reverse ? 0 : null, + left: widget.reverse ? null : 0, + bottom: showBottomRow ? 18 : -2, + child: StreamSvgIcon.error(size: 20), + ), + ], + ), + ], + ), ), ), ), @@ -1343,12 +1354,8 @@ class _StreamMessageWidgetState extends State child: Row( mainAxisSize: MainAxisSize.min, children: [ - StreamSvgIcon.pin( - size: 16, - ), - const SizedBox( - width: 4, - ), + StreamSvgIcon.pin(size: 16), + const SizedBox(width: 4), Text( context.translations.pinnedByUserText( pinnedBy: pinnedBy, From 07431bf75aadd48b61726301be64b6a14c243e80 Mon Sep 17 00:00:00 2001 From: Sahil Kumar Date: Mon, 13 Jun 2022 16:50:47 +0530 Subject: [PATCH 21/45] chore(ui): update CHANGELOG.md Signed-off-by: xsahil03x --- packages/stream_chat_flutter/CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/stream_chat_flutter/CHANGELOG.md b/packages/stream_chat_flutter/CHANGELOG.md index e6c04e31..e5087159 100644 --- a/packages/stream_chat_flutter/CHANGELOG.md +++ b/packages/stream_chat_flutter/CHANGELOG.md @@ -9,6 +9,11 @@ - [[#996]](https://github.com/GetStream/stream-chat-flutter/issues/996) Videos break bottom photo carousal. +✅ Added + +- [[#1011]](https://github.com/GetStream/stream-chat-flutter/issues/1011) Animate the background + color of pinned messages. + ## 4.2.0 🐞 Fixed From b87cd1d30f7bd9da8cc61b44bfb9388d697ee4c8 Mon Sep 17 00:00:00 2001 From: Sahil Kumar Date: Mon, 13 Jun 2022 17:02:02 +0530 Subject: [PATCH 22/45] chore(ui): fix analyzer Signed-off-by: xsahil03x --- .../stream_chat_flutter/lib/src/message_widget.dart | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/packages/stream_chat_flutter/lib/src/message_widget.dart b/packages/stream_chat_flutter/lib/src/message_widget.dart index 086145fe..b247c91e 100644 --- a/packages/stream_chat_flutter/lib/src/message_widget.dart +++ b/packages/stream_chat_flutter/lib/src/message_widget.dart @@ -708,7 +708,6 @@ class _StreamMessageWidgetState extends State child: (widget.message.isDeleted && !isFailedState) ? Container( - // ignore: lines_longer_than_80_chars margin: EdgeInsets.symmetric( horizontal: @@ -720,6 +719,7 @@ class _StreamMessageWidgetState extends State : 4.0, ), child: StreamDeletedMessage( + // ignore: lines_longer_than_80_chars borderRadiusGeometry: widget .borderRadiusGeometry, borderSide: @@ -761,8 +761,7 @@ class _StreamMessageWidgetState extends State .borderRadiusGeometry ?? BorderRadius.zero, ), - color: - _getBackgroundColor(), + color: _backgroundColor, child: Column( crossAxisAlignment: CrossAxisAlignment @@ -772,6 +771,7 @@ class _StreamMessageWidgetState extends State children: [ if (hasQuotedMessage) _buildQuotedMessage(), + // ignore: lines_longer_than_80_chars if (hasNonUrlAttachments) _parseAttachments(), if (!isGiphy) @@ -811,7 +811,8 @@ class _StreamMessageWidgetState extends State ), if (showBottomRow) SizedBox( - height: context.textScaleFactor * 18.0), + height: context.textScaleFactor * 18.0, + ), ], ), ), @@ -1374,7 +1375,7 @@ class _StreamMessageWidgetState extends State bool get isPinned => widget.message.pinned; - Color? _getBackgroundColor() { + Color? get _backgroundColor { if (hasQuotedMessage) { return widget.messageTheme.messageBackgroundColor; } From c4de28fd81763aa33043876f46b58e174d2c0d07 Mon Sep 17 00:00:00 2001 From: Salvatore Giordano Date: Mon, 13 Jun 2022 14:47:37 +0200 Subject: [PATCH 23/45] Update CONTRIBUTING.md --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index b99a2b3c..76a09d70 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -82,7 +82,7 @@ To run a script, use `melos run