mirror of
https://github.com/SideStore/SideStore.git
synced 2026-02-10 15:23:27 +01:00
52 lines
1.1 KiB
Swift
52 lines
1.1 KiB
Swift
//
|
|
// UserDefaults+AltServer.swift
|
|
// AltServer
|
|
//
|
|
// Created by Riley Testut on 7/31/19.
|
|
// Copyright © 2019 Riley Testut. All rights reserved.
|
|
//
|
|
|
|
import Foundation
|
|
|
|
extension UserDefaults
|
|
{
|
|
var serverID: String? {
|
|
get {
|
|
return self.string(forKey: "serverID")
|
|
}
|
|
set {
|
|
self.set(newValue, forKey: "serverID")
|
|
}
|
|
}
|
|
|
|
var didPresentInitialNotification: Bool {
|
|
get {
|
|
return self.bool(forKey: "didPresentInitialNotification")
|
|
}
|
|
set {
|
|
self.set(newValue, forKey: "didPresentInitialNotification")
|
|
}
|
|
}
|
|
|
|
func registerDefaults()
|
|
{
|
|
if self.serverID == nil
|
|
{
|
|
self.serverID = UUID().uuidString
|
|
}
|
|
}
|
|
}
|
|
|
|
// "Public" defaults configurable via CLI.
|
|
extension UserDefaults
|
|
{
|
|
private static let altJITTimeoutKey = "JITTimeout"
|
|
|
|
var altJITTimeout: TimeInterval? {
|
|
let timeout = self.double(forKey: UserDefaults.altJITTimeoutKey) // Coerces strings into doubles.
|
|
guard timeout != 0 else { return nil }
|
|
|
|
return timeout
|
|
}
|
|
}
|