mirror of
https://gitlab.com/famedly/fluffychat.git
synced 2024-12-21 04:42:37 +01:00
fix: Try to reload timeline on IOException
This commit is contained in:
parent
518739e29f
commit
44d7f61788
@ -290,7 +290,7 @@ class ChatController extends State<ChatPageWithRoom> {
|
|||||||
|
|
||||||
Future<void> _getTimeline({
|
Future<void> _getTimeline({
|
||||||
String? eventContextId,
|
String? eventContextId,
|
||||||
Duration timeout = const Duration(seconds: 5),
|
Duration timeout = const Duration(seconds: 7),
|
||||||
}) async {
|
}) async {
|
||||||
await Matrix.of(context).client.roomsLoading;
|
await Matrix.of(context).client.roomsLoading;
|
||||||
await Matrix.of(context).client.accountDataLoading;
|
await Matrix.of(context).client.accountDataLoading;
|
||||||
@ -305,19 +305,22 @@ class ChatController extends State<ChatPageWithRoom> {
|
|||||||
eventContextId: eventContextId,
|
eventContextId: eventContextId,
|
||||||
)
|
)
|
||||||
.timeout(timeout);
|
.timeout(timeout);
|
||||||
} on TimeoutException catch (_) {
|
} catch (e, s) {
|
||||||
|
Logs().w('Unable to load timeline on event ID $eventContextId', e, s);
|
||||||
if (!mounted) return;
|
if (!mounted) return;
|
||||||
timeline = await room.getTimeline(onUpdate: updateView);
|
timeline = await room.getTimeline(onUpdate: updateView);
|
||||||
if (!mounted) return;
|
if (!mounted) return;
|
||||||
ScaffoldMessenger.of(context).showSnackBar(
|
if (e is TimeoutException || e is IOException) {
|
||||||
SnackBar(
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
content: Text(L10n.of(context)!.jumpToLastReadMessage),
|
SnackBar(
|
||||||
action: SnackBarAction(
|
content: Text(L10n.of(context)!.jumpToLastReadMessage),
|
||||||
label: L10n.of(context)!.jump,
|
action: SnackBarAction(
|
||||||
onPressed: () => scrollToEventId(eventContextId!),
|
label: L10n.of(context)!.jump,
|
||||||
|
onPressed: () => scrollToEventId(eventContextId!),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
);
|
||||||
);
|
}
|
||||||
}
|
}
|
||||||
timeline!.requestKeys(onlineKeyBackupOnly: false);
|
timeline!.requestKeys(onlineKeyBackupOnly: false);
|
||||||
if (timeline!.events.isNotEmpty) {
|
if (timeline!.events.isNotEmpty) {
|
||||||
|
Loading…
Reference in New Issue
Block a user