File tree Expand file tree Collapse file tree 2 files changed +19
-6
lines changed
Fitfty/Projects/Core/Sources/Utilities Expand file tree Collapse file tree 2 files changed +19
-6
lines changed Original file line number Diff line number Diff line change @@ -13,6 +13,12 @@ import Common
1313
1414public final class LocationManager : NSObject {
1515
16+ public enum Constant {
17+ public static let defaultLongitude = 126.977829174031
18+ public static let defaultLatitude = 37.5663174209601
19+
20+ }
21+
1622 public static let shared = LocationManager ( )
1723 public var currentAuthorizationStatus : CLAuthorizationStatus { manager. authorizationStatus }
1824
@@ -55,8 +61,8 @@ extension LocationManager: CLLocationManagerDelegate {
5561 public func locationManagerDidChangeAuthorization( _ manager: CLLocationManager ) {
5662 guard _location. value == nil ||
5763 (
58- _location. value? . coordinate. longitude == 126.977829174031 &&
59- _location. value? . coordinate. latitude == 37.5663174209601
64+ _location. value? . coordinate. longitude == Constant . defaultLongitude &&
65+ _location. value? . coordinate. latitude == Constant . defaultLatitude
6066 )
6167 else {
6268 return
@@ -68,7 +74,7 @@ extension LocationManager: CLLocationManagerDelegate {
6874 case . notDetermined, . restricted:
6975 requestWhenInUseAuthorization ( )
7076 default :
71- _location. send ( CLLocation ( latitude: 37.5663174209601 , longitude: 126.977829174031 ) )
77+ _location. send ( CLLocation ( latitude: Constant . defaultLatitude , longitude: Constant . defaultLongitude ) )
7278 }
7379 }
7480
Original file line number Diff line number Diff line change @@ -74,7 +74,10 @@ extension DefaultUserManager: UserManager {
7474 }
7575 localStorage. write ( key: . currentLocation, value: addressDictionary)
7676 _location. send (
77- ( Double ( address. x) ?? 126.977829174031 , Double ( address. y) ?? 37.5663174209601 )
77+ (
78+ Double ( address. x) ?? LocationManager . Constant. defaultLongitude,
79+ Double ( address. y) ?? LocationManager . Constant. defaultLatitude
80+ )
7881 )
7982 }
8083
@@ -96,8 +99,12 @@ extension DefaultUserManager: UserManager {
9699
97100 public func fetchCurrentLocation( ) {
98101 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
102+ let x = Double (
103+ location [ " x " ] as? String ?? LocationManager . Constant. defaultLongitude. description
104+ ) ?? LocationManager . Constant. defaultLongitude
105+ let y = Double (
106+ location [ " y " ] as? String ?? LocationManager . Constant. defaultLatitude. description
107+ ) ?? LocationManager . Constant. defaultLatitude
101108 _location. send ( ( x, y) )
102109 } else {
103110 LocationManager . shared. currentLocation ( )
You can’t perform that action at this time.
0 commit comments