Prevents being refreshed by AltStore when in foreground
This commit is contained in:
parent
a09a875c92
commit
7cf89e32f7
@ -14,6 +14,18 @@ import Harmony_Dropbox
|
|||||||
import Fabric
|
import Fabric
|
||||||
import Crashlytics
|
import Crashlytics
|
||||||
|
|
||||||
|
private extension CFNotificationName
|
||||||
|
{
|
||||||
|
static let altstoreRequestAppState: CFNotificationName = CFNotificationName("com.altstore.RequestAppState.com.rileytestut.Delta" as CFString)
|
||||||
|
static let altstoreAppIsRunning: CFNotificationName = CFNotificationName("com.altstore.AppState.Running.com.rileytestut.Delta" as CFString)
|
||||||
|
}
|
||||||
|
|
||||||
|
private let ReceivedApplicationState: @convention(c) (CFNotificationCenter?, UnsafeMutableRawPointer?, CFNotificationName?, UnsafeRawPointer?, CFDictionary?) -> Void =
|
||||||
|
{ (center, observer, name, object, userInfo) in
|
||||||
|
guard let appDelegate = UIApplication.shared.delegate as? AppDelegate else { return }
|
||||||
|
appDelegate.receivedApplicationStateRequest()
|
||||||
|
}
|
||||||
|
|
||||||
@UIApplicationMain
|
@UIApplicationMain
|
||||||
class AppDelegate: UIResponder, UIApplicationDelegate
|
class AppDelegate: UIResponder, UIApplicationDelegate
|
||||||
{
|
{
|
||||||
@ -52,8 +64,12 @@ class AppDelegate: UIResponder, UIApplicationDelegate
|
|||||||
ExternalGameControllerManager.shared.startMonitoring()
|
ExternalGameControllerManager.shared.startMonitoring()
|
||||||
|
|
||||||
// Notifications
|
// Notifications
|
||||||
|
let center = CFNotificationCenterGetDarwinNotifyCenter()
|
||||||
|
CFNotificationCenterAddObserver(center, nil, ReceivedApplicationState, CFNotificationName.altstoreRequestAppState.rawValue, nil, .deliverImmediately)
|
||||||
|
|
||||||
NotificationCenter.default.addObserver(self, selector: #selector(AppDelegate.databaseManagerDidStart(_:)), name: DatabaseManager.didStartNotification, object: DatabaseManager.shared)
|
NotificationCenter.default.addObserver(self, selector: #selector(AppDelegate.databaseManagerDidStart(_:)), name: DatabaseManager.didStartNotification, object: DatabaseManager.shared)
|
||||||
|
|
||||||
|
|
||||||
// Deep Links
|
// Deep Links
|
||||||
if let shortcut = launchOptions?[.shortcutItem] as? UIApplicationShortcutItem
|
if let shortcut = launchOptions?[.shortcutItem] as? UIApplicationShortcutItem
|
||||||
{
|
{
|
||||||
@ -192,5 +208,11 @@ private extension AppDelegate
|
|||||||
self.deepLinkController.handle(deepLink)
|
self.deepLinkController.handle(deepLink)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func receivedApplicationStateRequest()
|
||||||
|
{
|
||||||
|
let center = CFNotificationCenterGetDarwinNotifyCenter()
|
||||||
|
CFNotificationCenterPostNotification(center!, CFNotificationName(CFNotificationName.altstoreAppIsRunning.rawValue), nil, nil, true)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user