Skip to content

Commit f648420

Browse files
committed
Merge branch 'develop' of https://github.com/YAPP-Github/21st-iOS-Team-2-iOS into feature/admin-report
2 parents 618807c + c9a88b7 commit f648420

File tree

5 files changed

+9
-10
lines changed

5 files changed

+9
-10
lines changed

Fitfty/Projects/Coordinator/Sources/Main/MainCoordinator.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ private extension MainCoordinator {
4242
userManager: DefaultUserManager.shared
4343
)
4444
)
45+
DefaultUserManager.shared.fetchCurrentLocation()
4546
return viewController
4647
}
4748

Fitfty/Projects/Core/Sources/Utilities/LocationManager.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ extension LocationManager: CLLocationManagerDelegate {
5858
case .authorizedAlways, .authorizedWhenInUse:
5959
manager.startUpdatingLocation()
6060
case .notDetermined, .restricted:
61-
manager.requestWhenInUseAuthorization()
61+
requestWhenInUseAuthorization()
6262
default:
6363
_location.send(CLLocation(latitude: 37.5663174209601, longitude: 126.977829174031))
6464
}

Fitfty/Projects/Core/Sources/Utilities/UserManager.swift

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ public final class DefaultUserManager {
4444

4545
private init(localStorage: LocalStorageService) {
4646
self.localStorage = localStorage
47-
fetchCurrentLocation()
4847
}
4948
}
5049

@@ -105,16 +104,17 @@ extension DefaultUserManager: UserManager {
105104
public func getAdminState() -> Bool {
106105
return _adminState.value
107106
}
108-
109-
}
110-
111-
private extension DefaultUserManager {
112107

113-
func fetchCurrentLocation() {
108+
public func fetchCurrentLocation() {
114109
LocationManager.shared.currentLocation()
115-
.map { ($0?.coordinate.longitude ?? 126.977829174031, $0?.coordinate.latitude ?? 37.5663174209601 )}
110+
.compactMap { $0 }
111+
.map { ($0.coordinate.longitude, $0.coordinate.latitude )}
116112
.sink(receiveValue: { [weak self] (longitude: Double, latitude: Double) in
117113
self?._location.send((longitude, latitude))
118114
}).store(in: &cancellables)
115+
Task {
116+
_guestState.send(await SessionManager.shared.checkUserSession())
117+
}
119118
}
119+
120120
}

Fitfty/Projects/MainFeed/Sources/Main/Home/ViewModel/MainViewModel.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,6 @@ private extension MainViewModel {
220220
longitude: longitude,
221221
latitude: latitude
222222
)
223-
userManager.updateCurrentLocation(address)
224223
return address
225224
}
226225
}

Fitfty/Projects/MainFeed/Sources/Main/Weather/ViewModel/WeatherViewModel.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,6 @@ private extension WeatherViewModel {
157157
longitude: longitude,
158158
latitude: latitude
159159
)
160-
userManager.updateCurrentLocation(address)
161160
return address
162161
}
163162
}

0 commit comments

Comments
 (0)