Better notifications

This commit is contained in:
Christian Pauly 2020-01-08 13:19:15 +00:00
commit c4353bbea6
14 changed files with 296 additions and 25 deletions

View file

@ -27,6 +27,8 @@ class _ChatState extends State<Chat> {
Timeline timeline;
MatrixState matrix;
String seenByText = "";
final ScrollController _scrollController = ScrollController();
@ -81,6 +83,7 @@ class _ChatState extends State<Chat> {
@override
void dispose() {
timeline?.sub?.cancel();
matrix.activeRoomId = "";
super.dispose();
}
@ -98,7 +101,7 @@ class _ChatState extends State<Chat> {
}
File file = await FilePicker.getFile();
if (file == null) return;
await Matrix.of(context).tryRequestWithLoadingDialog(
await matrix.tryRequestWithLoadingDialog(
room.sendFileEvent(
MatrixFile(bytes: await file.readAsBytes(), path: file.path),
),
@ -115,7 +118,7 @@ class _ChatState extends State<Chat> {
maxWidth: 1600,
maxHeight: 1600);
if (file == null) return;
await Matrix.of(context).tryRequestWithLoadingDialog(
await matrix.tryRequestWithLoadingDialog(
room.sendImageEvent(
MatrixFile(bytes: await file.readAsBytes(), path: file.path),
),
@ -132,7 +135,7 @@ class _ChatState extends State<Chat> {
maxWidth: 1600,
maxHeight: 1600);
if (file == null) return;
await Matrix.of(context).tryRequestWithLoadingDialog(
await matrix.tryRequestWithLoadingDialog(
room.sendImageEvent(
MatrixFile(bytes: await file.readAsBytes(), path: file.path),
),
@ -141,16 +144,18 @@ class _ChatState extends State<Chat> {
@override
Widget build(BuildContext context) {
Client client = Matrix.of(context).client;
matrix = Matrix.of(context);
Client client = matrix.client;
room ??= client.getRoomById(widget.id);
if (room == null) {
return Center(
child: Text("You are no longer participating in this chat"),
);
}
matrix.activeRoomId = widget.id;
if (room.membership == Membership.invite) {
Matrix.of(context).tryRequestWithLoadingDialog(room.join());
matrix.tryRequestWithLoadingDialog(room.join());
}
String typingText = "";