From 2c26be2ab5eb3129d547f51a3da44cd393d17c1d Mon Sep 17 00:00:00 2001 From: Scarriffle Date: Fri, 11 Sep 2026 18:53:17 +0200 Subject: [PATCH] Add a corner complication with the appointment's name as the value MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Requested shape: the event title as the text, the time small alongside. This inverts how accessoryCorner is built — the curved bezel is where a corner has room for long text and the inner area holds three or four characters — so the title shrinks and truncates. Kept alongside WatchCornerTime, which carries the same information with the roles the other way round, so both can be compared on the face rather than argued about. Co-Authored-By: Claude Opus 5 --- .../CalendarrWatchComplications.swift | 16 +++++++++ .../CornerComplicationViews.swift | 34 +++++++++++++++++++ 2 files changed, 50 insertions(+) diff --git a/CalendarrWatchComplications/CalendarrWatchComplications.swift b/CalendarrWatchComplications/CalendarrWatchComplications.swift index f789503..3f2b64f 100644 --- a/CalendarrWatchComplications/CalendarrWatchComplications.swift +++ b/CalendarrWatchComplications/CalendarrWatchComplications.swift @@ -6,6 +6,7 @@ struct CalendarrWatchComplicationBundle: WidgetBundle { var body: some Widget { WatchNextEventWidget() WatchCornerCountdownWidget() + WatchCornerTitleWidget() WatchCornerTimeWidget() WatchCountdownWidget() WatchDateWidget() @@ -54,6 +55,21 @@ struct WatchCornerCountdownWidget: Widget { } } +struct WatchCornerTitleWidget: Widget { + let kind = "WatchCornerTitle" + + var body: some WidgetConfiguration { + AppIntentConfiguration(kind: kind, + intent: WatchCalendarSelectionIntent.self, + provider: WatchComplicationProvider()) { entry in + CornerTitleComplicationView(entry: entry).complicationChrome(entry.language) + } + .configurationDisplayName("Terminname (Ecke)") + .description("Name des nächsten Termins, Uhrzeit klein am Rand.") + .supportedFamilies([.accessoryCorner]) + } +} + struct WatchCornerTimeWidget: Widget { let kind = "WatchCornerTime" diff --git a/CalendarrWatchComplications/CornerComplicationViews.swift b/CalendarrWatchComplications/CornerComplicationViews.swift index 07ad46e..2d614ea 100644 --- a/CalendarrWatchComplications/CornerComplicationViews.swift +++ b/CalendarrWatchComplications/CornerComplicationViews.swift @@ -54,3 +54,37 @@ struct CornerTimeComplicationView: View { } } } + +/// Value: the appointment's name. Label: the time, small and curved. +/// +/// This is the inverse of how the slot is shaped — the curved bezel is where a +/// corner has room for long text, and the inner area holds three or four +/// characters. The title therefore shrinks and truncates here. Built this way +/// on request; `CornerTimeComplicationView` is the same information with the +/// roles the other way round, so both can be compared on the face. +struct CornerTitleComplicationView: View { + let entry: WatchComplicationEntry + + var body: some View { + let next = WatchComplicationSupport.nextEvent(in: entry.snapshot, at: entry.date) + Group { + if let next { + Text(next.title) + .font(.system(size: 13, weight: .medium)) + .lineLimit(2) + .minimumScaleFactor(0.5) + .multilineTextAlignment(.center) + .widgetAccentable() + } else { + Image(systemName: "calendar") + } + } + .widgetLabel { + Text(next.map { + $0.isAllDay + ? WatchL10n.t("watch.allday", entry.language) + : WatchComplicationSupport.time($0.start, language: entry.language) + } ?? WatchL10n.t("watch.no_events", entry.language)) + } + } +}