mirror of
https://github.com/SideStore/SideStore.git
synced 2026-02-10 15:23:27 +01:00
mdc v14
This commit is contained in:
@@ -10,8 +10,7 @@ import Foundation
|
||||
|
||||
import Roxas
|
||||
|
||||
public extension UserDefaults
|
||||
{
|
||||
public extension UserDefaults {
|
||||
static let shared: UserDefaults = {
|
||||
guard let appGroup = Bundle.main.appGroups.first else { return .standard }
|
||||
|
||||
@@ -43,25 +42,27 @@ public extension UserDefaults
|
||||
|
||||
@NSManaged var trustedSourceIDs: [String]?
|
||||
|
||||
@nonobjc
|
||||
var activeAppsLimit: Int? {
|
||||
get {
|
||||
return self._activeAppsLimit?.intValue
|
||||
}
|
||||
set {
|
||||
if let value = newValue
|
||||
{
|
||||
if let value = newValue {
|
||||
self._activeAppsLimit = NSNumber(value: value)
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
self._activeAppsLimit = nil
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@NSManaged @objc(activeAppsLimit) private var _activeAppsLimit: NSNumber?
|
||||
|
||||
class func registerDefaults()
|
||||
{
|
||||
|
||||
@NSManaged var enableMacDirtyCowExploit: Bool
|
||||
@NSManaged var isMacDirtyCowSupported: Bool
|
||||
|
||||
class 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)
|
||||
@@ -69,15 +70,31 @@ public extension UserDefaults
|
||||
let ios14 = OperatingSystemVersion(majorVersion: 14, minorVersion: 0, patchVersion: 0)
|
||||
let localServerSupportsRefreshing = !ProcessInfo.processInfo.isOperatingSystemAtLeast(ios14)
|
||||
|
||||
let ios16 = OperatingSystemVersion(majorVersion: 16, minorVersion: 0, patchVersion: 0)
|
||||
let ios16_2 = OperatingSystemVersion(majorVersion: 16, minorVersion: 2, patchVersion: 0)
|
||||
let ios15_7_2 = OperatingSystemVersion(majorVersion: 15, minorVersion: 7, patchVersion: 2)
|
||||
|
||||
// MacDirtyCow supports iOS 14.0 - 15.7.1 OR 16.0 - 16.1.2
|
||||
let isMacDirtyCowSupported =
|
||||
(ProcessInfo.processInfo.isOperatingSystemAtLeast(ios14) && !ProcessInfo.processInfo.isOperatingSystemAtLeast(ios15_7_2)) ||
|
||||
(ProcessInfo.processInfo.isOperatingSystemAtLeast(ios16) && !ProcessInfo.processInfo.isOperatingSystemAtLeast(ios16_2))
|
||||
|
||||
let defaults = [
|
||||
#keyPath(UserDefaults.isBackgroundRefreshEnabled): true,
|
||||
#keyPath(UserDefaults.isLegacyDeactivationSupported): isLegacyDeactivationSupported,
|
||||
#keyPath(UserDefaults.activeAppLimitIncludesExtensions): activeAppLimitIncludesExtensions,
|
||||
#keyPath(UserDefaults.localServerSupportsRefreshing): localServerSupportsRefreshing,
|
||||
#keyPath(UserDefaults.requiresAppGroupMigration): true
|
||||
#keyPath(UserDefaults.requiresAppGroupMigration): true,
|
||||
#keyPath(UserDefaults.enableMacDirtyCowExploit): true,
|
||||
#keyPath(UserDefaults.isMacDirtyCowSupported): isMacDirtyCowSupported,
|
||||
]
|
||||
|
||||
UserDefaults.standard.register(defaults: defaults)
|
||||
UserDefaults.shared.register(defaults: defaults)
|
||||
|
||||
if !isMacDirtyCowSupported {
|
||||
// Disable enableMacDirtyCowExploit if running iOS version that doesn't support MacDirtyCow.
|
||||
UserDefaults.standard.enableMacDirtyCowExploit = false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user