Erweiterungen

This commit is contained in:
Sven committed 2024-05-29 20:34:22 +02:00
1 parent 17e7ce6fad
commit 054dfe616e
14 files changed
+297 -189

No files matched your search

+6 -6
View File
@@ -165,14 +165,16 @@ class MqttCore {
try {
final MqttPublishMessage message = mqttMessage.payload as MqttPublishMessage;
var messageBytes = message.payload.message;
String payload = utf8.decode(GZipDecoder().decodeBytes(messageBytes));
var topicArray = message.variableHeader?.topicName;
var topicArraySplited = topicArray!.split("/");
var topic = topicArraySplited[6];
Util.logInfo('message received\ntopic: $topic\nmessage: $payload');
Util.logInfo('message received\ntopic: $topic\n');
var messageBytes = message.payload.message;
String payload = utf8.decode(GZipDecoder().decodeBytes(messageBytes));
Util.logInfo('$topic\nmessage: $payload');
switch (topic) {
case 'session':
@@ -347,8 +349,6 @@ class MqttCore {
await Util.playMp3('asbeep.mp3');
MessageService().publish<MessageReceivedMessage>(Constants.messageTopicMessageReceived, arguments: MessageReceivedMessage(message: newMessage));
}
+29 -1
View File
@@ -360,6 +360,19 @@ String mapTourMode(String mode) {
return text;
}
Future<void> showQuestionDialog(BuildContext context, String title, String message, List<Widget> actions) async {
await showDialog(
context: context,
builder: (context) {
return AlertDialog(
title: Text(title),
content: Text(message),
actions: actions,
);
}
);
}
Future<void> showAlertDialog(BuildContext context, String title, String message) async {
await showDialog(
context: context,
@@ -406,4 +419,19 @@ class DecimalTextInputFormatter extends TextInputFormatter {
bool isJobInFuture(Job job) {
return DateTime.parse(job.ordertime).add(Duration(minutes: job.offsWarn)).toUtc().millisecondsSinceEpoch > DateTime.now().toUtc().millisecondsSinceEpoch;
}
}
Future<bool> taskDialogSecurityException(BuildContext context) async {
bool close = false;
await showQuestionDialog(context, "Achtung", "Wenn Sie den Dialog jetzt schließen gehen erfasste Daten verloren und die Aufgabe oder Station bleibt unerledigt.", [
TextButton(onPressed: () => {Navigator.of(context).pop(), close = true}, child: const Text('Schließen')),
TextButton(onPressed: () => {Navigator.of(context).pop(), close = false}, child: const Text('Zurück')),
]);
if (close) {
Navigator.of(context).pop();
}
return close;
}