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