File tree Expand file tree Collapse file tree 3 files changed +24
-2
lines changed
ViewRelated/Dashboard/Stats v4 Expand file tree Collapse file tree 3 files changed +24
-2
lines changed Original file line number Diff line number Diff line change @@ -49,6 +49,10 @@ enum WooConstants {
4949 /// before an app review prompt appears
5050 ///
5151 static let systemEventCount = 10
52+
53+ /// Store Info Widget Identifier.
54+ ///
55+ static let storeInfoWidgetKind = " StoreInfoWidget "
5256}
5357
5458// MARK: URLs
Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ import Combine
22import UIKit
33import XLPagerTabStrip
44import Yosemite
5+ import class WidgetKit. WidgetCenter
56
67/// Top-level stats container view controller that consists of a button bar with 4 time ranges.
78/// Each time range tab is managed by a `StoreStatsAndTopPerformersPeriodViewController`.
@@ -298,6 +299,11 @@ private extension StoreStatsAndTopPerformersViewController {
298299 // Update last successful data sync timestamp
299300 if periodSyncError == nil {
300301 vc. lastFullSyncTimestamp = Date ( )
302+
303+ // Reload the Store Info Widget after syncing the today's stats.
304+ if vc. timeRange == . today {
305+ WidgetCenter . shared. reloadTimelines ( ofKind: WooConstants . storeInfoWidgetKind)
306+ }
301307 } else {
302308 syncError = periodSyncError
303309 }
Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ struct StoreInfoWidget: Widget {
1010 let enableWidgets = DefaultFeatureFlagService ( ) . isFeatureFlagEnabled ( . storeWidgets)
1111
1212 var body : some WidgetConfiguration {
13- StaticConfiguration ( kind: " StoreInfoWidget " , provider: StoreInfoProvider ( ) ) { entry in
13+ StaticConfiguration ( kind: WooConstants . storeInfoWidgetKind , provider: StoreInfoProvider ( ) ) { entry in
1414 Group {
1515 switch entry {
1616 case . notConnected:
@@ -22,7 +22,7 @@ struct StoreInfoWidget: Widget {
2222 }
2323 }
2424 }
25- . configurationDisplayName ( " Store Info " )
25+ . configurationDisplayName ( Localization . storeInfo )
2626 . supportedFamilies ( enableWidgets ? [ . systemMedium] : [ ] )
2727 }
2828}
@@ -151,6 +151,18 @@ private struct UnableToFetchView: View {
151151
152152// MARK: Constants
153153
154+ /// Constants definition
155+ ///
156+ private extension StoreInfoWidget {
157+ enum Localization {
158+ static let storeInfo = AppLocalizedString (
159+ " storeWidgets.displayName " ,
160+ value: " Store Info " ,
161+ comment: " Widget title, displayed when selecting which widget to add "
162+ )
163+ }
164+ }
165+
154166/// Constants definition
155167///
156168private extension StoreInfoView {
You can’t perform that action at this time.
0 commit comments