Skip to content

Commit

Permalink
Add first app store snapshot (#100)
Browse files Browse the repository at this point in the history
  • Loading branch information
rbro112 authored Aug 6, 2024
1 parent 7b36239 commit 482f13b
Show file tree
Hide file tree
Showing 5 changed files with 143 additions and 2 deletions.
9 changes: 9 additions & 0 deletions android/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
root = true

[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
4 changes: 3 additions & 1 deletion android/app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ dependencies {
implementation(libs.androidx.browser)
implementation(libs.androidx.datastore)

implementation(libs.emerge.snapshots.annotations)
implementation(libs.okhttp)
implementation(libs.retrofit)
implementation(libs.retrofit.kotlinx.serialization)
Expand All @@ -110,4 +111,5 @@ dependencies {

debugImplementation(libs.androidx.ui.tooling)
debugImplementation(libs.androidx.ui.test.manifest)
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,17 @@ import androidx.compose.ui.graphics.graphicsLayer
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.tooling.preview.Devices
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.tooling.preview.PreviewLightDark
import androidx.compose.ui.unit.dp
import com.emergetools.hackernews.R
import com.emergetools.hackernews.features.comments.CommentsDestinations
import com.emergetools.hackernews.ui.preview.AppStoreSnapshot
import com.emergetools.hackernews.ui.theme.HackerNewsTheme
import com.emergetools.hackernews.ui.theme.HackerOrange
import com.emergetools.hackernews.ui.theme.HackerRed
import com.emergetools.snapshots.annotations.EmergeAppStoreSnapshot

@OptIn(ExperimentalMaterial3Api::class)
@Composable
Expand Down Expand Up @@ -508,4 +512,118 @@ private fun FeedSelectionPreview() {
HackerNewsTheme {
FeedSelection(feedType = FeedType.Top, onSelected = {})
}
}
}

@OptIn(EmergeAppStoreSnapshot::class)
@AppStoreSnapshot
@Composable
private fun StoriesScreenAppStorePreview() {
val stories = listOf(
StoryItem.Content(
id = 1L,
title = "Launch HN: Airhart Aeronautics (YC S22) – A modern personal airplane",
author = "heyrikin",
score = 252,
commentCount = 229,
epochTimestamp = 100L,
timeLabel = "5h ago",
url = ""
),
StoryItem.Content(
id = 2L,
title = "Can we stop the decline of monarch butterflies and other pollinators?",
author = "rbro112",
score = 40,
commentCount = 23,
epochTimestamp = 100L,
timeLabel = "2h ago",
url = ""
),
StoryItem.Content(
id = 3L,
title = "Andy Warhol's lost Amiga art found",
author = "telkins",
score = 332,
commentCount = 103,
epochTimestamp = 100L,
timeLabel = "7h ago",
url = ""
),
StoryItem.Content(
id = 4L,
title = "A new type of neural network is more interpretable",
author = "jshchnz",
score = 332,
commentCount = 37,
epochTimestamp = 100L,
timeLabel = "6h ago",
url = ""
),
StoryItem.Content(
id = 5L,
title = "Below the Root: A story, a computer game and my lifelong obsession (2015)",
author = "sond813",
score = 29,
commentCount = 8,
epochTimestamp = 100L,
timeLabel = "2h ago",
url = ""
),
StoryItem.Content(
id = 6L,
title = "Replacing Liquid Metal on an Asus Zephyrus G15's CPU",
author = "mptop27",
score = 19,
commentCount = 7,
epochTimestamp = 100L,
timeLabel = "2h ago",
url = ""
),
StoryItem.Content(
id = 7L,
title = "Debugging a rustc segfault on Illumos",
author = "chromy",
score = 301,
commentCount = 74,
epochTimestamp = 100L,
timeLabel = "5h ago",
url = ""
),
StoryItem.Content(
id = 8L,
title = "Google loses antitrust suit over search deals on phones",
author = "itaybre",
score = 537,
commentCount = 359,
epochTimestamp = 100L,
timeLabel = "3h ago",
url = ""
),
StoryItem.Content(
id = 9L,
title = "It's lights out at a cosmic restaurant",
author = "nhinderling",
score = 142,
commentCount = 22,
epochTimestamp = 100L,
timeLabel = "4h ago",
url = ""
),
StoryItem.Content(
id = 10L,
title = "Uncovered Euripides fragments are 'kind of a big deal'",
author = "sarahteng_",
score = 332,
commentCount = 46,
epochTimestamp = 100L,
timeLabel = "6h ago",
url = ""
),
)

HackerNewsTheme {
StoriesScreen(modifier = Modifier.fillMaxSize(), state = StoriesState(
stories = stories
), actions = {}, navigation = {})
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package com.emergetools.hackernews.ui.preview

import android.content.res.Configuration.UI_MODE_NIGHT_YES
import androidx.compose.ui.tooling.preview.Devices
import androidx.compose.ui.tooling.preview.Preview
import com.emergetools.snapshots.annotations.EmergeAppStoreSnapshot

@EmergeAppStoreSnapshot
@Preview(device = Devices.PIXEL_5, uiMode = UI_MODE_NIGHT_YES)
@Preview(device = Devices.PIXEL_5)
annotation class AppStoreSnapshot
1 change: 1 addition & 0 deletions android/gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ kotlinx-serialization-json = { group = "org.jetbrains.kotlinx", name = "kotlinx-
jsoup = { group = "org.jsoup", name = "jsoup", version.ref = "jsoup" }

emerge-snapshots = { group = "com.emergetools.snapshots", name = "snapshots", version.ref = "emergeSnapshots" }
emerge-snapshots-annotations = { group = "com.emergetools.snapshots", name = "snapshots-annotations", version.ref = "emergeSnapshots" }

junit = { group = "junit", name = "junit", version.ref = "junit" }
androidx-junit = { group = "androidx.test.ext", name = "junit", version.ref = "junitVersion" }
Expand Down

0 comments on commit 482f13b

Please sign in to comment.