Skip to content

Lock Screen Widgets: Create Two Field Widget - #21493

Merged
staskus merged 14 commits into
trunkfrom
task/21489-lock-screen-widgets-two-field
Sep 6, 2023
Merged

Lock Screen Widgets: Create Two Field Widget#21493
staskus merged 14 commits into
trunkfrom
task/21489-lock-screen-widgets-two-field

Conversation

@staskus

@staskus staskus commented Sep 5, 2023

Copy link
Copy Markdown
Contributor

Fixes #21489

Description

  1. Created LockScreenMultiStatView to show two fields, reusing elements from LockScreenSingleStatView
  2. Created LockScreenMultiStatWidgetViewProvider that configures all the states of the multi-stat widget, made providers more generic to support different types of HomeWidgetData
  3. Created LockScreenTodayLikesCommentsStatWidgetConfig, to add Likes and Comments widget
  4. Other changes are related to refactoring that cascades throughout multiple files

I plan to add more single and multi-field widgets in other PRs. For now, added one for Likes and Comments

To test:

Happy Path

  1. Open Jetpack
  2. Log into the account
  3. Enable Lock Screen Widget feature flag
  4. Open Lock screen, long tap, tap Customize, select Widget area
  5. Tap on Jetpack
  6. Confirm 2 "Today" Jetpack widgets exists, confirm one shows "Views", another "Likes and Comments"
  7. Add Both
  8. Tap on one of the widgets to change the site
  9. Confirm that the data loads as expected
  10. Confirm tapping on the widget opens "Today" Stats view

Logged out

  1. After Happy-Path, logout
  2. Confirm widgets show "Please login" option

No site

  1. After Happy-Path, logout
  2. Log into account with no sites
  3. Confirm widgets show "No site" message

Regression Notes

  1. Potential unintended areas of impact

Breaking single stat widget

  1. What I did to test those areas of impact (or what existing automated tests I relied on)

Manual testing, running unit-tests

  1. What automated tests I added (or what prevented me from doing so)

None

PR submission checklist:

  • I have completed the Regression Notes.
  • I have considered adding unit tests for my changes.
  • 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.

UI Changes testing checklist:

  • Portrait and landscape orientations.
  • Light and dark modes.
  • Fonts: Larger, smaller and bold text.
  • High contrast.
  • VoiceOver.
  • Languages with large words or with letters/accents not frequently used in English.
  • Right-to-left languages. (Even if translation isn’t complete, formatting should still respect the right-to-left layout)
  • iPhone and iPad.
  • Multi-tasking: Split view and Slide over. (iPad)

Images

long numbers 3 long numbers 2 image image image

@staskus
staskus marked this pull request as ready for review September 5, 2023 13:12
@staskus
staskus requested a review from guarani September 5, 2023 13:12
@wpmobilebot

wpmobilebot commented Sep 5, 2023

Copy link
Copy Markdown
Contributor
WordPress Alpha📲 You can test the changes from this Pull Request in WordPress Alpha by scanning the QR code below to install the corresponding build.
App NameWordPress Alpha WordPress Alpha
ConfigurationRelease-Alpha
Build Numberpr21493-b1f1f23
Version23.1
Bundle IDorg.wordpress.alpha
Commitb1f1f23
App Center BuildWPiOS - One-Offs #6957
Automatticians: You can use our internal self-serve MC tool to give yourself access to App Center if needed.

@wpmobilebot

wpmobilebot commented Sep 5, 2023

Copy link
Copy Markdown
Contributor
Jetpack Alpha📲 You can test the changes from this Pull Request in Jetpack Alpha by scanning the QR code below to install the corresponding build.
App NameJetpack Alpha Jetpack Alpha
ConfigurationRelease-Alpha
Build Numberpr21493-b1f1f23
Version23.1
Bundle IDcom.jetpack.alpha
Commitb1f1f23
App Center Buildjetpack-installable-builds #5999
Automatticians: You can use our internal self-serve MC tool to give yourself access to App Center if needed.

@staskus

staskus commented Sep 5, 2023

Copy link
Copy Markdown
Contributor Author

@guarani

You can see in this draft PR #21495 how more configurations are added, and how they would look. I provided the video.

With more configurations, I also found some issues with labels fitting when both numbers are in the hundreds of thousands, and titles do not always fit as well. I will look for more clever ways to ensure they fit since setting lower minimumScaleFactor could result in one field shrinking and another field staying at the same size which is undesirable.

@guarani guarani left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I couldn't get the widgets to show up on my device and I'm not sure why. I enabled the feature flag.

However, since I also tried a brand new test project with a sample lock screen widget and it didn't show up there, it might be an issue with my setup. I ran the Jetpack target but no luck today.

I'll come back to this tomorrow 👋

Comment thread WordPress/WordPressStatsWidgets/Model/HomeWidgetAllTimeData.swift Outdated
Comment thread WordPress/WordPressStatsWidgets/Tracks/Tracks+StatsWidgets.swift
@peril-wordpress-mobile

peril-wordpress-mobile Bot commented Sep 6, 2023

Copy link
Copy Markdown
Warnings
⚠️ PR is not assigned to a milestone.

Generated by 🚫 dangerJS

- Using allowsTightening flag to fit more text for the same font size
- Adding Spacers so widgets with different font sizes have elements aligned at the same positions
- Adding manual font size calculation for multi-field widget so both Text fields would have same font size when the value is longer
@staskus

staskus commented Sep 6, 2023

Copy link
Copy Markdown
Contributor Author

Made additional improvements to make sure widget elements are aligned and consistent with different font sizes

switch.between.widget.sizes.mov

@guarani
guarani self-requested a review September 6, 2023 14:12

@guarani guarani left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

👋 I was able to get this working by removing the feature flag (see discussion in p1694005726199069-slack-C441E3YTS where we found that feature flags were not working in extensions).

Happy Path testing

This worked great 👍 I tested with a couple of sites.

Logged Out testing

I saw the message asking me to log in here.

No Sites testing

(There might be a typo because this is called "Logged out" testing above). Otherwise this worked and I saw the message asking me to create a site.


I noticed a few scenarios where the widgets got "stuck" showing an outdated message. For example:

  1. Log out of the app and notice the app shows the "Log in..." message as expected
  2. Log in again and the Views widget shows data but the Likes & Comments one is stuck on the log in message
  3. Log out and log in to a different account with no sites, notice both widgets showing incorrect info: the Views one shows data for the previously logged in site (although this seems to correct itself after a minute) and the Likes & Comments one shows a Log in message

These are all fixed by re-adding the widgets, and I'm not sure they're blockers for this PR but may be good to look into before shipping.

@staskus

staskus commented Sep 6, 2023

Copy link
Copy Markdown
Contributor Author

@guarani thanks for testing!

I noticed a few scenarios where the widgets got "stuck" showing an outdated message.

Adding it to the todo list to check!

@staskus
staskus merged commit 1cc0fc7 into trunk Sep 6, 2023
@staskus
staskus deleted the task/21489-lock-screen-widgets-two-field branch September 6, 2023 14:25
@staskus staskus added this to the 23.3 milestone Sep 7, 2023
@staskus staskus mentioned this pull request Sep 8, 2023
4 tasks
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.

Lock Screen Widgets: Two Field View

3 participants