From 6c479bfede93c43ce96c60bb5afa140261e2d306 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 d8783230a776cf53aa513d2c2f25bfa8e1a5ed6e 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 06e38aae008401218cffdc394445d087a9b56f90 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 2d141afbaf29e281067701df8720f0ae070ad507 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 ff28f6fa8fc46d36ec52c515bf0dc09dd7ccebf3 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 4801f6e8f2cae67c50292e8834bbc49a4715a771 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 7ff4b4822354df122f42a60e6d7c90a2f20acd4e 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 1a1aa42e021fdeaa295a02b3fd206aa143f99dc5 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 0fe8d7fed98ab003bf4def16a9f24b89010ae354 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 f7e34cbbe984449d14ef439bc7e809d38372a2bc 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 625389ab96734fccf4ae8519360f151ed54e72ca 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)