Skip to content

Commit f366b2b

Browse files
authored
Merge pull request #122 from DeveloperAcademy-POSTECH/feature/117-vo-station-detail
✨ Feature: #117 [VO] 정류장 상세 화면 VoiceOver 접근성 개선
2 parents 1ed847d + 9bce636 commit f366b2b

File tree

4 files changed

+49
-4
lines changed

4 files changed

+49
-4
lines changed

OffStageApp/Sources/Presentation/BusStation/BusStationView.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,8 @@ struct BusStationView: View {
7474
Button(action: { router.popToRoot() }) {
7575
Image(systemName: "house")
7676
}
77+
.accessibilityLabel("홈 화면으로 가기")
78+
.accessibilityHint("홈으로 가려면 두번 탭하십시오.")
7779
)
7880

7981
RefreshButton(countdown: countdown, rotationAngle: $rotationAngle) {
@@ -109,8 +111,9 @@ struct BusStationView: View {
109111
ActivityIndicator(isAnimating: .constant(true), style: .large)
110112
.frame(maxWidth: .infinity, alignment: .center)
111113
.padding(.vertical, 40)
114+
.accessibilityHidden(true)
112115

113-
case let .success(routes):
116+
case let .refreshing(routes), let .success(routes):
114117
if routes.isEmpty {
115118
Group {
116119
if viewModel.input.routes.isEmpty {

OffStageApp/Sources/Presentation/BusStation/BusStationViewModel.swift

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
import BusAPI
22
import Foundation
3+
import UIKit
34

45
@MainActor
56
final class BusStationViewModel: ObservableObject {
67
enum ViewState {
78
case idle
89
case loading
10+
case refreshing([RouteDetail])
911
case success([RouteDetail])
1012
case error(Error)
1113
}
@@ -73,7 +75,12 @@ final class BusStationViewModel: ObservableObject {
7375
}
7476

7577
func refresh() {
76-
viewState = .loading
78+
switch viewState {
79+
case let .success(details):
80+
viewState = .refreshing(details)
81+
default:
82+
viewState = .loading
83+
}
7784
Task { await fetchArrivals() }
7885
}
7986

@@ -138,9 +145,8 @@ final class BusStationViewModel: ObservableObject {
138145
}
139146
}
140147

141-
print("DETAIL \n\n\n\n\n\(details)\n\n\n\n\n\n")
142-
143148
viewState = .success(details)
149+
UIAccessibility.post(notification: .announcement, argument: "버스 도착정보가 갱신되었습니다.")
144150
} catch {
145151
viewState = .error(error)
146152
}

OffStageApp/Sources/Presentation/BusStation/SubView/BusStationRowSubView.swift

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,36 @@ struct BusStationRowSubView: View {
2020
isFavorite
2121
}
2222

23+
private var routeInfoAccessibilityLabel: String {
24+
var label = "\(route.routeNumber)번 버스"
25+
label += route.direction.isEmpty ? ", 방면 정보 없음" : ",\(route.direction) 방면"
26+
if route.arrivals.isEmpty {
27+
label += ", 도착 정보 없음"
28+
} else {
29+
for (index, arrival) in
30+
route.arrivals.enumerated()
31+
{
32+
var arrivalLabel = ""
33+
if route.arrivals.count > 1 {
34+
arrivalLabel += (
35+
index == 0) ? ", 첫번째 버스" : ", 두번째 버스"
36+
} else {
37+
arrivalLabel += ","
38+
}
39+
40+
arrivalLabel += "\(arrival.arrivalDescription)"
41+
42+
if let remaining =
43+
arrival.remainingStopsDescription
44+
{
45+
arrivalLabel += ", \(remaining)"
46+
}
47+
label += arrivalLabel
48+
}
49+
}
50+
return label
51+
}
52+
2353
var body: some View {
2454
HStack(alignment: .top) {
2555
VStack(alignment: .leading, spacing: 8) {
@@ -57,6 +87,8 @@ struct BusStationRowSubView: View {
5787
}
5888
}
5989
}
90+
.accessibilityElement(children: .ignore)
91+
.accessibilityLabel(routeInfoAccessibilityLabel)
6092

6193
CircularToggleButton(isOn: isSavedOn) {
6294
if isSavedOn {

OffStageApp/Sources/Presentation/BusStation/SubView/CircularToggleButton.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,9 @@ struct CircularToggleButton: View {
2828
.font(.system(size: 24, weight: .regular))
2929
}
3030
}
31+
.accessibilityLabel("즐겨찾기 버튼")
32+
.accessibilityValue(isOn ? "선택됨" : "선택 안됨")
33+
.accessibilityHint("즐겨찾기 하려면 두번 탭하십시오.")
34+
.accessibilityAddTraits(.isButton)
3135
}
3236
}

0 commit comments

Comments
 (0)