Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[iOS] 실시간으로 Coordinate 기록 시 위치 필터링 구현 #303

Merged
merged 10 commits into from
Dec 11, 2023
Merged
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,12 @@ extension MapViewController: CLLocationManagerDelegate {
let recordJourneyViewModel = self.viewModel as? RecordJourneyViewModel else {
return
}
let previousCoordinate = (self.viewModel as? RecordJourneyViewModel)?.state.previousCoordinate.value
if self.timeRemaining != 0 || viewModel is NavigateMapViewModel { return }
if let previousCoordinate {
if !self.isDistanceOver5AndUnder50(coordinate1: previousCoordinate,
coordinate2: newCurrentLocation.coordinate) { return }
}

let coordinate2D = CLLocationCoordinate2D(latitude: newCurrentLocation.coordinate.latitude,
longitude: newCurrentLocation.coordinate.longitude)
Expand Down Expand Up @@ -371,6 +377,7 @@ extension MapViewController: CLLocationManagerDelegate {
coordinate2: CLLocationCoordinate2D) -> Bool {
let location1 = CLLocation(latitude: coordinate1.latitude, longitude: coordinate1.longitude)
let location2 = CLLocation(latitude: coordinate2.latitude, longitude: coordinate2.longitude)
MSLogger.make(category: .navigateMap).log("이동한 거리: \(location1.distance(from: location2))")
return 5 <= location1.distance(from: location2) && location1.distance(from: location2) <= 50
}

Expand Down
5 changes: 2 additions & 3 deletions iOS/MusicSpot/MusicSpot/SceneDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import MSConstants
import MSData
import MSDesignSystem
import MSLogger
import MSUserDefaults

class SceneDelegate: UIResponder, UIWindowSceneDelegate {

Expand All @@ -20,14 +21,14 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {
var window: UIWindow?
private var appCoordinator: Coordinator!

#if DEBUG
@UserDefaultsWrapped(UserDefaultsKey.recordingJourneyID, defaultValue: nil)
var recordingJourneyID: String?
@UserDefaultsWrapped(UserDefaultsKey.isFirstLaunch, defaultValue: false)
var isFirstLaunch: Bool
@UserDefaultsWrapped(UserDefaultsKey.isRecording, defaultValue: false)
var isRecording: Bool

#if DEBUG
var keychain = MSKeychainStorage()
#endif

Expand Down Expand Up @@ -72,12 +73,10 @@ private extension SceneDelegate {

}


// MARK: - Debug

#if DEBUG
import MSKeychainStorage
import MSUserDefaults

private extension SceneDelegate {

Expand Down