add reconnect button on Connection Error
Signed-off-by: 21pages <pages21@163.com>
This commit is contained in:
parent
f21bd44f43
commit
ed441242bf
@ -676,7 +676,7 @@ class CustomAlertDialog extends StatelessWidget {
|
||||
|
||||
void msgBox(String id, String type, String title, String text, String link,
|
||||
OverlayDialogManager dialogManager,
|
||||
{bool? hasCancel}) {
|
||||
{bool? hasCancel, ReconnectHandle? reconnect}) {
|
||||
dialogManager.dismissAll();
|
||||
List<Widget> buttons = [];
|
||||
bool hasOk = false;
|
||||
@ -716,6 +716,13 @@ void msgBox(String id, String type, String title, String text, String link,
|
||||
dialogManager.dismissAll();
|
||||
}));
|
||||
}
|
||||
if (reconnect != null && title == "Connection Error") {
|
||||
buttons.insert(
|
||||
0,
|
||||
dialogButton('Reconnect', isOutline: true, onPressed: () {
|
||||
reconnect(dialogManager, id, false);
|
||||
}));
|
||||
}
|
||||
if (link.isNotEmpty) {
|
||||
buttons.insert(0, dialogButton('JumpLink', onPressed: jumplink));
|
||||
}
|
||||
|
@ -33,6 +33,7 @@ import 'input_model.dart';
|
||||
import 'platform_model.dart';
|
||||
|
||||
typedef HandleMsgBox = Function(Map<String, dynamic> evt, String id);
|
||||
typedef ReconnectHandle = Function(OverlayDialogManager, String, bool);
|
||||
final _waitForImage = <String, bool>{};
|
||||
|
||||
class FfiModel with ChangeNotifier {
|
||||
@ -310,14 +311,12 @@ class FfiModel with ChangeNotifier {
|
||||
showMsgBox(String id, String type, String title, String text, String link,
|
||||
bool hasRetry, OverlayDialogManager dialogManager,
|
||||
{bool? hasCancel}) {
|
||||
msgBox(id, type, title, text, link, dialogManager, hasCancel: hasCancel);
|
||||
msgBox(id, type, title, text, link, dialogManager,
|
||||
hasCancel: hasCancel, reconnect: reconnect);
|
||||
_timer?.cancel();
|
||||
if (hasRetry) {
|
||||
_timer = Timer(Duration(seconds: _reconnects), () {
|
||||
bind.sessionReconnect(id: id, forceRelay: false);
|
||||
clearPermissions();
|
||||
dialogManager.showLoading(translate('Connecting...'),
|
||||
onCancel: closeConnection);
|
||||
reconnect(dialogManager, id, false);
|
||||
});
|
||||
_reconnects *= 2;
|
||||
} else {
|
||||
@ -325,6 +324,14 @@ class FfiModel with ChangeNotifier {
|
||||
}
|
||||
}
|
||||
|
||||
void reconnect(
|
||||
OverlayDialogManager dialogManager, String id, bool forceRelay) {
|
||||
bind.sessionReconnect(id: id, forceRelay: forceRelay);
|
||||
clearPermissions();
|
||||
dialogManager.showLoading(translate('Connecting...'),
|
||||
onCancel: closeConnection);
|
||||
}
|
||||
|
||||
void showRelayHintDialog(String id, String type, String title, String text,
|
||||
OverlayDialogManager dialogManager) {
|
||||
dialogManager.show(tag: '$id-$type', (setState, close) {
|
||||
@ -333,13 +340,6 @@ class FfiModel with ChangeNotifier {
|
||||
close();
|
||||
}
|
||||
|
||||
reconnect(bool forceRelay) {
|
||||
bind.sessionReconnect(id: id, forceRelay: forceRelay);
|
||||
clearPermissions();
|
||||
dialogManager.showLoading(translate('Connecting...'),
|
||||
onCancel: closeConnection);
|
||||
}
|
||||
|
||||
final style =
|
||||
ElevatedButton.styleFrom(backgroundColor: Colors.green[700]);
|
||||
return CustomAlertDialog(
|
||||
@ -348,14 +348,16 @@ class FfiModel with ChangeNotifier {
|
||||
"${translate(text)}\n\n${translate('relay_hint_tip')}"),
|
||||
actions: [
|
||||
dialogButton('Close', onPressed: onClose, isOutline: true),
|
||||
dialogButton('Retry', onPressed: () => reconnect(false)),
|
||||
dialogButton('Retry',
|
||||
onPressed: () => reconnect(dialogManager, id, false)),
|
||||
dialogButton('Connect via relay',
|
||||
onPressed: () => reconnect(true), buttonStyle: style),
|
||||
onPressed: () => reconnect(dialogManager, id, true),
|
||||
buttonStyle: style),
|
||||
dialogButton('Always connect via relay', onPressed: () {
|
||||
const option = 'force-always-relay';
|
||||
bind.sessionPeerOption(
|
||||
id: id, name: option, value: bool2option(option, true));
|
||||
reconnect(true);
|
||||
reconnect(dialogManager, id, true);
|
||||
}, buttonStyle: style),
|
||||
],
|
||||
onCancel: onClose,
|
||||
|
@ -450,5 +450,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Text chat", ""),
|
||||
("Stop voice call", ""),
|
||||
("relay_hint_tip", ""),
|
||||
].iter().cloned().collect();
|
||||
("Reconnect", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -422,7 +422,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Ask the remote user for authentication", "请求远端用户授权"),
|
||||
("Choose this if the remote account is administrator", "当对面电脑是管理员账号时选择该选项"),
|
||||
("Transmit the username and password of administrator", "发送管理员账号的用户名密码"),
|
||||
("still_click_uac_tip", "依然需要被控端用戶在運行 RustDesk 的 UAC 窗口點擊確認。"),
|
||||
("still_click_uac_tip", "依然需要被控端用户在运行 RustDesk 的 UAC 窗口点击确认。"),
|
||||
("Request Elevation", "请求提权"),
|
||||
("wait_accept_uac_tip", "请等待远端用户确认 UAC 对话框。"),
|
||||
("Elevate successfully", "提权成功"),
|
||||
@ -450,5 +450,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Text chat", "文字聊天"),
|
||||
("Stop voice call", "停止语音聊天"),
|
||||
("relay_hint_tip", "可能无法直连,可以尝试中继连接。\n另外,如果想直接使用中继连接,可以在ID后面添加/r,或者在卡片选项里选择强制走中继连接。"),
|
||||
].iter().cloned().collect();
|
||||
("Reconnect", "重连"),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -450,5 +450,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Text chat", ""),
|
||||
("Stop voice call", ""),
|
||||
("relay_hint_tip", ""),
|
||||
].iter().cloned().collect();
|
||||
("Reconnect", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -450,5 +450,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Text chat", ""),
|
||||
("Stop voice call", ""),
|
||||
("relay_hint_tip", ""),
|
||||
].iter().cloned().collect();
|
||||
("Reconnect", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -450,5 +450,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Text chat", "Text-Chat"),
|
||||
("Stop voice call", "Sprachanruf beenden"),
|
||||
("relay_hint_tip", ""),
|
||||
].iter().cloned().collect();
|
||||
("Reconnect", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -450,5 +450,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Text chat", ""),
|
||||
("Stop voice call", ""),
|
||||
("relay_hint_tip", ""),
|
||||
].iter().cloned().collect();
|
||||
("Reconnect", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -450,5 +450,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Text chat", "Chat de texto"),
|
||||
("Stop voice call", "Detener llamada de voz"),
|
||||
("relay_hint_tip", ""),
|
||||
].iter().cloned().collect();
|
||||
("Reconnect", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -450,5 +450,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Text chat", "گفتگو متنی (چت متنی)"),
|
||||
("Stop voice call", "توقف تماس صوتی"),
|
||||
("relay_hint_tip", ""),
|
||||
].iter().cloned().collect();
|
||||
("Reconnect", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -450,5 +450,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Text chat", ""),
|
||||
("Stop voice call", ""),
|
||||
("relay_hint_tip", ""),
|
||||
].iter().cloned().collect();
|
||||
("Reconnect", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -450,5 +450,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Text chat", ""),
|
||||
("Stop voice call", ""),
|
||||
("relay_hint_tip", ""),
|
||||
].iter().cloned().collect();
|
||||
("Reconnect", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -450,5 +450,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Text chat", ""),
|
||||
("Stop voice call", ""),
|
||||
("relay_hint_tip", ""),
|
||||
].iter().cloned().collect();
|
||||
("Reconnect", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -450,5 +450,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Text chat", ""),
|
||||
("Stop voice call", ""),
|
||||
("relay_hint_tip", ""),
|
||||
].iter().cloned().collect();
|
||||
("Reconnect", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -450,5 +450,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Text chat", "Chat testuale"),
|
||||
("Stop voice call", "Interrompi la chiamata vocale"),
|
||||
("relay_hint_tip", ""),
|
||||
].iter().cloned().collect();
|
||||
("Reconnect", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -450,5 +450,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Text chat", ""),
|
||||
("Stop voice call", ""),
|
||||
("relay_hint_tip", ""),
|
||||
].iter().cloned().collect();
|
||||
("Reconnect", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -450,5 +450,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Text chat", ""),
|
||||
("Stop voice call", ""),
|
||||
("relay_hint_tip", ""),
|
||||
].iter().cloned().collect();
|
||||
("Reconnect", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -450,5 +450,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Text chat", ""),
|
||||
("Stop voice call", ""),
|
||||
("relay_hint_tip", ""),
|
||||
].iter().cloned().collect();
|
||||
("Reconnect", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -209,7 +209,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Closed manually by the peer", "Handmatig gesloten door de peer"),
|
||||
("Enable remote configuration modification", "Wijziging configuratie op afstand inschakelen"),
|
||||
("Run without install", "Uitvoeren zonder installatie"),
|
||||
("Always connected via relay", "Altijd verbonden via relay"),
|
||||
("Connect via relay", ""),
|
||||
("Always connect via relay", "Altijd verbinden via relay"),
|
||||
("whitelist_tip", "Alleen een IP-adres op de witte lijst krijgt toegang tot mijn toestel"),
|
||||
("Login", "Log In"),
|
||||
@ -449,5 +449,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Voice call", "Spraakoproep"),
|
||||
("Text chat", "Tekst chat"),
|
||||
("Stop voice call", "Stop spraakoproep"),
|
||||
].iter().cloned().collect();
|
||||
("relay_hint_tip", ""),
|
||||
("Reconnect", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -450,5 +450,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Text chat", ""),
|
||||
("Stop voice call", ""),
|
||||
("relay_hint_tip", ""),
|
||||
].iter().cloned().collect();
|
||||
("Reconnect", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -450,5 +450,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Text chat", ""),
|
||||
("Stop voice call", ""),
|
||||
("relay_hint_tip", ""),
|
||||
].iter().cloned().collect();
|
||||
("Reconnect", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -450,5 +450,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Text chat", ""),
|
||||
("Stop voice call", ""),
|
||||
("relay_hint_tip", ""),
|
||||
].iter().cloned().collect();
|
||||
("Reconnect", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -450,5 +450,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Text chat", ""),
|
||||
("Stop voice call", ""),
|
||||
("relay_hint_tip", ""),
|
||||
].iter().cloned().collect();
|
||||
("Reconnect", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -450,5 +450,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Text chat", "Текстовый чат"),
|
||||
("Stop voice call", "Завершить голосовой вызов"),
|
||||
("relay_hint_tip", ""),
|
||||
].iter().cloned().collect();
|
||||
("Reconnect", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -450,5 +450,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Text chat", ""),
|
||||
("Stop voice call", ""),
|
||||
("relay_hint_tip", ""),
|
||||
].iter().cloned().collect();
|
||||
("Reconnect", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -450,5 +450,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Text chat", ""),
|
||||
("Stop voice call", ""),
|
||||
("relay_hint_tip", ""),
|
||||
].iter().cloned().collect();
|
||||
("Reconnect", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -450,5 +450,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Text chat", ""),
|
||||
("Stop voice call", ""),
|
||||
("relay_hint_tip", ""),
|
||||
].iter().cloned().collect();
|
||||
("Reconnect", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -450,5 +450,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Text chat", ""),
|
||||
("Stop voice call", ""),
|
||||
("relay_hint_tip", ""),
|
||||
].iter().cloned().collect();
|
||||
("Reconnect", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -450,5 +450,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Text chat", ""),
|
||||
("Stop voice call", ""),
|
||||
("relay_hint_tip", ""),
|
||||
].iter().cloned().collect();
|
||||
("Reconnect", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -450,5 +450,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Text chat", ""),
|
||||
("Stop voice call", ""),
|
||||
("relay_hint_tip", ""),
|
||||
].iter().cloned().collect();
|
||||
("Reconnect", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -450,5 +450,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Text chat", ""),
|
||||
("Stop voice call", ""),
|
||||
("relay_hint_tip", ""),
|
||||
].iter().cloned().collect();
|
||||
("Reconnect", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -450,5 +450,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Text chat", ""),
|
||||
("Stop voice call", ""),
|
||||
("relay_hint_tip", ""),
|
||||
].iter().cloned().collect();
|
||||
("Reconnect", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -446,9 +446,10 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("FPS", "幀率"),
|
||||
("Auto", "自動"),
|
||||
("Other Default Options", "其它默認選項"),
|
||||
("Voice call", ""),
|
||||
("Text chat", ""),
|
||||
("Stop voice call", ""),
|
||||
("relay_hint_tip", ""),
|
||||
].iter().cloned().collect();
|
||||
("Voice call", "語音通話"),
|
||||
("Text chat", "文字聊天"),
|
||||
("Stop voice call", "停止語音聊天"),
|
||||
("relay_hint_tip", "可能無法直連,可以嘗試中繼連接。 \n另外,如果想直接使用中繼連接,可以在ID後面添加/r,或者在卡片選項裡選擇強制走中繼連接。"),
|
||||
("Reconnect", "重連"),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -450,5 +450,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Text chat", ""),
|
||||
("Stop voice call", ""),
|
||||
("relay_hint_tip", ""),
|
||||
].iter().cloned().collect();
|
||||
("Reconnect", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -450,5 +450,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("Text chat", ""),
|
||||
("Stop voice call", ""),
|
||||
("relay_hint_tip", ""),
|
||||
].iter().cloned().collect();
|
||||
("Reconnect", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user