From 65efa4fdd6b2b0c7027ebdf68d7fa296175d4bf5 Mon Sep 17 00:00:00 2001 From: Spidy123222 <64176728+Spidy123222@users.noreply.github.com> Date: Mon, 31 Mar 2025 16:35:44 -0700 Subject: [PATCH 01/11] test open URL Signed-off-by: Spidy123222 <64176728+Spidy123222@users.noreply.github.com> --- AltStore/Operations/InstallAppOperation.swift | 1 + 1 file changed, 1 insertion(+) diff --git a/AltStore/Operations/InstallAppOperation.swift b/AltStore/Operations/InstallAppOperation.swift index c88ad8d0..d2a6e25b 100644 --- a/AltStore/Operations/InstallAppOperation.swift +++ b/AltStore/Operations/InstallAppOperation.swift @@ -225,6 +225,7 @@ final class InstallAppOperation: ResultOperation } do { + UIApplication.shared.open("shortcuts://run-shortcut?name=TurnOffData", completionHandler: nil) try install_ipa(installedApp.bundleIdentifier) installing = false installedApp.refreshedDate = Date() From a51a144052cbe7e74593abbf0a8c187c4d546ad1 Mon Sep 17 00:00:00 2001 From: Spidy123222 <64176728+Spidy123222@users.noreply.github.com> Date: Mon, 31 Mar 2025 16:55:42 -0700 Subject: [PATCH 02/11] fix error for open link Signed-off-by: Spidy123222 <64176728+Spidy123222@users.noreply.github.com> --- AltStore/Operations/InstallAppOperation.swift | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/AltStore/Operations/InstallAppOperation.swift b/AltStore/Operations/InstallAppOperation.swift index d2a6e25b..67b36f75 100644 --- a/AltStore/Operations/InstallAppOperation.swift +++ b/AltStore/Operations/InstallAppOperation.swift @@ -225,7 +225,9 @@ final class InstallAppOperation: ResultOperation } do { - UIApplication.shared.open("shortcuts://run-shortcut?name=TurnOffData", completionHandler: nil) + if let url = URL(string: "shortcuts://run-shortcut?name=TurnOffData") { + UIApplication.shared.open(url, options: [:], completionHandler: nil) + } try install_ipa(installedApp.bundleIdentifier) installing = false installedApp.refreshedDate = Date() From 4714d34beb6b7dce80339ed341c89271687f140a Mon Sep 17 00:00:00 2001 From: Spidy123222 <64176728+Spidy123222@users.noreply.github.com> Date: Mon, 31 Mar 2025 17:44:40 -0700 Subject: [PATCH 03/11] Hopefully fix problem Signed-off-by: Spidy123222 <64176728+Spidy123222@users.noreply.github.com> --- AltStore/Operations/InstallAppOperation.swift | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/AltStore/Operations/InstallAppOperation.swift b/AltStore/Operations/InstallAppOperation.swift index 67b36f75..747737bf 100644 --- a/AltStore/Operations/InstallAppOperation.swift +++ b/AltStore/Operations/InstallAppOperation.swift @@ -225,9 +225,9 @@ final class InstallAppOperation: ResultOperation } do { - if let url = URL(string: "shortcuts://run-shortcut?name=TurnOffData") { - UIApplication.shared.open(url, options: [:], completionHandler: nil) - } + let shortcutURL = URL(string: "shortcuts://run-shortcut?name=TurnOffData")! + + UIApplication.shared.open(shortcutURL, options: [:], completionHandler: nil) try install_ipa(installedApp.bundleIdentifier) installing = false installedApp.refreshedDate = Date() From 447f7814b640253546e6950d5b629a0925861bdc Mon Sep 17 00:00:00 2001 From: Spidy123222 <64176728+Spidy123222@users.noreply.github.com> Date: Mon, 31 Mar 2025 18:27:38 -0700 Subject: [PATCH 04/11] remove from install apps Signed-off-by: Spidy123222 <64176728+Spidy123222@users.noreply.github.com> --- AltStore/Operations/InstallAppOperation.swift | 3 --- 1 file changed, 3 deletions(-) diff --git a/AltStore/Operations/InstallAppOperation.swift b/AltStore/Operations/InstallAppOperation.swift index 747737bf..c88ad8d0 100644 --- a/AltStore/Operations/InstallAppOperation.swift +++ b/AltStore/Operations/InstallAppOperation.swift @@ -225,9 +225,6 @@ final class InstallAppOperation: ResultOperation } do { - let shortcutURL = URL(string: "shortcuts://run-shortcut?name=TurnOffData")! - - UIApplication.shared.open(shortcutURL, options: [:], completionHandler: nil) try install_ipa(installedApp.bundleIdentifier) installing = false installedApp.refreshedDate = Date() From 78b3b36047ceff1c21159a53523ea85ee9bfa2fa Mon Sep 17 00:00:00 2001 From: Spidy123222 <64176728+Spidy123222@users.noreply.github.com> Date: Mon, 31 Mar 2025 18:32:52 -0700 Subject: [PATCH 05/11] Add files via upload Signed-off-by: Spidy123222 <64176728+Spidy123222@users.noreply.github.com> --- AltStore/Managing Apps/AppManager.swift | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/AltStore/Managing Apps/AppManager.swift b/AltStore/Managing Apps/AppManager.swift index 3728e8c8..1fcd9309 100644 --- a/AltStore/Managing Apps/AppManager.swift +++ b/AltStore/Managing Apps/AppManager.swift @@ -954,6 +954,11 @@ extension AppManager context.resignedApp = resignedApp let patchAppOperation = PatchAppOperation(context: context) + + let shortcutURLoff = URL(string: "shortcuts://run-shortcut?name=TurnOffData")! + let shortcutURLon = URL(string: "shortcuts://run-shortcut?name=TurnOnData")! + + UIApplication.shared.open(shortcutURLoff, options: [:], completionHandler: nil) let sendAppOperation = SendAppOperation(context: context) let installOperation = InstallAppOperation(context: context) @@ -993,6 +998,7 @@ extension AppManager case .failure(let error): completionHandler(.failure(error)) case .success(let installedApp): completionHandler(.success(installedApp)) } + UIApplication.shared.open(shortcutURLon, options: [:], completionHandler: nil) } installOperation.addDependency(sendAppOperation) From 48d9fcfc28aa2445d1458bf2c50278949ff855d3 Mon Sep 17 00:00:00 2001 From: spidy123222 Date: Mon, 31 Mar 2025 20:44:43 -0700 Subject: [PATCH 06/11] Attempt a million --- AltStore/Managing Apps/AppManager.swift | 5 +++-- AltStore/Operations/Patch App/PatchAppOperation.swift | 5 ++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/AltStore/Managing Apps/AppManager.swift b/AltStore/Managing Apps/AppManager.swift index 1fcd9309..d639d1a9 100644 --- a/AltStore/Managing Apps/AppManager.swift +++ b/AltStore/Managing Apps/AppManager.swift @@ -954,11 +954,12 @@ extension AppManager context.resignedApp = resignedApp let patchAppOperation = PatchAppOperation(context: context) - + /* let shortcutURLoff = URL(string: "shortcuts://run-shortcut?name=TurnOffData")! let shortcutURLon = URL(string: "shortcuts://run-shortcut?name=TurnOnData")! UIApplication.shared.open(shortcutURLoff, options: [:], completionHandler: nil) + */ let sendAppOperation = SendAppOperation(context: context) let installOperation = InstallAppOperation(context: context) @@ -998,7 +999,7 @@ extension AppManager case .failure(let error): completionHandler(.failure(error)) case .success(let installedApp): completionHandler(.success(installedApp)) } - UIApplication.shared.open(shortcutURLon, options: [:], completionHandler: nil) + //UIApplication.shared.open(shortcutURLon, options: [:], completionHandler: nil) } installOperation.addDependency(sendAppOperation) diff --git a/AltStore/Operations/Patch App/PatchAppOperation.swift b/AltStore/Operations/Patch App/PatchAppOperation.swift index 47f835dd..dab0fbad 100644 --- a/AltStore/Operations/Patch App/PatchAppOperation.swift +++ b/AltStore/Operations/Patch App/PatchAppOperation.swift @@ -212,7 +212,10 @@ private extension PatchAppOperation #if targetEnvironment(simulator) throw PatchAppError.unsupportedOperatingSystemVersion(ProcessInfo.processInfo.operatingSystemVersion) #else - + let shortcutURLoff = URL(string: "shortcuts://run-shortcut?name=TurnOffData")! + let shortcutURLon = URL(string: "shortcuts://run-shortcut?name=TurnOnData")! + + UIApplication.shared.open(shortcutURLoff, options: [:], completionHandler: nil) let spotlightPath = "Applications/Spotlight.app/Spotlight" let spotlightFileURL = self.patchDirectory.appendingPathComponent(spotlightPath) From 10019b3edc0756b8a047b05290f322d27eb45e71 Mon Sep 17 00:00:00 2001 From: spidy123222 Date: Mon, 31 Mar 2025 21:09:17 -0700 Subject: [PATCH 07/11] Move attempt to a higher Stage. --- AltStore/Managing Apps/AppManager.swift | 4 +--- AltStore/Operations/Patch App/PatchAppOperation.swift | 4 ---- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/AltStore/Managing Apps/AppManager.swift b/AltStore/Managing Apps/AppManager.swift index d639d1a9..0713937a 100644 --- a/AltStore/Managing Apps/AppManager.swift +++ b/AltStore/Managing Apps/AppManager.swift @@ -953,13 +953,11 @@ extension AppManager let context = Context(bundleIdentifier: originalBundleID, authenticatedContext: authContext) context.resignedApp = resignedApp - let patchAppOperation = PatchAppOperation(context: context) - /* let shortcutURLoff = URL(string: "shortcuts://run-shortcut?name=TurnOffData")! let shortcutURLon = URL(string: "shortcuts://run-shortcut?name=TurnOnData")! UIApplication.shared.open(shortcutURLoff, options: [:], completionHandler: nil) - */ + let patchAppOperation = PatchAppOperation(context: context) let sendAppOperation = SendAppOperation(context: context) let installOperation = InstallAppOperation(context: context) diff --git a/AltStore/Operations/Patch App/PatchAppOperation.swift b/AltStore/Operations/Patch App/PatchAppOperation.swift index dab0fbad..7332d0eb 100644 --- a/AltStore/Operations/Patch App/PatchAppOperation.swift +++ b/AltStore/Operations/Patch App/PatchAppOperation.swift @@ -212,10 +212,6 @@ private extension PatchAppOperation #if targetEnvironment(simulator) throw PatchAppError.unsupportedOperatingSystemVersion(ProcessInfo.processInfo.operatingSystemVersion) #else - let shortcutURLoff = URL(string: "shortcuts://run-shortcut?name=TurnOffData")! - let shortcutURLon = URL(string: "shortcuts://run-shortcut?name=TurnOnData")! - - UIApplication.shared.open(shortcutURLoff, options: [:], completionHandler: nil) let spotlightPath = "Applications/Spotlight.app/Spotlight" let spotlightFileURL = self.patchDirectory.appendingPathComponent(spotlightPath) From 4896ca50a3129be1e01706ef00c03dc3bec24768 Mon Sep 17 00:00:00 2001 From: spidy123222 Date: Mon, 31 Mar 2025 21:34:30 -0700 Subject: [PATCH 08/11] move it behind pendiungunitcount 60 --- AltStore/Managing Apps/AppManager.swift | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/AltStore/Managing Apps/AppManager.swift b/AltStore/Managing Apps/AppManager.swift index 0713937a..f873307a 100644 --- a/AltStore/Managing Apps/AppManager.swift +++ b/AltStore/Managing Apps/AppManager.swift @@ -953,16 +953,16 @@ extension AppManager let context = Context(bundleIdentifier: originalBundleID, authenticatedContext: authContext) context.resignedApp = resignedApp - let shortcutURLoff = URL(string: "shortcuts://run-shortcut?name=TurnOffData")! - let shortcutURLon = URL(string: "shortcuts://run-shortcut?name=TurnOnData")! - - UIApplication.shared.open(shortcutURLoff, options: [:], completionHandler: nil) let patchAppOperation = PatchAppOperation(context: context) let sendAppOperation = SendAppOperation(context: context) let installOperation = InstallAppOperation(context: context) let installationProgress = Progress.discreteProgress(totalUnitCount: 100) installationProgress.addChild(sendAppOperation.progress, withPendingUnitCount: 40) + let shortcutURLoff = URL(string: "shortcuts://run-shortcut?name=TurnOffData")! + let shortcutURLon = URL(string: "shortcuts://run-shortcut?name=TurnOnData")! + + UIApplication.shared.open(shortcutURLoff, options: [:], completionHandler: nil) installationProgress.addChild(installOperation.progress, withPendingUnitCount: 60) /* Patch */ From d6e8c37347ac8111773c8436e7ebb37aa83c31ec Mon Sep 17 00:00:00 2001 From: spidy123222 Date: Mon, 31 Mar 2025 22:36:55 -0700 Subject: [PATCH 09/11] Move to SendAppOperation --- AltStore/Managing Apps/AppManager.swift | 4 ---- AltStore/Operations/SendAppOperation.swift | 6 +++++- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/AltStore/Managing Apps/AppManager.swift b/AltStore/Managing Apps/AppManager.swift index f873307a..7b613e0b 100644 --- a/AltStore/Managing Apps/AppManager.swift +++ b/AltStore/Managing Apps/AppManager.swift @@ -959,10 +959,6 @@ extension AppManager let installationProgress = Progress.discreteProgress(totalUnitCount: 100) installationProgress.addChild(sendAppOperation.progress, withPendingUnitCount: 40) - let shortcutURLoff = URL(string: "shortcuts://run-shortcut?name=TurnOffData")! - let shortcutURLon = URL(string: "shortcuts://run-shortcut?name=TurnOnData")! - - UIApplication.shared.open(shortcutURLoff, options: [:], completionHandler: nil) installationProgress.addChild(installOperation.progress, withPendingUnitCount: 60) /* Patch */ diff --git a/AltStore/Operations/SendAppOperation.swift b/AltStore/Operations/SendAppOperation.swift index 0da089a7..9580a3ca 100644 --- a/AltStore/Operations/SendAppOperation.swift +++ b/AltStore/Operations/SendAppOperation.swift @@ -41,9 +41,13 @@ final class SendAppOperation: ResultOperation<()> } // self.context.resignedApp.fileURL points to the app bundle, but we want the .ipa. + let shortcutURLoff = URL(string: "shortcuts://run-shortcut?name=TurnOffData")! + let shortcutURLon = URL(string: "shortcuts://run-shortcut?name=TurnOnData")! + + UIApplication.shared.open(shortcutURLoff, options: [:], completionHandler: nil) + let app = AnyApp(name: resignedApp.name, bundleIdentifier: self.context.bundleIdentifier, url: resignedApp.fileURL, storeApp: nil) let fileURL = InstalledApp.refreshedIPAURL(for: app) - print("AFC App `fileURL`: \(fileURL.absoluteString)") if let data = NSData(contentsOf: fileURL) { From 6a7d4dd3d23dd0f564028b7d3b3c50302fd111bb Mon Sep 17 00:00:00 2001 From: spidy123222 Date: Tue, 1 Apr 2025 02:20:44 -0700 Subject: [PATCH 10/11] Rewrite SendAppOperation execution to allow to wait for shortcut execution. --- AltStore/Operations/SendAppOperation.swift | 52 ++++++++++++---------- 1 file changed, 29 insertions(+), 23 deletions(-) diff --git a/AltStore/Operations/SendAppOperation.swift b/AltStore/Operations/SendAppOperation.swift index 9580a3ca..28d58a4a 100644 --- a/AltStore/Operations/SendAppOperation.swift +++ b/AltStore/Operations/SendAppOperation.swift @@ -27,43 +27,49 @@ final class SendAppOperation: ResultOperation<()> self.progress.totalUnitCount = 1 } - override func main() - { + override func main() { super.main() - - if let error = self.context.error - { + + if let error = self.context.error { return self.finish(.failure(error)) } - + guard let resignedApp = self.context.resignedApp else { return self.finish(.failure(OperationError.invalidParameters("SendAppOperation.main: self.resignedApp is nil"))) } - - // self.context.resignedApp.fileURL points to the app bundle, but we want the .ipa. + let shortcutURLoff = URL(string: "shortcuts://run-shortcut?name=TurnOffData")! let shortcutURLon = URL(string: "shortcuts://run-shortcut?name=TurnOnData")! - UIApplication.shared.open(shortcutURLoff, options: [:], completionHandler: nil) - let app = AnyApp(name: resignedApp.name, bundleIdentifier: self.context.bundleIdentifier, url: resignedApp.fileURL, storeApp: nil) let fileURL = InstalledApp.refreshedIPAURL(for: app) print("AFC App `fileURL`: \(fileURL.absoluteString)") - - if let data = NSData(contentsOf: fileURL) { - do { - let bytes = Data(data).toRustByteSlice() - try yeet_app_afc(app.bundleIdentifier, bytes.forRust()) - self.progress.completedUnitCount += 1 - self.finish(.success(())) - } catch { - self.finish(.failure(MinimuxerError.RwAfc)) - self.progress.completedUnitCount += 1 - self.finish(.success(())) + + // Wait for Shortcut to Finish Before Proceeding + UIApplication.shared.open(shortcutURLoff, options: [:]) { _ in + print("Shortcut finished execution. Proceeding with file transfer.") + + DispatchQueue.global().async { + self.processFile(at: fileURL, for: app.bundleIdentifier) } - } else { + } + } + + private func processFile(at fileURL: URL, for bundleIdentifier: String) { + guard let data = NSData(contentsOf: fileURL) else { print("IPA doesn't exist????") - self.finish(.failure(OperationError(.appNotFound(name: resignedApp.name)))) + return self.finish(.failure(OperationError(.appNotFound(name: bundleIdentifier)))) + } + + do { + let bytes = Data(data).toRustByteSlice() + try yeet_app_afc(bundleIdentifier, bytes.forRust()) + self.progress.completedUnitCount += 1 + self.finish(.success(())) + } catch { + self.finish(.failure(MinimuxerError.RwAfc)) + self.progress.completedUnitCount += 1 + self.finish(.success(())) } } } From 9167fb74077a68a5f203b11e7ceddbe3b46b10fc Mon Sep 17 00:00:00 2001 From: spidy123222 Date: Thu, 3 Apr 2025 03:32:35 -0700 Subject: [PATCH 11/11] Add Exit Shortcut --- AltStore/Operations/InstallAppOperation.swift | 8 ++++++++ AltStore/Operations/SendAppOperation.swift | 1 - 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/AltStore/Operations/InstallAppOperation.swift b/AltStore/Operations/InstallAppOperation.swift index c88ad8d0..327cb78d 100644 --- a/AltStore/Operations/InstallAppOperation.swift +++ b/AltStore/Operations/InstallAppOperation.swift @@ -13,6 +13,8 @@ import AltSign import Roxas import minimuxer +let shortcutURLonDelay = URL(string: "shortcuts://run-shortcut?name=TurnOnDataDelay")! + @objc(InstallAppOperation) final class InstallAppOperation: ResultOperation { @@ -204,6 +206,10 @@ final class InstallAppOperation: ResultOperation let alert = UIAlertController(title: "Finish Refresh", message: "Please reopen SideStore after the process is finished.To finish refreshing, SideStore must be moved to the background. To do this, you can either go to the Home Screen manually or by hitting Continue. Please reopen SideStore after doing this.", preferredStyle: .alert) alert.addAction(UIAlertAction(title: NSLocalizedString("Continue", comment: ""), style: .default, handler: { _ in print("Going home") + // Cell Shortcut + UIApplication.shared.open(shortcutURLonDelay, options: [:]) { _ in + print("Cell OFF Shortcut finished execution.")} + UIApplication.shared.perform(#selector(NSXPCConnection.suspend)) })) @@ -220,6 +226,8 @@ final class InstallAppOperation: ResultOperation } } } + // Cell Shortcut + UIApplication.shared.open(shortcutURLonDelay, options: [:]) { _ in print("Cell OFF Shortcut finished execution.")} UIApplication.shared.perform(#selector(NSXPCConnection.suspend)) } } diff --git a/AltStore/Operations/SendAppOperation.swift b/AltStore/Operations/SendAppOperation.swift index 28d58a4a..3bc9d7fc 100644 --- a/AltStore/Operations/SendAppOperation.swift +++ b/AltStore/Operations/SendAppOperation.swift @@ -39,7 +39,6 @@ final class SendAppOperation: ResultOperation<()> } let shortcutURLoff = URL(string: "shortcuts://run-shortcut?name=TurnOffData")! - let shortcutURLon = URL(string: "shortcuts://run-shortcut?name=TurnOnData")! let app = AnyApp(name: resignedApp.name, bundleIdentifier: self.context.bundleIdentifier, url: resignedApp.fileURL, storeApp: nil) let fileURL = InstalledApp.refreshedIPAURL(for: app)