File tree Expand file tree Collapse file tree 1 file changed +12
-6
lines changed
Fitfty/Projects/Core/Sources/Utilities Expand file tree Collapse file tree 1 file changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -95,12 +95,18 @@ extension DefaultUserManager: UserManager {
9595 }
9696
9797 public func fetchCurrentLocation( ) {
98- LocationManager . shared. currentLocation ( )
99- . compactMap { $0 }
100- . map { ( $0. coordinate. longitude, $0. coordinate. latitude ) }
101- . sink ( receiveValue: { [ weak self] ( longitude: Double , latitude: Double ) in
102- self ? . _location. send ( ( longitude, latitude) )
103- } ) . store ( in: & cancellables)
98+ if let location = localStorage. read ( key: . currentLocation) as? [ String : Any ] {
99+ let x = Double ( location [ " x " ] as? String ?? " 126.977829174031 " ) ?? 126.977829174031
100+ let y = Double ( location [ " y " ] as? String ?? " 37.5663174209601 " ) ?? 37.5663174209601
101+ _location. send ( ( x, y) )
102+ } else {
103+ LocationManager . shared. currentLocation ( )
104+ . compactMap { $0 }
105+ . map { ( $0. coordinate. longitude, $0. coordinate. latitude ) }
106+ . sink ( receiveValue: { [ weak self] ( longitude: Double , latitude: Double ) in
107+ self ? . _location. send ( ( longitude, latitude) )
108+ } ) . store ( in: & cancellables)
109+ }
104110 Task {
105111 _guestState. send ( await SessionManager . shared. checkUserSession ( ) )
106112 }
You canβt perform that action at this time.
0 commit comments