From 43b94defd9aaf37cc5e7a8864d6f6549535254b9 Mon Sep 17 00:00:00 2001 From: Codex Date: Sat, 17 Oct 2026 19:47:28 +0300 Subject: [PATCH] fix(mobile): use JSON maps for nested config compatibility defaults --- mobile/lib/utils/openapi_patching.dart | 10 ++++++++-- mobile/test/modules/utils/openapi_patching_test.dart | 4 ++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/mobile/lib/utils/openapi_patching.dart b/mobile/lib/utils/openapi_patching.dart index c8f96fefb..1b41736dc 100644 --- a/mobile/lib/utils/openapi_patching.dart +++ b/mobile/lib/utils/openapi_patching.dart @@ -34,7 +34,9 @@ final Map> openApiPatches = { lightStyle: 'https://tiles.immich.cloud/v1/style/light.json', darkStyle: 'https://tiles.immich.cloud/v1/style/dark.json', ).toJson(), - 'ffmpeg': PublicConfigFFmpegDto(realtime: PublicConfigFFmpegRealtimeDto(enabled: false)).toJson(), + 'ffmpeg': { + 'realtime': {'enabled': false}, + }, }, 'ServerConfigDto': { 'mapLightStyleUrl': 'https://tiles.immich.cloud/v1/style/light.json', @@ -53,7 +55,11 @@ final Map> openApiPatches = { 'PeopleResponse': {'updateStrategy': 'everyone'}, 'PersonResponseDto': {'otherPeople': const [], 'sharedBy': const [], 'sharedWith': const []}, 'ServerVersionResponseDto': {'featureLevel': 0}, - 'UserConfigDto': {'notifications': UserConfigNotificationsDto(smtp: UserConfigSmtpDto(enabled: false)).toJson()}, + 'UserConfigDto': { + 'notifications': { + 'smtp': {'enabled': false}, + }, + }, 'WorkflowResponseDto': {'logging': false}, }; diff --git a/mobile/test/modules/utils/openapi_patching_test.dart b/mobile/test/modules/utils/openapi_patching_test.dart index 65d8b5a2b..237fd149b 100644 --- a/mobile/test/modules/utils/openapi_patching_test.dart +++ b/mobile/test/modules/utils/openapi_patching_test.dart @@ -7,7 +7,7 @@ import 'package:openapi/api.dart'; void main() { group('Test OpenApi Patching', () { test('older public config deserializes with map and video defaults', () { - final config = PublicConfigDto.fromJson({ + final config = PublicConfigDto.fromJson({ 'oauth': {'autoLaunch': false, 'buttonText': 'Login', 'enabled': false}, 'passwordLogin': {'enabled': true}, 'server': {'loginPageMessage': ''}, @@ -19,7 +19,7 @@ void main() { }); test('public config keeps explicit server map and video settings', () { - final config = PublicConfigDto.fromJson({ + final config = PublicConfigDto.fromJson({ 'oauth': {'autoLaunch': false, 'buttonText': 'Login', 'enabled': false}, 'passwordLogin': {'enabled': true}, 'server': {'loginPageMessage': ''},