mirror of
https://github.com/xweiba/location-spoofer.git
synced 2026-09-26 00:21:55 +08:00
feat: unify app and third-party wloc features
This commit is contained in:
@@ -44,6 +44,50 @@ enum WlocSettingsStore {
|
||||
}
|
||||
}
|
||||
|
||||
@MainActor
|
||||
final class MotionSimulationStore: ObservableObject {
|
||||
static let shared = MotionSimulationStore()
|
||||
|
||||
private enum Key {
|
||||
static let enabled = "motionSimulation.enabled"
|
||||
}
|
||||
|
||||
@Published private(set) var isEnabled: Bool
|
||||
private let defaults: UserDefaults
|
||||
|
||||
init(defaults: UserDefaults = AppGroup.defaults) {
|
||||
self.defaults = defaults
|
||||
isEnabled = defaults.bool(forKey: Key.enabled)
|
||||
}
|
||||
|
||||
func setEnabled(_ enabled: Bool) {
|
||||
isEnabled = enabled
|
||||
defaults.set(enabled, forKey: Key.enabled)
|
||||
}
|
||||
}
|
||||
|
||||
@MainActor
|
||||
final class ThirdPartyModuleSourceStore: ObservableObject {
|
||||
static let shared = ThirdPartyModuleSourceStore()
|
||||
|
||||
private enum Key {
|
||||
static let useMirror = "thirdPartyModule.useMirror"
|
||||
}
|
||||
|
||||
@Published private(set) var useMirror: Bool
|
||||
private let defaults: UserDefaults
|
||||
|
||||
init(defaults: UserDefaults = AppGroup.defaults) {
|
||||
self.defaults = defaults
|
||||
useMirror = defaults.object(forKey: Key.useMirror) as? Bool ?? true
|
||||
}
|
||||
|
||||
func setUseMirror(_ enabled: Bool) {
|
||||
useMirror = enabled
|
||||
defaults.set(enabled, forKey: Key.useMirror)
|
||||
}
|
||||
}
|
||||
|
||||
enum VirtualLocationTipKind: Equatable {
|
||||
case activation
|
||||
case deactivation
|
||||
|
||||
Reference in New Issue
Block a user