mirror of
https://github.com/neon443/NearFuture.git
synced 2026-03-11 06:49:12 +00:00
app intents make me wanna kms
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
|
||||
import WidgetKit
|
||||
import SwiftUI
|
||||
import AppIntents
|
||||
|
||||
// Timeline Entry for Widget
|
||||
struct EventWidgetEntry: TimelineEntry {
|
||||
@@ -46,6 +47,24 @@ struct EventWidgetProvider: TimelineProvider {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// Event Widget View
|
||||
struct EventWidgetView: View {
|
||||
var entry: EventWidgetEntry
|
||||
@@ -135,6 +154,25 @@ struct EventWidgetView: View {
|
||||
.foregroundColor(event.date < Date() ? .red : .primary)
|
||||
.padding(.trailing, -12)
|
||||
} else {
|
||||
Button(
|
||||
intent: CompleteEvent(
|
||||
eventID: IntentParameter(
|
||||
title: LocalizedStringResource(
|
||||
stringLiteral: event.id.uuidString
|
||||
)
|
||||
)
|
||||
)
|
||||
) {
|
||||
if event.complete {
|
||||
Circle()
|
||||
.frame(width: 10)
|
||||
.foregroundStyle(.green)
|
||||
} else {
|
||||
Circle()
|
||||
.frame(width: 10)
|
||||
.foregroundStyle(.gray)
|
||||
}
|
||||
}
|
||||
Text(daysUntilEvent(event.date).long)
|
||||
.font(.caption)
|
||||
.multilineTextAlignment(.trailing)
|
||||
|
||||
Reference in New Issue
Block a user