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

Missing indicators in pages list #12090

Merged
merged 5 commits into from
Jun 3, 2020

Conversation

planarvoid
Copy link
Contributor

This PR fixes a missing functionality where there were not indicators for Homepage and Posts Page on the pages list. I'm adding these indicators into the field that previously only contained the date the page was created.

To test:

  • Go to the pages list on a WP.com or Jetpack site
  • Notice that there are Homepage/Posts Page indicators visible
  • Try to set Homepage/Posts Page
  • The indicators are updated

To test 2:

  • The indicators are not visible on a self-hosted site without a Jetpack

homepage_in_page_list

PR submission checklist:

  • I have considered adding unit tests where possible.
  • I have considered adding accessibility improvements for my changes.
  • I have considered if this change warrants user-facing release notes and have added them to RELEASE-NOTES.txt if necessary.

@planarvoid planarvoid added this to the 15.0 ❄️ milestone Jun 3, 2020
@planarvoid planarvoid requested a review from mzorz June 3, 2020 12:33
@planarvoid planarvoid self-assigned this Jun 3, 2020
@peril-wordpress-mobile
Copy link

peril-wordpress-mobile bot commented Jun 3, 2020

You can trigger optional UI/connected tests for these changes by visiting CircleCI here.

@peril-wordpress-mobile
Copy link

peril-wordpress-mobile bot commented Jun 3, 2020

You can test the changes on this Pull Request by downloading the APK here.

}

private data class ItemUiStateData(
val labels: List<UiString>,
@ColorRes val labelsColor: Int?,
val progressBarUiState: ProgressBarUiState,
val showOverlay: Boolean,
val actions: Set<Action>
val actions: Set<Action>,
val subtitle: Int? = null
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: extra spaces here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks, I've fixed that and one other lint error

@@ -292,14 +292,14 @@ class PageListViewModel @Inject constructor(
ScheduledPage(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wdyt about adding named parameters here for the first 3 params? I know it's not necessary but given the subtitle optional param has been placed right below title, it now looks weird to have most of the parameters in named fashion with only the first few with a different notation. Also, comparing these two it looks a lot clearer to have names for everything given it's quite a list of parameters to look into :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good idea 👍 , I'll change it in all the places

@@ -316,14 +316,14 @@ class PageListViewModel @Inject constructor(
it.remoteId,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here if it makes sense to you

@@ -338,14 +338,14 @@ class PageListViewModel @Inject constructor(
it.remoteId,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and here

stringDate
} else {
String.format(
Locale.getDefault(),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've seen we have a very inconsistent use of getLocale() throughout the app.
Sometimes we use Locale.US, sometimes we sue String.format() without indicating the Locale, sometimes Locale.getDefault() as you use here, and sometimes we even have our own LanguageUtils function that does exactly that, called getCurrentDeviceLanguage.

This is just a comment as I was curious to see if there was a particular "way we do things" in the codebase but it seems to be all evenly split. No action need be taken but thought I'd still make the observation here, in case this triggers any thoughts.

Copy link
Contributor Author

@planarvoid planarvoid Jun 3, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm honestly not sure why this method needs a Locale, the documentation says it's for localization. I think we should always use getDefault for user facing texts. We should use Locale.US if we want a consistent result (that's not translated) - this is for example for tracking or for API calls.
I'm also not sure about which way we should call the locale (like the language utils). In this case it was so simple I don't think it needed any utility method.

Copy link
Contributor

@mzorz mzorz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM :shipit:

@mzorz mzorz merged commit cf2b616 into release/15.0 Jun 3, 2020
@mzorz mzorz deleted the fix/missing-indicators-in-pages-list branch June 3, 2020 14:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants