mirror of
https://github.com/danbee/persephone
synced 2025-03-04 08:39:11 +00:00
Remove port pref if it's 0 or nil
This commit is contained in:
parent
32f8c68af2
commit
97ee384007
@ -23,7 +23,11 @@ struct Preferences {
|
|||||||
return UserDefaults.standard.value(forKey: "mpdPort") as? Int
|
return UserDefaults.standard.value(forKey: "mpdPort") as? Int
|
||||||
}
|
}
|
||||||
set {
|
set {
|
||||||
UserDefaults.standard.set(newValue, forKey: "mpdPort")
|
if (newValue.map { $0 > 0 } ?? false) {
|
||||||
|
UserDefaults.standard.set(newValue, forKey: "mpdPort")
|
||||||
|
} else {
|
||||||
|
UserDefaults.standard.removeObject(forKey: "mpdPort")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user