From c64b0c99de97c3211e73ab7af3c0a30604492490 Mon Sep 17 00:00:00 2001 From: mahee96 <47920326+mahee96@users.noreply.github.com> Date: Sun, 16 Nov 2025 03:01:29 +0530 Subject: [PATCH] EMP: added back EMP entry/exit points as it was in 0.6.1 but with option to enable/disable it via settings --- AltStore/AppDelegate.swift | 12 +- AltStore/LaunchViewController.swift | 5 + .../BackgroundRefreshAppsOperation.swift | 5 + AltStore/SceneDelegate.swift | 10 +- AltStore/Settings/Settings.storyboard | 176 +++++++++++------- .../Settings/SettingsViewController.swift | 7 + .../Extensions/UserDefaults+AltStore.swift | 2 + 7 files changed, 142 insertions(+), 75 deletions(-) diff --git a/AltStore/AppDelegate.swift b/AltStore/AppDelegate.swift index 497bd9e8..8cb0230c 100644 --- a/AltStore/AppDelegate.swift +++ b/AltStore/AppDelegate.swift @@ -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() } diff --git a/AltStore/LaunchViewController.swift b/AltStore/LaunchViewController.swift index eed84aa1..12804d19 100644 --- a/AltStore/LaunchViewController.swift +++ b/AltStore/LaunchViewController.swift @@ -8,6 +8,7 @@ import UIKit import Roxas +import EmotionalDamage import minimuxer import WidgetKit @@ -74,6 +75,10 @@ final class LaunchViewController: UIViewController, UIDocumentPickerDelegate { #if !targetEnvironment(simulator) detectAndImportAccountFile() + + if UserDefaults.standard.enableEMPforWireguard { + start_em_proxy(bind_addr: Consts.Proxy.serverURL) + } guard let pf = fetchPairingFile() else { displayError("Device pairing file not found.") return diff --git a/AltStore/Operations/BackgroundRefreshAppsOperation.swift b/AltStore/Operations/BackgroundRefreshAppsOperation.swift index de21751b..e1d0ec80 100644 --- a/AltStore/Operations/BackgroundRefreshAppsOperation.swift +++ b/AltStore/Operations/BackgroundRefreshAppsOperation.swift @@ -10,6 +10,7 @@ import UIKit import CoreData import AltStoreCore +import EmotionalDamage import minimuxer typealias RefreshError = RefreshErrorCode.Error @@ -98,6 +99,10 @@ final class BackgroundRefreshAppsOperation: ResultOperation<[String: Result - + - + @@ -22,7 +22,7 @@ - +