Rename PreviewParameterProvider subclasses to the PreviewParam suffix

The `Provider` suffix reads as a dependency provider rather than as preview
data, and it collides with the real providers in the codebase — `StringProvider`,
`PickerProvider`, the login feature's `AccountProvider` — so the name says
nothing about which of the two a class is. `PreviewParam` says it.

195 classes are renamed, along with the 185 files named after them, the konsist
rule that enforces the convention, the presentation-class file templates and the
onboarding documentation.

This cannot be split. `Konsist.scopeFromProduction()` scans the whole project, so
flipping the assertion before every class has moved leaves the rule red, and a
rule that accepted either suffix during a transition would be exactly the kind of
compatibility layer this convention change is meant to remove.

Two judgement calls in the rule itself. The `name.endsWith("PreviewProvider")`
exclusion is dropped: its only job was to reject a redundant `Preview` before
`Provider`, and the new suffix already contains it; no class currently ends with
`PreviewProvider`, so removing it changes nothing today. And
`EditableAvatarViewUriProvider` is renamed rather than deleted from the exclusion
list even though no such class exists in this repository, since it presumably
comes from the modules overlaid for the enterprise build.

Nothing keyed off the old suffix: no snapshot filename contains a provider class
name, so no Paparazzi image changes, and the Kover variants match on `*Presenter`,
`*State` and `*ViewKt`, so coverage bounds are unaffected.
This commit is contained in:
hayaksi1
2026-08-17 17:40:33 +03:00
parent 12791406ca
commit 03c330ee07
388 changed files with 495 additions and 476 deletions
@@ -17,7 +17,7 @@ import kotlinx.collections.immutable.ImmutableList
import kotlinx.collections.immutable.persistentListOf
import kotlinx.collections.immutable.toImmutableList
internal class AddRoomToSpaceStateProvider : PreviewParameterProvider<AddRoomToSpaceState> {
internal class AddRoomToSpaceStatePreviewParam : PreviewParameterProvider<AddRoomToSpaceState> {
override val values: Sequence<AddRoomToSpaceState>
get() = sequenceOf(
// Initial state with suggestions
@@ -273,7 +273,7 @@ private fun RoomListItem(
@PreviewsDayNight
@Composable
internal fun AddRoomToSpaceViewPreview(
@PreviewParameter(AddRoomToSpaceStateProvider::class) state: AddRoomToSpaceState
@PreviewParameter(AddRoomToSpaceStatePreviewParam::class) state: AddRoomToSpaceState
) = ElementPreview {
AddRoomToSpaceView(
state = state,
@@ -19,7 +19,7 @@ import kotlinx.collections.immutable.ImmutableList
import kotlinx.collections.immutable.persistentListOf
import kotlinx.collections.immutable.toImmutableList
class LeaveSpaceStateProvider : PreviewParameterProvider<LeaveSpaceState> {
class LeaveSpaceStatePreviewParam : PreviewParameterProvider<LeaveSpaceState> {
override val values: Sequence<LeaveSpaceState>
get() = sequenceOf(
aLeaveSpaceState(),
@@ -366,7 +366,7 @@ private fun SpaceItem(
@PreviewsDayNight
@Composable
internal fun LeaveSpaceViewPreview(
@PreviewParameter(LeaveSpaceStateProvider::class) state: LeaveSpaceState,
@PreviewParameter(LeaveSpaceStatePreviewParam::class) state: LeaveSpaceState,
) = ElementPreview {
LeaveSpaceView(
state = state,
@@ -26,7 +26,7 @@ import kotlinx.collections.immutable.toImmutableList
import kotlinx.collections.immutable.toImmutableMap
import kotlinx.collections.immutable.toImmutableSet
open class SpaceStateProvider : PreviewParameterProvider<SpaceState> {
open class SpaceStatePreviewParam : PreviewParameterProvider<SpaceState> {
override val values: Sequence<SpaceState>
get() = sequenceOf(
aSpaceState(),
@@ -680,7 +680,7 @@ private fun RemoveRoomsActionView(
@PreviewsDayNight
@Composable
internal fun SpaceViewPreview(
@PreviewParameter(SpaceStateProvider::class) state: SpaceState
@PreviewParameter(SpaceStatePreviewParam::class) state: SpaceState
) = ElementPreview {
SpaceView(
state = state,
@@ -13,7 +13,7 @@ import io.element.android.libraries.designsystem.preview.SPACE_NAME
import io.element.android.libraries.matrix.api.core.RoomAlias
import io.element.android.libraries.matrix.api.core.RoomId
open class SpaceSettingsStateProvider : PreviewParameterProvider<SpaceSettingsState> {
open class SpaceSettingsStatePreviewParam : PreviewParameterProvider<SpaceSettingsState> {
override val values: Sequence<SpaceSettingsState>
get() = sequenceOf(
aSpaceSettingsState(),
@@ -223,7 +223,7 @@ private fun LeaveSpaceItem(
@PreviewsDayNight
@Composable
internal fun SpaceSettingsViewPreview(
@PreviewParameter(SpaceSettingsStateProvider::class) state: SpaceSettingsState
@PreviewParameter(SpaceSettingsStatePreviewParam::class) state: SpaceSettingsState
) = ElementPreview {
SpaceSettingsView(
state = state,