Fehlerkorrekturen und Erweiterungen
This commit is contained in:
1 parent
6c4294512e
commit
b3d010b453
29 files changed
+430
-212
No files matched your search
@@ -192,13 +192,10 @@ class _ApproachAreaPageState extends State<ApproachAreaPage> with ProducerMixin,
|
||||
setPosMessage.track!.pos!.acc = position.accuracy.toInt();
|
||||
}
|
||||
|
||||
// TODO MESSAGING
|
||||
sendMessage(
|
||||
routingKey: Constants.messageTopicPublishPayload,
|
||||
payload: PublishPayloadMessage(topic: "set_zip", message: setPosMessage.toJson(), acknowledgeRequired: false),
|
||||
);
|
||||
|
||||
//await MessageService().publish<PublishPayloadMessage>(Constants.messageTopicPublishPayload, arguments: PublishPayloadMessage(topic: "set_zip", message: setPosMessage.toJson(), qos: MqttQos.exactlyOnce));
|
||||
}
|
||||
|
||||
_initMessages() {
|
||||
@@ -210,11 +207,6 @@ class _ApproachAreaPageState extends State<ApproachAreaPage> with ProducerMixin,
|
||||
setState(() {});
|
||||
},
|
||||
);
|
||||
/*MessageService().subscribe<RankingUpdated>(Constants.messageTopicRankingUpdated, this, (rankingUpdateMessage) async {
|
||||
_ranking = await MyApp.isarInstance.rankings.where().findFirst();
|
||||
|
||||
setState(() {});
|
||||
});*/
|
||||
}
|
||||
}
|
||||
|
||||
@@ -253,13 +245,10 @@ class _HeaderWidgetState extends State<_HeaderWidget> with ProducerMixin {
|
||||
child: FittedBox(
|
||||
child: GestureDetector(
|
||||
onTap: () async {
|
||||
// TODO MESSAGING
|
||||
sendMessage(
|
||||
routingKey: Constants.messageTopicPopContentView,
|
||||
payload: PopContentViewMessage(count: 1),
|
||||
);
|
||||
|
||||
//await MessageService().publish<PopContentViewMessage>(Constants.messageTopicPopContentView, arguments: PopContentViewMessage(count: 1));
|
||||
},
|
||||
child: const CircleAvatar(
|
||||
radius: 10,
|
||||
@@ -282,13 +271,10 @@ class _HeaderWidgetState extends State<_HeaderWidget> with ProducerMixin {
|
||||
child: FittedBox(
|
||||
child: GestureDetector(
|
||||
onTap: () async {
|
||||
// TODO MESSAGING
|
||||
sendMessage(
|
||||
routingKey: Constants.messageTopicPopContentView,
|
||||
payload: PopContentViewMessage(count: 1),
|
||||
);
|
||||
|
||||
//await MessageService().publish<PopContentViewMessage>(Constants.messageTopicPopContentView, arguments: PopContentViewMessage(count: 1));
|
||||
},
|
||||
child: const CircleAvatar(
|
||||
backgroundColor: Constants.colorPrimary,
|
||||
|
||||
@@ -66,6 +66,11 @@ class _FinishedJobsPageState extends State<FinishedJobsPage> with ProducerMixin
|
||||
List<Widget> jobWidgets = [];
|
||||
|
||||
for (var job in _jobs) {
|
||||
var bottomText = "${job.id}\n${job.tours[0].comp}\n${job.tours[0].street}\n${job.tours[0].city}";
|
||||
if (job.rem.trim().isNotEmpty) {
|
||||
bottomText += "\n\n${job.rem.trim()}";
|
||||
}
|
||||
|
||||
jobWidgets.add(
|
||||
ListTile(
|
||||
onTap: () {
|
||||
@@ -100,19 +105,7 @@ class _FinishedJobsPageState extends State<FinishedJobsPage> with ProducerMixin
|
||||
],
|
||||
),
|
||||
Text(
|
||||
job.id.toString(),
|
||||
textAlign: TextAlign.left,
|
||||
),
|
||||
Text(
|
||||
job.tours[0].comp,
|
||||
textAlign: TextAlign.left,
|
||||
),
|
||||
Text(
|
||||
job.tours[0].street,
|
||||
textAlign: TextAlign.left,
|
||||
),
|
||||
Text(
|
||||
job.tours[0].city,
|
||||
bottomText,
|
||||
textAlign: TextAlign.left,
|
||||
),
|
||||
],
|
||||
|
||||
@@ -222,7 +222,7 @@ class _MainPageState extends State<MainPage> with ConsumerMixin, ProducerMixin {
|
||||
),
|
||||
SizedBox(height: _loggedOut == true ? 0 : 20),
|
||||
Visibility(
|
||||
visible: !_loggedOut,
|
||||
visible: !_loggedOut && Util.preferencesGetBool(Constants.prefsBWVEnabled, false),
|
||||
child: getDefaultButton(
|
||||
'Wunschziel für heute',
|
||||
image: Image.asset('assets/wunsch_plz.png', width: 30, height: 30),
|
||||
|
||||
@@ -420,13 +420,10 @@ class _TaskListPageState extends State<TaskListPage> with ProducerMixin {
|
||||
|
||||
_finishTaskProcessing(taskInfo);
|
||||
|
||||
// TODO MESSAGING
|
||||
sendMessage(
|
||||
routingKey: Constants.messageTopicPopContentView,
|
||||
payload: PopContentViewMessage(count: 2),
|
||||
);
|
||||
|
||||
//await MessageService().publish<PopContentViewMessage>(Constants.messageTopicPopContentView, arguments: PopContentViewMessage(count: 2));
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -524,14 +521,11 @@ class _TaskListPageState extends State<TaskListPage> with ProducerMixin {
|
||||
}
|
||||
}
|
||||
|
||||
// TODO MESSAGING
|
||||
sendMessage(
|
||||
routingKey: Constants.messageTopicPublishPayload,
|
||||
payload: PublishPayloadMessage(topic: "fin_tour", message: finTourMessage.toJson(), acknowledgeRequired: true),
|
||||
);
|
||||
|
||||
//await MessageService().publish<PublishPayloadMessage>(Constants.messageTopicPublishPayload, arguments: PublishPayloadMessage(topic: "fin_tour", message: finTourMessage.toJson(), qos: MqttQos.exactlyOnce));
|
||||
|
||||
widget.tour.state = Constants.stateFinishedNotConfirmed;
|
||||
|
||||
await MyApp.isarInstance.writeTxn(() async {
|
||||
@@ -555,14 +549,11 @@ class _TaskListPageState extends State<TaskListPage> with ProducerMixin {
|
||||
message.time = DateTime.now().millisecondsSinceEpoch;
|
||||
message.data = picture.data;
|
||||
|
||||
// TODO MESSAGING
|
||||
sendMessage(
|
||||
routingKey: Constants.messageTopicPublishPayload,
|
||||
payload: PublishPayloadMessage(topic: "pic", message: message.toJson(), acknowledgeRequired: true),
|
||||
);
|
||||
|
||||
//await MessageService().publish<PublishPayloadMessage>(Constants.messageTopicPublishPayload, arguments: PublishPayloadMessage(topic: "pic", message: message.toJson(), qos: MqttQos.exactlyOnce));
|
||||
|
||||
await MyApp.isarInstance.writeTxn(() async {
|
||||
await MyApp.isarInstance.pictures.delete(picture.id);
|
||||
});
|
||||
@@ -626,13 +617,10 @@ class _HeaderWidgetState extends State<_HeaderWidget> with ProducerMixin {
|
||||
child: FittedBox(
|
||||
child: GestureDetector(
|
||||
onTap: () async {
|
||||
// TODO MESSAGING
|
||||
sendMessage(
|
||||
routingKey: Constants.messageTopicPopContentView,
|
||||
payload: PopContentViewMessage(count: 1),
|
||||
);
|
||||
|
||||
//await MessageService().publish<PopContentViewMessage>(Constants.messageTopicPopContentView, arguments: PopContentViewMessage(count: 1));
|
||||
},
|
||||
child: const CircleAvatar(
|
||||
radius: 10,
|
||||
@@ -655,13 +643,10 @@ class _HeaderWidgetState extends State<_HeaderWidget> with ProducerMixin {
|
||||
child: FittedBox(
|
||||
child: GestureDetector(
|
||||
onTap: () async {
|
||||
// TODO MESSAGING
|
||||
sendMessage(
|
||||
routingKey: Constants.messageTopicPopContentView,
|
||||
payload: PopContentViewMessage(count: 1),
|
||||
);
|
||||
|
||||
//await MessageService().publish<PopContentViewMessage>(Constants.messageTopicPopContentView, arguments: PopContentViewMessage(count: 1));
|
||||
},
|
||||
child: const CircleAvatar(
|
||||
backgroundColor: Constants.colorPrimary,
|
||||
|
||||
@@ -91,14 +91,14 @@ class _TourListPageState extends State<TourListPage> with ProducerMixin {
|
||||
visible: widget.job.tours[0].pos != null,
|
||||
child: ElevatedButton(
|
||||
style: ButtonStyle(
|
||||
shape: MaterialStateProperty.all<RoundedRectangleBorder>(
|
||||
shape: WidgetStateProperty.all<RoundedRectangleBorder>(
|
||||
RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(8.0),
|
||||
side: const BorderSide(color: Colors.grey),
|
||||
),
|
||||
),
|
||||
backgroundColor: MaterialStateProperty.all<Color>(Colors.lightGreen),
|
||||
foregroundColor: MaterialStateProperty.all<Color>(Colors.black),
|
||||
backgroundColor: WidgetStateProperty.all<Color>(Colors.lightGreen),
|
||||
foregroundColor: WidgetStateProperty.all<Color>(Colors.black),
|
||||
),
|
||||
onPressed: () => {showMapPopup(context, widget.job.tours[0], widget.job.tours)},
|
||||
child: const Text("Karte")),
|
||||
@@ -198,13 +198,10 @@ class _TourListPageState extends State<TourListPage> with ProducerMixin {
|
||||
}
|
||||
|
||||
Future<void> _clicked(JobTour tour, bool readOnly) async {
|
||||
// TODO MESSAGING
|
||||
sendMessage(
|
||||
routingKey: Constants.messageTopicPushContentView,
|
||||
payload: TourDetailsPage(job: widget.job, tour: tour, readOnly: readOnly),
|
||||
);
|
||||
|
||||
//await MessageService().publish<ContentViewWidget>(Constants.messageTopicPushContentView, arguments: TourDetailsPage(job: widget.job, tour: tour, readOnly: readOnly));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -243,13 +240,10 @@ class _HeaderWidgetState extends State<_HeaderWidget> with ProducerMixin {
|
||||
child: FittedBox(
|
||||
child: GestureDetector(
|
||||
onTap: () async {
|
||||
// TODO MESSAGING
|
||||
sendMessage(
|
||||
routingKey: Constants.messageTopicPopContentView,
|
||||
payload: PopContentViewMessage(count: 1),
|
||||
);
|
||||
|
||||
//await MessageService().publish<PopContentViewMessage>(Constants.messageTopicPopContentView, arguments: PopContentViewMessage(count: 1));
|
||||
},
|
||||
child: const CircleAvatar(
|
||||
radius: 10,
|
||||
@@ -272,13 +266,10 @@ class _HeaderWidgetState extends State<_HeaderWidget> with ProducerMixin {
|
||||
child: FittedBox(
|
||||
child: GestureDetector(
|
||||
onTap: () async {
|
||||
// TODO MESSAGING
|
||||
sendMessage(
|
||||
routingKey: Constants.messageTopicPopContentView,
|
||||
payload: PopContentViewMessage(count: 1),
|
||||
);
|
||||
|
||||
//await MessageService().publish<PopContentViewMessage>(Constants.messageTopicPopContentView, arguments: PopContentViewMessage(count: 1));
|
||||
},
|
||||
child: const CircleAvatar(
|
||||
backgroundColor: Constants.colorPrimary,
|
||||
|
||||
@@ -26,6 +26,8 @@ class SessionStatus {
|
||||
late String serverVersion;
|
||||
@JsonKey(name: 'server_instance')
|
||||
late String serverInstance;
|
||||
@JsonKey(name: 'bwv', defaultValue: false, required: false)
|
||||
late bool bwvEnabled;
|
||||
|
||||
SessionStatus();
|
||||
|
||||
|
||||
@@ -17,48 +17,53 @@ const SessionStatusSchema = CollectionSchema(
|
||||
name: r'SessionStatus',
|
||||
id: -8915225926978838405,
|
||||
properties: {
|
||||
r'crId': PropertySchema(
|
||||
r'bwvEnabled': PropertySchema(
|
||||
id: 0,
|
||||
name: r'bwvEnabled',
|
||||
type: IsarType.bool,
|
||||
),
|
||||
r'crId': PropertySchema(
|
||||
id: 1,
|
||||
name: r'crId',
|
||||
type: IsarType.long,
|
||||
),
|
||||
r'custId': PropertySchema(
|
||||
id: 1,
|
||||
id: 2,
|
||||
name: r'custId',
|
||||
type: IsarType.long,
|
||||
),
|
||||
r'hqId': PropertySchema(
|
||||
id: 2,
|
||||
id: 3,
|
||||
name: r'hqId',
|
||||
type: IsarType.long,
|
||||
),
|
||||
r'locZip': PropertySchema(
|
||||
id: 3,
|
||||
id: 4,
|
||||
name: r'locZip',
|
||||
type: IsarType.string,
|
||||
),
|
||||
r'serverInstance': PropertySchema(
|
||||
id: 4,
|
||||
id: 5,
|
||||
name: r'serverInstance',
|
||||
type: IsarType.string,
|
||||
),
|
||||
r'serverVersion': PropertySchema(
|
||||
id: 5,
|
||||
id: 6,
|
||||
name: r'serverVersion',
|
||||
type: IsarType.string,
|
||||
),
|
||||
r'sid': PropertySchema(
|
||||
id: 6,
|
||||
id: 7,
|
||||
name: r'sid',
|
||||
type: IsarType.string,
|
||||
),
|
||||
r'usrId': PropertySchema(
|
||||
id: 7,
|
||||
id: 8,
|
||||
name: r'usrId',
|
||||
type: IsarType.long,
|
||||
),
|
||||
r'vhtId': PropertySchema(
|
||||
id: 8,
|
||||
id: 9,
|
||||
name: r'vhtId',
|
||||
type: IsarType.long,
|
||||
)
|
||||
@@ -96,15 +101,16 @@ void _sessionStatusSerialize(
|
||||
List<int> offsets,
|
||||
Map<Type, List<int>> allOffsets,
|
||||
) {
|
||||
writer.writeLong(offsets[0], object.crId);
|
||||
writer.writeLong(offsets[1], object.custId);
|
||||
writer.writeLong(offsets[2], object.hqId);
|
||||
writer.writeString(offsets[3], object.locZip);
|
||||
writer.writeString(offsets[4], object.serverInstance);
|
||||
writer.writeString(offsets[5], object.serverVersion);
|
||||
writer.writeString(offsets[6], object.sid);
|
||||
writer.writeLong(offsets[7], object.usrId);
|
||||
writer.writeLong(offsets[8], object.vhtId);
|
||||
writer.writeBool(offsets[0], object.bwvEnabled);
|
||||
writer.writeLong(offsets[1], object.crId);
|
||||
writer.writeLong(offsets[2], object.custId);
|
||||
writer.writeLong(offsets[3], object.hqId);
|
||||
writer.writeString(offsets[4], object.locZip);
|
||||
writer.writeString(offsets[5], object.serverInstance);
|
||||
writer.writeString(offsets[6], object.serverVersion);
|
||||
writer.writeString(offsets[7], object.sid);
|
||||
writer.writeLong(offsets[8], object.usrId);
|
||||
writer.writeLong(offsets[9], object.vhtId);
|
||||
}
|
||||
|
||||
SessionStatus _sessionStatusDeserialize(
|
||||
@@ -114,15 +120,16 @@ SessionStatus _sessionStatusDeserialize(
|
||||
Map<Type, List<int>> allOffsets,
|
||||
) {
|
||||
final object = SessionStatus();
|
||||
object.crId = reader.readLong(offsets[0]);
|
||||
object.custId = reader.readLong(offsets[1]);
|
||||
object.hqId = reader.readLong(offsets[2]);
|
||||
object.locZip = reader.readString(offsets[3]);
|
||||
object.serverInstance = reader.readString(offsets[4]);
|
||||
object.serverVersion = reader.readString(offsets[5]);
|
||||
object.sid = reader.readString(offsets[6]);
|
||||
object.usrId = reader.readLong(offsets[7]);
|
||||
object.vhtId = reader.readLong(offsets[8]);
|
||||
object.bwvEnabled = reader.readBool(offsets[0]);
|
||||
object.crId = reader.readLong(offsets[1]);
|
||||
object.custId = reader.readLong(offsets[2]);
|
||||
object.hqId = reader.readLong(offsets[3]);
|
||||
object.locZip = reader.readString(offsets[4]);
|
||||
object.serverInstance = reader.readString(offsets[5]);
|
||||
object.serverVersion = reader.readString(offsets[6]);
|
||||
object.sid = reader.readString(offsets[7]);
|
||||
object.usrId = reader.readLong(offsets[8]);
|
||||
object.vhtId = reader.readLong(offsets[9]);
|
||||
return object;
|
||||
}
|
||||
|
||||
@@ -134,13 +141,13 @@ P _sessionStatusDeserializeProp<P>(
|
||||
) {
|
||||
switch (propertyId) {
|
||||
case 0:
|
||||
return (reader.readLong(offset)) as P;
|
||||
return (reader.readBool(offset)) as P;
|
||||
case 1:
|
||||
return (reader.readLong(offset)) as P;
|
||||
case 2:
|
||||
return (reader.readLong(offset)) as P;
|
||||
case 3:
|
||||
return (reader.readString(offset)) as P;
|
||||
return (reader.readLong(offset)) as P;
|
||||
case 4:
|
||||
return (reader.readString(offset)) as P;
|
||||
case 5:
|
||||
@@ -148,9 +155,11 @@ P _sessionStatusDeserializeProp<P>(
|
||||
case 6:
|
||||
return (reader.readString(offset)) as P;
|
||||
case 7:
|
||||
return (reader.readLong(offset)) as P;
|
||||
return (reader.readString(offset)) as P;
|
||||
case 8:
|
||||
return (reader.readLong(offset)) as P;
|
||||
case 9:
|
||||
return (reader.readLong(offset)) as P;
|
||||
default:
|
||||
throw IsarError('Unknown property with id $propertyId');
|
||||
}
|
||||
@@ -250,6 +259,16 @@ extension SessionStatusQueryWhere
|
||||
|
||||
extension SessionStatusQueryFilter
|
||||
on QueryBuilder<SessionStatus, SessionStatus, QFilterCondition> {
|
||||
QueryBuilder<SessionStatus, SessionStatus, QAfterFilterCondition>
|
||||
bwvEnabledEqualTo(bool value) {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addFilterCondition(FilterCondition.equalTo(
|
||||
property: r'bwvEnabled',
|
||||
value: value,
|
||||
));
|
||||
});
|
||||
}
|
||||
|
||||
QueryBuilder<SessionStatus, SessionStatus, QAfterFilterCondition> crIdEqualTo(
|
||||
int value) {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
@@ -1133,6 +1152,19 @@ extension SessionStatusQueryLinks
|
||||
|
||||
extension SessionStatusQuerySortBy
|
||||
on QueryBuilder<SessionStatus, SessionStatus, QSortBy> {
|
||||
QueryBuilder<SessionStatus, SessionStatus, QAfterSortBy> sortByBwvEnabled() {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addSortBy(r'bwvEnabled', Sort.asc);
|
||||
});
|
||||
}
|
||||
|
||||
QueryBuilder<SessionStatus, SessionStatus, QAfterSortBy>
|
||||
sortByBwvEnabledDesc() {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addSortBy(r'bwvEnabled', Sort.desc);
|
||||
});
|
||||
}
|
||||
|
||||
QueryBuilder<SessionStatus, SessionStatus, QAfterSortBy> sortByCrId() {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addSortBy(r'crId', Sort.asc);
|
||||
@@ -1248,6 +1280,19 @@ extension SessionStatusQuerySortBy
|
||||
|
||||
extension SessionStatusQuerySortThenBy
|
||||
on QueryBuilder<SessionStatus, SessionStatus, QSortThenBy> {
|
||||
QueryBuilder<SessionStatus, SessionStatus, QAfterSortBy> thenByBwvEnabled() {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addSortBy(r'bwvEnabled', Sort.asc);
|
||||
});
|
||||
}
|
||||
|
||||
QueryBuilder<SessionStatus, SessionStatus, QAfterSortBy>
|
||||
thenByBwvEnabledDesc() {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addSortBy(r'bwvEnabled', Sort.desc);
|
||||
});
|
||||
}
|
||||
|
||||
QueryBuilder<SessionStatus, SessionStatus, QAfterSortBy> thenByCrId() {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addSortBy(r'crId', Sort.asc);
|
||||
@@ -1375,6 +1420,12 @@ extension SessionStatusQuerySortThenBy
|
||||
|
||||
extension SessionStatusQueryWhereDistinct
|
||||
on QueryBuilder<SessionStatus, SessionStatus, QDistinct> {
|
||||
QueryBuilder<SessionStatus, SessionStatus, QDistinct> distinctByBwvEnabled() {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addDistinctBy(r'bwvEnabled');
|
||||
});
|
||||
}
|
||||
|
||||
QueryBuilder<SessionStatus, SessionStatus, QDistinct> distinctByCrId() {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addDistinctBy(r'crId');
|
||||
@@ -1444,6 +1495,12 @@ extension SessionStatusQueryProperty
|
||||
});
|
||||
}
|
||||
|
||||
QueryBuilder<SessionStatus, bool, QQueryOperations> bwvEnabledProperty() {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addPropertyName(r'bwvEnabled');
|
||||
});
|
||||
}
|
||||
|
||||
QueryBuilder<SessionStatus, int, QQueryOperations> crIdProperty() {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addPropertyName(r'crId');
|
||||
@@ -1515,7 +1572,8 @@ SessionStatus _$SessionStatusFromJson(Map<String, dynamic> json) =>
|
||||
..vhtId = (json['vht_id'] as num).toInt()
|
||||
..locZip = json['loc_zip'] as String
|
||||
..serverVersion = json['server_version'] as String
|
||||
..serverInstance = json['server_instance'] as String;
|
||||
..serverInstance = json['server_instance'] as String
|
||||
..bwvEnabled = json['bwv'] as bool? ?? false;
|
||||
|
||||
Map<String, dynamic> _$SessionStatusToJson(SessionStatus instance) =>
|
||||
<String, dynamic>{
|
||||
@@ -1528,4 +1586,5 @@ Map<String, dynamic> _$SessionStatusToJson(SessionStatus instance) =>
|
||||
'loc_zip': instance.locZip,
|
||||
'server_version': instance.serverVersion,
|
||||
'server_instance': instance.serverInstance,
|
||||
'bwv': instance.bwvEnabled,
|
||||
};
|
||||
@@ -7,6 +7,8 @@ class SyncJobsMessage {
|
||||
@JsonKey(name: 'utc_unix_time')
|
||||
late int utcUnixTime;
|
||||
|
||||
late SyncMessagePos? pos;
|
||||
|
||||
late SyncJobMessageSync sync;
|
||||
|
||||
SyncJobsMessage();
|
||||
@@ -42,3 +44,17 @@ class SyncJobMessageJob {
|
||||
Map<String, dynamic> toJson() => _$SyncJobMessageJobToJson(this);
|
||||
}
|
||||
|
||||
@JsonSerializable()
|
||||
class SyncMessagePos {
|
||||
late double lat;
|
||||
|
||||
late double long;
|
||||
|
||||
late int acc = 0;
|
||||
|
||||
SyncMessagePos();
|
||||
|
||||
factory SyncMessagePos.fromJson(Map<String, dynamic> json) => _$SyncMessagePosFromJson(json);
|
||||
|
||||
Map<String, dynamic> toJson() => _$SyncMessagePosToJson(this);
|
||||
}
|
||||
@@ -9,12 +9,16 @@ part of 'sync_jobs_message.dart';
|
||||
SyncJobsMessage _$SyncJobsMessageFromJson(Map<String, dynamic> json) =>
|
||||
SyncJobsMessage()
|
||||
..utcUnixTime = (json['utc_unix_time'] as num).toInt()
|
||||
..pos = json['pos'] == null
|
||||
? null
|
||||
: SyncMessagePos.fromJson(json['pos'] as Map<String, dynamic>)
|
||||
..sync =
|
||||
SyncJobMessageSync.fromJson(json['sync'] as Map<String, dynamic>);
|
||||
|
||||
Map<String, dynamic> _$SyncJobsMessageToJson(SyncJobsMessage instance) =>
|
||||
<String, dynamic>{
|
||||
'utc_unix_time': instance.utcUnixTime,
|
||||
'pos': instance.pos,
|
||||
'sync': instance.sync,
|
||||
};
|
||||
|
||||
@@ -41,3 +45,16 @@ Map<String, dynamic> _$SyncJobMessageJobToJson(SyncJobMessageJob instance) =>
|
||||
'ver': instance.ver,
|
||||
'state': instance.state,
|
||||
};
|
||||
|
||||
SyncMessagePos _$SyncMessagePosFromJson(Map<String, dynamic> json) =>
|
||||
SyncMessagePos()
|
||||
..lat = (json['lat'] as num).toDouble()
|
||||
..long = (json['long'] as num).toDouble()
|
||||
..acc = (json['acc'] as num).toInt();
|
||||
|
||||
Map<String, dynamic> _$SyncMessagePosToJson(SyncMessagePos instance) =>
|
||||
<String, dynamic>{
|
||||
'lat': instance.lat,
|
||||
'long': instance.long,
|
||||
'acc': instance.acc,
|
||||
};
|
||||
@@ -184,12 +184,6 @@ Future<List<Widget>> _fetchJobWidgets(StateSetter dialogState, Function() onFini
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
SizedBox(width: double.infinity, child: Text(job.rem, textAlign: TextAlign.left)),
|
||||
SizedBox(width: double.infinity, child: Text(job.rem, textAlign: TextAlign.left)),
|
||||
SizedBox(width: double.infinity, child: Text(job.rem, textAlign: TextAlign.left)),
|
||||
SizedBox(width: double.infinity, child: Text(job.rem, textAlign: TextAlign.left)),
|
||||
SizedBox(width: double.infinity, child: Text(job.rem, textAlign: TextAlign.left)),
|
||||
SizedBox(width: double.infinity, child: Text(job.rem, textAlign: TextAlign.left)),
|
||||
SizedBox(width: double.infinity, child: Text(job.rem, textAlign: TextAlign.left)),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
@@ -175,8 +175,8 @@ showMapPopup(BuildContext context, JobTour currentTour, List<JobTour> tourList)
|
||||
child: FlutterMap(
|
||||
mapController: mapController,
|
||||
options: MapOptions(
|
||||
//center: LatLng(currentTour.pos!.lat, currentTour.pos!.long),
|
||||
//zoom: 14,
|
||||
initialCenter: LatLng(currentTour.pos!.lat, currentTour.pos!.long),
|
||||
initialZoom: 14,
|
||||
),
|
||||
children: [
|
||||
TileLayer(
|
||||
|
||||
@@ -28,6 +28,7 @@ class Constants {
|
||||
static const String messageShowPopup = "show_popup";
|
||||
|
||||
static const String prefsPreviousMqttSubscription = "previous_mqtt_subscription";
|
||||
static const String prefsBWVEnabled = "bwv_enabled";
|
||||
static const String prefsDesiredZip = "desired_zip";
|
||||
|
||||
static const int stateAssigned = 0;
|
||||
|
||||
@@ -136,6 +136,10 @@ class MqttCore with ProducerMixin, ConsumerMixin {
|
||||
connectionLostMessage.connectionLost = true;
|
||||
var connectionLostEncapsulatedMessage = _encapsulateMessage(const Uuid().v4(), false, connectionLostMessage.toJson());
|
||||
|
||||
var willMessageUtf8 = utf8.encode(connectionLostEncapsulatedMessage);
|
||||
Uint8Buffer uint8Buffer = Uint8Buffer();
|
||||
uint8Buffer.addAll(willMessageUtf8);
|
||||
|
||||
_mqttClient!.connectionMessage = MqttConnectMessage()
|
||||
.withClientIdentifier(Util.getAppUuid())
|
||||
.authenticateAs("app", "apppwd")
|
||||
@@ -144,7 +148,7 @@ class MqttCore with ProducerMixin, ConsumerMixin {
|
||||
.withWillTopic("$_toServerTopic$_clientId/connection_lost")
|
||||
.withWillQos(MqttQos.atMostOnce)
|
||||
.keepAliveFor(60)
|
||||
.withWillPayload(MqttUtf8Encoding().toUtf8(connectionLostEncapsulatedMessage))
|
||||
.withWillPayload(uint8Buffer)
|
||||
.will();
|
||||
}
|
||||
|
||||
@@ -320,14 +324,13 @@ class MqttCore with ProducerMixin, ConsumerMixin {
|
||||
await MyApp.isarInstance.sessionStatus.put(sessionStatusMessage);
|
||||
});
|
||||
|
||||
// TODO MESSAGING
|
||||
Util.preferencesSaveBool(Constants.prefsBWVEnabled, sessionStatusMessage.bwvEnabled);
|
||||
|
||||
sendMessage(
|
||||
routingKey: Constants.messageTopicSessionStatusInfoUpdate,
|
||||
payload: SessionStatusInfoUpdate(status: sessionStatusMessage),
|
||||
);
|
||||
|
||||
//await MessageService().publish<SessionStatusInfoUpdate>(Constants.messageTopicSessionStatusInfoUpdate, arguments: SessionStatusInfoUpdate(status: sessionStatusMessage));
|
||||
|
||||
_startTrackTimer();
|
||||
}
|
||||
|
||||
@@ -585,10 +588,18 @@ class MqttCore with ProducerMixin, ConsumerMixin {
|
||||
}
|
||||
|
||||
_sendSyncMessage() async {
|
||||
var currentPosition = MyApp.currentPosition;
|
||||
|
||||
var jobs = await MyApp.isarInstance.jobs.filter().stateGreaterThan(-1).findAll();
|
||||
|
||||
var answer = SyncJobsMessage();
|
||||
answer.utcUnixTime = DateTime.now().toUtc().millisecondsSinceEpoch ~/ 1000;
|
||||
|
||||
answer.pos = SyncMessagePos();
|
||||
answer.pos!.lat = currentPosition != null ? currentPosition.latitude : 0.0;
|
||||
answer.pos!.long = currentPosition != null ? currentPosition.longitude : 0.0;
|
||||
answer.pos!.acc = currentPosition != null ? currentPosition.accuracy.toInt() : 0;
|
||||
|
||||
answer.sync = SyncJobMessageSync();
|
||||
answer.sync.jobs = [];
|
||||
for (var job in jobs) {
|
||||
|
||||
Reference in new issue
Block a user