Skip to content

Commit c9a88b7

Browse files
committed
πŸ› [fix] 메인화면 μ§„μž… μ‹œ μ‚¬μš©μžμ˜ ν˜„μž¬ μœ„μΉ˜λ₯Ό κ°€μ Έμ˜€μ§€ λͺ»ν•˜λŠ” 경우 κ°œμ„ 
- 둜그인 μƒνƒœμ—μ„œ μ•± μ’…λ£Œ ν›„ λ‹€μ‹œ 앱을 μ‹€ν–‰ν–ˆμ„ λ•Œ, 게슀트 μ—¬λΆ€ μ—…λ°μ΄νŠΈν•˜μ—¬ λ°˜μ˜ν•˜λ„λ‘ κ°œμ„  - μ‚¬μš©μž ν˜„μž¬ μ£Όμ†Œ μ—…λ°μ΄νŠΈλŠ” μ‚¬μš©μžκ°€ μ£Όμ†Œμ„€μ •μ—μ„œ μ£Όμ†Œλ₯Ό μ„ νƒν–ˆμ„ κ²½μš°μ—λ§Œ μ—…λ°μ΄νŠΈ ν•˜λ„λ‘ κ°œμ„ 
1 parent 9cf4d15 commit c9a88b7

File tree

5 files changed

+9
-11
lines changed

5 files changed

+9
-11
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
@@ -42,7 +42,6 @@ public final class DefaultUserManager {
4242

4343
private init(localStorage: LocalStorageService) {
4444
self.localStorage = localStorage
45-
fetchCurrentLocation()
4645
}
4746
}
4847

@@ -94,16 +93,17 @@ extension DefaultUserManager: UserManager {
9493
public func getCurrentGuestState() -> Bool {
9594
return _guestState.value
9695
}
97-
98-
}
99-
100-
private extension DefaultUserManager {
10196

102-
func fetchCurrentLocation() {
97+
public func fetchCurrentLocation() {
10398
LocationManager.shared.currentLocation()
104-
.map { ($0?.coordinate.longitude ?? 126.977829174031, $0?.coordinate.latitude ?? 37.5663174209601 )}
99+
.compactMap { $0 }
100+
.map { ($0.coordinate.longitude, $0.coordinate.latitude )}
105101
.sink(receiveValue: { [weak self] (longitude: Double, latitude: Double) in
106102
self?._location.send((longitude, latitude))
107103
}).store(in: &cancellables)
104+
Task {
105+
_guestState.send(await SessionManager.shared.checkUserSession())
106+
}
108107
}
108+
109109
}

β€ŽFitfty/Projects/MainFeed/Sources/Main/Home/ViewModel/MainViewModel.swiftβ€Ž

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,6 @@ private extension MainViewModel {
186186
} else {
187187
let userPrivacy = try await self.getUserPrivacy()
188188
self.myUserToken = userPrivacy.data?.userToken
189-
190189
for i in 0..<codyList.count {
191190
list.append((codyList[i], codyList[i].userToken == self.myUserToken ? .myProfile : .userProfile))
192191
}
@@ -213,7 +212,6 @@ private extension MainViewModel {
213212
longitude: longitude,
214213
latitude: latitude
215214
)
216-
userManager.updateCurrentLocation(address)
217215
return address
218216
}
219217
}

β€Ž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)