[AltWidget] Refactors previous widgets to use AppsTimelineProvider

This commit is contained in:
Riley Testut
2023-09-01 13:30:19 -05:00
parent 21c2f8d5ce
commit ce3b032dc1
5 changed files with 46 additions and 169 deletions

View File

@@ -200,3 +200,28 @@ extension AppsTimelineProvider: TimelineProvider
}
}
}
extension AppsTimelineProvider: IntentTimelineProvider
{
typealias Intent = ViewAppIntent
func getSnapshot(for intent: Intent, in context: Context, completion: @escaping (AppsEntry) -> Void)
{
Task<Void, Never> {
let bundleIDs = [intent.identifier ?? StoreApp.altstoreAppID]
let snapshot = await self.snapshot(for: bundleIDs)
completion(snapshot)
}
}
func getTimeline(for intent: Intent, in context: Context, completion: @escaping (Timeline<AppsEntry>) -> Void)
{
Task<Void, Never> {
let bundleIDs = [intent.identifier ?? StoreApp.altstoreAppID]
let timeline = await self.timeline(for: bundleIDs)
completion(timeline)
}
}
}