mirror of
https://gitlab.com/famedly/fluffychat.git
synced 2024-11-24 04:59:26 +01:00
Merge branch 'soru/fix-sentry-errors' into 'main'
fix: resolve some sentry issues See merge request ChristianPauly/fluffychat-flutter!274
This commit is contained in:
commit
ccb8cf5a9d
@ -86,16 +86,24 @@ class _ImageBubbleState extends State<ImageBubble> {
|
|||||||
}
|
}
|
||||||
if (_thumbnail == null && !_requestedThumbnail && !isUnencrypted) {
|
if (_thumbnail == null && !_requestedThumbnail && !isUnencrypted) {
|
||||||
_getThumbnail().then((MatrixFile thumbnail) {
|
_getThumbnail().then((MatrixFile thumbnail) {
|
||||||
|
if (mounted) {
|
||||||
setState(() => _thumbnail = thumbnail);
|
setState(() => _thumbnail = thumbnail);
|
||||||
|
}
|
||||||
}, onError: (error, stacktrace) {
|
}, onError: (error, stacktrace) {
|
||||||
|
if (mounted) {
|
||||||
setState(() => _error = error);
|
setState(() => _error = error);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (_file == null && !widget.thumbnailOnly && !_requestedFile) {
|
if (_file == null && !widget.thumbnailOnly && !_requestedFile) {
|
||||||
_getFile().then((MatrixFile file) {
|
_getFile().then((MatrixFile file) {
|
||||||
|
if (mounted) {
|
||||||
setState(() => _file = file);
|
setState(() => _file = file);
|
||||||
|
}
|
||||||
}, onError: (error, stacktrace) {
|
}, onError: (error, stacktrace) {
|
||||||
|
if (mounted) {
|
||||||
setState(() => _error = error);
|
setState(() => _error = error);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
final display = _file ?? _thumbnail;
|
final display = _file ?? _thumbnail;
|
||||||
|
@ -121,6 +121,9 @@ class _ChatState extends State<_Chat> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void _updateScrollController() {
|
void _updateScrollController() {
|
||||||
|
if (!mounted) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (_scrollController.position.pixels ==
|
if (_scrollController.position.pixels ==
|
||||||
_scrollController.position.maxScrollExtent &&
|
_scrollController.position.maxScrollExtent &&
|
||||||
timeline.events.isNotEmpty &&
|
timeline.events.isNotEmpty &&
|
||||||
@ -176,17 +179,27 @@ class _ChatState extends State<_Chat> {
|
|||||||
if (timeline == null) {
|
if (timeline == null) {
|
||||||
timeline = await room.getTimeline(onUpdate: updateView);
|
timeline = await room.getTimeline(onUpdate: updateView);
|
||||||
if (timeline.events.isNotEmpty) {
|
if (timeline.events.isNotEmpty) {
|
||||||
unawaited(room.sendReadReceipt(timeline.events.first.eventId));
|
unawaited(room
|
||||||
|
.sendReadReceipt(timeline.events.first.eventId)
|
||||||
|
.catchError((err) {
|
||||||
|
if (err is MatrixException && err.errcode == 'M_FORBIDDEN') {
|
||||||
|
// ignore if the user is not in the room (still joining)
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
throw err;
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
// when the scroll controller is attached we want to scroll to an event id, if specified
|
// when the scroll controller is attached we want to scroll to an event id, if specified
|
||||||
// and update the scroll controller...which will trigger a request history, if the
|
// and update the scroll controller...which will trigger a request history, if the
|
||||||
// "load more" button is visible on the screen
|
// "load more" button is visible on the screen
|
||||||
SchedulerBinding.instance.addPostFrameCallback((_) async {
|
SchedulerBinding.instance.addPostFrameCallback((_) async {
|
||||||
|
if (mounted) {
|
||||||
if (widget.scrollToEventId != null) {
|
if (widget.scrollToEventId != null) {
|
||||||
_scrollToEventId(widget.scrollToEventId, context: context);
|
_scrollToEventId(widget.scrollToEventId, context: context);
|
||||||
}
|
}
|
||||||
_updateScrollController();
|
_updateScrollController();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
updateView();
|
updateView();
|
||||||
@ -406,6 +419,9 @@ class _ChatState extends State<_Chat> {
|
|||||||
await task;
|
await task;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (!mounted) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
await _scrollController.scrollToIndex(eventIndex,
|
await _scrollController.scrollToIndex(eventIndex,
|
||||||
preferPosition: AutoScrollPosition.middle);
|
preferPosition: AutoScrollPosition.middle);
|
||||||
_updateScrollController();
|
_updateScrollController();
|
||||||
|
@ -215,8 +215,8 @@ packages:
|
|||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
path: "."
|
path: "."
|
||||||
ref: "66572bd03209c1c6488cde53a0c72c11faef341d"
|
ref: c8d5bbfd144fd4ed36ebb12abc83e7676b9e45b0
|
||||||
resolved-ref: "66572bd03209c1c6488cde53a0c72c11faef341d"
|
resolved-ref: c8d5bbfd144fd4ed36ebb12abc83e7676b9e45b0
|
||||||
url: "https://gitlab.com/famedly/famedlysdk.git"
|
url: "https://gitlab.com/famedly/famedlysdk.git"
|
||||||
source: git
|
source: git
|
||||||
version: "0.0.1"
|
version: "0.0.1"
|
||||||
@ -1151,5 +1151,5 @@ packages:
|
|||||||
source: hosted
|
source: hosted
|
||||||
version: "0.1.2"
|
version: "0.1.2"
|
||||||
sdks:
|
sdks:
|
||||||
dart: ">=2.10.2 <2.11.0"
|
dart: ">=2.10.2 <=2.11.0-161.0.dev"
|
||||||
flutter: ">=1.22.2 <2.0.0"
|
flutter: ">=1.22.2 <2.0.0"
|
||||||
|
@ -23,7 +23,7 @@ dependencies:
|
|||||||
famedlysdk:
|
famedlysdk:
|
||||||
git:
|
git:
|
||||||
url: https://gitlab.com/famedly/famedlysdk.git
|
url: https://gitlab.com/famedly/famedlysdk.git
|
||||||
ref: 66572bd03209c1c6488cde53a0c72c11faef341d
|
ref: c8d5bbfd144fd4ed36ebb12abc83e7676b9e45b0
|
||||||
|
|
||||||
localstorage: ^3.0.3+6
|
localstorage: ^3.0.3+6
|
||||||
file_picker_cross: 4.2.2
|
file_picker_cross: 4.2.2
|
||||||
|
Loading…
Reference in New Issue
Block a user