diff --git a/android/build.gradle b/android/build.gradle index 713d7f6..4dd6b12 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -1,12 +1,12 @@ buildscript { - ext.kotlin_version = '1.7.10' + ext.kotlin_version = '1.8.0' repositories { google() mavenCentral() } dependencies { - classpath 'com.android.tools.build:gradle:7.2.0' + classpath 'com.android.tools.build:gradle:7.2.2' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" } } diff --git a/integration_test/job_test.dart b/integration_test/job_test.dart new file mode 100644 index 0000000..7d30f97 --- /dev/null +++ b/integration_test/job_test.dart @@ -0,0 +1,27 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:stadtbote/main.dart'; + +void main() { + testWidgets('tap on the floating action button, verify counter', + (tester) async { + // Load app widget. + await tester.pumpWidget(MyApp()); + + // Verify the counter starts at 0. + expect(find.text('HH1091'), findsOneWidget); + + // Finds the floating action button to tap on. + //final fab = find.byKey(const Key('increment')); + + // Emulate a tap on the floating action button. + //await tester.tap(fab); + + // Trigger a frame. + //await tester.pumpAndSettle(); + + // Verify the counter increments by 1. + //expect(find.text('0'), findsNothing); + //expect(find.text('1'), findsOneWidget); + }); +} \ No newline at end of file diff --git a/lib/content_views/accepted_jobs_page.dart b/lib/content_views/accepted_jobs_page.dart index 6bb1b63..e74b149 100644 --- a/lib/content_views/accepted_jobs_page.dart +++ b/lib/content_views/accepted_jobs_page.dart @@ -77,6 +77,12 @@ class _AcceptedJobsPageState extends State { List jobWidgets = []; for (var job in _jobs) { + String remarkString = ''; + for (var remark in job.rem) { + remarkString += '$remark\n'; + } + remarkString = remarkString.trim(); + jobWidgets.add( ListTile( onTap: () { @@ -111,6 +117,10 @@ class _AcceptedJobsPageState extends State { ), ], ), + Text( + remarkString, + textAlign: TextAlign.left, + ), Text( job.id.toString(), textAlign: TextAlign.left, diff --git a/lib/tools/mqtt_core.dart b/lib/tools/mqtt_core.dart index 854d441..ccbeb4f 100644 --- a/lib/tools/mqtt_core.dart +++ b/lib/tools/mqtt_core.dart @@ -94,12 +94,14 @@ class MqttCore { _mqttClient = MqttServerClient.withPort(_brokerUri, clientId, _brokerPort); _mqttClient.logging(on: false); - _mqttClient.keepAlivePeriod = 20; - _mqttClient.autoReconnect = false; + _mqttClient.keepAlivePeriod = 5; + _mqttClient.disconnectOnNoResponsePeriod = 10; + _mqttClient.autoReconnect = true; _mqttClient.onDisconnected = _clientDisconnected; + _mqttClient.onAutoReconnect = _clientDisconnected; + _mqttClient.onAutoReconnected = _clientConnected; _mqttClient.connectionMessage = MqttConnectMessage() .withClientIdentifier(await Util.getAppUuid()) - .withWillQos(MqttQos.atMostOnce) .authenticateAs("app", "apppwd"); await _mqttClient.connect(); @@ -116,13 +118,9 @@ class MqttCore { Util.logInfo('Verbindung zum MQTT-Broker fehlgeschlagen!'); MessageService().publish(Constants.messageTopicConnectionStatusChanged, arguments: ConnectionStatus(status: ConnectionStatusEnum.notConnected)); - - _startReconnectTimer(); } } catch (ex) { - _startReconnectTimer(); - Util.logInfo('Verbindung zum MQTT-Broker fehlgeschlagen!: $ex'); MessageService().publish(Constants.messageTopicConnectionStatusChanged, arguments: ConnectionStatus(status: ConnectionStatusEnum.notConnected)); @@ -328,7 +326,7 @@ class MqttCore { publishBinary(topic, gzipBytes!); } - void _startReconnectTimer() { + void _startBootstrapReconnectTimer() { connectionState = ConnectionStateEnum.notConnected; if (!_disconnectInProgress) { @@ -349,17 +347,23 @@ class MqttCore { } void _clientDisconnected() { - connectionState = ConnectionStateEnum.notConnected; - - _cancelTrackTimer(); - Util.logInfo("_clientDisconnected called"); - MessageService().publish(Constants.messageTopicConnectionStatusChanged, arguments: ConnectionStatus(status: ConnectionStatusEnum.notConnected)); + connectionState = ConnectionStateEnum.notConnected; - if (!_disconnectInProgress) { - _startReconnectTimer(); - } + _startTrackTimer(); + + MessageService().publish(Constants.messageTopicConnectionStatusChanged, arguments: ConnectionStatus(status: ConnectionStatusEnum.notConnected)); + } + + void _clientConnected() { + Util.logInfo("_clientDisconnected called"); + + connectionState = ConnectionStateEnum.connected; + + _initSession(); + + MessageService().publish(Constants.messageTopicConnectionStatusChanged, arguments: ConnectionStatus(status: ConnectionStatusEnum.connected)); } void _processBootstrap() async { @@ -401,7 +405,7 @@ class MqttCore { _connectToBroker(); } catch (ex) { - _startReconnectTimer(); + _startBootstrapReconnectTimer(); } }