diff --git a/lib/constants/app_info.dart b/lib/constants/app_info.dart index 52f6b3797..f4916660b 100644 --- a/lib/constants/app_info.dart +++ b/lib/constants/app_info.dart @@ -1,4 +1,5 @@ import 'package:flutter/foundation.dart'; +import 'package:mornye/utils/desktop_platform.dart'; class AppInfo { static const String version = '5.2.5'; @@ -8,7 +9,14 @@ class AppInfo { static String get shortGitCommit => gitCommit.length > 8 ? gitCommit.substring(0, 8) : gitCommit; - static String get displayVersion => kDebugMode ? 'Internal' : version; + /// The version shown to people; desktop builds are still in beta. + static String get displayVersion => versionLabel(); + + @visibleForTesting + static String versionLabel({bool debug = kDebugMode, bool? desktop}) { + if (debug) return 'Internal'; + return desktop ?? isDesktopPlatform ? '$version (beta)' : version; + } static const String appName = 'Mornye'; static const String copyright = '© 2026 Zarz Eleutherius'; diff --git a/test/app_info_version_test.dart b/test/app_info_version_test.dart new file mode 100644 index 000000000..90d21ec48 --- /dev/null +++ b/test/app_info_version_test.dart @@ -0,0 +1,17 @@ +import 'package:flutter_test/flutter_test.dart'; +import 'package:mornye/constants/app_info.dart'; + +void main() { + test('desktop release builds mark the version as beta', () { + expect( + AppInfo.versionLabel(debug: false, desktop: true), + '${AppInfo.version} (beta)', + ); + expect(AppInfo.versionLabel(debug: false, desktop: false), AppInfo.version); + }); + + test('debug builds stay internal on every platform', () { + expect(AppInfo.versionLabel(debug: true, desktop: true), 'Internal'); + expect(AppInfo.versionLabel(debug: true, desktop: false), 'Internal'); + }); +}