@@ -55,8 +55,14 @@ final class DetailRouteViewModel: BaseViewModel {
5555 @Published var isRefreshing : Bool = false
5656
5757 private var lastValidTime : Date ? = nil
58- private var consecutiveValidCount = 0
58+ private var didSendInitialLocation = false
5959
60+ private var consecutiveValidCount = 0
61+ func forceLocationSnap( ) {
62+ self . didSendInitialLocation = false
63+ self . lastValidTime = nil
64+ self . consecutiveValidCount = 0
65+ }
6066 //#if DEBUG
6167 //@Published var mockLocation: CLLocationCoordinate2D? = nil
6268 //#endif
@@ -204,10 +210,19 @@ final class DetailRouteViewModel: BaseViewModel {
204210 streamTask = Task {
205211 for await location in streamUseCase. startUpdate ( ) {
206212 let now = Date ( )
213+
214+ let isInitialTracking = !self . didSendInitialLocation
215+
207216 let timeGap = self . lastValidTime != nil ? now. timeIntervalSince ( self . lastValidTime!) : 999.0
208217 let isRecovering = timeGap > 60.0
209218
210- let accuracyThreshold = isRecovering ? 300.0 : 150.0
219+ let accuracyThreshold : CLLocationAccuracy
220+
221+ if isInitialTracking {
222+ accuracyThreshold = 1000.0 // 시청 탈출용 널널한 기준
223+ } else {
224+ accuracyThreshold = isRecovering ? 300.0 : 150.0 // 회원님의 지하철 복구 로직 유지!
225+ }
211226
212227 guard location. horizontalAccuracy < accuracyThreshold else {
213228 self . consecutiveValidCount = 0
@@ -218,7 +233,9 @@ final class DetailRouteViewModel: BaseViewModel {
218233 // 지상 탈출이 의심될 때: 바로 안 믿고 카운터를 올립니다.
219234 self . consecutiveValidCount += 1
220235
221- if self . consecutiveValidCount >= 3 {
236+ let requiredCount = isInitialTracking ? 1 : 3
237+
238+ if self . consecutiveValidCount >= requiredCount {
222239 // 3번 연속(약 3초) 정상 신호가 들어왔다? 이건 100% 진짜 지상이다!
223240 smoother. reset ( location. coordinate)
224241
@@ -252,6 +269,9 @@ final class DetailRouteViewModel: BaseViewModel {
252269
253270 await MainActor . run {
254271 self . currentLocation = capturedCoord
272+ if !self . didSendInitialLocation {
273+ self . didSendInitialLocation = true
274+ }
255275 HomeArrivalManager . shared. checkHomeArrival ( currentCoord: capturedCoord)
256276 }
257277
0 commit comments