Skip to content

A cross platform Audiobookshelf client for Android and iOS

Dart

Show the app build number in the logs and settings

Barnabas870e08d45a02
diff --git a/lib/screens/settings_screen.dart b/lib/screens/settings_screen.dart
index d07448f6..d0d0b0e9 100644
--- a/lib/screens/settings_screen.dart
+++ b/lib/screens/settings_screen.dart
@@ -755,7 +755,9 @@ class _SettingsScreenState extends State<SettingsScreen> {
_deviceAvailableBytes = deviceStorage['availableBytes']!;
}
_autoSleepSettings = autoSleep;
- _appVersion = pkgInfo.version;
+ _appVersion = pkgInfo.buildNumber.isEmpty
+ ? pkgInfo.version
+ : '${pkgInfo.version}+${pkgInfo.buildNumber}';
_streamingCacheSizeMb = cacheSizeMb;
_localServerEnabled = localEnabled;
_localServerUrl = localUrl;
diff --git a/lib/services/api_service.dart b/lib/services/api_service.dart
index 1bf43b7c..74e164dc 100644
--- a/lib/services/api_service.dart
+++ b/lib/services/api_service.dart
@@ -16,6 +16,12 @@ class LocalSessionResult {
class ApiService {
static String appVersion = '1.3.0'; // fallback; overwritten by initVersion()
+ static String appBuild = ''; // build number; set by initVersion()
+
+ /// Version plus build (e.g. "1.9.1+198") for logs. `appVersion` stays clean
+ /// because it's also sent to the server as clientVersion.
+ static String get appVersionFull =>
+ appBuild.isEmpty ? appVersion : '$appVersion+$appBuild';
/// Audible region code derived from device locale.
static String get _region {
@@ -33,6 +39,7 @@ class ApiService {
try {
final info = await PackageInfo.fromPlatform();
appVersion = info.version;
+ appBuild = info.buildNumber;
} catch (_) {}
}
diff --git a/lib/services/log_service.dart b/lib/services/log_service.dart
index 94087e0f..99124b4a 100644
--- a/lib/services/log_service.dart
+++ b/lib/services/log_service.dart
@@ -56,7 +56,7 @@ class LogService {
// Start fresh - write device/server info header
final header = StringBuffer()
..writeln('=== Absorb Log ===')
- ..writeln('App Version: ${ApiService.appVersion}')
+ ..writeln('App Version: ${ApiService.appVersionFull}')
..writeln('Device: ${ApiService.deviceManufacturer} ${ApiService.deviceModel}')
..writeln('OS: ${Platform.operatingSystem} ${Platform.operatingSystemVersion}')
..writeln('Created: ${DateTime.now().toIso8601String()}')
@@ -146,7 +146,7 @@ class LogService {
// still have device info (don't wait for next init/restart).
final header = StringBuffer()
..writeln('=== Absorb Log ===')
- ..writeln('App Version: ${ApiService.appVersion}')
+ ..writeln('App Version: ${ApiService.appVersionFull}')
..writeln('Device: ${ApiService.deviceManufacturer} ${ApiService.deviceModel}')
..writeln('OS: ${Platform.operatingSystem} ${Platform.operatingSystemVersion}')
..writeln('Created: ${DateTime.now().toIso8601String()}')
@@ -166,7 +166,7 @@ class LogService {
/// Build device info string used by both email methods.
String _deviceInfo({String? serverVersion}) {
final buf = StringBuffer()
- ..writeln('App Version: ${ApiService.appVersion}')
+ ..writeln('App Version: ${ApiService.appVersionFull}')
..writeln('Device: ${ApiService.deviceManufacturer} ${ApiService.deviceModel}')
..writeln('Device ID: ${ApiService.deviceId}');
if (serverVersion != null) {
diff --git a/pubspec.yaml b/pubspec.yaml
index f2a431cc..ffd3d2a2 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -1,7 +1,7 @@
name: absorb
description: An Audiobookshelf Client
publish_to: 'none'
-version: 1.9.1+199
+version: 1.9.1+200
environment:
sdk: '>=3.10.0 <4.0.0'