Show relay hint regardless of whether data is received or not

Signed-off-by: 21pages <pages21@163.com>
This commit is contained in:
21pages
2023-11-09 22:40:15 +08:00
parent 45dbea57f1
commit eaa054e599
2 changed files with 23 additions and 13 deletions

View File

@@ -512,7 +512,7 @@ class FfiModel with ChangeNotifier {
showWaitUacDialog(sessionId, dialogManager, type);
} else if (type == 'elevation-error') {
showElevationError(sessionId, type, title, text, dialogManager);
} else if (type == 'relay-hint') {
} else if (type == 'relay-hint' || type == 'relay-hint2') {
showRelayHintDialog(sessionId, type, title, text, dialogManager, peerId);
} else if (text == 'Connected, waiting for image...') {
showConnectedWaitingForImage(dialogManager, sessionId, type, title, text);
@@ -564,17 +564,19 @@ class FfiModel with ChangeNotifier {
if (text.contains("10054") || text.contains("104")) {
hint = "";
}
final alreadyForceAlwaysRelay = bind
.mainGetPeerOptionSync(id: peerId, key: 'force-always-relay')
.isNotEmpty;
return CustomAlertDialog(
title: null,
content: msgboxContent(type, title, "${translate(text)}$hint"),
actions: [
dialogButton('Close', onPressed: onClose, isOutline: true),
if (type == 'relay-hint')
dialogButton('Connect via relay',
onPressed: () => reconnect(dialogManager, sessionId, true),
buttonStyle: style,
isOutline: true),
dialogButton('Retry',
onPressed: () => reconnect(dialogManager, sessionId, false)),
if (!alreadyForceAlwaysRelay)
if (type == 'relay-hint2')
dialogButton('Connect via relay',
onPressed: () => reconnect(dialogManager, sessionId, true),
buttonStyle: style),