fix(mobile): use JSON maps for nested config compatibility defaults

This commit is contained in:
Codex
2026-10-17 19:47:28 +03:00
parent ffb8c84e48
commit 43b94defd9
2 changed files with 10 additions and 4 deletions
+8 -2
View File
@@ -34,7 +34,9 @@ final Map<String, Map<String, Object?>> 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<String, Map<String, Object?>> 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},
};
@@ -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(<String, dynamic>{
'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(<String, dynamic>{
'oauth': {'autoLaunch': false, 'buttonText': 'Login', 'enabled': false},
'passwordLogin': {'enabled': true},
'server': {'loginPageMessage': ''},