mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-11-04 01:19:33 +00:00
Make AboutState stable
This commit is contained in:
committed by
Benoit Marty
parent
fe51f65aff
commit
cd31ff0f9f
+3
-1
@@ -7,6 +7,8 @@
|
|||||||
|
|
||||||
package io.element.android.features.preferences.impl.about
|
package io.element.android.features.preferences.impl.about
|
||||||
|
|
||||||
|
import kotlinx.collections.immutable.ImmutableList
|
||||||
|
|
||||||
data class AboutState(
|
data class AboutState(
|
||||||
val elementLegals: List<ElementLegal>,
|
val elementLegals: ImmutableList<ElementLegal>,
|
||||||
)
|
)
|
||||||
|
|||||||
+2
-1
@@ -8,6 +8,7 @@
|
|||||||
package io.element.android.features.preferences.impl.about
|
package io.element.android.features.preferences.impl.about
|
||||||
|
|
||||||
import androidx.compose.ui.tooling.preview.PreviewParameterProvider
|
import androidx.compose.ui.tooling.preview.PreviewParameterProvider
|
||||||
|
import kotlinx.collections.immutable.toImmutableList
|
||||||
|
|
||||||
open class AboutStateProvider : PreviewParameterProvider<AboutState> {
|
open class AboutStateProvider : PreviewParameterProvider<AboutState> {
|
||||||
override val values: Sequence<AboutState>
|
override val values: Sequence<AboutState>
|
||||||
@@ -19,5 +20,5 @@ open class AboutStateProvider : PreviewParameterProvider<AboutState> {
|
|||||||
fun anAboutState(
|
fun anAboutState(
|
||||||
elementLegals: List<ElementLegal> = getAllLegals(),
|
elementLegals: List<ElementLegal> = getAllLegals(),
|
||||||
) = AboutState(
|
) = AboutState(
|
||||||
elementLegals = elementLegals,
|
elementLegals = elementLegals.toImmutableList(),
|
||||||
)
|
)
|
||||||
|
|||||||
+4
-2
@@ -10,6 +10,8 @@ package io.element.android.features.preferences.impl.about
|
|||||||
import androidx.annotation.StringRes
|
import androidx.annotation.StringRes
|
||||||
import io.element.android.features.preferences.impl.BuildConfig
|
import io.element.android.features.preferences.impl.BuildConfig
|
||||||
import io.element.android.libraries.ui.strings.CommonStrings
|
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 COPYRIGHT_URL = BuildConfig.URL_COPYRIGHT
|
||||||
private const val USE_POLICY_URL = BuildConfig.URL_ACCEPTABLE_USE
|
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)
|
data object PrivacyPolicy : ElementLegal(CommonStrings.common_privacy_policy, PRIVACY_URL)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getAllLegals(): List<ElementLegal> {
|
fun getAllLegals(): ImmutableList<ElementLegal> {
|
||||||
return listOf(
|
return persistentListOf(
|
||||||
ElementLegal.Copyright,
|
ElementLegal.Copyright,
|
||||||
ElementLegal.AcceptableUsePolicy,
|
ElementLegal.AcceptableUsePolicy,
|
||||||
ElementLegal.PrivacyPolicy,
|
ElementLegal.PrivacyPolicy,
|
||||||
|
|||||||
Reference in New Issue
Block a user