58 lines
1.7 KiB
Swift
58 lines
1.7 KiB
Swift
//
|
|
// UserDefaults+AltStore.swift
|
|
// AltStore
|
|
//
|
|
// Created by Riley Testut on 6/4/19.
|
|
// Copyright © 2019 Riley Testut. All rights reserved.
|
|
//
|
|
|
|
import Foundation
|
|
|
|
import Roxas
|
|
|
|
extension UserDefaults
|
|
{
|
|
@NSManaged var firstLaunch: Date?
|
|
|
|
@NSManaged var preferredServerID: String?
|
|
|
|
@NSManaged var isBackgroundRefreshEnabled: Bool
|
|
@NSManaged var isDebugModeEnabled: Bool
|
|
@NSManaged var presentedLaunchReminderNotification: Bool
|
|
|
|
@NSManaged var legacySideloadedApps: [String]?
|
|
|
|
@NSManaged var isLegacyDeactivationSupported: Bool
|
|
@NSManaged var activeAppLimitIncludesExtensions: Bool
|
|
|
|
var activeAppsLimit: Int? {
|
|
get {
|
|
return self._activeAppsLimit?.intValue
|
|
}
|
|
set {
|
|
if let value = newValue
|
|
{
|
|
self._activeAppsLimit = NSNumber(value: value)
|
|
}
|
|
else
|
|
{
|
|
self._activeAppsLimit = nil
|
|
}
|
|
}
|
|
}
|
|
@NSManaged @objc(activeAppsLimit) private var _activeAppsLimit: NSNumber?
|
|
|
|
func registerDefaults()
|
|
{
|
|
let ios13_5 = OperatingSystemVersion(majorVersion: 13, minorVersion: 5, patchVersion: 0)
|
|
let isLegacyDeactivationSupported = !ProcessInfo.processInfo.isOperatingSystemAtLeast(ios13_5)
|
|
let activeAppLimitIncludesExtensions = !ProcessInfo.processInfo.isOperatingSystemAtLeast(ios13_5)
|
|
|
|
self.register(defaults: [
|
|
#keyPath(UserDefaults.isBackgroundRefreshEnabled): true,
|
|
#keyPath(UserDefaults.isLegacyDeactivationSupported): isLegacyDeactivationSupported,
|
|
#keyPath(UserDefaults.activeAppLimitIncludesExtensions): activeAppLimitIncludesExtensions
|
|
])
|
|
}
|
|
}
|