Erweiterungen und cleanup

This commit is contained in:
Sven committed 2024-11-14 17:38:14 +01:00
1 parent def0f3fc2f
commit 38f5d374b2
15 files changed
+9 -119

No files matched your search

+8 -16
View File
@@ -10,9 +10,7 @@ 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/messages/publish_payload_message.dart';
import 'package:stadtbote/tools/messages/ranking_updated.dart';
import 'package:badges/badges.dart' as badges;
import '../tools/util.dart';
@@ -31,7 +29,7 @@ class ApproachAreaPage extends ContentViewWidget {
}
}
class _ApproachAreaPageState extends State<ApproachAreaPage> with ProducerMixin{
class _ApproachAreaPageState extends State<ApproachAreaPage> with ProducerMixin, ConsumerMixin {
late Ranking? _ranking;
late bool _initCompleted = false;
@@ -51,14 +49,6 @@ class _ApproachAreaPageState extends State<ApproachAreaPage> with ProducerMixin{
_initMessages();
}
@override
void deactivate() {
super.deactivate();
// TODO MESSAGING
//MessageService().unsubscribe(Constants.messageTopicRankingUpdated, this);
}
@override
Widget build(BuildContext context) {
if (!_initCompleted) {
@@ -213,12 +203,14 @@ class _ApproachAreaPageState extends State<ApproachAreaPage> with ProducerMixin{
}
_initMessages() {
// TODO MESSAGING
sendMessage(
routingKey: Constants.messageTopicPopContentView,
payload: PopContentViewMessage(count: 1),
);
subscribe(
queueId: Constants.messageTopicRankingUpdated,
callback: (message) async {
_ranking = await MyApp.isarInstance.rankings.where().findFirst();
setState(() {});
},
);
/*MessageService().subscribe<RankingUpdated>(Constants.messageTopicRankingUpdated, this, (rankingUpdateMessage) async {
_ranking = await MyApp.isarInstance.rankings.where().findFirst();