Versionnummer (halb) automatisiert

This commit is contained in:
Sven committed 2024-03-10 12:03:09 +01:00
1 parent 8751e3ec80
commit 1a6d00730e
6 files changed
+62 -9

No files matched your search

+5 -2
View File
@@ -49,11 +49,14 @@ android {
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "de.assecutor.stadtbote"
// You can update the following values to match your application needs.
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
minSdkVersion flutter.minSdkVersion
targetSdkVersion flutter.targetSdkVersion
versionCode 3
versionName 'A213'
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
minSdkVersion 28
}
+3 -1
View File
@@ -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";
+12 -5
View File
@@ -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);
+7
View File
@@ -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)));
+32
View File
@@ -297,6 +297,22 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.2.0"
device_info_plus:
dependency: "direct main"
description:
name: device_info_plus
sha256: "77f757b789ff68e4eaf9c56d1752309bd9f7ad557cb105b938a7f8eb89e59110"
url: "https://pub.dev"
source: hosted
version: "9.1.2"
device_info_plus_platform_interface:
dependency: transitive
description:
name: device_info_plus_platform_interface
sha256: d3b01d5868b50ae571cd1dc6e502fc94d956b665756180f7b16ead09e836fd64
url: "https://pub.dev"
source: hosted
version: "7.0.0"
diffutil_dart:
dependency: transitive
description:
@@ -896,6 +912,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.1.0"
package_info:
dependency: "direct main"
description:
name: package_info
sha256: "6c07d9d82c69e16afeeeeb6866fe43985a20b3b50df243091bfc4a4ad2b03b75"
url: "https://pub.dev"
source: hosted
version: "2.0.2"
path:
dependency: transitive
description:
@@ -1453,6 +1477,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "5.1.0"
win32_registry:
dependency: transitive
description:
name: win32_registry
sha256: "41fd8a189940d8696b1b810efb9abcf60827b6cbfab90b0c43e8439e3a39d85a"
url: "https://pub.dev"
source: hosted
version: "1.1.2"
wkt_parser:
dependency: transitive
description:
+3 -1
View File
@@ -16,7 +16,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
# In Windows, build-name is used as the major, minor, and patch parts
# of the product and file versions while build-number is used as the build suffix.
version: 1.0.0+1
version: 214.0.0+5
environment:
sdk: '>=2.19.6 <3.0.0'
@@ -68,6 +68,8 @@ dependencies:
url_launcher: ^6.2.4
audioplayers: ^5.2.1
image: ^4.1.7
device_info_plus: ^9.1.2
package_info: ^2.0.2
dev_dependencies:
flutter_test: