align with main repo

This commit is contained in:
Salvatore Giordano
2021-06-21 20:34:34 +02:00
parent 9cd88dc0eb
commit 1ecc21ca53
7 changed files with 23 additions and 27 deletions
@@ -306,7 +306,7 @@ class _AdvancedOptionsPageState extends State<AdvancedOptionsPage> {
key: kStreamToken, key: kStreamToken,
value: userToken, value: userToken,
); );
await client.disconnect(); client.closeConnection();
} catch (e) { } catch (e) {
var errorText = 'Error connecting, retry'; var errorText = 'Error connecting, retry';
if (e is Map) { if (e is Map) {
@@ -317,7 +317,7 @@ class _AdvancedOptionsPageState extends State<AdvancedOptionsPage> {
_apiKeyError = errorText.toUpperCase(); _apiKeyError = errorText.toUpperCase();
}); });
loading = false; loading = false;
await client.disconnect(); client.closeConnection();
return; return;
} }
loading = false; loading = false;
@@ -6,8 +6,8 @@ import 'package:stream_chat_flutter/stream_chat_flutter.dart';
import 'channel_file_display_screen.dart'; import 'channel_file_display_screen.dart';
import 'channel_media_display_screen.dart'; import 'channel_media_display_screen.dart';
import 'pinned_messages_screen.dart';
import 'main.dart'; import 'main.dart';
import 'pinned_messages_screen.dart';
import 'routes/routes.dart'; import 'routes/routes.dart';
/// Detail screen for a 1:1 chat correspondence /// Detail screen for a 1:1 chat correspondence
@@ -615,7 +615,7 @@ class __SharedGroupsScreenState extends State<_SharedGroupsScreen> {
title = 'No title'; title = 'No title';
} }
} else { } else {
title = extraData['name']; title = extraData['name'] as String;
} }
return Column( return Column(
@@ -633,7 +633,7 @@ class __SharedGroupsScreenState extends State<_SharedGroupsScreen> {
), ),
Expanded( Expanded(
child: Text( child: Text(
title!, title,
style: textStyle, style: textStyle,
)), )),
Padding( Padding(
@@ -90,7 +90,7 @@ class ChooseUserPage extends StatelessWidget {
); );
final client = StreamChat.of(context).client; final client = StreamChat.of(context).client;
client.apiKey = kDefaultStreamApiKey; // client.apiKey = kDefaultStreamApiKey;
await client.connectUser( await client.connectUser(
user, user,
token, token,
@@ -10,9 +10,9 @@ import 'package:stream_chat_flutter/stream_chat_flutter.dart';
import 'channel_file_display_screen.dart'; import 'channel_file_display_screen.dart';
import 'channel_media_display_screen.dart'; import 'channel_media_display_screen.dart';
import 'pinned_messages_screen.dart';
import 'chat_info_screen.dart'; import 'chat_info_screen.dart';
import 'main.dart'; import 'main.dart';
import 'pinned_messages_screen.dart';
import 'routes/routes.dart'; import 'routes/routes.dart';
class GroupInfoScreen extends StatefulWidget { class GroupInfoScreen extends StatefulWidget {
@@ -61,7 +61,9 @@ class _GroupInfoScreenState extends State<GroupInfoScreen> {
super.initState(); super.initState();
var channel = StreamChannel.of(context); var channel = StreamChannel.of(context);
_nameController = TextEditingController.fromValue( _nameController = TextEditingController.fromValue(
TextEditingValue(text: channel.channel.extraData['name'] ?? '')); TextEditingValue(
text: (channel.channel.extraData['name'] as String?) ?? ''),
);
_searchController = TextEditingController()..addListener(_userNameListener); _searchController = TextEditingController()..addListener(_userNameListener);
_nameController!.addListener(() { _nameController!.addListener(() {
@@ -333,7 +335,7 @@ class _GroupInfoScreenState extends State<GroupInfoScreen> {
Widget _buildNameTile() { Widget _buildNameTile() {
var channel = StreamChannel.of(context).channel; var channel = StreamChannel.of(context).channel;
var channelName = channel.extraData['name'] ?? ''; var channelName = (channel.extraData['name'] as String?) ?? '';
return Material( return Material(
color: StreamChatTheme.of(context).colorTheme.whiteSnow, color: StreamChatTheme.of(context).colorTheme.whiteSnow,
@@ -377,8 +379,7 @@ class _GroupInfoScreenState extends State<GroupInfoScreen> {
), ),
), ),
), ),
if ((channelName == null) || if (channelName != _nameController!.text.trim())
(channelName != _nameController!.text.trim()))
Row( Row(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ children: [
+5 -8
View File
@@ -61,7 +61,7 @@ class _MyAppState extends State<MyApp> with TickerProviderStateMixin {
logLevel: Level.INFO, logLevel: Level.INFO,
)..chatPersistenceClient = chatPersistentClient; )..chatPersistenceClient = chatPersistentClient;
if (userId != null) { if (userId != null && token != null) {
await client.connectUser( await client.connectUser(
User(id: userId), User(id: userId),
token, token,
@@ -148,7 +148,7 @@ class _MyAppState extends State<MyApp> with TickerProviderStateMixin {
if (!kIsWeb) { if (!kIsWeb) {
_initData!.client.state.totalUnreadCountStream.listen((count) { _initData!.client.state.totalUnreadCountStream.listen((count) {
if (count! > 0) { if (count > 0) {
FlutterAppBadger.updateBadgeCount(count); FlutterAppBadger.updateBadgeCount(count);
} else { } else {
FlutterAppBadger.removeBadge(); FlutterAppBadger.removeBadge();
@@ -235,6 +235,7 @@ class _MyAppState extends State<MyApp> with TickerProviderStateMixin {
builder: (context, snapshot) => MaterialApp( builder: (context, snapshot) => MaterialApp(
builder: (context, child) { builder: (context, child) {
return StreamChat( return StreamChat(
backgroundKeepAlive: Duration(seconds: 5),
client: _initData!.client, client: _initData!.client,
onBackgroundEventReceived: (e) => showLocalNotification( onBackgroundEventReceived: (e) => showLocalNotification(
e, _initData!.client.state.user!.id), e, _initData!.client.state.user!.id),
@@ -445,9 +446,7 @@ class _HomePageState extends State<HomePage> {
await secureStorage.deleteAll(); await secureStorage.deleteAll();
} }
StreamChat.of(context).client.disconnect( StreamChat.of(context).client.disconnectUser();
clearUser: true,
);
await Navigator.pushReplacementNamed( await Navigator.pushReplacementNamed(
context, context,
@@ -714,9 +713,7 @@ class _ChannelListPageState extends State<ChannelListPage> {
}, },
swipeToAction: true, swipeToAction: true,
filter: Filter.in_('members', [user!.id]), filter: Filter.in_('members', [user!.id]),
options: { presence: true,
'presence': true,
},
pagination: PaginationParams( pagination: PaginationParams(
limit: 20, limit: 20,
), ),
@@ -66,10 +66,8 @@ class _NewChatScreenState extends State<NewChatScreen> {
final chatState = StreamChat.of(context); final chatState = StreamChat.of(context);
final res = await chatState.client.queryChannelsOnline( final res = await chatState.client.queryChannelsOnline(
options: { state: false,
'state': false, watch: false,
'watch': false,
},
filter: Filter.raw(value: { filter: Filter.raw(value: {
'members': [ 'members': [
..._selectedUsers.map((e) => e.id), ..._selectedUsers.map((e) => e.id),
+4 -4
View File
@@ -13,12 +13,12 @@ dependencies:
stream_chat_flutter: stream_chat_flutter:
git: git:
url: https://github.com/GetStream/stream-chat-flutter.git url: https://github.com/GetStream/stream-chat-flutter.git
ref: develop ref: ref/segregate-api-layer
path: packages/stream_chat_flutter path: packages/stream_chat_flutter
stream_chat_persistence: stream_chat_persistence:
git: git:
url: https://github.com/GetStream/stream-chat-flutter.git url: https://github.com/GetStream/stream-chat-flutter.git
ref: develop ref: ref/segregate-api-layer
path: packages/stream_chat_persistence path: packages/stream_chat_persistence
flutter_local_notifications: ^5.0.0+4 flutter_local_notifications: ^5.0.0+4
flutter_svg: ^0.22.0 flutter_svg: ^0.22.0
@@ -33,12 +33,12 @@ dependency_overrides:
stream_chat: stream_chat:
git: git:
url: https://github.com/GetStream/stream-chat-flutter.git url: https://github.com/GetStream/stream-chat-flutter.git
ref: develop ref: ref/segregate-api-layer
path: packages/stream_chat path: packages/stream_chat
stream_chat_flutter_core: stream_chat_flutter_core:
git: git:
url: https://github.com/GetStream/stream-chat-flutter.git url: https://github.com/GetStream/stream-chat-flutter.git
ref: develop ref: ref/segregate-api-layer
path: packages/stream_chat_flutter_core path: packages/stream_chat_flutter_core
dev_dependencies: dev_dependencies: