Repository: thunderbird/thunderbird-android
File: legacy/core/src/main/java/com/fsck/k9/preferences/DefaultGeneralSettingsManager.kt (Kotlin)

Code before:
                notification = notificationSettings,
            )
        }
        .combine(displaySettingsSettingsPreferenceManager.getConfigFlow()) { generalSettings, displaySettings ->
            generalSettings.copy(
                display = displaySettings,
            )
        }
        .combine(displayCoreSettingsPreferenceManager.getConfigFlow()) { generalSettings, coreSettings ->
            generalSettings.copy(
                display = generalSettings.display.copy(coreSettings = coreSettings),
            )
        }
        .combine(displayInboxSettingsPreferenceManager.getConfigFlow()) { generalSettings, inboxSettings ->
            generalSettings.copy(
                display = generalSettings.display.copy(inboxSettings = inboxSettings),
            )
        }
        .combine(displayVisualSettingsPreferenceManager.getConfigFlow()) { generalSettings, visualSettings ->
            generalSettings.copy(
                display = generalSettings.display.copy(visualSettings = visualSettings),
            )
        }
        .combine(messageListPreferencesManager.getConfigFlow()) { generalSettings, messageListSettings ->
            logger.debug { "messageListSettings: $messageListSettings" }
            generalSettings.copy(
                display = generalSettings.display.copy(
                    visualSettings = generalSettings.display.visualSettings.copy(
                        messageListSettings = messageListSettings,
                    ),
                ),
            )
        }
        .combine(displayMiscSettingsPreferenceManager.getConfigFlow()) { generalSettings, miscSettings ->
            generalSettings.copy(
                display = generalSettings.display.copy(miscSettings = miscSettings),
            )
        }
        .combine(networkSettingsPreferenceManager.getConfigFlow()) { generalSettings, networkSettings ->
            generalSettings.copy(
                network = networkSettings,
            )
        }
        .combine(debuggingSettingsPreferenceManager.getConfigFlow()) { generalSettings, debuggingSettings ->
            generalSettings.copy(
                debugging = debuggingSettings,
            ).also {
                debugLogConfigurator.updateLoggingStatus(debuggingSettings.isDebugLoggingEnabled)
                debugLogConfigurator.updateSyncLogging(debuggingSettings.isSyncLoggingEnabled)
            }
        }

Review comment (security):
Worth noting that logger is currently not recommended:
```
"Use a net.thunderbird.core.logging.Logger instance via dependency injection instead. " +
        "This class will be removed in a future release.",
```


Code after:
            generalSettings.copy(
                notification = notificationSettings,
            )
        }
        .combine(displaySettingsSettingsPreferenceManager.getConfigFlow()) { generalSettings, displaySettings ->
            generalSettings.copy(
                display = displaySettings,
            )
        }
        .combine(displayCoreSettingsPreferenceManager.getConfigFlow()) { generalSettings, coreSettings ->
            generalSettings.copy(
                display = generalSettings.display.copy(coreSettings = coreSettings),
            )
        }
        .combine(displayInboxSettingsPreferenceManager.getConfigFlow()) { generalSettings, inboxSettings ->
            generalSettings.copy(
                display = generalSettings.display.copy(inboxSettings = inboxSettings),
            )
        }
        .combine(displayVisualSettingsPreferenceManager.getConfigFlow()) { generalSettings, visualSettings ->
            generalSettings.copy(
                display = generalSettings.display.copy(visualSettings = visualSettings),
            )
        }
        .combine(messageListPreferencesManager.getConfigFlow()) { generalSettings, messageListSettings ->
            logger.debug { "messageListSettings: $messageListSettings" }
            generalSettings.copy(
                display = generalSettings.display.copy(
                    visualSettings = generalSettings.display.visualSettings.copy(
                        messageListSettings = messageListSettings,
                    ),
                ),
            )
        }
        .combine(displayMiscSettingsPreferenceManager.getConfigFlow()) { generalSettings, miscSettings ->
            generalSettings.copy(
                display = generalSettings.display.copy(miscSettings = miscSettings),
            )
        }
        .combine(networkSettingsPreferenceManager.getConfigFlow()) { generalSettings, networkSettings ->
            generalSettings.copy(
                network = networkSettings,
            )
        }
        .combine(debuggingSettingsPreferenceManager.getConfigFlow()) { generalSettings, debuggingSettings ->
            generalSettings.copy(
                debugging = debuggingSettings,
            ).also {
                debugLogConfigurator.updateLoggingStatus(debuggingSettings.isDebugLoggingEnabled)
                debugLogConfigurator.updateSyncLogging(debuggingSettings.isSyncLoggingEnabled)
            }