fix: unify location report state
This commit is contained in:
@ -29,7 +29,7 @@ final class LocationReportViewModel {
|
||||
private let locationProvider: any LocationProviding
|
||||
|
||||
init(
|
||||
locationStateStore: HomeLocationStateStore = HomeLocationStateStore(),
|
||||
locationStateStore: HomeLocationStateStore = .shared,
|
||||
locationProvider: any LocationProviding = LocationProvider.shared
|
||||
) {
|
||||
self.locationStateStore = locationStateStore
|
||||
@ -38,11 +38,15 @@ final class LocationReportViewModel {
|
||||
locationStateStore: locationStateStore,
|
||||
locationProvider: locationProvider
|
||||
)
|
||||
self.locationStateStore.onStateChange = { [weak self] in
|
||||
self.locationStateStore.observe(self) { [weak self] in
|
||||
self?.notifyStateChange()
|
||||
}
|
||||
}
|
||||
|
||||
deinit {
|
||||
locationStateStore.removeObserver(self)
|
||||
}
|
||||
|
||||
var isOnline: Bool { locationStateStore.isOnline }
|
||||
var countdownDisplayText: String { locationStateStore.countdownDisplayTextSingleHour }
|
||||
var reminderMinutes: Int { locationStateStore.reminderMinutes }
|
||||
|
||||
Reference in New Issue
Block a user