Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update emerge-snapshots plugin and add multipreviews #9

Merged
merged 5 commits into from
Oct 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
rbro112 marked this conversation as resolved.
Show resolved Hide resolved
@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")
Loading