Skip to content

Commit

Permalink
Merge pull request #38 from JYPjoy/feat/#14-Check-VoiceOver
Browse files Browse the repository at this point in the history
[FEAT] 보이스오버 기능 체크
  • Loading branch information
JYPjoy authored Oct 24, 2023
2 parents 608a14d + fd822fd commit 5dc31da
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ class BasePaddingLabel: UILabel {
convenience init(padding: UIEdgeInsets) {
self.init()
self.padding = padding
self.accessibilityTraits = .none
}

override func drawText(in rect: CGRect) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,7 @@ protocol ConfigUI {

/// 위치 설정
func setConstraints()

/// VoiceOver 설정용
func setupAccessibility()
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ class GiveTtekkViewController: UIViewController {
view.backgroundColor = .gs90

setupNavigationBar()
setupAccessibility()
view.addSubview(storyLabel)
storyLabel.snp.makeConstraints {
$0.height.equalTo(68)
Expand Down Expand Up @@ -73,6 +74,11 @@ class GiveTtekkViewController: UIViewController {
}
}

func setupAccessibility() {
self.navigationItem.leftBarButtonItem?.accessibilityLabel = "내 책장"
storyLabel.accessibilityTraits = .none
}

func setupNavigationBar() {
view.addSubview(naviLine)
naviLine.snp.makeConstraints {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ final class NoTtekkViewController: UIViewController, ConfigUI {
label.font = FontManager.body()
label.textColor = .gs10
label.numberOfLines = 0

label.lineBreakMode = .byCharWrapping
return label
}()

Expand All @@ -35,16 +35,20 @@ final class NoTtekkViewController: UIViewController, ConfigUI {
override func viewDidLoad() {
super.viewDidLoad()
view.backgroundColor = .gs90

// TODO: NavBar 디자인 component로 나오면 수정하기
self.navigationController?.navigationBar.topItem?.title = "호랑이를 마주친 엄마"
self.navigationController?.navigationBar.titleTextAttributes = [.foregroundColor: UIColor.gs20, .font: FontManager.p_semiBold(.footnote)]
setupAccessibility()
setupNavigationBar()
addComponents()
setConstraints()
nextButton.setup(model: nextButtonViewModel)
}

func setupAccessibility(){
view.accessibilityElements = [titleLabel, nextButton]
titleLabel.accessibilityTraits = .none
nextButton.accessibilityLabel = "다음"
nextButton.accessibilityTraits = .button
}

func setupNavigationBar() {
view.addSubview(naviLine)
naviLine.snp.makeConstraints {
Expand All @@ -61,6 +65,7 @@ final class NoTtekkViewController: UIViewController, ConfigUI {
target: self,
action: .none
)
self.navigationItem.leftBarButtonItem?.accessibilityLabel = "내 책장"
}

func addComponents() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ final class TigerAnimationViewController: UIViewController, ConfigUI {
view.backgroundColor = .gs90

// TODO: NavBar 디자인 component로 나오면 수정하기
setupAccessibility()
setupNavigationBar()
addComponents()
setConstraints()
Expand Down Expand Up @@ -87,6 +88,7 @@ final class TigerAnimationViewController: UIViewController, ConfigUI {
// self.navigationController?.navigationBar.isAccessibilityElement = true
// self.navigationController?.navigationBar.accessibilityTraits = .header
// self.navigationController?.navigationBar.accessibilityLabel = ("호랑이를 마주친 엄마")
self.navigationItem.leftBarButtonItem?.accessibilityLabel = "내 책장"
}


Expand Down Expand Up @@ -119,6 +121,14 @@ final class TigerAnimationViewController: UIViewController, ConfigUI {
$0.right.equalToSuperview().offset(-Constants.Button.buttonPadding)
}
}

func setupAccessibility() {
view.accessibilityElements = [titleLabel, nextButton]
self.navigationItem.leftBarButtonItem?.accessibilityLabel = "내 책장"
titleLabel.accessibilityTraits = .none
nextButton.accessibilityLabel = "다음"
nextButton.accessibilityTraits = .button
}
}

extension TigerAnimationViewController {
Expand All @@ -130,6 +140,7 @@ extension TigerAnimationViewController {
initialSpringVelocity: 0.4,
options: []) { [weak self] in
guard let self = self else { return }
self.navigationController?.navigationBar.isHidden = true
self.btnBottomConstraints?.constant = -Constants.Button.buttonPadding * 2
self.view.layoutIfNeeded()
} completion: { _ in
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ final class TtekkkochiViewController: UIViewController, ConfigUI {

private let titleLabel: UILabel = {
let label = UILabel()
label.text = "떡 블록을 탭해서 꼬치에 순서대로 끼워 주세요."
label.text = "떡 블록을 탭 해서 꼬치에 순서대로 끼워 주세요."
label.translatesAutoresizingMaskIntoConstraints = false
label.font = FontManager.body()
label.textColor = .gs10
Expand All @@ -50,7 +50,7 @@ final class TtekkkochiViewController: UIViewController, ConfigUI {

private let bottomView = TtekkkochiSelectionView()

private let settingButton = CommonButton()
private let nextButton = CommonButton()
private lazy var settingButtonViewModel = CommonbuttonModel(title: "다음", font: FontManager.textbutton(), titleColor: .primary1, backgroundColor: .primary2) {[weak self] in
//self?.viewModel.selectItem()
// TODO: 나중에 ViewModel로 분리하기
Expand All @@ -62,9 +62,10 @@ final class TtekkkochiViewController: UIViewController, ConfigUI {
super.viewDidLoad()
view.backgroundColor = .gs90
setupNavigationBar()
setupAccessibility()
addComponents()
setConstraints()
settingButton.isHidden = true
nextButton.isHidden = true
}

override func viewWillAppear(_ animated: Bool) {
Expand All @@ -91,7 +92,7 @@ final class TtekkkochiViewController: UIViewController, ConfigUI {
}

func addComponents() {
[titleLabel, ttekkkochiCollectionView, bottomView, settingButton, stickView].forEach { view.addSubview($0) }
[titleLabel, ttekkkochiCollectionView, bottomView, nextButton, stickView].forEach { view.addSubview($0) }
}

func setConstraints() {
Expand Down Expand Up @@ -124,14 +125,23 @@ final class TtekkkochiViewController: UIViewController, ConfigUI {
$0.height.equalTo(112)
}

settingButton.snp.makeConstraints {
nextButton.snp.makeConstraints {
$0.left.equalToSuperview().offset(Constants.Button.buttonPadding)
$0.right.equalToSuperview().offset(-Constants.Button.buttonPadding)
$0.bottom.equalToSuperview().offset(-Constants.Button.buttonPadding * 2)
$0.height.equalTo(72)
}
}

func setupAccessibility(){
view.accessibilityElements = [titleLabel, bottomView, nextButton]
self.navigationItem.leftBarButtonItem?.accessibilityLabel = "내 책장"
ttekkkochiCollectionView.isAccessibilityElement = false
titleLabel.accessibilityTraits = .none
nextButton.accessibilityLabel = "다음"
nextButton.accessibilityTraits = .button
}

func binding() {
self.bottomView.$selectedValue
.zip(bottomView.$initialValue)
Expand All @@ -145,21 +155,22 @@ final class TtekkkochiViewController: UIViewController, ConfigUI {
DispatchQueue.global().async {
SoundManager.shared.playSound(sound: .bell)
}

self.ttekkkochiCollectionView.reloadData()
self.blockIndex += 1

switch index {
case 4: // TODO: 읽어 주기(tts)
self.bottomView.isHidden = true
self.settingButton.isHidden = false
settingButton.setup(model: settingButtonViewModel)
self.nextButton.isHidden = false
nextButton.setup(model: settingButtonViewModel)


self.stickView.snp.remakeConstraints {
$0.top.equalTo(self.titleLabel.snp.bottom).offset(50)
$0.centerX.equalToSuperview()
$0.width.equalTo(8)
$0.bottom.equalTo(self.settingButton.snp.top).offset(-30)
$0.bottom.equalTo(self.nextButton.snp.top).offset(-30)
}

self.ttekkkochiCollectionView.snp.remakeConstraints {
Expand Down

0 comments on commit 5dc31da

Please sign in to comment.