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
@@ -13,7 +13,7 @@ import androidx.compose.ui.tooling.preview.PreviewParameterProvider
import io.element.android.libraries.permissions.api.PermissionsState
import io.element.android.libraries.permissions.api.aPermissionsState
open class DesktopNoticeStateProvider : PreviewParameterProvider<DesktopNoticeState> {
open class DesktopNoticeStatePreviewParam : PreviewParameterProvider<DesktopNoticeState> {
override val values: Sequence<DesktopNoticeState>
get() = sequenceOf(
aDesktopNoticeState(),
@@ -118,7 +118,7 @@ fun DesktopNoticeView(
@PreviewsDayNight
@Composable
internal fun DesktopNoticeViewPreview(
@PreviewParameter(DesktopNoticeStateProvider::class) state: DesktopNoticeState,
@PreviewParameter(DesktopNoticeStatePreviewParam::class) state: DesktopNoticeState,
) = ElementPreview {
DesktopNoticeView(
state = state,
@@ -9,7 +9,7 @@ package io.element.android.features.linknewdevice.impl.screens.error
import androidx.compose.ui.tooling.preview.PreviewParameterProvider
class ErrorScreenTypeProvider : PreviewParameterProvider<ErrorScreenType> {
class ErrorScreenTypePreviewParam : PreviewParameterProvider<ErrorScreenType> {
override val values: Sequence<ErrorScreenType> = sequenceOf(
ErrorScreenType.Cancelled,
ErrorScreenType.Declined,
@@ -165,7 +165,7 @@ private fun ColumnScope.Buttons(
@PreviewsDayNight
@Composable
internal fun ErrorViewPreview(@PreviewParameter(ErrorScreenTypeProvider::class) errorScreenType: ErrorScreenType) {
internal fun ErrorViewPreview(@PreviewParameter(ErrorScreenTypePreviewParam::class) errorScreenType: ErrorScreenType) {
ElementPreview {
ErrorView(
errorScreenType = errorScreenType,
@@ -11,7 +11,7 @@ import androidx.compose.ui.tooling.preview.PreviewParameterProvider
import io.element.android.libraries.architecture.AsyncAction
import io.element.android.libraries.matrix.api.linknewdevice.ErrorType
open class EnterNumberStateProvider : PreviewParameterProvider<EnterNumberState> {
open class EnterNumberStatePreviewParam : PreviewParameterProvider<EnterNumberState> {
override val values: Sequence<EnterNumberState>
get() = sequenceOf(
aEnterNumberState(),
@@ -117,7 +117,7 @@ fun EnterNumberView(
@PreviewsDayNight
@Composable
internal fun EnterNumberViewPreview(
@PreviewParameter(EnterNumberStateProvider::class) state: EnterNumberState,
@PreviewParameter(EnterNumberStatePreviewParam::class) state: EnterNumberState,
) = ElementPreview {
EnterNumberView(
state = state,
@@ -10,7 +10,7 @@ package io.element.android.features.linknewdevice.impl.screens.qrcode
import androidx.compose.ui.tooling.preview.PreviewParameterProvider
import io.element.android.libraries.architecture.AsyncData
class ShowQrCodeStateProvider : PreviewParameterProvider<ShowQrCodeState> {
class ShowQrCodeStatePreviewParam : PreviewParameterProvider<ShowQrCodeState> {
override val values: Sequence<ShowQrCodeState>
get() = sequenceOf(
aShowQrCodeState(),
@@ -117,7 +117,7 @@ private fun QrCodeOrLoading(
@PreviewsDayNight
@Composable
internal fun ShowQrCodeViewPreview(
@PreviewParameter(ShowQrCodeStateProvider::class) state: ShowQrCodeState,
@PreviewParameter(ShowQrCodeStatePreviewParam::class) state: ShowQrCodeState,
) = ElementPreview {
ShowQrCodeView(
state = state,
@@ -11,7 +11,7 @@ import androidx.compose.ui.tooling.preview.PreviewParameterProvider
import io.element.android.libraries.architecture.AsyncData
import io.element.android.libraries.matrix.api.linknewdevice.ErrorType
open class LinkNewDeviceRootStateProvider : PreviewParameterProvider<LinkNewDeviceRootState> {
open class LinkNewDeviceRootStatePreviewParam : PreviewParameterProvider<LinkNewDeviceRootState> {
override val values: Sequence<LinkNewDeviceRootState>
get() = sequenceOf(
aLinkNewDeviceRootState(),
@@ -140,7 +140,7 @@ fun LinkNewDeviceRootView(
@PreviewsDayNight
@Composable
internal fun LinkNewDeviceRootViewPreview(
@PreviewParameter(LinkNewDeviceRootStateProvider::class) state: LinkNewDeviceRootState
@PreviewParameter(LinkNewDeviceRootStatePreviewParam::class) state: LinkNewDeviceRootState
) = ElementPreview {
LinkNewDeviceRootView(
state = state,
@@ -10,7 +10,7 @@ package io.element.android.features.linknewdevice.impl.screens.scan
import androidx.compose.ui.tooling.preview.PreviewParameterProvider
import io.element.android.libraries.architecture.AsyncAction
open class ScanQrCodeStateProvider : PreviewParameterProvider<ScanQrCodeState> {
open class ScanQrCodeStatePreviewParam : PreviewParameterProvider<ScanQrCodeState> {
override val values: Sequence<ScanQrCodeState>
get() = sequenceOf(
aScanQrCodeState(),
@@ -166,7 +166,7 @@ private fun ColumnScope.Buttons(
@PreviewsDayNight
@Composable
internal fun ScanQrCodeViewPreview(@PreviewParameter(ScanQrCodeStateProvider::class) state: ScanQrCodeState) = ElementPreview {
internal fun ScanQrCodeViewPreview(@PreviewParameter(ScanQrCodeStatePreviewParam::class) state: ScanQrCodeState) = ElementPreview {
ScanQrCodeView(
state = state,
onBackClick = {},