Make AboutState stable
This commit is contained in:
committed by
Benoit Marty
parent
0f1ae41b41
commit
f6eed21055
@@ -7,6 +7,8 @@
|
||||
|
||||
package io.element.android.features.preferences.impl.about
|
||||
|
||||
import kotlinx.collections.immutable.ImmutableList
|
||||
|
||||
data class AboutState(
|
||||
val elementLegals: List<ElementLegal>,
|
||||
val elementLegals: ImmutableList<ElementLegal>,
|
||||
)
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
package io.element.android.features.preferences.impl.about
|
||||
|
||||
import androidx.compose.ui.tooling.preview.PreviewParameterProvider
|
||||
import kotlinx.collections.immutable.toImmutableList
|
||||
|
||||
open class AboutStateProvider : PreviewParameterProvider<AboutState> {
|
||||
override val values: Sequence<AboutState>
|
||||
@@ -19,5 +20,5 @@ open class AboutStateProvider : PreviewParameterProvider<AboutState> {
|
||||
fun anAboutState(
|
||||
elementLegals: List<ElementLegal> = getAllLegals(),
|
||||
) = AboutState(
|
||||
elementLegals = elementLegals,
|
||||
elementLegals = elementLegals.toImmutableList(),
|
||||
)
|
||||
|
||||
@@ -10,6 +10,8 @@ package io.element.android.features.preferences.impl.about
|
||||
import androidx.annotation.StringRes
|
||||
import io.element.android.features.preferences.impl.BuildConfig
|
||||
import io.element.android.libraries.ui.strings.CommonStrings
|
||||
import kotlinx.collections.immutable.ImmutableList
|
||||
import kotlinx.collections.immutable.persistentListOf
|
||||
|
||||
private const val COPYRIGHT_URL = BuildConfig.URL_COPYRIGHT
|
||||
private const val USE_POLICY_URL = BuildConfig.URL_ACCEPTABLE_USE
|
||||
@@ -24,8 +26,8 @@ sealed class ElementLegal(
|
||||
data object PrivacyPolicy : ElementLegal(CommonStrings.common_privacy_policy, PRIVACY_URL)
|
||||
}
|
||||
|
||||
fun getAllLegals(): List<ElementLegal> {
|
||||
return listOf(
|
||||
fun getAllLegals(): ImmutableList<ElementLegal> {
|
||||
return persistentListOf(
|
||||
ElementLegal.Copyright,
|
||||
ElementLegal.AcceptableUsePolicy,
|
||||
ElementLegal.PrivacyPolicy,
|
||||
|
||||
Reference in New Issue
Block a user