From 51e72c6035938965ce18903d80837767fb9035ef Mon Sep 17 00:00:00 2001 From: modyhoon Date: Wed, 24 Nov 2021 19:46:32 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20#275=20=ED=95=98=EC=B0=A8=20=EC=95=8C?= =?UTF-8?q?=EB=9E=8C=20=EA=B4=80=EB=A0=A8=20=EB=B2=84=EA=B7=B8=20=ED=95=B4?= =?UTF-8?q?=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AlarmSettingViewController.swift | 35 +++++++++++-------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/BBus/BBus/Foreground/AlarmSetting/AlarmSettingViewController.swift b/BBus/BBus/Foreground/AlarmSetting/AlarmSettingViewController.swift index 9bea1e6a..634a32ea 100644 --- a/BBus/BBus/Foreground/AlarmSetting/AlarmSettingViewController.swift +++ b/BBus/BBus/Foreground/AlarmSetting/AlarmSettingViewController.swift @@ -346,22 +346,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) + } } } }