Fehlerkorrekturen und Erweiterungen
This commit is contained in:
1 parent
b3d010b453
commit
52415e0759
18 files changed
+136
-128
No files matched your search
@@ -43,11 +43,14 @@ class _MainPageState extends State<MainPage> with ConsumerMixin, ProducerMixin {
|
||||
final ValueNotifier<int> _messagesValueNotifier = ValueNotifier<int>(0);
|
||||
|
||||
late bool _loggedOut = false;
|
||||
late bool _showBWVButton = false;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
|
||||
_showBWVButton = Util.preferencesGetBool(Constants.prefsBWVEnabled, false);
|
||||
|
||||
_refreshBadges();
|
||||
|
||||
_initMessages();
|
||||
@@ -212,17 +215,15 @@ class _MainPageState extends State<MainPage> with ConsumerMixin, ProducerMixin {
|
||||
'Anfahrtsbereich',
|
||||
image: Image.asset('assets/anfahrtsbereich.png', width: 30, height: 30),
|
||||
() async => {
|
||||
// TODO MESSAGING
|
||||
sendMessage(
|
||||
routingKey: Constants.messageTopicPushContentView,
|
||||
payload: const ApproachAreaPage(),
|
||||
)
|
||||
//await MessageService().publish<ContentViewWidget>(Constants.messageTopicPushContentView, arguments: const ApproachAreaPage())
|
||||
}),
|
||||
),
|
||||
SizedBox(height: _loggedOut == true ? 0 : 20),
|
||||
Visibility(
|
||||
visible: !_loggedOut && Util.preferencesGetBool(Constants.prefsBWVEnabled, false),
|
||||
visible: !_loggedOut && _showBWVButton,
|
||||
child: getDefaultButton(
|
||||
'Wunschziel für heute',
|
||||
image: Image.asset('assets/wunsch_plz.png', width: 30, height: 30),
|
||||
@@ -296,6 +297,15 @@ class _MainPageState extends State<MainPage> with ConsumerMixin, ProducerMixin {
|
||||
_refreshBadges();
|
||||
},
|
||||
);
|
||||
|
||||
subscribe(
|
||||
queueId: Constants.messageTopicBWVEnabled,
|
||||
callback: (message) {
|
||||
setState(() {
|
||||
_showBWVButton = Util.preferencesGetBool(Constants.prefsBWVEnabled, false);
|
||||
});
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
void _refreshBadges() async {
|
||||
@@ -319,7 +329,7 @@ class _MainPageState extends State<MainPage> with ConsumerMixin, ProducerMixin {
|
||||
|
||||
_loggedOut = false;
|
||||
|
||||
setState(() {});
|
||||
setState(() { });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -577,20 +587,12 @@ class _HeaderWidgetState extends State<_HeaderWidget> with ConsumerMixin {
|
||||
},
|
||||
);
|
||||
|
||||
/*MessageService().subscribe<SessionStatusInfoUpdate>(Constants.messageTopicSessionStatusInfoUpdate, this, (sessionStatusInfoUpdateMessage) {
|
||||
_updateHeader();
|
||||
});*/
|
||||
|
||||
subscribe(
|
||||
queueId: Constants.messageTopicLocationStatusUpdated,
|
||||
callback: (message) {
|
||||
_updateHeader();
|
||||
},
|
||||
);
|
||||
|
||||
/*MessageService().subscribe<LocationStatusUpdate>(Constants.messageTopicLocationStatusUpdated, this, (statusInfoUpdateMessage) {
|
||||
_updateHeader();
|
||||
});*/
|
||||
}
|
||||
|
||||
_updateHeader() async {
|
||||
|
||||
+7
-7
@@ -57,6 +57,7 @@ Future<void> main() async {
|
||||
MQClient.instance.declareQueue(Constants.messageTopicMessageReceived);
|
||||
MQClient.instance.declareQueue(Constants.messageTopicUpdateBadges);
|
||||
MQClient.instance.declareQueue(Constants.messageTopicRemoveState0JobFromMap);
|
||||
MQClient.instance.declareQueue(Constants.messageTopicBWVEnabled);
|
||||
|
||||
final dir = await getApplicationDocumentsDirectory();
|
||||
MyApp.isarInstance = await Isar.open([
|
||||
@@ -244,14 +245,13 @@ class _MainState extends State<Main> with SingleTickerProviderStateMixin, Produc
|
||||
|
||||
return ColoredSafeArea(
|
||||
key: GlobalKey(),
|
||||
child: WillPopScope(
|
||||
onWillPop: () async {
|
||||
if (contentStack.isNotEmpty) {
|
||||
_popContentView(1);
|
||||
child: PopScope(
|
||||
canPop: contentStack.isNotEmpty,
|
||||
onPopInvokedWithResult: (didPop, result) async {
|
||||
if (didPop) return;
|
||||
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
if (contentStack.isNotEmpty) {
|
||||
_popContentView(1); // alten Inhalt entfernen
|
||||
}
|
||||
},
|
||||
child: Scaffold(
|
||||
|
||||
@@ -46,7 +46,7 @@ class ChatMessage {
|
||||
}
|
||||
|
||||
static Future<int> getNextId() async {
|
||||
int currentExport500Id = await Util.preferencesGetInt('next_message_id', 0) as int;
|
||||
int currentExport500Id = Util.preferencesGetInt('next_message_id', 0) as int;
|
||||
|
||||
currentExport500Id += 1;
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ class TaskInfo {
|
||||
TaskInfo();
|
||||
|
||||
static Future<int> getNextId() async {
|
||||
int taskInfoId = await Util.preferencesGetInt('task_info_id', 0) as int;
|
||||
int taskInfoId = Util.preferencesGetInt('task_info_id', 0) as int;
|
||||
|
||||
taskInfoId += 1;
|
||||
|
||||
|
||||
@@ -7,24 +7,19 @@ import 'package:stadtbote/main.dart';
|
||||
import 'package:stadtbote/model/job.dart';
|
||||
import 'package:stadtbote/network_messages/accept_job_message.dart';
|
||||
import 'package:stadtbote/network_messages/fin_task_message.dart';
|
||||
import 'package:stadtbote/tools/ExtendedStatefulBuilder.dart';
|
||||
import 'package:stadtbote/tools/extended_stateful_builder.dart';
|
||||
import 'package:stadtbote/tools/constants.dart';
|
||||
import 'package:stadtbote/tools/messages/job_deleted_message.dart';
|
||||
import 'package:stadtbote/tools/messages/job_received_message.dart';
|
||||
import 'package:stadtbote/tools/messages/refresh_badges_message.dart';
|
||||
import 'package:stadtbote/tools/messages/remove_job_message.dart';
|
||||
import 'package:stadtbote/tools/util.dart';
|
||||
import 'package:badges/badges.dart' as badges;
|
||||
|
||||
import '../tools/messages/publish_payload_message.dart';
|
||||
|
||||
late Map<int, bool> _infoExpandedMap;
|
||||
|
||||
final ScrollController _scrollController = ScrollController();
|
||||
|
||||
Future<void> showAcceptJobsPopup(SharedMapReference mapReference, Function() onFinished) async {
|
||||
_infoExpandedMap = {};
|
||||
|
||||
ExtendendStatefulBuilder extendedStatefulBuilder;
|
||||
|
||||
return showDialog<void>(
|
||||
@@ -367,7 +362,6 @@ Future<List<Widget>> _fetchJobWidgets(StateSetter dialogState, Function() onFini
|
||||
),
|
||||
);
|
||||
}))*/
|
||||
;
|
||||
}
|
||||
|
||||
return widgets;
|
||||
|
||||
@@ -24,6 +24,7 @@ class Constants {
|
||||
static const String messageTopicDisconnectClient = "disconnect_client";
|
||||
static const String messageTopicRequestConnectionStatus = "request_connection_status";
|
||||
static const String messageTopicCurrentConnectionStatus = "current_connection_status";
|
||||
static const String messageTopicBWVEnabled = "bwv_enabled";
|
||||
|
||||
static const String messageShowPopup = "show_popup";
|
||||
|
||||
|
||||
File renamed without changes.
@@ -0,0 +1,5 @@
|
||||
class BWVMessage {
|
||||
final bool bwvEnabled;
|
||||
|
||||
BWVMessage({ required this.bwvEnabled});
|
||||
}
|
||||
@@ -49,6 +49,7 @@ import 'package:uuid/uuid.dart';
|
||||
import '../main.dart';
|
||||
import '../model/session_status.dart';
|
||||
import 'constants.dart';
|
||||
import 'messages/bwv_message.dart';
|
||||
import 'util.dart';
|
||||
|
||||
enum ConnectionStateEnum { notConnected, connected }
|
||||
@@ -301,13 +302,10 @@ class MqttCore with ProducerMixin, ConsumerMixin {
|
||||
|
||||
Util.logInfo('subscribed to topic: $fromServerTopic');
|
||||
|
||||
// TODO MESSAGING
|
||||
sendMessage(
|
||||
routingKey: Constants.messageTopicConnectionStatusChanged,
|
||||
payload: ConnectionStatus(status: ConnectionStatusEnum.connected),
|
||||
);
|
||||
|
||||
//await MessageService().publish<ConnectionStatus>(Constants.messageTopicConnectionStatusChanged, arguments: ConnectionStatus(status: ConnectionStatusEnum.connected));
|
||||
}
|
||||
|
||||
void _sessionMessageReceived(payloadData) async {
|
||||
@@ -324,7 +322,12 @@ class MqttCore with ProducerMixin, ConsumerMixin {
|
||||
await MyApp.isarInstance.sessionStatus.put(sessionStatusMessage);
|
||||
});
|
||||
|
||||
Util.preferencesSaveBool(Constants.prefsBWVEnabled, sessionStatusMessage.bwvEnabled);
|
||||
var bwvEnabled = sessionStatusMessage.bwvEnabled;
|
||||
Util.preferencesSaveBool(Constants.prefsBWVEnabled, bwvEnabled);
|
||||
sendMessage(
|
||||
routingKey: Constants.messageTopicBWVEnabled,
|
||||
payload: BWVMessage(bwvEnabled: bwvEnabled),
|
||||
);
|
||||
|
||||
sendMessage(
|
||||
routingKey: Constants.messageTopicSessionStatusInfoUpdate,
|
||||
|
||||
Reference in new issue
Block a user