Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add sensor widget sizes #3187

Merged
merged 1 commit into from
Nov 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions HomeAssistant.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,6 @@
3E02C0F32CA8032500102131 /* WidgetSensorsAppIntent.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3E02C0E92CA7FD2A00102131 /* WidgetSensorsAppIntent.swift */; };
3E02C0F52CA8047000102131 /* WidgetSensorsAppIntent.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3E02C0E92CA7FD2A00102131 /* WidgetSensorsAppIntent.swift */; };
3E02C0F62CA8049500102131 /* WidgetSensorsAppIntentTimelineProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3E02C0EA2CA7FD2A00102131 /* WidgetSensorsAppIntentTimelineProvider.swift */; };
3E02C0F72CA818A400102131 /* WidgetSensorsAppIntentTimelineProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3E02C0EA2CA7FD2A00102131 /* WidgetSensorsAppIntentTimelineProvider.swift */; };
3E4087EB2CD9047B0085DF29 /* ReloadWidgetsAppIntent.swift in Sources */ = {isa = PBXBuildFile; fileRef = 420F53F02C4EA314003C8415 /* ReloadWidgetsAppIntent.swift */; };
3E4087ED2CE62B5A0085DF29 /* WidgetBasicViewInterface.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3E4087EC2CE62B5A0085DF29 /* WidgetBasicViewInterface.swift */; };
3E4087EE2CE62B5A0085DF29 /* WidgetBasicViewInterface.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3E4087EC2CE62B5A0085DF29 /* WidgetBasicViewInterface.swift */; };
Expand Down Expand Up @@ -6745,7 +6744,6 @@
D0FF79D220D87D200034574D /* ClientEventTableViewController.swift in Sources */,
42D5ACCE2C636F2B00D9C4E2 /* WatchConfigurationViewModel.swift in Sources */,
117D8A0824A9347F00580913 /* UIColor+CSSRGB.swift in Sources */,
3E02C0F72CA818A400102131 /* WidgetSensorsAppIntentTimelineProvider.swift in Sources */,
11F3D74C2495377B00C05BBA /* SensorListViewController.swift in Sources */,
42FCCFFA2B9B1C310057783F /* ThreadCredentialsSharingToKeychainViewModel.swift in Sources */,
B6617EED1CFE79AD004DEE6D /* NSURL+QueryDictionary.swift in Sources */,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ struct WidgetSensorsAppIntent: WidgetConfigurationIntent {
title: .init("app_intents.choose_sensor.title", defaultValue: "Choose Sensor"),
size: [
.systemSmall: 2,
.systemMedium: 4,
.systemLarge: 10,
.systemExtraLarge: 20,
]
)
var sensors: [IntentSensorsAppEntity]?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ struct WidgetSensorsAppIntentTimelineProvider: AppIntentTimelineProvider {
) async -> WidgetSensorsEntry {
do {
let suggestions = await suggestions()
configuration.sensors = Array(suggestions.flatMap { key, value in
configuration.sensors = await Array(suggestions.flatMap { key, value in
value.map { sensor in
IntentSensorsAppEntity(
id: sensor.id,
Expand All @@ -27,7 +27,7 @@ struct WidgetSensorsAppIntentTimelineProvider: AppIntentTimelineProvider {
icon: sensor.icon
)
}
}.prefix(upTo: 2))
}.prefix(WidgetBasicContainerView.maximumCount(family: context.family)))
return try await entry(for: configuration, in: context)
} catch {
Current.Log.error("Using placeholder for sensor widget snapshot")
Expand Down
3 changes: 3 additions & 0 deletions Sources/Extensions/Widgets/Sensor/WidgetSensors.swift
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,8 @@ enum WidgetDetailsTableSupportedFamilies {
@available(iOS 17.0, *)
static let families: [WidgetFamily] = [
.systemSmall,
.systemMedium,
.systemLarge,
.systemExtraLarge,
]
}
Loading