Skip to content

Commit 88aafba

Browse files
committed
Added VoiceOver + bug fixes
1 parent 1a21507 commit 88aafba

3 files changed

Lines changed: 56 additions & 12 deletions

File tree

HuggingSnap/Views/ContentView.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,10 @@ struct ContentView: View {
9494
}
9595
.onAppear {
9696
// Will always appear in DEBUG. Not a bug
97+
#if targetEnvironment(simulator)
98+
#else
9799
requestReview()
100+
#endif
98101
}
99102
.overlay {
100103
ZStack(alignment: .bottom) {
@@ -105,6 +108,7 @@ struct ContentView: View {
105108
.fontWeight(.bold)
106109
.foregroundStyle(.white.secondary)
107110
})
111+
.accessibilityLabel(Text("Press this button to access app settings"))
108112
Spacer()
109113
}.padding(.horizontal, 40)
110114

HuggingSnap/Views/ControlView.swift

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ struct ControlView: View {
8989
.fill(.ultraThickMaterial)
9090
}
9191
}
92+
.accessibilityLabel(Text("Press this button to have HuggingSnap describe the current image"))
9293
.transition(.blurReplace.combined(with: .scale))
9394
}
9495

@@ -110,6 +111,7 @@ struct ControlView: View {
110111
.fill(.ultraThickMaterial)
111112
}
112113
}
114+
.accessibilityLabel(Text("Press this button to have HuggingSnap summarize the current video."))
113115
}
114116
}
115117
.frame(maxWidth: .infinity, alignment: .center)
@@ -130,6 +132,7 @@ struct ControlView: View {
130132
.fontWeight(.bold)
131133
}
132134
}
135+
.accessibilityLabel(Text("Press the button to type a message to HuggingSnap"))
133136
} else {
134137
PhotosPicker(selection: $selectedItem,
135138
matching: .any(of: [.images, .videos])) {
@@ -142,6 +145,7 @@ struct ControlView: View {
142145
.fontWeight(.bold)
143146
}
144147
}
148+
.accessibilityLabel(Text("Press the button to select a photo or video as input to HuggingSnap"))
145149
}
146150

147151

@@ -200,6 +204,7 @@ struct ControlView: View {
200204
}
201205
.frame(width: 70, height: 70)
202206
.contentShape(.rect)
207+
.accessibilityLabel(Text(isCaptured ? "Press the button to clear the capture.":"Press the button to snap a picture. Tap and hold to record a video."))
203208
.gesture(
204209
DragGesture(minimumDistance: 0)
205210
.onChanged { _ in
@@ -252,7 +257,6 @@ struct ControlView: View {
252257
Button {
253258
isAudioMode = true
254259
showInputView = true
255-
256260
} label: {
257261
ZStack {
258262
Circle()
@@ -263,6 +267,7 @@ struct ControlView: View {
263267
.fontWeight(.bold)
264268
}
265269
}
270+
.accessibilityLabel(Text("Press the button to dictate a message to HuggingSnap"))
266271
} else {
267272
Button {
268273
#if targetEnvironment(simulator)
@@ -279,6 +284,7 @@ struct ControlView: View {
279284
.fontWeight(.bold)
280285
}
281286
}
287+
.accessibilityLabel(Text("Press the button to switch between front and back cameras"))
282288
.disabled(isCaptured)
283289
}
284290

HuggingSnap/Views/SettingsView.swift

Lines changed: 45 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import MessageUI
1111
struct SettingsView: View {
1212

1313
@Environment(\.dismiss) var dismiss
14+
@Environment(\.openURL) private var openURL
1415

1516
// Support
1617
@State var result: Result<MFMailComposeResult, Error>? = nil
@@ -20,17 +21,48 @@ struct SettingsView: View {
2021
NavigationStack {
2122
List {
2223
Section("Support") {
23-
LabeledContent {
24-
} label: {
25-
Label("Terms of Use", systemImage: "book.pages")
26-
.imageScale(.medium)
27-
}
24+
Button(action: {
25+
guard let url = URL(string: "https://huggingface.co/privacy") else { return }
26+
openURL(url)
27+
}, label: {
28+
Label(title: {
29+
Text("Privacy Policy")
30+
.foregroundStyle(.primary)
31+
}, icon: {
32+
Image(systemName: "lock")
33+
.resizable()
34+
.aspectRatio(contentMode: .fit)
35+
.frame(width: 20, height: 20)
36+
})
37+
.frame(maxWidth: .infinity, alignment: .leading)
38+
.imageScale(.medium)
39+
})
40+
.tint(.primary)
41+
.accessibilityLabel(Text("Press the button to view Hugging Face's privacy policy"))
42+
.buttonStyle(.borderless)
43+
.contentShape(Rectangle())
2844

29-
LabeledContent {
30-
} label: {
31-
Label("Privacy Policy", systemImage: "lock")
32-
.imageScale(.medium)
33-
}
45+
Button(action: {
46+
guard let url = URL(string: "https://huggingface.co/terms-of-service/") else { return }
47+
openURL(url)
48+
}, label: {
49+
Label(title: {
50+
Text("Terms of Use")
51+
.foregroundStyle(.primary)
52+
}, icon: {
53+
Image(systemName: "book.pages")
54+
.resizable()
55+
.aspectRatio(contentMode: .fit)
56+
.frame(width: 20, height: 20)
57+
})
58+
59+
.frame(maxWidth: .infinity, alignment: .leading)
60+
.imageScale(.medium)
61+
})
62+
.tint(.primary)
63+
.accessibilityLabel(Text("Press the button to view Hugging Face's terms of service"))
64+
.buttonStyle(.borderless)
65+
.contentShape(Rectangle())
3466

3567
LabeledContent {
3668
Text(Bundle.main.releaseVersionNumberPretty)
@@ -47,6 +79,7 @@ struct SettingsView: View {
4779
})
4880
.imageScale(.medium)
4981
}
82+
.accessibilityLabel(Text("HuggingSnap version \(Bundle.main.releaseVersionNumberPretty)"))
5083
}
5184

5285
Button(action: {
@@ -64,9 +97,10 @@ struct SettingsView: View {
6497
.frame(maxWidth: .infinity, alignment: .leading)
6598
.imageScale(.medium)
6699
})
100+
.tint(.primary)
101+
.accessibilityLabel(Text("Press the button to send an email to Hugging Face support."))
67102
.buttonStyle(.borderless)
68103
.contentShape(Rectangle())
69-
.disabled(!MFMailComposeViewController.canSendMail())
70104
.sheet(isPresented: $isShowingMailView) {
71105
MailView(
72106
result: self.$result,

0 commit comments

Comments
 (0)