Skip to content

Conversation

@ealeksandrov
Copy link
Contributor

Part of: #7863
Based on: #7872

Description

This PR updates widget data provider to fetch data for user-selected time interval.
It also cleans up code for any hardcoded mention of "today" for the widget.

Note: configuration UI still says "Today" in 2 widget title and description, because they are overriden in Localizable.strings.

Testing

  1. Add a widget to home screen (long press on home screen > tap + in top left > search for Woo).
  2. Configure Widget (long press on widget > tap "Edit Widget").
  3. Select different time intervals and confirm that data is the same as on application's stats dashboard.
  4. Confirm that time range title (in top right corner of a widget) is correct.

  • I have considered if this change warrants user-facing release notes and have added them to RELEASE-NOTES.txt if necessary.

@ealeksandrov ealeksandrov added the feature: widgets iOS Homescreen widgets label Oct 17, 2022
@ealeksandrov ealeksandrov added this to the 10.9 milestone Oct 17, 2022
@ealeksandrov ealeksandrov changed the title Issue/7863 widgets configuration time interval Widgets Configuration: Add time interval setting Oct 17, 2022
@ealeksandrov ealeksandrov marked this pull request as draft October 18, 2022 14:22
@ealeksandrov ealeksandrov force-pushed the issue/7863-widgets-configuration-custom-intent branch from a487ca0 to a9094a4 Compare October 18, 2022 15:00
@ealeksandrov ealeksandrov force-pushed the issue/7863-widgets-configuration-time-interval branch from 91d935b to dbb6279 Compare October 18, 2022 16:19
@wpmobilebot
Copy link
Collaborator

You can test the changes from this Pull Request by:
  • Clicking here or scanning the QR code below to access App Center
  • Then installing the build number pr7873-dbb6279 on your iPhone

If you need access to App Center, please ask a maintainer to add you.

@ealeksandrov ealeksandrov marked this pull request as ready for review October 18, 2022 17:04
Copy link
Contributor

@Ecarrion Ecarrion left a comment

Choose a reason for hiding this comment

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

Looks good!
I like this nice and simple improvement 🚀


A couple of extra questions to be on the safe side:

Note: configuration UI still says "Today" in 2 widget title and description, because they are overriden in Localizable.strings.

Would these get updated on the next translation pass or do we need to do something about them?

  1. How the analytic events would look with these changes? Do we have to update them?

I noticed that big numbers get clipped, I think it is worth looking if we can fit the number somehow!

Screen Shot 2022-10-19 at 4 52 51 PM

Comment on lines +33 to +46

/// The maximum number of stats intervals a time range could have.
var maxNumberOfIntervals: Int {
switch self {
case .today:
return 24
case .thisWeek:
return 7
case .thisMonth:
return 31
case .thisYear:
return 12
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Do you think all of these properties should be shared in a commonplace with the main stats code?
Since we are going to update the analytics dashboard soon, there is a chance that these go outdated.

Copy link
Contributor Author

@ealeksandrov ealeksandrov Oct 20, 2022

Choose a reason for hiding this comment

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

I thought about moving StatsTimeRangeV4 to WooFoundation, but it imports Networking models. Do you think it's ok to allow WooFoundation depend on Networking? Or can we move all related models to WF and make Networking import it?

Original StatsTimeRangeV4 currently lives in Yosemite. I copy-pasted the code to prevent the import of Yosemite+Storage (+ Networking but it's already imported to widgets target).

Copy link
Contributor

@Ecarrion Ecarrion Oct 20, 2022

Choose a reason for hiding this comment

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

WooFoundation depend on Networking

Probs not. Maybe we can move that to an extension helper that is imported in both targets?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Can it be WooFoundation? I don't like idea of creating another library for a few models.

move all related models to WF and make Networking import it?

  • move StatsTimeRangeV4 from Yosemite to WF
  • move StatGranularity from Networking to WF
  • import WF everywhere
  • remove copy-pasted StatsTimeRange and use StatsTimeRangeV4 in widgets from WF

Copy link
Contributor

Choose a reason for hiding this comment

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

That also work, may involve more work tho!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Then I'll merge current implementation into the feature branch and we can experiment with dependencies later.

Copy link
Contributor

Choose a reason for hiding this comment

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

there is a chance that these go outdated

☝️ What are the chances of this happening? What is the risk? How many times is this duplicated?

Maybe we can also use the Rule of three as a guideline.

Another library is also fine to me, assuming the cost is smaller compared to trying to place it in WooFoundation.

Base automatically changed from issue/7863-widgets-configuration-custom-intent to issue/7863-widgets-configuration October 20, 2022 10:11
@peril-woocommerce
Copy link

Warnings
⚠️ This PR is assigned to a milestone which is closing in less than 2 days Please, make sure to get it merged by then or assign it to a later expiring milestone

Generated by 🚫 dangerJS

@ealeksandrov
Copy link
Contributor Author

ealeksandrov commented Oct 20, 2022

Would these get updated on the next translation pass or do we need to do something about them?

We should ask release managers when we're ready. One way I see is to remove already translated keys manually to "force" new translation pass. But there may be a better more organized way.
I've added a note about this to the parent issue.

How the analytic events would look with these changes? Do we have to update them?

Sure, that's something to think about before finishing. This PR lands on feature branch, not on the trunk yet. I'll see if store picker will be easy to add into this set of changes, so we can consider both parameters in Tracks.

I noticed that big numbers get clipped, I think it is worth looking if we can fit the number somehow!

We can use compact presentation in that case? Like $54,8m. I've created #7887 to track it.

@ealeksandrov ealeksandrov modified the milestones: 10.9, 11.0 Oct 20, 2022
@ealeksandrov ealeksandrov merged commit 57bd117 into issue/7863-widgets-configuration Oct 20, 2022
@ealeksandrov ealeksandrov deleted the issue/7863-widgets-configuration-time-interval branch October 20, 2022 14:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature: widgets iOS Homescreen widgets

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants