1
0
Fork 0
mirror of https://github.com/immich-app/immich.git synced 2025-01-01 08:31:59 +00:00

fix(mobile): warning message not resetting when changing server URL (#10112)

This commit is contained in:
Alex 2024-06-11 05:48:49 -05:00 committed by GitHub
parent 8a866297f7
commit 04808f8b5c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -54,7 +54,7 @@ class LoginForm extends HookConsumerWidget {
duration: const Duration(seconds: 60), duration: const Duration(seconds: 60),
)..repeat(); )..repeat();
final serverInfo = ref.watch(serverInfoProvider); final serverInfo = ref.watch(serverInfoProvider);
final warningMessage = useState<String>(''); final warningMessage = useState<String?>(null);
final ValueNotifier<String?> serverEndpoint = useState<String?>(null); final ValueNotifier<String?> serverEndpoint = useState<String?>(null);
@ -67,16 +67,12 @@ class LoginForm extends HookConsumerWidget {
final serverMajorVersion = serverInfo.serverVersion.major; final serverMajorVersion = serverInfo.serverVersion.major;
final serverMinorVersion = serverInfo.serverVersion.minor; final serverMinorVersion = serverInfo.serverVersion.minor;
final message = getVersionCompatibilityMessage( warningMessage.value = getVersionCompatibilityMessage(
appMajorVersion, appMajorVersion,
appMinorVersion, appMinorVersion,
serverMajorVersion, serverMajorVersion,
serverMinorVersion, serverMinorVersion,
); );
if (message != null) {
warningMessage.value = message;
}
} catch (error) { } catch (error) {
warningMessage.value = 'Error checking version compatibility'; warningMessage.value = 'Error checking version compatibility';
} }
@ -345,7 +341,7 @@ class LoginForm extends HookConsumerWidget {
buildVersionCompatWarning() { buildVersionCompatWarning() {
checkVersionMismatch(); checkVersionMismatch();
if (warningMessage.value.isEmpty) { if (warningMessage.value == null) {
return const SizedBox.shrink(); return const SizedBox.shrink();
} }
@ -363,7 +359,7 @@ class LoginForm extends HookConsumerWidget {
), ),
), ),
child: Text( child: Text(
warningMessage.value, warningMessage.value!,
textAlign: TextAlign.center, textAlign: TextAlign.center,
), ),
), ),