-
Notifications
You must be signed in to change notification settings - Fork 346
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(llc): when removing current user from channel check for null in t…
…he callback Closes #1753
- Loading branch information
Showing
5 changed files
with
103 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
packages/stream_chat_flutter/example/lib/debug/actions/add_user.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
// ignore_for_file: public_member_api_docs | ||
|
||
import 'package:flutter/material.dart'; | ||
import 'package:stream_chat_flutter/stream_chat_flutter.dart'; | ||
|
||
import 'package:stream_chat_flutter_example/debug/error_dialog.dart'; | ||
|
||
class DebugAddUser extends StatelessWidget { | ||
const DebugAddUser({ | ||
super.key, | ||
required this.client, | ||
required this.channel, | ||
}); | ||
|
||
final StreamChatClient client; | ||
final Channel channel; | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return Padding( | ||
padding: const EdgeInsets.all(8), | ||
child: TextField( | ||
decoration: const InputDecoration( | ||
labelText: 'Add User', | ||
hintText: 'User Id', | ||
isDense: true, | ||
border: OutlineInputBorder(), | ||
), | ||
onSubmitted: (value) async { | ||
final userId = value.trim(); | ||
try { | ||
debugPrint('[addUser] userId: $userId'); | ||
final result = await client.addChannelMembers( | ||
channel.id!, | ||
channel.type, | ||
[userId], | ||
); | ||
debugPrint('[addUser] result: $result'); | ||
} catch (e) { | ||
debugPrint('[addUser] failed: $e'); | ||
showErrorDialog(context, e, 'Add User'); | ||
} | ||
}, | ||
), | ||
); | ||
} | ||
} |
47 changes: 47 additions & 0 deletions
47
packages/stream_chat_flutter/example/lib/debug/actions/remove_user.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
// ignore_for_file: public_member_api_docs | ||
|
||
import 'package:flutter/material.dart'; | ||
import 'package:stream_chat_flutter/stream_chat_flutter.dart'; | ||
|
||
import 'package:stream_chat_flutter_example/debug/error_dialog.dart'; | ||
|
||
class DebugRemoveUser extends StatelessWidget { | ||
const DebugRemoveUser({ | ||
super.key, | ||
required this.client, | ||
required this.channel, | ||
}); | ||
|
||
final StreamChatClient client; | ||
final Channel channel; | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return Padding( | ||
padding: const EdgeInsets.all(8), | ||
child: TextField( | ||
decoration: const InputDecoration( | ||
labelText: 'Remove User', | ||
hintText: 'User Id', | ||
isDense: true, | ||
border: OutlineInputBorder(), | ||
), | ||
onSubmitted: (value) async { | ||
final userId = value.trim(); | ||
try { | ||
debugPrint('[removeUser] userId: $userId'); | ||
final result = await client.removeChannelMembers( | ||
channel.id!, | ||
channel.type, | ||
[userId], | ||
); | ||
debugPrint('[removeUser] result: $result'); | ||
} catch (e) { | ||
debugPrint('[removeUser] failed: $e'); | ||
showErrorDialog(context, e, 'Remove User'); | ||
} | ||
}, | ||
), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters