Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions Atcha-iOS/Presentation/Location/MainViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ final class MainViewModel: BaseViewModel{


guard self.isServiceRegion == true, !isGuest else { return }

let req = FetchTaxiFareRequest(
originLat: lastReverseGeocode?.lat,
originLon: lastReverseGeocode?.lon,
Expand Down Expand Up @@ -585,6 +586,8 @@ extension MainViewModel {

address = info?.name?.isEmpty == false ? info?.name : info?.address

guard self.isServiceRegion == true, !isGuest else { return }

let request = FetchTaxiFareRequest(
originLat: info?.lat,
originLon: info?.lon,
Expand All @@ -607,6 +610,10 @@ extension MainViewModel {
throw NSError(domain: "StartCoord", code: -1, userInfo: [NSLocalizedDescriptionKey: "저장된 출발 좌표가 유효하지 않습니다."])
}

guard self.isServiceRegion == true && !isGuest else {
throw NSError(domain: "AuthError", code: 401, userInfo: [NSLocalizedDescriptionKey: "게스트는 요금 조회가 불가능합니다."])
}

let req = FetchTaxiFareRequest(
originLat: lat,
originLon: lon,
Expand Down Expand Up @@ -642,6 +649,10 @@ extension MainViewModel {
}

private func fetchTaxiFare(request: FetchTaxiFareRequest) async throws -> Double {
guard self.isServiceRegion == true && !isGuest else {
throw NSError(domain: "AuthError", code: 401, userInfo: [NSLocalizedDescriptionKey: "게스트는 요금 조회가 불가능합니다."])
}

return try await fetchTaxiFareUseCase.fetchTaxiFare(request: request)
}

Expand Down
Loading