File tree Expand file tree Collapse file tree 5 files changed +9
-10
lines changed
Expand file tree Collapse file tree 5 files changed +9
-10
lines changed Original file line number Diff line number Diff line change @@ -42,6 +42,7 @@ private extension MainCoordinator {
4242 userManager: DefaultUserManager . shared
4343 )
4444 )
45+ DefaultUserManager . shared. fetchCurrentLocation ( )
4546 return viewController
4647 }
4748
Original file line number Diff line number Diff 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 }
Original file line number Diff line number Diff 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}
Original file line number Diff line number Diff 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 }
Original file line number Diff line number Diff 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 }
You can’t perform that action at this time.
0 commit comments