EMP: added back EMP entry/exit points as it was in 0.6.1 but with option to enable/disable it via settings

This commit is contained in:
mahee96
2025-11-16 03:01:29 +05:30
parent e19b147962
commit c64b0c99de
7 changed files with 142 additions and 75 deletions

View File

@@ -14,6 +14,7 @@ import Intents
import AltStoreCore
import AltSign
import Roxas
import EmotionalDamage
import Nuke
@@ -98,7 +99,9 @@ final class AppDelegate: UIResponder, UIApplicationDelegate {
self.prepareImageCache()
// TODO: @mahee96: find if we need to start em_proxy as in altstore?
// start_em_proxy(bind_addr: Consts.Proxy.serverURL)
if UserDefaults.standard.enableEMPforWireguard {
start_em_proxy(bind_addr: Consts.Proxy.serverURL)
}
SecureValueTransformer.register()
@@ -123,7 +126,9 @@ final class AppDelegate: UIResponder, UIApplicationDelegate {
{
// Make sure to update SceneDelegate.sceneDidEnterBackground() as well.
// TODO: @mahee96: find if we need to stop em_proxy as in altstore?
// stop_em_proxy()
if UserDefaults.standard.enableEMPforWireguard {
stop_em_proxy()
}
guard let oneMonthAgo = Calendar.current.date(byAdding: .month, value: -1, to: Date()) else { return }
let midnightOneMonthAgo = Calendar.current.startOfDay(for: oneMonthAgo)
@@ -140,6 +145,9 @@ final class AppDelegate: UIResponder, UIApplicationDelegate {
func applicationWillEnterForeground(_ application: UIApplication)
{
AppManager.shared.update()
if UserDefaults.standard.enableEMPforWireguard {
start_em_proxy(bind_addr: Consts.Proxy.serverURL)
}
PatreonAPI.shared.refreshPatreonAccount()
}