Skip to content

Commit

Permalink
Update emerge-snapshots plugin and add multipreviews (#9)
Browse files Browse the repository at this point in the history
  • Loading branch information
trevor-e authored Oct 4, 2023
1 parent d894aa2 commit 8093136
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 2 deletions.
1 change: 1 addition & 0 deletions android/app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ dependencies {
implementation(libs.accompanist.webview)
implementation(libs.androidx.appcompat)
implementation(libs.compose.activity)
implementation(libs.compose.tooling)
implementation(libs.compose.tooling.preview)
implementation(libs.emerge.snapshots.annotations)
implementation(libs.androidx.datastore.preferences)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package com.emergetools.hackernews.ui.annotations

import androidx.compose.ui.tooling.preview.Preview

@Preview(
name = "Small font",
fontScale = 0.5f,
)
@Preview(
name = "Large font",
fontScale = 1.5f,
)
annotation class FontScalePreviews
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package com.emergetools.hackernews.ui.annotations

import android.content.res.Configuration
import androidx.compose.ui.tooling.preview.Preview

@Preview(
name = "Light mode",
uiMode = Configuration.UI_MODE_NIGHT_NO,
)
@Preview(
name = "Dark mode",
uiMode = Configuration.UI_MODE_NIGHT_YES,
)
annotation class LightDarkPreviews
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package com.emergetools.hackernews.ui.annotations

@FontScalePreviews
@LightDarkPreviews
annotation class SnapshotTestingPreviews
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import com.emergetools.hackernews.network.models.Comment
import com.emergetools.hackernews.ui.BuildItem
import com.emergetools.hackernews.ui.annotations.SnapshotTestingPreviews

@Composable
fun BuildComment(
Expand All @@ -35,6 +36,7 @@ fun BuildComment(
* Example generated snapshot test from main source set.
* To generate a snapshot test for this preview, add the snapshot-processor as a ksp dependency.
*/
@SnapshotTestingPreviews
@Preview
@Composable
fun CommentRow() {
Expand Down
2 changes: 1 addition & 1 deletion android/gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ androidx-test-ext = "1.1.5"
accompanist = "0.24.1-alpha"
emerge-gradle-plugin = "2.0.0"
emerge-perf = "2.0.0-beta01"
emerge-snapshots = "0.7.2"
emerge-snapshots = "0.8.1"
kotlin = "1.8.22"
ksp = "1.8.22-1.0.11"
material-compose = "1.1.0"
Expand Down
4 changes: 3 additions & 1 deletion android/settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ rootProject.name = "HackerNews"
pluginManagement {
repositories {
gradlePluginPortal()
mavenLocal()
mavenCentral()
google()
}
Expand All @@ -11,10 +12,11 @@ pluginManagement {
dependencyResolutionManagement {
repositories {
google()
mavenLocal()
mavenCentral()
}
}

enableFeaturePreview("STABLE_CONFIGURATION_CACHE")

include(":app")
include(":app")

0 comments on commit 8093136

Please sign in to comment.