|
@@ -29,18 +29,18 @@ struct Provider: TimelineProvider {
|
|
|
typealias Entry = DashboardDataEntry
|
|
|
|
|
|
func placeholder(in context: Context) -> Entry {
|
|
|
- return Entry(date: Date(), dashboardDatas: [], isPlaceholder: true)
|
|
|
+ return Entry(date: Date(), dashboardDatas: [], isPlaceholder: true, title: getTitle(account: nil))
|
|
|
}
|
|
|
|
|
|
func getSnapshot(in context: Context, completion: @escaping (Entry) -> Void) {
|
|
|
- readDashboard { dashboardDatas, isPlaceholder in
|
|
|
- completion(Entry(date: Date(), dashboardDatas: dashboardDatas, isPlaceholder: isPlaceholder))
|
|
|
+ readDashboard { dashboardDatas, isPlaceholder, title in
|
|
|
+ completion(Entry(date: Date(), dashboardDatas: dashboardDatas, isPlaceholder: isPlaceholder, title: title))
|
|
|
}
|
|
|
}
|
|
|
|
|
|
func getTimeline(in context: Context, completion: @escaping (Timeline<Entry>) -> Void) {
|
|
|
- readDashboard { dashboardDatas, isPlaceholder in
|
|
|
- let timeLine = Timeline(entries: [Entry(date: Date(), dashboardDatas: dashboardDatas, isPlaceholder: isPlaceholder)], policy: .atEnd)
|
|
|
+ readDashboard { dashboardDatas, isPlaceholder, title in
|
|
|
+ let timeLine = Timeline(entries: [Entry(date: Date(), dashboardDatas: dashboardDatas, isPlaceholder: isPlaceholder, title: title)], policy: .atEnd)
|
|
|
completion(timeLine)
|
|
|
}
|
|
|
}
|
|
@@ -63,7 +63,7 @@ struct DashboardWidget: Widget {
|
|
|
struct DashboardWidget_Previews: PreviewProvider {
|
|
|
|
|
|
static var previews: some View {
|
|
|
- let entry = DashboardDataEntry(date: Date(), dashboardDatas: dashboardDatasTest, isPlaceholder: false)
|
|
|
+ let entry = DashboardDataEntry(date: Date(), dashboardDatas: dashboardDatasTest, isPlaceholder: false, title: getTitle(account: nil))
|
|
|
DashboardWidgetView(entry: entry).previewContext(WidgetPreviewContext(family: .systemLarge))
|
|
|
}
|
|
|
}
|