2020-11-18 03:49:12 +01:00
|
|
|
//
|
|
|
|
// WidgetBundle.swift
|
|
|
|
// NetNewsWire Widget Extension
|
|
|
|
//
|
|
|
|
// Created by Stuart Breckenridge on 18/11/2020.
|
|
|
|
// Copyright © 2020 Ranchero Software. All rights reserved.
|
|
|
|
//
|
|
|
|
|
|
|
|
import WidgetKit
|
|
|
|
import SwiftUI
|
|
|
|
|
|
|
|
// MARK: - Supported Widgets
|
|
|
|
|
|
|
|
struct UnreadWidget: Widget {
|
|
|
|
let kind: String = "com.ranchero.NetNewsWire.UnreadWidget"
|
|
|
|
|
|
|
|
var body: some WidgetConfiguration {
|
|
|
|
|
|
|
|
return StaticConfiguration(kind: kind, provider: Provider(), content: { entry in
|
|
|
|
UnreadWidgetView(entry: entry)
|
|
|
|
.frame(maxWidth: .infinity, maxHeight: .infinity)
|
|
|
|
.background(Color("WidgetBackground"))
|
|
|
|
|
|
|
|
})
|
2020-11-21 02:11:31 +01:00
|
|
|
.configurationDisplayName(L10n.unreadWidgetTitle)
|
|
|
|
.description(L10n.unreadWidgetDescription)
|
2020-11-18 08:43:14 +01:00
|
|
|
.supportedFamilies([.systemMedium, .systemLarge])
|
2020-11-18 03:49:12 +01:00
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
struct TodayWidget: Widget {
|
|
|
|
let kind: String = "com.ranchero.NetNewsWire.TodayWidget"
|
|
|
|
|
|
|
|
var body: some WidgetConfiguration {
|
|
|
|
|
|
|
|
return StaticConfiguration(kind: kind, provider: Provider(), content: { entry in
|
|
|
|
TodayWidgetView(entry: entry)
|
|
|
|
.frame(maxWidth: .infinity, maxHeight: .infinity)
|
|
|
|
.background(Color("WidgetBackground"))
|
|
|
|
|
|
|
|
})
|
2020-11-21 02:11:31 +01:00
|
|
|
.configurationDisplayName(L10n.todayWidgetTitle)
|
|
|
|
.description(L10n.todayWidgetDescription)
|
2020-11-18 08:43:14 +01:00
|
|
|
.supportedFamilies([.systemMedium, .systemLarge])
|
2020-11-18 03:49:12 +01:00
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
struct StarredWidget: Widget {
|
|
|
|
let kind: String = "com.ranchero.NetNewsWire.StarredWidget"
|
|
|
|
|
|
|
|
var body: some WidgetConfiguration {
|
|
|
|
|
|
|
|
return StaticConfiguration(kind: kind, provider: Provider(), content: { entry in
|
|
|
|
StarredWidgetView(entry: entry)
|
|
|
|
.frame(maxWidth: .infinity, maxHeight: .infinity)
|
|
|
|
.background(Color("WidgetBackground"))
|
|
|
|
|
|
|
|
})
|
2020-11-21 02:11:31 +01:00
|
|
|
.configurationDisplayName(L10n.starredWidgetTitle)
|
|
|
|
.description(L10n.starredWidgetDescription)
|
2020-11-18 08:43:14 +01:00
|
|
|
.supportedFamilies([.systemMedium, .systemLarge])
|
2020-11-18 03:49:12 +01:00
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
struct SmartFeedSummaryWidget: Widget {
|
|
|
|
let kind: String = "com.ranchero.NetNewsWire.SmartFeedSummaryWidget"
|
|
|
|
|
|
|
|
var body: some WidgetConfiguration {
|
|
|
|
|
|
|
|
return StaticConfiguration(kind: kind, provider: Provider(), content: { entry in
|
|
|
|
SmartFeedSummaryWidgetView(entry: entry)
|
|
|
|
.frame(maxWidth: .infinity, maxHeight: .infinity)
|
2020-11-21 10:16:21 +01:00
|
|
|
.background(Color("AccentColor"))
|
2020-11-18 03:49:12 +01:00
|
|
|
|
|
|
|
})
|
2020-11-21 02:11:31 +01:00
|
|
|
.configurationDisplayName(L10n.smartFeedSummaryWidgetTitle)
|
|
|
|
.description(L10n.smartFeedSummaryWidgetDescription)
|
2020-11-18 03:49:12 +01:00
|
|
|
.supportedFamilies([.systemSmall])
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// MARK: - WidgetBundle
|
|
|
|
@main
|
|
|
|
struct NetNewsWireWidgets: WidgetBundle {
|
|
|
|
@WidgetBundleBuilder
|
|
|
|
var body: some Widget {
|
|
|
|
SmartFeedSummaryWidget()
|
|
|
|
UnreadWidget()
|
|
|
|
TodayWidget()
|
|
|
|
StarredWidget()
|
|
|
|
}
|
|
|
|
}
|