Skip to content

Commit 02688a8

Browse files
committed
Use intent configuration in widgets
1 parent 343d4b4 commit 02688a8

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

WooCommerce/StoreWidgets/StoreInfoProvider.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ struct StoreInfoData {
5656

5757
/// Type that provides data entries to the widget system.
5858
///
59-
final class StoreInfoProvider: TimelineProvider {
59+
final class StoreInfoProvider: IntentTimelineProvider {
6060

6161
/// Holds a reference to the service while a network request is being performed.
6262
///
@@ -75,13 +75,13 @@ final class StoreInfoProvider: TimelineProvider {
7575

7676
/// Quick Snapshot. Required when previewing the widget.
7777
///
78-
func getSnapshot(in context: Context, completion: @escaping (StoreInfoEntry) -> Void) {
78+
func getSnapshot(for configuration: StoreWidgetsConfigIntent, in context: Context, completion: @escaping (StoreInfoEntry) -> Void) {
7979
completion(placeholder(in: context))
8080
}
8181

8282
/// Real data widget.
8383
///
84-
func getTimeline(in context: Context, completion: @escaping (Timeline<StoreInfoEntry>) -> Void) {
84+
func getTimeline(for configuration: StoreWidgetsConfigIntent, in context: Context, completion: @escaping (Timeline<StoreInfoEntry>) -> Void) {
8585
guard let dependencies = Self.fetchDependencies() else {
8686
return completion(Timeline<StoreInfoEntry>(entries: [StoreInfoEntry.notConnected], policy: .never))
8787
}

WooCommerce/StoreWidgets/StoreInfoWidget.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ struct StoreInfoWidget: Widget {
1818
}
1919

2020
var body: some WidgetConfiguration {
21-
StaticConfiguration(kind: WooConstants.storeInfoWidgetKind, provider: StoreInfoProvider()) { entry in
21+
IntentConfiguration(kind: WooConstants.storeInfoWidgetKind, intent: StoreWidgetsConfigIntent.self, provider: StoreInfoProvider()) { entry in
2222
StoreInfoWidgetEntryView(entry: entry)
2323
}
2424
.configurationDisplayName(Localization.title)

WooCommerce/StoreWidgets/StoreWidgets.intentdefinition

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@
66
<array>
77
<dict>
88
<key>INEnumDisplayName</key>
9-
<string>Stats Time Range</string>
9+
<string>Time Range</string>
1010
<key>INEnumDisplayNameID</key>
1111
<string>pG2KCr</string>
1212
<key>INEnumGeneratesHeader</key>
1313
<true/>
1414
<key>INEnumName</key>
15-
<string>StatsTimeRange</string>
15+
<string>IntentTimeRange</string>
1616
<key>INEnumType</key>
1717
<string>Regular</string>
1818
<key>INEnumValues</key>
@@ -105,7 +105,7 @@
105105
<key>INIntentParameterDisplayPriority</key>
106106
<integer>1</integer>
107107
<key>INIntentParameterEnumType</key>
108-
<string>StatsTimeRange</string>
108+
<string>IntentTimeRange</string>
109109
<key>INIntentParameterEnumTypeNamespace</key>
110110
<string>88xZPY</string>
111111
<key>INIntentParameterMetadata</key>

0 commit comments

Comments
 (0)