Skip to content

Commit

Permalink
Merge pull request #281 from boostcampwm-2021/issue/#279
Browse files Browse the repository at this point in the history
[리뷰 반영] 백그라운드 리뷰 & MapJSONBBusError operator 리뷰 반영
  • Loading branch information
minsangKang authored Nov 25, 2021
2 parents 7bfeacb + fdba7a1 commit 45e5821
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions BBus/BBus/Background/GetOnAlarm/GetOnAlarmController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import UIKit
import Combine
import CoreLocation

final class GetOnAlarmController: NSObject {
final class GetOnAlarmController {

static private let alarmIdentifier: String = "GetOnAlarm"

Expand All @@ -21,7 +21,7 @@ final class GetOnAlarmController: NSObject {

@Published private(set) var viewModel: GetOnAlarmViewModel?

private override init() {
private init() {
self.cancellables = []
}

Expand Down Expand Up @@ -70,14 +70,14 @@ final class GetOnAlarmController: NSObject {
}

private func bindMessage() {
self.viewModel?.$getApproachStatus
self.viewModel?.$busApproachStatus
.sink(receiveValue: { [weak self] status in
guard let status = status,
let message = self?.viewModel?.message else { return }
if status == .oneStationLeft {
self?.stop()
}
self?.pushGetOnAlarm(title: "승차 알람" ,message: message)
self?.pushGetOnAlarm(title: "승차 알람", message: message)
})
.store(in: &self.cancellables)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ final class GetOnAlarmViewModel {
let usecase: GetOnAlarmUsecase
private(set) var getOnAlarmStatus: GetOnAlarmStatus
private var cancellables: Set<AnyCancellable>
@Published private(set) var getApproachStatus: BusApproachStatus?
@Published private(set) var busApproachStatus: BusApproachStatus?
private(set) var message: String?
@Published private(set) var networkErrorMessage: (title: String, body: String)?

Expand All @@ -23,7 +23,7 @@ final class GetOnAlarmViewModel {
self.message = nil
self.networkErrorMessage = nil
self.cancellables = []
self.getApproachStatus = nil
self.busApproachStatus = nil
self.execute()
self.configureObserver()
}
Expand Down Expand Up @@ -51,7 +51,7 @@ final class GetOnAlarmViewModel {
beforeOrd: self.getOnAlarmStatus.currentBusOrd ?? stationOrd,
targetOrd: self.getOnAlarmStatus.targetOrd) {
self.makeMessage(with: status)
self.getApproachStatus = status
self.busApproachStatus = status
}
self.getOnAlarmStatus = self.getOnAlarmStatus.withCurrentBusOrd(stationOrd)
}
Expand Down

0 comments on commit 45e5821

Please sign in to comment.