-
Notifications
You must be signed in to change notification settings - Fork 4.2k
feat: updates @DevicePreviews to use the Devices object constants
#2038
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The news cards are an important part of the screenshots because they improve test fidelity - is there a reason why they've been removed from all the screenshots?
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That change wasn't intentional, I assure you. Perhaps one of the GitHub bots made this change? I'll look into it.
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No worries. There is a step in the build workflow that generates new screenshots based on the changes in your PR. This is so that you, the PR owner, can visually verify that the changes you've made have the desired effect, or allows you to spot when you've changed something that inadvertently changes the UI. In this case, it sounds like the latter so you need to fix the news resources being displayed. The current screenshots will be removed from the PR after you push the code changes and the build workflow completes. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -42,14 +42,6 @@ protobuf { | |
| } | ||
| } | ||
|
|
||
| androidComponents.beforeVariants { | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why has this been removed? Usually if it's not directly related to the PR it should go in a separate PR.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This change was made by Gemini. I believe it was done to address a build error. I'll see if I can revert this without breaking the PR.
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This change has already been made on |
||
| android.sourceSets.register(it.name) { | ||
| val buildDir = layout.buildDirectory.get().asFile | ||
| java.srcDir(buildDir.resolve("generated/source/proto/${it.name}/java")) | ||
| kotlin.srcDir(buildDir.resolve("generated/source/proto/${it.name}/kotlin")) | ||
| } | ||
| } | ||
|
|
||
| dependencies { | ||
| api(libs.protobuf.kotlin.lite) | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -618,3 +618,24 @@ fun ForYouScreenPopulatedAndLoading( | |
| ) | ||
| } | ||
| } | ||
|
|
||
| @DevicePreviews | ||
| @Composable | ||
| fun ForYouScreenNotPopulatedOnboarding() { | ||
dturner marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| NiaTheme { | ||
| ForYouScreen( | ||
| isSyncing = true, | ||
| onboardingUiState = OnboardingUiState.Shown( | ||
| topics = emptyList(), | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If there is a justification for adding this preview, using
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As mentioned previously, it's realistic in the sense that it's a state I encountered. Specifically when running on a tablet.
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You encountered a state where the onboarding was shown but there were no topics in it? If so, that's a bug, and we shouldn't provide previews for buggy states. The correct state to preview should be that the onboarding has topics in it. |
||
| ), | ||
| feedState = NewsFeedUiState.Loading, | ||
| deepLinkedUserNewsResource = null, | ||
| onTopicCheckedChanged = { _, _ -> }, | ||
| saveFollowedTopics = {}, | ||
| onNewsResourcesCheckedChanged = { _, _ -> }, | ||
| onNewsResourceViewed = {}, | ||
| onTopicClick = {}, | ||
| onDeepLinkOpened = {}, | ||
| ) | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -16,17 +16,35 @@ | |
|
|
||
| package com.google.samples.apps.nowinandroid.feature.foryou.impl.navigation | ||
|
|
||
| import androidx.compose.ui.platform.LocalInspectionMode | ||
| import androidx.navigation3.runtime.EntryProviderScope | ||
| import androidx.navigation3.runtime.NavKey | ||
| import com.google.samples.apps.nowinandroid.core.navigation.Navigator | ||
| import com.google.samples.apps.nowinandroid.core.ui.NewsFeedUiState | ||
| import com.google.samples.apps.nowinandroid.feature.foryou.api.navigation.ForYouNavKey | ||
| import com.google.samples.apps.nowinandroid.feature.foryou.impl.ForYouScreen | ||
| import com.google.samples.apps.nowinandroid.feature.foryou.impl.OnboardingUiState | ||
| import com.google.samples.apps.nowinandroid.feature.topic.api.navigation.navigateToTopic | ||
|
|
||
| fun EntryProviderScope<NavKey>.forYouEntry(navigator: Navigator) { | ||
| entry<ForYouNavKey> { | ||
| ForYouScreen( | ||
| onTopicClick = navigator::navigateToTopic, | ||
| ) | ||
| if (LocalInspectionMode.current) { | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This pollutes the production code with code that is only used for previews. Are there any alternatives to doing this? Maybe have a different |
||
| ForYouScreen( | ||
| isSyncing = false, | ||
| onboardingUiState = OnboardingUiState.NotShown, | ||
| feedState = NewsFeedUiState.Success(emptyList()), | ||
| deepLinkedUserNewsResource = null, | ||
| onTopicCheckedChanged = { _, _ -> }, | ||
| onTopicClick = {}, | ||
| onDeepLinkOpened = {}, | ||
| saveFollowedTopics = {}, | ||
| onNewsResourcesCheckedChanged = { _, _ -> }, | ||
| onNewsResourceViewed = {}, | ||
| ) | ||
| } else { | ||
| ForYouScreen( | ||
| onTopicClick = navigator::navigateToTopic, | ||
| ) | ||
| } | ||
telpirion marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -106,6 +106,7 @@ androidx-metrics = { group = "androidx.metrics", name = "metrics-performance", v | |
| androidx-navigation-testing = { group = "androidx.navigation", name = "navigation-testing", version.ref = "androidxNavigation" } | ||
| androidx-navigation3-runtime = { group = "androidx.navigation3", name = "navigation3-runtime", version.ref = "androidxNavigation3" } | ||
| androidx-navigation3-ui = { group = "androidx.navigation3", name = "navigation3-ui", version.ref = "androidxNavigation3" } | ||
| androidx-navigationevent-compose = { group = "androidx.navigationevent", name = "navigationevent-compose", version = "1.0.1" } | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please follow the convention for all other dependencies by moving the version number into a variable at the top of the file. |
||
| androidx-savedstate-compose = { group = "androidx.savedstate", name = "savedstate-compose", version.ref = "androidxSavedStateCompose" } | ||
| androidx-profileinstaller = { group = "androidx.profileinstaller", name = "profileinstaller", version.ref = "androidxProfileinstaller" } | ||
| androidx-test-core = { group = "androidx.test", name = "core", version.ref = "androidxTestCore" } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add a link to the issue so we can remove this workaround when it's fixed.