fix missing retry (#8750)

Signed-off-by: 21pages <sunboeasy@gmail.com>
This commit is contained in:
21pages 2024-07-18 17:16:25 +08:00 committed by GitHub
parent a81d6468cc
commit c3c99ba107
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1096,21 +1096,33 @@ void msgBox(SessionID sessionId, String type, String title, String text,
dialogManager.dismissAll(); dialogManager.dismissAll();
})); }));
} }
if (reconnect != null && if (reconnect != null && title == "Connection Error") {
title == "Connection Error" &&
reconnectTimeout != null) {
// `enabled` is used to disable the dialog button once the button is clicked. // `enabled` is used to disable the dialog button once the button is clicked.
final enabled = true.obs; final enabled = true.obs;
final button = Obx(() => _ReconnectCountDownButton( final button = reconnectTimeout != null
second: reconnectTimeout, ? Obx(() => _ReconnectCountDownButton(
onPressed: enabled.isTrue second: reconnectTimeout,
? () { onPressed: enabled.isTrue
// Disable the button ? () {
enabled.value = false; // Disable the button
reconnect(dialogManager, sessionId, false); enabled.value = false;
} reconnect(dialogManager, sessionId, false);
: null, }
)); : null,
))
: Obx(
() => dialogButton(
'Reconnect',
isOutline: true,
onPressed: enabled.isTrue
? () {
// Disable the button
enabled.value = false;
reconnect(dialogManager, sessionId, false);
}
: null,
),
);
buttons.insert(0, button); buttons.insert(0, button);
} }
if (link.isNotEmpty) { if (link.isNotEmpty) {