From 6613476700d7d10586c43ad0b524d4a4e3e20149 Mon Sep 17 00:00:00 2001 From: Salvatore Giordano Date: Mon, 9 Nov 2020 09:43:47 +0100 Subject: [PATCH 1/4] channel query on local notification was using event.type --- example/lib/main.dart | 3 +-- example/pubspec.yaml | 2 +- lib/src/stream_chat.dart | 6 +++--- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/example/lib/main.dart b/example/lib/main.dart index 9eee4db0..fd051afc 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -69,8 +69,7 @@ void main() async { final client = Client( 's2dxdhpxd94g', logLevel: Level.INFO, - showLocalNotification: - (!kIsWeb && Platform.isAndroid) ? showLocalNotification : null, + showLocalNotification: (m, c) {}, persistenceEnabled: true, ); diff --git a/example/pubspec.yaml b/example/pubspec.yaml index c56b9834..babdff9a 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -1,6 +1,6 @@ name: example description: A new Flutter project. -version: 1.0.22+23 +version: 1.0.23+24 environment: sdk: ">=2.2.2 <3.0.0" diff --git a/lib/src/stream_chat.dart b/lib/src/stream_chat.dart index dfc6095b..d11f5fef 100644 --- a/lib/src/stream_chat.dart +++ b/lib/src/stream_chat.dart @@ -186,10 +186,10 @@ class StreamChatState extends State with WidgetsBindingObserver { .listen((event) async { var channel = client.state.channels[event.cid]; - if (channel == null) { + if (channel != null) { channel = client.channel( - event.type, - id: event.cid.split(':')[1], + event.channelType, + id: event.channelId, ); await channel.query(); } From 1285f82a6488b6aa6e017bc4c288aadebd21318b Mon Sep 17 00:00:00 2001 From: Salvatore Giordano Date: Mon, 9 Nov 2020 09:44:10 +0100 Subject: [PATCH 2/4] fix condition --- lib/src/stream_chat.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/src/stream_chat.dart b/lib/src/stream_chat.dart index d11f5fef..081849b5 100644 --- a/lib/src/stream_chat.dart +++ b/lib/src/stream_chat.dart @@ -186,7 +186,7 @@ class StreamChatState extends State with WidgetsBindingObserver { .listen((event) async { var channel = client.state.channels[event.cid]; - if (channel != null) { + if (channel == null) { channel = client.channel( event.channelType, id: event.channelId, From 2f8891af7f23cac11f2717138e1c861782ad3a0a Mon Sep 17 00:00:00 2001 From: Salvatore Giordano Date: Mon, 9 Nov 2020 09:46:54 +0100 Subject: [PATCH 3/4] version bump --- CHANGELOG.md | 4 ++++ pubspec.yaml | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e51cb8bc..e924ddc7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.2.11+1 + +- Fix error with channel query while handling background notifications + ## 0.2.11 - Update llc dependency diff --git a/pubspec.yaml b/pubspec.yaml index 56d2270d..70e4ed1e 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,7 +1,7 @@ name: stream_chat_flutter homepage: https://github.com/GetStream/stream-chat-flutter description: Stream Chat official Flutter SDK. Build your own chat experience using Dart and Flutter. -version: 0.2.11 +version: 0.2.11+1 repository: https://github.com/GetStream/stream-chat-flutter issue_tracker: https://github.com/GetStream/stream-chat-flutter/issues From 7740932f2f576a70784858871a6b29b998b247b0 Mon Sep 17 00:00:00 2001 From: Salvatore Giordano Date: Mon, 9 Nov 2020 09:48:04 +0100 Subject: [PATCH 4/4] fix example --- example/lib/main.dart | 3 ++- example/pubspec.yaml | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/example/lib/main.dart b/example/lib/main.dart index fd051afc..9eee4db0 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -69,7 +69,8 @@ void main() async { final client = Client( 's2dxdhpxd94g', logLevel: Level.INFO, - showLocalNotification: (m, c) {}, + showLocalNotification: + (!kIsWeb && Platform.isAndroid) ? showLocalNotification : null, persistenceEnabled: true, ); diff --git a/example/pubspec.yaml b/example/pubspec.yaml index babdff9a..9f50d014 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -1,6 +1,6 @@ name: example description: A new Flutter project. -version: 1.0.23+24 +version: 1.0.24+25 environment: sdk: ">=2.2.2 <3.0.0"