portable-service: better prompt message

Signed-off-by: 21pages <pages21@163.com>
This commit is contained in:
21pages
2022-11-15 16:49:55 +08:00
parent abd665153b
commit ca8cb5a3b0
38 changed files with 131 additions and 124 deletions

View File

@@ -195,6 +195,8 @@ class FfiModel with ChangeNotifier {
} else if (name == 'show_elevation') {
final show = evt['show'].toString() == 'true';
parent.target?.serverModel.setShowElevation(show);
} else if (name == 'cancel_msgbox') {
cancelMsgBox(evt, peerId);
}
};
}
@@ -231,6 +233,13 @@ class FfiModel with ChangeNotifier {
notifyListeners();
}
cancelMsgBox(Map<String, dynamic> evt, String id) {
if (parent.target == null) return;
final dialogManager = parent.target!.dialogManager;
final tag = '$id-${evt['tag']}';
dialogManager.dismissByTag(tag);
}
/// Handle the message box event based on [evt] and [id].
handleMsgBox(Map<String, dynamic> evt, String id) {
if (parent.target == null) return;
@@ -256,7 +265,7 @@ class FfiModel with ChangeNotifier {
showMsgBox(String id, String type, String title, String text, String link,
bool hasRetry, OverlayDialogManager dialogManager,
{bool? hasCancel}) {
msgBox(type, title, text, link, dialogManager, hasCancel: hasCancel);
msgBox(id, type, title, text, link, dialogManager, hasCancel: hasCancel);
_timer?.cancel();
if (hasRetry) {
_timer = Timer(Duration(seconds: _reconnects), () {