Skip to content

Commit

Permalink
Merge pull request #276 from boostcampwm-2021/issue/#275
Browse files Browse the repository at this point in the history
fix: #275 하차 알람 관련 버그 해결
  • Loading branch information
Modyhoon authored Nov 24, 2021
2 parents 7ddf872 + 51e72c6 commit 61a91a3
Showing 1 changed file with 20 additions and 15 deletions.
35 changes: 20 additions & 15 deletions BBus/BBus/Foreground/AlarmSetting/AlarmSettingViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -342,22 +342,27 @@ extension AlarmSettingViewController: GetOffAlarmButtonDelegate {
let endStationArsId = self.viewModel?.busStationInfos?[indexPath.item].arsId,
let targetOrd = self.viewModel?.busStationInfos?[indexPath.item].ord else { return }

let result = GetOffAlarmController.shared.start(targetOrd: targetOrd, busRouteId: busRouteId, arsId: startStationArsId)
switch result {
case .success:
UIView.animate(withDuration: 0.3) { [weak self] in
self?.coordinator?.openMovingStatus(busRouteId: busRouteId, fromArsId: startStationArsId, toArsId: endStationArsId)
}
case .sameAlarm:
self.alarmSettingActionSheet(titleMessage: "하차 알람을 종료하시겠습니까?", buttonMessage: "종료") {
self.coordinator?.closeMovingStatus()
}
case .duplicated:
self.alarmSettingActionSheet(titleMessage: "이미 설정되어있는 하차알람이 있습니다.\n 재설정 하시겠습니까?", buttonMessage: "재설정") {
GetOffAlarmController.shared.stop()
_ = GetOffAlarmController.shared.start(targetOrd: targetOrd, busRouteId: busRouteId, arsId: endStationArsId)
if startStationArsId == endStationArsId {
self.alarmSettingAlert(message: "해당 정거장으로 하차알람을 등록할 수 없습니다.")
}
else {
let result = GetOffAlarmController.shared.start(targetOrd: targetOrd, busRouteId: busRouteId, arsId: startStationArsId)
switch result {
case .success:
UIView.animate(withDuration: 0.3) { [weak self] in
self?.coordinator?.resetMovingStatus(busRouteId: busRouteId, fromArsId: startStationArsId, toArsId: startStationArsId)
self?.coordinator?.openMovingStatus(busRouteId: busRouteId, fromArsId: startStationArsId, toArsId: endStationArsId)
}
case .sameAlarm:
self.alarmSettingActionSheet(titleMessage: "하차 알람을 종료하시겠습니까?", buttonMessage: "종료") {
self.coordinator?.closeMovingStatus()
}
case .duplicated:
self.alarmSettingActionSheet(titleMessage: "이미 설정되어있는 하차알람이 있습니다.\n 재설정 하시겠습니까?", buttonMessage: "재설정") {
GetOffAlarmController.shared.stop()
_ = GetOffAlarmController.shared.start(targetOrd: targetOrd, busRouteId: busRouteId, arsId: endStationArsId)
UIView.animate(withDuration: 0.3) { [weak self] in
self?.coordinator?.resetMovingStatus(busRouteId: busRouteId, fromArsId: startStationArsId, toArsId: endStationArsId)
}
}
}
}
Expand Down

0 comments on commit 61a91a3

Please sign in to comment.