Versionnummer (halb) automatisiert
This commit is contained in:
1 parent
8751e3ec80
commit
1a6d00730e
6 files changed
+62
-9
No files matched your search
@@ -5,7 +5,9 @@ import 'package:stadtbote/tools/mqtt_core.dart';
|
||||
import 'package:stadtbote/tools/util.dart';
|
||||
|
||||
void showInfosPopup(BuildContext context, SessionStatus? status) async {
|
||||
var text = "Versionsnummer: a213\n";
|
||||
var version = await Util.getAppVersion();
|
||||
|
||||
var text = "Versionsnummer: a$version\n";
|
||||
text += "Verbindungsstatus: ${MqttCore.instance.connectionState == ConnectionStateEnum.connected ? "Verbunden" : "NICHT verbunden"}\n";
|
||||
text += "GPS-Status: ${MyApp.currentPosition != null ? MyApp.currentPosition!.timestamp.toString() : "Unbekannt"}\n";
|
||||
text += "\n";
|
||||
|
||||
@@ -2,10 +2,12 @@ import 'dart:async';
|
||||
import 'dart:convert';
|
||||
import 'dart:math';
|
||||
|
||||
import 'package:device_info_plus/device_info_plus.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:isar/isar.dart';
|
||||
import 'package:mqtt_client/mqtt_client.dart';
|
||||
import 'package:mqtt_client/mqtt_server_client.dart';
|
||||
import 'package:package_info/package_info.dart';
|
||||
import 'package:stadtbote/model/enqueued_message.dart';
|
||||
import 'package:stadtbote/model/ranking.dart';
|
||||
import 'package:stadtbote/model/status.dart';
|
||||
@@ -357,17 +359,22 @@ class MqttCore {
|
||||
|
||||
void _processBootstrap() async {
|
||||
try {
|
||||
var deviceInfoPlugin = DeviceInfoPlugin();
|
||||
|
||||
AndroidDeviceInfo androidInfo = await deviceInfoPlugin.androidInfo;
|
||||
BaseDeviceInfo deviceInfo = await deviceInfoPlugin.deviceInfo;
|
||||
|
||||
var deviceObject = DeviceObject();
|
||||
deviceObject.manufacturer = "sven";
|
||||
deviceObject.model = "emulator";
|
||||
deviceObject.os = "hat es";
|
||||
deviceObject.osVer = "0.0";
|
||||
deviceObject.manufacturer = deviceInfo.data['manufacturer'];
|
||||
deviceObject.model = deviceInfo.data['model'];
|
||||
deviceObject.os = androidInfo.version.release;
|
||||
deviceObject.osVer = androidInfo.version.sdkInt.toString();
|
||||
|
||||
var handshakeMessage = BootstrapRequest();
|
||||
handshakeMessage.app = "sb";
|
||||
handshakeMessage.mqttClientId = await Util.getAppUuid();
|
||||
handshakeMessage.deviceObject = deviceObject;
|
||||
handshakeMessage.ver = 213;
|
||||
handshakeMessage.ver = await Util.getAppVersion();
|
||||
|
||||
var jsonMap = handshakeMessage.toJson();
|
||||
var json = jsonEncode(jsonMap);
|
||||
|
||||
@@ -4,6 +4,7 @@ import 'package:audioplayers/audioplayers.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:image_picker/image_picker.dart';
|
||||
import 'package:package_info/package_info.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
import 'package:stadtbote/model/job.dart';
|
||||
import 'package:stadtbote/tools/constants.dart';
|
||||
@@ -72,6 +73,12 @@ class Util {
|
||||
return currentUuid;
|
||||
}
|
||||
|
||||
static Future<int> getAppVersion() async {
|
||||
PackageInfo packageInfo = await PackageInfo.fromPlatform();
|
||||
|
||||
return int.parse(packageInfo.version.replaceAll(".0.0", ""));
|
||||
}
|
||||
|
||||
static _printLongText(String text) {
|
||||
final pattern = RegExp('.{1,800}'); // 800 is the size of each chunk
|
||||
pattern.allMatches(text).forEach((match) => debugPrint(match.group(0)));
|
||||
|
||||
Reference in new issue
Block a user