Skip to content

Commit 74c78d9

Browse files
More bugfixes and optmizations for visionOS
1 parent de3dd40 commit 74c78d9

4 files changed

Lines changed: 11 additions & 7 deletions

File tree

dcbattwebhook-swift/AutomationsView.swift

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,15 @@ struct AutomationsView: View {
7373
#elseif os(watchOS)
7474
AutomationsViewNotEligibleView()
7575
#elseif os(visionOS)
76-
AutomationsViewNotEligibleView()
76+
AutomationsViewRequiresShortcutsView()
7777
#elseif os(tvOS)
7878
AutomationsViewNotEligibleView()
7979
#elseif os(iOS)
80-
AutomationsViewRequiresShortcutsView()
80+
if !(isiOSPre16()) {
81+
AutomationsViewRequiresShortcutsView()
82+
} else {
83+
AutomationsViewNotEligibleView()
84+
}
8185
#endif
8286
}.navigationTitle("Automations")
8387
}
@@ -107,7 +111,7 @@ struct AutomationsViewRequiresShortcutsView: View {
107111
Form {
108112
VStack{
109113
Image(systemName: "info.circle").foregroundStyle(.yellow).font(.system(size: 30)).padding()
110-
Text("This device does not support in-app automations, but it can use Shortcuts Automations.\n\nPlease see the Help for more details about Shortcuts Automations.").frame(maxWidth: .infinity, alignment: .center)
114+
Text("This device does not support in-app automations, but it can use the Automations feature built into the Shortcuts app.\n\nPlease see the documentation for details about setting up automations.").frame(maxWidth: .infinity, alignment: .center)
111115
}
112116
}
113117
}

dcbattwebhook-swift/DeviceInfo.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public struct DeviceInfo {
5757
#endif
5858

5959
func mapToDevice(identifier: String) -> String { // swiftlint:disable:this cyclomatic_complexity
60-
#if os(xrOS)
60+
#if os(visionOS)
6161
switch identifier {
6262
case "RealityDevice14,1": return "Apple Vision Pro"
6363
case "i386", "x86_64", "arm64":return "Simulator \(mapToDevice(identifier: ProcessInfo().environment["SIMULATOR_MODEL_IDENTIFIER"] ?? "visionOS"))"

dcbattwebhook-swift/SettingsView.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ struct SettingsView: View {
103103

104104
Section(header: Text("Identity"), footer: Text("Enter a display name, then choose if you want to show the specified avatar image next to your display name.\nYou can also change the shown device name. \nYour pronoun will be used primarily in automated sending of battery info, and if disabled we will default to using 'their'.")) {
105105

106-
#if os(iOS)
106+
#if os(iOS) || os(visionOS)
107107
HStack {
108108
Text("Display Name:")
109109
TextField(text: $usrName) {
@@ -118,7 +118,7 @@ struct SettingsView: View {
118118
#endif
119119

120120

121-
#if os(iOS)
121+
#if os(iOS) || os(visionOS)
122122
HStack {
123123
Text("Pronoun:")
124124
TextField(text: $usrPronoun) {
@@ -138,7 +138,7 @@ struct SettingsView: View {
138138
#endif
139139
#endif
140140

141-
#if os(iOS)
141+
#if os(iOS) || os(visionOS)
142142
HStack {
143143
Text("Device Name:")
144144
TextField(text: $usrDeviceName) {

0 commit comments

Comments
 (0)