Repository: thunderbird/thunderbird-android
File: core/ui/compose/preference/src/main/kotlin/net/thunderbird/core/ui/compose/preference/api/Preference.kt (Kotlin)

Code before:
        val title: () -> String,
        val description: () -> String? = { null },
        override val value: Choice,
        val options: ImmutableList<Choice>,
    ) : PreferenceSetting<Choice> {
        @IgnoredOnParcel
        override val requiresEditView: Boolean = false

        @Parcelize
        data class Choice(
            val id: String,
            val title: () -> String,
        ) : Parcelable
    }

    @Parcelize
    data class SingleChoiceCompact(
        override val id: String,
        val title: () -> String,
        val description: () -> String? = { null },
        val icon: () -> ImageVector? = { null },
        override val value: CompactChoice,
        val options: ImmutableList<CompactChoice>,
    ) : PreferenceSetting<CompactChoice> {
        @IgnoredOnParcel
        override val requiresEditView: Boolean = false

        @Parcelize
        data class CompactChoice(
            val id: String,
            val title: () -> String,
        ) : Parcelable
    }

    @Parcelize
    data class Switch(
        override val id: String,
        val title: () -> String,
        val description: () -> String? = { null },
        val enabled: Boolean,
        override val value: Boolean,
    ) : PreferenceSetting<Boolean> {
        @IgnoredOnParcel
        override val requiresEditView: Boolean = false
    }
}

/**
 * A preference that does not hold a value. It is used to display a section, a divider or custom UI.
 */
sealed interface PreferenceDisplay : Preference {

Review comment (suggestion):
This should be true to signal that there is an edit view. Not used at the moment, but I'll update the implementation to check the flag.

Code after:
        val title: () -> String,
        val description: () -> String? = { null },
        override val value: Choice,
        val options: ImmutableList<Choice>,
    ) : PreferenceSetting<Choice> {
        @IgnoredOnParcel
        override val requiresEditView: Boolean = false

        @Parcelize
        data class Choice(
            val id: String,
            val title: () -> String,
        ) : Parcelable
    }

    @Parcelize
    data class SingleChoiceCompact(
        override val id: String,
        val title: () -> String,
        val description: () -> String? = { null },
        val icon: () -> ImageVector? = { null },
        override val value: CompactChoice,
        val options: ImmutableList<CompactChoice>,
    ) : PreferenceSetting<CompactChoice> {
        @IgnoredOnParcel
        override val requiresEditView: Boolean = true

        @Parcelize
        data class CompactChoice(
            val id: String,
            val title: () -> String,
        ) : Parcelable
    }

    @Parcelize
    data class Switch(
        override val id: String,
        val title: () -> String,
        val description: () -> String? = { null },
        val enabled: Boolean,
        override val value: Boolean,
    ) : PreferenceSetting<Boolean> {
        @IgnoredOnParcel
        override val requiresEditView: Boolean = false
    }
}

/**
 * A preference that does not hold a value. It is used to display a section, a divider or custom UI.
 */
sealed interface PreferenceDisplay : Preference {