Location Status eingebaut
Ranking wieder teilaktivert.
This commit is contained in:
1 parent
276b337b62
commit
cfbc0cf765
12 files changed
+566
-862
No files matched your search
@@ -1,17 +1,19 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:isar/isar.dart';
|
||||
import 'package:stadtbote/content_views/utils/content_view_widget.dart';
|
||||
import 'package:stadtbote/content_views/utils/header_info.dart';
|
||||
//import 'package:stadtbote/model/ranking.dart';
|
||||
import 'package:stadtbote/main.dart';
|
||||
import 'package:stadtbote/model/rank.dart';
|
||||
import 'package:stadtbote/popups/tasks_popups/zip_popup.dart';
|
||||
import 'package:stadtbote/protocoll_messages/zip_message.dart';
|
||||
import 'package:stadtbote/tools/constants.dart';
|
||||
import 'package:stadtbote/tools/message_service.dart';
|
||||
import 'package:stadtbote/tools/mqtt_core.dart';
|
||||
|
||||
import '../tools/util.dart';
|
||||
|
||||
enum ModeEnum {
|
||||
set,
|
||||
request
|
||||
}
|
||||
|
||||
class ApproachAreaPage extends ContentViewWidget {
|
||||
const ApproachAreaPage({super.key});
|
||||
|
||||
@@ -38,7 +40,7 @@ class ApproachAreaPage extends ContentViewWidget {
|
||||
}
|
||||
|
||||
class _ApproachAreaPageState extends State<ApproachAreaPage> {
|
||||
//late Ranking? _ranking;
|
||||
late List<Rank>? _ranking;
|
||||
|
||||
late bool _initCompleted = false;
|
||||
|
||||
@@ -47,10 +49,12 @@ class _ApproachAreaPageState extends State<ApproachAreaPage> {
|
||||
super.initState();
|
||||
|
||||
Future.delayed(const Duration(seconds: 0), () async {
|
||||
//_ranking = await MyApp.isarInstance.rankings.where().findFirst();
|
||||
_ranking = await MyApp.isarInstance.ranks.where().findAll();
|
||||
|
||||
_initCompleted = true;
|
||||
|
||||
_sendZip(Rank(), "24893");
|
||||
|
||||
setState(() {});
|
||||
});
|
||||
|
||||
@@ -88,16 +92,16 @@ class _ApproachAreaPageState extends State<ApproachAreaPage> {
|
||||
List<Widget> _fillColumns() {
|
||||
List<Widget> columns = [];
|
||||
|
||||
/*if (_ranking != null) {
|
||||
for (int i = 0; i < _ranking!.ranks.length; i++) {
|
||||
var rank = _ranking!.ranks[i];
|
||||
if (_ranking != null) {
|
||||
for (int i = 0; i < _ranking!.length; i++) {
|
||||
var rank = _ranking![i];
|
||||
|
||||
List<Widget> entries = [];
|
||||
entries.add(
|
||||
GestureDetector(
|
||||
onTap: () => {
|
||||
if (i == 0) {
|
||||
showZipPopup(context, 'ACHTUNG: Wenn Sie Ihre PLZ ändern, verlieren Sie Ihr Ranking!\n', 'Freimelden', (zip) => {_sendZip(rank, zip, ModeEnum.set)}),
|
||||
showZipPopup(context, 'ACHTUNG: Wenn Sie Ihre PLZ ändern, verlieren Sie Ihr Ranking!\n', 'Freimelden', (zip) => {_sendZip(rank, zip)}),
|
||||
}
|
||||
},
|
||||
child: Container(
|
||||
@@ -165,36 +169,31 @@ class _ApproachAreaPageState extends State<ApproachAreaPage> {
|
||||
),
|
||||
));
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
return columns;
|
||||
}
|
||||
|
||||
/*_sendZip(Rank rank, String zip, ModeEnum mode) {
|
||||
var zipMessage = ZipMessage();
|
||||
_sendZip(Rank rank, String zip) {
|
||||
var position = MyApp.currentPosition;
|
||||
|
||||
if (mode == ModeEnum.set) {
|
||||
var position = MyApp.currentPosition;
|
||||
var setPosMessage = ZipSetPos();
|
||||
setPosMessage.zip = zip;
|
||||
|
||||
zipMessage.setPos = ZipSetPos();
|
||||
zipMessage.setPos!.zip = zip;
|
||||
|
||||
if (position != null) {
|
||||
zipMessage.setPos!.track = ZipTrack();
|
||||
zipMessage.setPos!.track!.time = DateTime.now().toIso8601String();
|
||||
zipMessage.setPos!.track!.pos = ZipTrackPos();
|
||||
zipMessage.setPos!.track!.pos!.lat = position.latitude;
|
||||
zipMessage.setPos!.track!.pos!.long = position.longitude;
|
||||
zipMessage.setPos!.track!.pos!.acc = position.accuracy.toInt();
|
||||
}
|
||||
} else {
|
||||
zipMessage.reqZip = ZipReqZip();
|
||||
zipMessage.reqZip!.id = rank.id;
|
||||
zipMessage.reqZip!.zip = zip;
|
||||
if (position != null) {
|
||||
setPosMessage.track = ZipTrack();
|
||||
setPosMessage.track!.time = DateTime.now().toIso8601String();
|
||||
setPosMessage.track!.pos = ZipTrackPos();
|
||||
setPosMessage.track!.pos!.lat = position.latitude;
|
||||
setPosMessage.track!.pos!.long = position.longitude;
|
||||
setPosMessage.track!.pos!.acc = position.accuracy.toInt();
|
||||
}
|
||||
|
||||
MqttCore.instance.publishPayloadMessage("rank", zipMessage.toJson());
|
||||
}*/
|
||||
var json = jsonEncode(setPosMessage.toJson());
|
||||
Util.logInfo(json);
|
||||
|
||||
MqttCore.instance.publishMessage("set_zip", jsonEncode(setPosMessage.toJson()));
|
||||
}
|
||||
|
||||
_initMessages() {
|
||||
/*MessageService().subscribe<RankingUpdated>(Constants.messageTopicRankingUpdated, this, (rankingUpdateMessage) async {
|
||||
|
||||
@@ -13,7 +13,7 @@ import 'package:stadtbote/content_views/utils/header_info.dart';
|
||||
import 'package:stadtbote/model/job.dart';
|
||||
import 'package:stadtbote/model/message.dart';
|
||||
import 'package:stadtbote/model/session_status.dart';
|
||||
import 'package:stadtbote/model/status.dart';
|
||||
import 'package:stadtbote/model/location_status.dart';
|
||||
import 'package:stadtbote/popups/infos_popup.dart';
|
||||
import 'package:stadtbote/protocoll_messages/logout_message.dart';
|
||||
import 'package:stadtbote/tools/message_service.dart';
|
||||
@@ -265,7 +265,7 @@ class _MainPageState extends State<MainPage> {
|
||||
widget.sidValueNotifier.value = sessionStatusInfoUpdateMessage.status.sid;
|
||||
});
|
||||
|
||||
MessageService().subscribe<StatusInfoUpdate>(Constants.messageTopicStatusInfoUpdated, this, (statusInfoUpdateMessage) {
|
||||
MessageService().subscribe<LocationStatusUpdate>(Constants.messageTopicLocationStatusUpdated, this, (statusInfoUpdateMessage) {
|
||||
_updateHeader();
|
||||
});
|
||||
|
||||
@@ -303,11 +303,11 @@ class _MainPageState extends State<MainPage> {
|
||||
}
|
||||
|
||||
void _updateHeader() async {
|
||||
var status = await MyApp.isarInstance.status.where().findFirst();
|
||||
var status = await MyApp.isarInstance.locationStatus.where().findFirst();
|
||||
var sessionStatus = await MyApp.isarInstance.sessionStatus.where().findFirst();
|
||||
|
||||
if (status != null) {
|
||||
widget._zipValueNotifier.value = '${status.pos.zip} (${status.pos.zipReal})';
|
||||
widget._zipValueNotifier.value = '${status.zip} (${status.zipReal})';
|
||||
} else if (sessionStatus != null) {
|
||||
widget._zipValueNotifier.value = sessionStatus.locZip;
|
||||
} else {
|
||||
|
||||
+5
-3
@@ -8,7 +8,8 @@ import 'package:stadtbote/messages/pop_content_view_message.dart';
|
||||
import 'package:stadtbote/model/enqueued_message.dart';
|
||||
import 'package:stadtbote/model/log_entry.dart';
|
||||
import 'package:stadtbote/model/message.dart';
|
||||
import 'package:stadtbote/model/status.dart';
|
||||
import 'package:stadtbote/model/rank.dart';
|
||||
import 'package:stadtbote/model/location_status.dart';
|
||||
import 'package:stadtbote/model/task_info.dart';
|
||||
import 'package:stadtbote/popups/accept_jobs_popup.dart';
|
||||
import 'package:stadtbote/tools/colored_safe_area.dart';
|
||||
@@ -32,12 +33,13 @@ Future<void> main() async {
|
||||
final dir = await getApplicationDocumentsDirectory();
|
||||
MyApp.isarInstance = await Isar.open([
|
||||
SessionStatusSchema,
|
||||
StatusSchema,
|
||||
LocationStatusSchema,
|
||||
JobSchema,
|
||||
TaskInfoSchema,
|
||||
MessageSchema,
|
||||
EnqueuedMessageSchema,
|
||||
LogEntrySchema
|
||||
LogEntrySchema,
|
||||
RankSchema
|
||||
], directory: dir.path);
|
||||
|
||||
runZonedGuarded(() {}, (error, stackTrace) {
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
import 'package:isar/isar.dart';
|
||||
import 'package:json_annotation/json_annotation.dart';
|
||||
|
||||
part 'location_status.g.dart';
|
||||
|
||||
@collection
|
||||
@JsonSerializable()
|
||||
class LocationStatus {
|
||||
Id? id = 0;
|
||||
|
||||
late String zip;
|
||||
|
||||
late String area;
|
||||
|
||||
@JsonKey(name:'zip_real')
|
||||
late String zipReal;
|
||||
|
||||
LocationStatus();
|
||||
|
||||
factory LocationStatus.fromJson(Map<String, dynamic> json) => _$LocationStatusFromJson(json);
|
||||
|
||||
Map<String, dynamic> toJson() => _$LocationStatusToJson(this);
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,36 +0,0 @@
|
||||
import 'package:isar/isar.dart';
|
||||
import 'package:json_annotation/json_annotation.dart';
|
||||
|
||||
part 'status.g.dart';
|
||||
|
||||
@collection
|
||||
@JsonSerializable()
|
||||
class Status {
|
||||
@JsonKey(name: "id", defaultValue: 0)
|
||||
Id? id;
|
||||
|
||||
late StatusPos pos;
|
||||
|
||||
Status();
|
||||
|
||||
factory Status.fromJson(Map<String, dynamic> json) => _$StatusFromJson(json);
|
||||
|
||||
Map<String, dynamic> toJson() => _$StatusToJson(this);
|
||||
}
|
||||
|
||||
@embedded
|
||||
@JsonSerializable()
|
||||
class StatusPos {
|
||||
late String zip;
|
||||
|
||||
late String area;
|
||||
|
||||
@JsonKey(name:'zip_real')
|
||||
late String zipReal;
|
||||
|
||||
StatusPos();
|
||||
|
||||
factory StatusPos.fromJson(Map<String, dynamic> json) => _$StatusPosFromJson(json);
|
||||
|
||||
Map<String, dynamic> toJson() => _$StatusPosToJson(this);
|
||||
}
|
||||
@@ -3,59 +3,6 @@ import 'package:json_annotation/json_annotation.dart';
|
||||
|
||||
part 'zip_message.g.dart';
|
||||
|
||||
/*
|
||||
{
|
||||
"recv": "rank",
|
||||
"payload": {
|
||||
"set_pos": {
|
||||
"zip": "22525",
|
||||
"track": {
|
||||
"time": "2021-03-01T12:55:51Z",
|
||||
"pos":
|
||||
{
|
||||
"lat": 53.595121,
|
||||
"long": 9.907433,
|
||||
"acc": 35
|
||||
}
|
||||
}
|
||||
},
|
||||
"reg_zip": {
|
||||
"id": 2,
|
||||
"zip": "22039"
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
@JsonSerializable()
|
||||
class ZipMessage {
|
||||
@JsonKey(name: "set_pos")
|
||||
ZipSetPos? setPos;
|
||||
|
||||
@JsonKey(name: "req_zip")
|
||||
ZipReqZip? reqZip;
|
||||
|
||||
ZipMessage();
|
||||
|
||||
factory ZipMessage.fromJson(Map<String, dynamic> json) => _$ZipMessageFromJson(json);
|
||||
|
||||
Map<String, dynamic> toJson() => _$ZipMessageToJson(this);
|
||||
}
|
||||
|
||||
@embedded
|
||||
@JsonSerializable()
|
||||
class ZipReqZip {
|
||||
late int id;
|
||||
|
||||
late String zip;
|
||||
|
||||
ZipReqZip();
|
||||
|
||||
factory ZipReqZip.fromJson(Map<String, dynamic> json) => _$ZipReqZipFromJson(json);
|
||||
|
||||
Map<String, dynamic> toJson() => _$ZipReqZipToJson(this);
|
||||
}
|
||||
|
||||
@embedded
|
||||
@JsonSerializable()
|
||||
class ZipSetPos {
|
||||
@@ -99,22 +46,3 @@ class ZipTrackPos {
|
||||
|
||||
Map<String, dynamic> toJson() => _$ZipTrackPosToJson(this);
|
||||
}
|
||||
|
||||
/*
|
||||
@JsonSerializable()
|
||||
class MessageContent
|
||||
{
|
||||
late String text;
|
||||
|
||||
late String subj;
|
||||
|
||||
late String time;
|
||||
|
||||
MessageContent();
|
||||
|
||||
factory MessageContent.fromJson(Map<String, dynamic> json) => _$MessageContentFromJson(json);
|
||||
|
||||
Map<String, dynamic> toJson() => _$MessageContentToJson(this);
|
||||
}
|
||||
|
||||
*/
|
||||
@@ -9,267 +9,6 @@ part of 'zip_message.dart';
|
||||
// coverage:ignore-file
|
||||
// ignore_for_file: duplicate_ignore, non_constant_identifier_names, constant_identifier_names, invalid_use_of_protected_member, unnecessary_cast, prefer_const_constructors, lines_longer_than_80_chars, require_trailing_commas, inference_failure_on_function_invocation, unnecessary_parenthesis, unnecessary_raw_strings, unnecessary_null_checks, join_return_with_assignment, prefer_final_locals, avoid_js_rounded_ints, avoid_positional_boolean_parameters, always_specify_types
|
||||
|
||||
const ZipReqZipSchema = Schema(
|
||||
name: r'ZipReqZip',
|
||||
id: 2176882141139579108,
|
||||
properties: {
|
||||
r'id': PropertySchema(
|
||||
id: 0,
|
||||
name: r'id',
|
||||
type: IsarType.long,
|
||||
),
|
||||
r'zip': PropertySchema(
|
||||
id: 1,
|
||||
name: r'zip',
|
||||
type: IsarType.string,
|
||||
)
|
||||
},
|
||||
estimateSize: _zipReqZipEstimateSize,
|
||||
serialize: _zipReqZipSerialize,
|
||||
deserialize: _zipReqZipDeserialize,
|
||||
deserializeProp: _zipReqZipDeserializeProp,
|
||||
);
|
||||
|
||||
int _zipReqZipEstimateSize(
|
||||
ZipReqZip object,
|
||||
List<int> offsets,
|
||||
Map<Type, List<int>> allOffsets,
|
||||
) {
|
||||
var bytesCount = offsets.last;
|
||||
bytesCount += 3 + object.zip.length * 3;
|
||||
return bytesCount;
|
||||
}
|
||||
|
||||
void _zipReqZipSerialize(
|
||||
ZipReqZip object,
|
||||
IsarWriter writer,
|
||||
List<int> offsets,
|
||||
Map<Type, List<int>> allOffsets,
|
||||
) {
|
||||
writer.writeLong(offsets[0], object.id);
|
||||
writer.writeString(offsets[1], object.zip);
|
||||
}
|
||||
|
||||
ZipReqZip _zipReqZipDeserialize(
|
||||
Id id,
|
||||
IsarReader reader,
|
||||
List<int> offsets,
|
||||
Map<Type, List<int>> allOffsets,
|
||||
) {
|
||||
final object = ZipReqZip();
|
||||
object.id = reader.readLong(offsets[0]);
|
||||
object.zip = reader.readString(offsets[1]);
|
||||
return object;
|
||||
}
|
||||
|
||||
P _zipReqZipDeserializeProp<P>(
|
||||
IsarReader reader,
|
||||
int propertyId,
|
||||
int offset,
|
||||
Map<Type, List<int>> allOffsets,
|
||||
) {
|
||||
switch (propertyId) {
|
||||
case 0:
|
||||
return (reader.readLong(offset)) as P;
|
||||
case 1:
|
||||
return (reader.readString(offset)) as P;
|
||||
default:
|
||||
throw IsarError('Unknown property with id $propertyId');
|
||||
}
|
||||
}
|
||||
|
||||
extension ZipReqZipQueryFilter
|
||||
on QueryBuilder<ZipReqZip, ZipReqZip, QFilterCondition> {
|
||||
QueryBuilder<ZipReqZip, ZipReqZip, QAfterFilterCondition> idEqualTo(
|
||||
int value) {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addFilterCondition(FilterCondition.equalTo(
|
||||
property: r'id',
|
||||
value: value,
|
||||
));
|
||||
});
|
||||
}
|
||||
|
||||
QueryBuilder<ZipReqZip, ZipReqZip, QAfterFilterCondition> idGreaterThan(
|
||||
int value, {
|
||||
bool include = false,
|
||||
}) {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addFilterCondition(FilterCondition.greaterThan(
|
||||
include: include,
|
||||
property: r'id',
|
||||
value: value,
|
||||
));
|
||||
});
|
||||
}
|
||||
|
||||
QueryBuilder<ZipReqZip, ZipReqZip, QAfterFilterCondition> idLessThan(
|
||||
int value, {
|
||||
bool include = false,
|
||||
}) {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addFilterCondition(FilterCondition.lessThan(
|
||||
include: include,
|
||||
property: r'id',
|
||||
value: value,
|
||||
));
|
||||
});
|
||||
}
|
||||
|
||||
QueryBuilder<ZipReqZip, ZipReqZip, QAfterFilterCondition> idBetween(
|
||||
int lower,
|
||||
int upper, {
|
||||
bool includeLower = true,
|
||||
bool includeUpper = true,
|
||||
}) {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addFilterCondition(FilterCondition.between(
|
||||
property: r'id',
|
||||
lower: lower,
|
||||
includeLower: includeLower,
|
||||
upper: upper,
|
||||
includeUpper: includeUpper,
|
||||
));
|
||||
});
|
||||
}
|
||||
|
||||
QueryBuilder<ZipReqZip, ZipReqZip, QAfterFilterCondition> zipEqualTo(
|
||||
String value, {
|
||||
bool caseSensitive = true,
|
||||
}) {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addFilterCondition(FilterCondition.equalTo(
|
||||
property: r'zip',
|
||||
value: value,
|
||||
caseSensitive: caseSensitive,
|
||||
));
|
||||
});
|
||||
}
|
||||
|
||||
QueryBuilder<ZipReqZip, ZipReqZip, QAfterFilterCondition> zipGreaterThan(
|
||||
String value, {
|
||||
bool include = false,
|
||||
bool caseSensitive = true,
|
||||
}) {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addFilterCondition(FilterCondition.greaterThan(
|
||||
include: include,
|
||||
property: r'zip',
|
||||
value: value,
|
||||
caseSensitive: caseSensitive,
|
||||
));
|
||||
});
|
||||
}
|
||||
|
||||
QueryBuilder<ZipReqZip, ZipReqZip, QAfterFilterCondition> zipLessThan(
|
||||
String value, {
|
||||
bool include = false,
|
||||
bool caseSensitive = true,
|
||||
}) {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addFilterCondition(FilterCondition.lessThan(
|
||||
include: include,
|
||||
property: r'zip',
|
||||
value: value,
|
||||
caseSensitive: caseSensitive,
|
||||
));
|
||||
});
|
||||
}
|
||||
|
||||
QueryBuilder<ZipReqZip, ZipReqZip, QAfterFilterCondition> zipBetween(
|
||||
String lower,
|
||||
String upper, {
|
||||
bool includeLower = true,
|
||||
bool includeUpper = true,
|
||||
bool caseSensitive = true,
|
||||
}) {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addFilterCondition(FilterCondition.between(
|
||||
property: r'zip',
|
||||
lower: lower,
|
||||
includeLower: includeLower,
|
||||
upper: upper,
|
||||
includeUpper: includeUpper,
|
||||
caseSensitive: caseSensitive,
|
||||
));
|
||||
});
|
||||
}
|
||||
|
||||
QueryBuilder<ZipReqZip, ZipReqZip, QAfterFilterCondition> zipStartsWith(
|
||||
String value, {
|
||||
bool caseSensitive = true,
|
||||
}) {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addFilterCondition(FilterCondition.startsWith(
|
||||
property: r'zip',
|
||||
value: value,
|
||||
caseSensitive: caseSensitive,
|
||||
));
|
||||
});
|
||||
}
|
||||
|
||||
QueryBuilder<ZipReqZip, ZipReqZip, QAfterFilterCondition> zipEndsWith(
|
||||
String value, {
|
||||
bool caseSensitive = true,
|
||||
}) {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addFilterCondition(FilterCondition.endsWith(
|
||||
property: r'zip',
|
||||
value: value,
|
||||
caseSensitive: caseSensitive,
|
||||
));
|
||||
});
|
||||
}
|
||||
|
||||
QueryBuilder<ZipReqZip, ZipReqZip, QAfterFilterCondition> zipContains(
|
||||
String value,
|
||||
{bool caseSensitive = true}) {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addFilterCondition(FilterCondition.contains(
|
||||
property: r'zip',
|
||||
value: value,
|
||||
caseSensitive: caseSensitive,
|
||||
));
|
||||
});
|
||||
}
|
||||
|
||||
QueryBuilder<ZipReqZip, ZipReqZip, QAfterFilterCondition> zipMatches(
|
||||
String pattern,
|
||||
{bool caseSensitive = true}) {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addFilterCondition(FilterCondition.matches(
|
||||
property: r'zip',
|
||||
wildcard: pattern,
|
||||
caseSensitive: caseSensitive,
|
||||
));
|
||||
});
|
||||
}
|
||||
|
||||
QueryBuilder<ZipReqZip, ZipReqZip, QAfterFilterCondition> zipIsEmpty() {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addFilterCondition(FilterCondition.equalTo(
|
||||
property: r'zip',
|
||||
value: '',
|
||||
));
|
||||
});
|
||||
}
|
||||
|
||||
QueryBuilder<ZipReqZip, ZipReqZip, QAfterFilterCondition> zipIsNotEmpty() {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addFilterCondition(FilterCondition.greaterThan(
|
||||
property: r'zip',
|
||||
value: '',
|
||||
));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
extension ZipReqZipQueryObject
|
||||
on QueryBuilder<ZipReqZip, ZipReqZip, QFilterCondition> {}
|
||||
|
||||
// coverage:ignore-file
|
||||
// ignore_for_file: duplicate_ignore, non_constant_identifier_names, constant_identifier_names, invalid_use_of_protected_member, unnecessary_cast, prefer_const_constructors, lines_longer_than_80_chars, require_trailing_commas, inference_failure_on_function_invocation, unnecessary_parenthesis, unnecessary_raw_strings, unnecessary_null_checks, join_return_with_assignment, prefer_final_locals, avoid_js_rounded_ints, avoid_positional_boolean_parameters, always_specify_types
|
||||
|
||||
const ZipSetPosSchema = Schema(
|
||||
name: r'ZipSetPos',
|
||||
id: 2736271830323112702,
|
||||
@@ -1039,29 +778,6 @@ extension ZipTrackPosQueryObject
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
ZipMessage _$ZipMessageFromJson(Map<String, dynamic> json) => ZipMessage()
|
||||
..setPos = json['set_pos'] == null
|
||||
? null
|
||||
: ZipSetPos.fromJson(json['set_pos'] as Map<String, dynamic>)
|
||||
..reqZip = json['req_zip'] == null
|
||||
? null
|
||||
: ZipReqZip.fromJson(json['req_zip'] as Map<String, dynamic>);
|
||||
|
||||
Map<String, dynamic> _$ZipMessageToJson(ZipMessage instance) =>
|
||||
<String, dynamic>{
|
||||
'set_pos': instance.setPos,
|
||||
'req_zip': instance.reqZip,
|
||||
};
|
||||
|
||||
ZipReqZip _$ZipReqZipFromJson(Map<String, dynamic> json) => ZipReqZip()
|
||||
..id = json['id'] as int
|
||||
..zip = json['zip'] as String;
|
||||
|
||||
Map<String, dynamic> _$ZipReqZipToJson(ZipReqZip instance) => <String, dynamic>{
|
||||
'id': instance.id,
|
||||
'zip': instance.zip,
|
||||
};
|
||||
|
||||
ZipSetPos _$ZipSetPosFromJson(Map<String, dynamic> json) => ZipSetPos()
|
||||
..zip = json['zip'] as String
|
||||
..track = json['track'] == null
|
||||
|
||||
@@ -7,7 +7,7 @@ class Constants {
|
||||
static const String messageTopicConnectionStatusChanged = "connection_status_changed";
|
||||
static const String messageTopicSessionInfoUpdate = "status_info_updated";
|
||||
static const String messageTopicSessionStatusInfoUpdate = "session_status_info_updated";
|
||||
static const String messageTopicStatusInfoUpdated = "status_info_updated";
|
||||
static const String messageTopicLocationStatusUpdated = "status_info_updated";
|
||||
static const String messageTopicRankingUpdated = "ranking_updated";
|
||||
static const String messageTopicJobReceived = "job_received";
|
||||
static const String messageTopicJobDeleted = "job_deleted";
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import 'package:stadtbote/model/status.dart';
|
||||
import 'package:stadtbote/model/location_status.dart';
|
||||
|
||||
class StatusInfoUpdate {
|
||||
StatusInfoUpdate({required this.status});
|
||||
class LocationStatusUpdate {
|
||||
LocationStatusUpdate({required this.status});
|
||||
|
||||
final Status status;
|
||||
final LocationStatus status;
|
||||
}
|
||||
+10
-10
@@ -12,7 +12,7 @@ import 'package:stadtbote/model/enqueued_message.dart';
|
||||
import 'package:stadtbote/model/job.dart';
|
||||
import 'package:stadtbote/model/log_entry.dart';
|
||||
import 'package:stadtbote/model/message.dart';
|
||||
import 'package:stadtbote/model/status.dart';
|
||||
import 'package:stadtbote/model/location_status.dart';
|
||||
import 'package:stadtbote/protocoll_messages/acknowledge_job.dart';
|
||||
import 'package:stadtbote/protocoll_messages/bootstrap_request.dart';
|
||||
import 'package:stadtbote/protocoll_messages/bootstrap_response_payload.dart';
|
||||
@@ -170,12 +170,12 @@ class MqttCore {
|
||||
_sessionMessageReceived(jsonDecode(payload));
|
||||
break;
|
||||
|
||||
case 'status':
|
||||
_statusMessageReceived(jsonDecode(payload));
|
||||
case 'location_status':
|
||||
_locationSatusMessageReceived(jsonDecode(payload));
|
||||
break;
|
||||
|
||||
case 'ranks':
|
||||
//_rankingMessageReceived(messageData);
|
||||
case 'ranking':
|
||||
_rankingMessageReceived(jsonDecode(payload));
|
||||
break;
|
||||
|
||||
case 'job':
|
||||
@@ -235,15 +235,15 @@ class MqttCore {
|
||||
_startTrackTimer();
|
||||
}
|
||||
|
||||
void _statusMessageReceived(payloadData) async {
|
||||
var statusMessage = Status.fromJson(payloadData);
|
||||
void _locationSatusMessageReceived(payloadData) async {
|
||||
var locationStatus = LocationStatus.fromJson(payloadData);
|
||||
|
||||
await MyApp.isarInstance.writeTxn(() async {
|
||||
await MyApp.isarInstance.status.clear();
|
||||
await MyApp.isarInstance.status.put(statusMessage);
|
||||
await MyApp.isarInstance.locationStatus.clear();
|
||||
await MyApp.isarInstance.locationStatus.put(locationStatus);
|
||||
});
|
||||
|
||||
MessageService().publish<StatusInfoUpdate>(Constants.messageTopicStatusInfoUpdated, arguments: StatusInfoUpdate(status: statusMessage));
|
||||
MessageService().publish<LocationStatusUpdate>(Constants.messageTopicLocationStatusUpdated, arguments: LocationStatusUpdate(status: locationStatus));
|
||||
}
|
||||
|
||||
void _rankingMessageReceived(List<dynamic> payloadData) async {
|
||||
|
||||
Reference in new issue
Block a user