From f4adda1722bfc22427eebcea62320bcda66ab61d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bruno=20Pantale=C3=A3o?=
<5808343+bgoncal@users.noreply.github.com>
Date: Mon, 16 Dec 2024 20:37:02 +0100
Subject: [PATCH] Update Open page widget items limit and sensor capitalized
state
---
Sources/App/Resources/Base.lproj/Intents.intentdefinition | 8 ++++----
.../Sensor/WidgetSensorsAppIntentTimelineProvider.swift | 6 +++++-
2 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/Sources/App/Resources/Base.lproj/Intents.intentdefinition b/Sources/App/Resources/Base.lproj/Intents.intentdefinition
index 8a570cf8c..96a1c94e3 100644
--- a/Sources/App/Resources/Base.lproj/Intents.intentdefinition
+++ b/Sources/App/Resources/Base.lproj/Intents.intentdefinition
@@ -9,7 +9,7 @@
INIntentDefinitionNamespace
sI7YSe
INIntentDefinitionSystemVersion
- 24C5089c
+ 24C101
INIntentDefinitionToolsBuildVersion
16B40
INIntentDefinitionToolsVersion
@@ -1730,19 +1730,19 @@
INIntentParameterArraySizeSize
- 2
+ 3
INIntentParameterArraySizeSizeClass
Small
INIntentParameterArraySizeSize
- 4
+ 6
INIntentParameterArraySizeSizeClass
Medium
INIntentParameterArraySizeSize
- 10
+ 12
INIntentParameterArraySizeSizeClass
Large
diff --git a/Sources/Extensions/AppIntents/Widget/Sensor/WidgetSensorsAppIntentTimelineProvider.swift b/Sources/Extensions/AppIntents/Widget/Sensor/WidgetSensorsAppIntentTimelineProvider.swift
index 406431cb2..5df91d9c8 100644
--- a/Sources/Extensions/AppIntents/Widget/Sensor/WidgetSensorsAppIntentTimelineProvider.swift
+++ b/Sources/Extensions/AppIntents/Widget/Sensor/WidgetSensorsAppIntentTimelineProvider.swift
@@ -130,7 +130,7 @@ struct WidgetSensorsAppIntentTimelineProvider: AppIntentTimelineProvider {
stateValue: stateValue
)
let unitOfMeasurement = (state?["attributes"] as? [String: Any])?["unit_of_measurement"] as? String
-
+ stateValue = capitalizeFirstLetter(stateValue)
return WidgetSensorsEntry.SensorData(
id: sensor.id,
key: sensor.displayString,
@@ -140,6 +140,10 @@ struct WidgetSensorsAppIntentTimelineProvider: AppIntentTimelineProvider {
)
}
+ private func capitalizeFirstLetter(_ text: String) -> String {
+ text.prefix(1).uppercased() + text.dropFirst()
+ }
+
private func adjustPrecision(serverId: String, entityId: String, stateValue: String) -> String {
guard let stateValueFloat = Float(stateValue) else {
return stateValue