Erweiterungen

This commit is contained in:
Sven committed 2024-01-31 09:41:33 +01:00
1 parent 957b944b55
commit 2ca11f87a3
1 file changed
+15 -12
+15 -12
View File
@@ -144,11 +144,11 @@ Future<List<Widget>> _createListEntries() async {
const SizedBox(height: 20), const SizedBox(height: 20),
Row(children: [ Row(children: [
Expanded( Expanded(
child: getDefaultButton(!job.global ? 'Ablehnen' : 'Ignorieren', () => { _sendAnswer(!job.global ? 2: 3)}), child: getDefaultButton(!job.global ? 'Ablehnen' : 'Ignorieren', () => { _sendAnswer(job, !job.global ? 2: 3)}),
), ),
const SizedBox(width: 20), const SizedBox(width: 20),
Expanded( Expanded(
child: getDefaultButton('Annehmen', () => {_sendAnswer(1)}), child: getDefaultButton('Annehmen', () => {_sendAnswer(job, 1)}),
) )
]) ])
], ],
@@ -194,15 +194,18 @@ private void SendAnswer(int item)
} }
*/ */
_sendAnswer(int item) { _sendAnswer(Job job, int item) {
var answer = AcceptJobMessage(); var message = AcceptJobMessage();
answer.reaction = Reaction(); message.reaction = Reaction();
answer.reaction.item = item; message.reaction.id = job.id.toString();
answer.reaction.id = const Uuid().v4().toString(); message.reaction.ver = job.ver.toString();
answer.reaction.track = Track(); message.reaction.item = item;
answer.reaction.track.time = DateTime.now().toUtc().toIso8601String(); message.reaction.track = Track();
message.reaction.track.time = DateTime.now().toUtc().toIso8601String();
message.reaction.track.pos = Pos();
message.reaction.track.pos.lat = 0;
message.reaction.track.pos.long = 0;
message.reaction.track.pos.acc = 1;
var json = answer.toJson(); MqttCore.instance.publishPayloadMessage("server", message.toJson());
MqttCore.instance.publishPayloadMessage("server", json);
} }