Skip to content

Commit dbb6279

Browse files
committed
Remove hardcoded mention of today time interval
1 parent 6afdcd5 commit dbb6279

File tree

4 files changed

+21
-21
lines changed

4 files changed

+21
-21
lines changed

WooCommerce/StoreWidgets/Homescreen/StoreInfoView.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ private extension StoreInfoView {
225225
static let viewMore = AppLocalizedString(
226226
"storeWidgets.infoView.viewMore",
227227
value: "View More",
228-
comment: "Title for the button indicator to display more stats in the Today's Stat widget when using accessibility fonts."
228+
comment: "Title for the button indicator to display more stats in the Stat widget when using accessibility fonts."
229229
)
230230
static func updatedAt(_ updatedTime: String) -> LocalizedString {
231231
let format = AppLocalizedString("storeWidgets.infoView.updatedAt",
@@ -247,7 +247,7 @@ private extension NotLoggedInView {
247247
enum Localization {
248248
static let notLoggedIn = AppLocalizedString(
249249
"storeWidgets.notLoggedInView.notLoggedIn",
250-
value: "Log in to see today’s stats.",
250+
value: "Log in to see store’s stats.",
251251
comment: "Title label when the widget does not have a logged-in store."
252252
)
253253
static let login = AppLocalizedString(
@@ -269,7 +269,7 @@ private extension UnableToFetchView {
269269
enum Localization {
270270
static let unableToFetch = AppLocalizedString(
271271
"storeWidgets.unableToFetchView.unableToFetch",
272-
value: "Unable to fetch today's stats",
272+
value: "Unable to fetch store's stats",
273273
comment: "Title label when the widget can't fetch data."
274274
)
275275
}

WooCommerce/StoreWidgets/StoreInfoDataService.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import Networking
22

3-
/// Orchestrator class that fetches today store stats data.
3+
/// Orchestrator class that fetches store stats data.
44
///
55
final class StoreInfoDataService {
66

@@ -56,7 +56,7 @@ final class StoreInfoDataService {
5656
///
5757
private extension StoreInfoDataService {
5858

59-
/// Async wrapper that fetches todays revenues & orders.
59+
/// Async wrapper that fetches revenues & orders.
6060
///
6161
func fetchRevenueAndOrders(for storeID: Int64, timeRange: StatsTimeRange) async throws -> OrderStatsV4 {
6262
try await withCheckedThrowingContinuation { continuation in

WooCommerce/StoreWidgets/StoreInfoProvider.swift

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -90,14 +90,14 @@ final class StoreInfoProvider: IntentTimelineProvider {
9090
networkService = strongService
9191
Task {
9292
do {
93-
let todayStats = try await strongService.fetchStats(for: dependencies.storeID, timeRange: StatsTimeRange(configuration.timeRange))
94-
let entry = Self.dataEntry(for: todayStats, with: dependencies)
93+
let stats = try await strongService.fetchStats(for: dependencies.storeID, timeRange: StatsTimeRange(configuration.timeRange))
94+
let entry = Self.dataEntry(for: stats, with: dependencies)
9595
let reloadDate = Date(timeIntervalSinceNow: reloadInterval)
9696
let timeline = Timeline<StoreInfoEntry>(entries: [entry], policy: .after(reloadDate))
9797
completion(timeline)
9898
} catch {
9999
// WooFoundation does not expose `DDLOG` types. Should we include them?
100-
print("⛔️ Error fetching today's widget stats: \(error)")
100+
print("⛔️ Error fetching widget stats: \(error)")
101101

102102
let reloadDate = Date(timeIntervalSinceNow: reloadInterval)
103103
let timeline = Timeline<StoreInfoEntry>(entries: [.error], policy: .after(reloadDate))
@@ -155,14 +155,14 @@ private extension StoreInfoProvider {
155155

156156
/// Real data entry.
157157
///
158-
static func dataEntry(for todayStats: StoreInfoDataService.Stats, with dependencies: Dependencies) -> StoreInfoEntry {
159-
StoreInfoEntry.data(.init(range: Localization.periodString(from: todayStats.timeRange),
158+
static func dataEntry(for stats: StoreInfoDataService.Stats, with dependencies: Dependencies) -> StoreInfoEntry {
159+
StoreInfoEntry.data(.init(range: Localization.periodString(from: stats.timeRange),
160160
name: dependencies.storeName,
161-
revenue: Self.formattedAmountString(for: todayStats.revenue, with: dependencies.storeCurrencySettings),
162-
revenueCompact: Self.formattedAmountCompactString(for: todayStats.revenue, with: dependencies.storeCurrencySettings),
163-
visitors: "\(todayStats.totalVisitors)",
164-
orders: "\(todayStats.totalOrders)",
165-
conversion: Self.formattedConversionString(for: todayStats.conversion),
161+
revenue: Self.formattedAmountString(for: stats.revenue, with: dependencies.storeCurrencySettings),
162+
revenueCompact: Self.formattedAmountCompactString(for: stats.revenue, with: dependencies.storeCurrencySettings),
163+
visitors: "\(stats.totalVisitors)",
164+
orders: "\(stats.totalOrders)",
165+
conversion: Self.formattedConversionString(for: stats.conversion),
166166
updatedTime: Self.currentFormattedTime()))
167167
}
168168

@@ -211,25 +211,25 @@ private extension StoreInfoProvider {
211211
switch timeRange {
212212
case .today:
213213
return AppLocalizedString(
214-
"storeWidgets.infoProvider.today",
214+
"storeWidgets.timeRange.today",
215215
value: "Today",
216216
comment: "Range title for the store info widget"
217217
)
218218
case .thisWeek:
219219
return AppLocalizedString(
220-
"storeWidgets.infoProvider.thisWeek",
220+
"storeWidgets.timeRange.thisWeek",
221221
value: "This Week",
222222
comment: "Range title for the store info widget"
223223
)
224224
case .thisMonth:
225225
return AppLocalizedString(
226-
"storeWidgets.infoProvider.thisMonth",
226+
"storeWidgets.timeRange.thisMonth",
227227
value: "This Month",
228228
comment: "Range title for the store info widget"
229229
)
230230
case .thisYear:
231231
return AppLocalizedString(
232-
"storeWidgets.infoProvider.thisYear",
232+
"storeWidgets.timeRange.thisYear",
233233
value: "This Year",
234234
comment: "Range title for the store info widget"
235235
)

WooCommerce/StoreWidgets/StoreInfoWidget.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,12 @@ private extension StoreInfoWidget {
6161
enum Localization {
6262
static let title = AppLocalizedString(
6363
"storeWidgets.displayName",
64-
value: "Today",
64+
value: "Stats",
6565
comment: "Widget title, displayed when selecting which widget to add"
6666
)
6767
static let description = AppLocalizedString(
6868
"storeWidgets.description",
69-
value: "WooCommerce Stats Today",
69+
value: "WooCommerce Stats",
7070
comment: "Widget description, displayed when selecting which widget to add"
7171
)
7272
}

0 commit comments

Comments
 (0)