Add missing device id to settings screen (#2320)
* Add missing device id to settings screen * Extract footer component * Restore `@PreviewWithLargeHeight` logic --------- Co-authored-by: ElementBot <benoitm+elementbot@element.io>
This commit is contained in:
parent
3e9f8bd024
commit
47f7f8952b
50 changed files with 122 additions and 83 deletions
|
|
@ -17,6 +17,7 @@
|
|||
package ui
|
||||
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.unit.Dp
|
||||
import com.airbnb.android.showkase.models.ShowkaseBrowserComponent
|
||||
|
||||
class ComponentTestPreview(
|
||||
|
|
@ -27,6 +28,10 @@ class ComponentTestPreview(
|
|||
|
||||
override val name: String = showkaseBrowserComponent.componentName
|
||||
|
||||
override fun customHeightDp(): Dp? {
|
||||
return showkaseBrowserComponent.heightDp?.let { Dp(it.toFloat()) }
|
||||
}
|
||||
|
||||
override fun toString(): String = showkaseBrowserComponent.componentKey
|
||||
// Strip common package beginning
|
||||
.replace("io.element.android.features.", "f.")
|
||||
|
|
|
|||
|
|
@ -94,6 +94,8 @@ class S {
|
|||
) {
|
||||
val locale = localeStr.toLocale()
|
||||
Locale.setDefault(locale) // Needed for regional settings, as first day of week
|
||||
val densityScale = baseDeviceConfig.deviceConfig.density.dpiValue / 160f
|
||||
val customScreenHeight = componentTestPreview.customHeightDp()?.value?.let { it * densityScale }?.toInt()
|
||||
paparazzi.unsafeUpdateConfig(
|
||||
deviceConfig = baseDeviceConfig.deviceConfig.copy(
|
||||
softButtons = false,
|
||||
|
|
@ -104,6 +106,7 @@ class S {
|
|||
false -> NightMode.NOTNIGHT
|
||||
}
|
||||
},
|
||||
screenHeight = customScreenHeight ?: baseDeviceConfig.deviceConfig.screenHeight,
|
||||
),
|
||||
)
|
||||
paparazzi.snapshot {
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ package ui
|
|||
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.compose.ui.unit.Dp
|
||||
import com.airbnb.android.showkase.models.ShowkaseElementsMetadata
|
||||
import io.element.android.libraries.designsystem.preview.NIGHT_MODE_NAME
|
||||
|
||||
|
|
@ -26,6 +27,8 @@ interface TestPreview {
|
|||
fun Content()
|
||||
|
||||
val name: String
|
||||
|
||||
fun customHeightDp(): Dp? = null
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue