Updated "SendMessage" to try to use updated windows dialog
Bryan Roe committed
Jan 31, 2022 at 10:19 UTC
70b8d48320d8516828691a42fb695aa4c037c4c3
1 file changed
+36
-2
agents/meshcore.js
+36
-2
@@ -1071,9 +1071,43 @@ function handleServerCommand(data) {
1071
}
1072
case 'messagebox': {
1073
// Display a message box
1074
- if (data.title && data.msg) {
1074
+ if (data.title && data.msg)
1075
+ {
1076
MeshServerLogEx(18, [data.title, data.msg], "Displaying message box, title=" + data.title + ", message=" + data.msg, data);
1076
- try { require('message-box').create(data.title, data.msg, 120).then(function () { }).catch(function () { }); } catch (ex) { }
1077
+ if (process.platform == 'win32')
1078
+ {
1079
+ if(global._clientmessage)
1080
+ {
1081
+ global._clientmessage.addMessage(data.msg);
1082
+ }
1083
+ else
1084
+ {
1085
+ try
1086
+ {
1087
+ require('win-dialog');
1088
+ var ipr = server_getUserImage(data.userid);
1089
+ ipr.title = data.title;
1090
+ ipr.message = data.msg;
1091
+ ipr.username = data.username;
1092
+ global._clientmessage = ipr.then(function (img)
1093
+ {
1094
+ this.messagebox = require('win-dialog').create(this.title, this.message, this.username, { timeout: 120000, b64Image: img.split(',').pop() });
1095
+ this.__childPromise.addMessage = this.messagebox.addMessage.bind(this.messagebox);
1096
+ return (this.messagebox);
1097
+ });
1098
+
1099
+ global._clientmessage.then(function () { global._clientmessage = null; });
1100
+ }
1101
+ catch(z)
1102
+ {
1103
+ try { require('message-box').create(data.title, data.msg, 120).then(function () { }).catch(function () { }); } catch (ex) { }
1104
+ }
1105
+ }
1106
+ }
1107
+ else
1108
+ {
1109
+ try { require('message-box').create(data.title, data.msg, 120).then(function () { }).catch(function () { }); } catch (ex) { }
1110
+ }
1111
}
1112
break;
1113
}