Skip to content

Commit b500e74

Browse files
authored
Add BETA label to custom widgets (#3426)
1 parent 61d8a5c commit b500e74

File tree

7 files changed

+31
-12
lines changed

7 files changed

+31
-12
lines changed

Sources/App/Resources/en.lproj/Localizable.strings

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1129,6 +1129,7 @@ Home Assistant is free and open source home automation software with a focus on
11291129
"widgets.custom.show_update_time.title" = "Last update:";
11301130
"widgets.custom.subtitle" = "Create widgets with your own style";
11311131
"widgets.custom.title" = "Custom widgets";
1132+
"widgets.custom.require_confirmation.footer" = "Widget confirmation and state display are currently in BETA, if you experience issues please disable 'Require confirmation' and save.";
11321133
"widgets.details.description" = "Display states using from Home Assistant in text";
11331134
"widgets.details.description_with_warning" = "Display states using from Home Assistant in text. ATTENTION: User needs to be admin for templating access";
11341135
"widgets.details.parameters.action" = "Action";
@@ -1169,4 +1170,4 @@ Home Assistant is free and open source home automation software with a focus on
11691170
"widgets.sensors.description" = "Display state of sensors";
11701171
"widgets.sensors.not_configured" = "No Sensors Configured";
11711172
"widgets.sensors.title" = "Sensors";
1172-
"yes_label" = "Yes";
1173+
"yes_label" = "Yes";

Sources/App/Settings/DebugView.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@ struct DebugView: View {
2727
var body: some View {
2828
List {
2929
AppleLikeListTopRowHeader(
30-
image: .init(uiImage: MaterialDesignIcons.bugIcon.image(
30+
image: AnyView(Image(uiImage: MaterialDesignIcons.bugIcon.image(
3131
ofSize: .init(width: 120, height: 120),
3232
color: Asset.Colors.haPrimary.color
33-
)),
33+
))),
3434
title: L10n.Settings.Debugging.Header.title,
3535
subtitle: L10n.Settings.Debugging.Header.subtitle
3636
)

Sources/App/Settings/Gestures/AppleLikeListTopRowHeader.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import Shared
22
import SwiftUI
33

44
struct AppleLikeListTopRowHeader: View {
5-
let image: Image
5+
let image: AnyView
66
let title: String
77
let subtitle: String
88

@@ -24,7 +24,7 @@ struct AppleLikeListTopRowHeader: View {
2424

2525
#Preview {
2626
AppleLikeListTopRowHeader(
27-
image: Image(imageAsset: Asset.SharedAssets.casita),
27+
image: AnyView(Image(imageAsset: Asset.SharedAssets.casita)),
2828
title: "Settings",
2929
subtitle: "This is a text that represents the body"
3030
)

Sources/App/Settings/Gestures/GesturesSetupView.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ struct GesturesSetupView: View {
77
var body: some View {
88
List {
99
AppleLikeListTopRowHeader(
10-
image: Image(uiImage: MaterialDesignIcons.gestureIcon.image(
10+
image: AnyView(Image(uiImage: MaterialDesignIcons.gestureIcon.image(
1111
ofSize: .init(width: 80, height: 80),
1212
color: Asset.Colors.haPrimary.color
13-
)),
13+
))),
1414
title: L10n.Gestures.Screen.title,
1515
subtitle: L10n.Gestures.Screen.body
1616
)

Sources/App/Settings/MagicItem/Edit/MagicItemCustomizationView.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,13 +219,16 @@ struct MagicItemCustomizationView: View {
219219
scriptActionDetails
220220
}
221221
}
222-
223222
Section {
224223
Toggle(L10n.MagicItem.RequireConfirmation.title, isOn: .init(get: {
225224
viewModel.item.customization?.requiresConfirmation ?? true
226225
}, set: { newValue in
227226
viewModel.item.customization?.requiresConfirmation = newValue
228227
}))
228+
} footer: {
229+
if context == .widget {
230+
Text(L10n.Widgets.Custom.RequireConfirmation.footer)
231+
}
229232
}
230233
}
231234

Sources/App/Settings/Widgets/Builder/WidgetBuilderView.swift

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,21 @@ struct WidgetBuilderView: View {
4848

4949
private var header: some View {
5050
AppleLikeListTopRowHeader(
51-
image: Image(uiImage: MaterialDesignIcons.widgetsIcon.image(
52-
ofSize: .init(width: 80, height: 80),
53-
color: Asset.Colors.haPrimary.color
54-
)),
51+
image: AnyView(
52+
ZStack(alignment: .topTrailing) {
53+
Image(uiImage: MaterialDesignIcons.widgetsIcon.image(
54+
ofSize: .init(width: 80, height: 80),
55+
color: Asset.Colors.haPrimary.color
56+
))
57+
Text("BETA")
58+
.font(.caption)
59+
.padding(.horizontal, Spaces.one)
60+
.padding(.vertical, Spaces.half)
61+
.background(.regularMaterial)
62+
.clipShape(Capsule())
63+
.offset(x: Spaces.oneAndHalf, y: 0)
64+
}
65+
),
5566
title: L10n.Widgets.Custom.title,
5667
subtitle: L10n.Widgets.Custom.subtitle
5768
)

Sources/Shared/Resources/Swiftgen/Strings.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3956,6 +3956,10 @@ public enum L10n {
39563956
/// Failed to 'toggle' entity
39573957
public static var title: String { return L10n.tr("Localizable", "widgets.custom.intent_toggle_failed.title") }
39583958
}
3959+
public enum RequireConfirmation {
3960+
/// Widget confirmation and state display are currently in BETA, if you experience issues please disable 'Require confirmation' and save.
3961+
public static var footer: String { return L10n.tr("Localizable", "widgets.custom.require_confirmation.footer") }
3962+
}
39593963
public enum ShowUpdateTime {
39603964
/// Last update:
39613965
public static var title: String { return L10n.tr("Localizable", "widgets.custom.show_update_time.title") }

0 commit comments

Comments
 (0)