Skip to content

High performance self-hosted photo and video management solution.

fix(mobile): hide latest version if disabled (#25691)

Thomas855817514c4c
diff --git a/mobile/lib/models/server_info/server_info.model.dart b/mobile/lib/models/server_info/server_info.model.dart
index a034960ddb..5d78acb0b8 100644
--- a/mobile/lib/models/server_info/server_info.model.dart
+++ b/mobile/lib/models/server_info/server_info.model.dart
@@ -20,7 +20,7 @@ enum VersionStatus {
class ServerInfo {
final ServerVersion serverVersion;
- final ServerVersion latestVersion;
+ final ServerVersion? latestVersion;
final ServerFeatures serverFeatures;
final ServerConfig serverConfig;
final ServerDiskInfo serverDiskInfo;
diff --git a/mobile/lib/providers/server_info.provider.dart b/mobile/lib/providers/server_info.provider.dart
index bb201a607c..fba4fa7294 100644
--- a/mobile/lib/providers/server_info.provider.dart
+++ b/mobile/lib/providers/server_info.provider.dart
@@ -15,7 +15,7 @@ class ServerInfoNotifier extends StateNotifier<ServerInfo> {
: super(
const ServerInfo(
serverVersion: ServerVersion(major: 0, minor: 0, patch: 0),
- latestVersion: ServerVersion(major: 0, minor: 0, patch: 0),
+ latestVersion: null,
serverFeatures: ServerFeatures(map: true, trash: true, oauthEnabled: false, passwordLogin: true),
serverConfig: ServerConfig(
trashDays: 30,
@@ -43,7 +43,7 @@ class ServerInfoNotifier extends StateNotifier<ServerInfo> {
try {
final serverVersion = await _serverInfoService.getServerVersion();
- // using isClientOutOfDate since that will show to users reguardless of if they are an admin
+ // using isClientOutOfDate since that will show to users regardless of if they are an admin
if (serverVersion == null) {
state = state.copyWith(versionStatus: VersionStatus.error);
return;
@@ -76,7 +76,7 @@ class ServerInfoNotifier extends StateNotifier<ServerInfo> {
state = state.copyWith(versionStatus: VersionStatus.upToDate);
}
- handleReleaseInfo(ServerVersion serverVersion, ServerVersion latestVersion) {
+ handleReleaseInfo(ServerVersion serverVersion, ServerVersion? latestVersion) {
// Update local server version
_checkServerVersionMismatch(serverVersion, latestVersion: latestVersion);
}
diff --git a/mobile/lib/widgets/common/app_bar_dialog/app_bar_server_info.dart b/mobile/lib/widgets/common/app_bar_dialog/app_bar_server_info.dart
index a83a3beee3..a341d6395c 100644
--- a/mobile/lib/widgets/common/app_bar_dialog/app_bar_server_info.dart
+++ b/mobile/lib/widgets/common/app_bar_dialog/app_bar_server_info.dart
@@ -170,50 +170,52 @@ class AppBarServerInfo extends HookConsumerWidget {
),
],
),
- const Padding(padding: EdgeInsets.symmetric(horizontal: 10), child: Divider(thickness: 1)),
- Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: [
- Expanded(
- child: Padding(
- padding: const EdgeInsets.only(left: 10.0),
- child: Row(
- children: [
- if (serverInfoState.versionStatus == VersionStatus.serverOutOfDate)
- const Padding(
- padding: EdgeInsets.only(right: 5.0),
- child: Icon(Icons.info, color: Color.fromARGB(255, 243, 188, 106), size: 12),
- ),
- Text(
- "latest_version".tr(),
- style: TextStyle(
- fontSize: titleFontSize,
- color: context.textTheme.labelSmall?.color,
- fontWeight: FontWeight.w500,
+ if (serverInfoState.latestVersion != null) ...[
+ const Padding(padding: EdgeInsets.symmetric(horizontal: 10), child: Divider(thickness: 1)),
+ Row(
+ mainAxisAlignment: MainAxisAlignment.spaceBetween,
+ children: [
+ Expanded(
+ child: Padding(
+ padding: const EdgeInsets.only(left: 10.0),
+ child: Row(
+ children: [
+ if (serverInfoState.versionStatus == VersionStatus.serverOutOfDate)
+ const Padding(
+ padding: EdgeInsets.only(right: 5.0),
+ child: Icon(Icons.info, color: Color.fromARGB(255, 243, 188, 106), size: 12),
+ ),
+ Text(
+ "latest_version".tr(),
+ style: TextStyle(
+ fontSize: titleFontSize,
+ color: context.textTheme.labelSmall?.color,
+ fontWeight: FontWeight.w500,
+ ),
),
- ),
- ],
+ ],
+ ),
),
),
- ),
- Expanded(
- flex: 0,
- child: Padding(
- padding: const EdgeInsets.only(right: 10.0),
- child: Text(
- serverInfoState.latestVersion.major > 0
- ? "${serverInfoState.latestVersion.major}.${serverInfoState.latestVersion.minor}.${serverInfoState.latestVersion.patch}"
- : "--",
- style: TextStyle(
- fontSize: contentFontSize,
- color: context.colorScheme.onSurfaceSecondary,
- fontWeight: FontWeight.bold,
+ Expanded(
+ flex: 0,
+ child: Padding(
+ padding: const EdgeInsets.only(right: 10.0),
+ child: Text(
+ serverInfoState.latestVersion!.major > 0
+ ? "${serverInfoState.latestVersion!.major}.${serverInfoState.latestVersion!.minor}.${serverInfoState.latestVersion!.patch}"
+ : "--",
+ style: TextStyle(
+ fontSize: contentFontSize,
+ color: context.colorScheme.onSurfaceSecondary,
+ fontWeight: FontWeight.bold,
+ ),
),
),
),
- ),
- ],
- ),
+ ],
+ ),
+ ],
],
),
),