From 5e2cc6e20c002929339489764ebdb878b1902c1b Mon Sep 17 00:00:00 2001 From: Joelle Stickney Date: Tue, 28 Mar 2023 01:33:55 -0400 Subject: [PATCH 01/30] Update store check to check for AltServer or SideServer installation --- Shared/Extensions/ALTApplication+AltStoreApp.swift | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Shared/Extensions/ALTApplication+AltStoreApp.swift b/Shared/Extensions/ALTApplication+AltStoreApp.swift index dc983b66d..66c567cc3 100644 --- a/Shared/Extensions/ALTApplication+AltStoreApp.swift +++ b/Shared/Extensions/ALTApplication+AltStoreApp.swift @@ -11,9 +11,10 @@ import AltSign extension ALTApplication { static let altstoreBundleID = Bundle.Info.appbundleIdentifier + static let altstoreBundleIDOriginal = "rileytestut.AltStore" var isAltStoreApp: Bool { - let isAltStoreApp = self.bundleIdentifier.contains(ALTApplication.altstoreBundleID) + let isAltStoreApp = self.bundleIdentifier.contains(ALTApplication.altstoreBundleID) || self.bundleIdentifier.contains(ALTApplication.altstoreBundleIDOriginal) return isAltStoreApp } } From 6d0f4bb3da8385b8e26ce624216b1992df03b9ea Mon Sep 17 00:00:00 2001 From: Joelle Stickney Date: Tue, 28 Mar 2023 23:48:24 -0400 Subject: [PATCH 02/30] Fixes widget refreshing and is more thorough matching store ID --- Shared/Extensions/ALTApplication+AltStoreApp.swift | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Shared/Extensions/ALTApplication+AltStoreApp.swift b/Shared/Extensions/ALTApplication+AltStoreApp.swift index 66c567cc3..9a7ee78f9 100644 --- a/Shared/Extensions/ALTApplication+AltStoreApp.swift +++ b/Shared/Extensions/ALTApplication+AltStoreApp.swift @@ -11,10 +11,12 @@ import AltSign extension ALTApplication { static let altstoreBundleID = Bundle.Info.appbundleIdentifier - static let altstoreBundleIDOriginal = "rileytestut.AltStore" + static let altstoreBundleIDOriginal = "AltStore" + static let storeBundleID = "SideStore" + static let widgetID = "Widget" var isAltStoreApp: Bool { - let isAltStoreApp = self.bundleIdentifier.contains(ALTApplication.altstoreBundleID) || self.bundleIdentifier.contains(ALTApplication.altstoreBundleIDOriginal) + let isAltStoreApp = ( self.bundleIdentifier.contains(ALTApplication.altstoreBundleID) || self.bundleIdentifier.contains(ALTApplication.altstoreBundleIDOriginal) || self.bundleIdentifier.contains(ALTApplication.storeBundleID) ) && !self.bundleIdentifier.contains(ALTApplication.widgetID) return isAltStoreApp } } From 0c171122b28781088f0ea942d4aa6eb5700c1a30 Mon Sep 17 00:00:00 2001 From: naturecodevoid <44983869+naturecodevoid@users.noreply.github.com> Date: Sat, 1 Apr 2023 16:02:12 -0700 Subject: [PATCH 03/30] refactor minimuxer to use swift-bridge (#321) also add team ID to the end of the bundle ID for Debug builds to mirror SideServer --- AltStore.xcodeproj/project.pbxproj | 62 +++++++--- AltStore/LaunchViewController.swift | 32 ++--- .../Operations/DeactivateAppOperation.swift | 9 +- AltStore/Operations/EnableJITOperation.swift | 16 +-- AltStore/Operations/InstallAppOperation.swift | 21 ++-- AltStore/Operations/OperationError.swift | 66 ++++++----- AltStore/Operations/RefreshAppOperation.swift | 11 +- AltStore/Operations/RemoveAppOperation.swift | 10 +- AltStore/Operations/ResignAppOperation.swift | 1 + AltStore/Operations/SendAppOperation.swift | 23 ++-- Build.xcconfig | 9 +- Dependencies/fetch-prebuilt.sh | 26 +++- .../minimuxer.xcodeproj/project.pbxproj | 27 ++++- minimuxer/minimuxer.swift | 111 ------------------ 14 files changed, 172 insertions(+), 252 deletions(-) delete mode 100644 minimuxer/minimuxer.swift diff --git a/AltStore.xcodeproj/project.pbxproj b/AltStore.xcodeproj/project.pbxproj index f1d2c7243..8a12bc506 100644 --- a/AltStore.xcodeproj/project.pbxproj +++ b/AltStore.xcodeproj/project.pbxproj @@ -11,17 +11,18 @@ 19104D952909BAEA00C49C7B /* libimobiledevice.a in Frameworks */ = {isa = PBXBuildFile; fileRef = BF45872B2298D31600BD7491 /* libimobiledevice.a */; }; 19104DB52909C06D00C49C7B /* EmotionalDamage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19104DB42909C06D00C49C7B /* EmotionalDamage.swift */; }; 19104DBC2909C4E500C49C7B /* libEmotionalDamage.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 19104DB22909C06C00C49C7B /* libEmotionalDamage.a */; }; - 191E5FAE290A5D92001A3B7C /* minimuxer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 191E5FAD290A5D92001A3B7C /* minimuxer.swift */; }; 191E5FB4290A5DA0001A3B7C /* libminimuxer.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 191E5FAB290A5D92001A3B7C /* libminimuxer.a */; }; 191E5FDC290AFA5C001A3B7C /* OpenSSL in Frameworks */ = {isa = PBXBuildFile; productRef = 191E5FDB290AFA5C001A3B7C /* OpenSSL */; }; 191E607D290B2EA5001A3B7C /* jsmn.c in Sources */ = {isa = PBXBuildFile; fileRef = 191E5FD0290A651D001A3B7C /* jsmn.c */; }; 191E607E290B2EA7001A3B7C /* jplist.c in Sources */ = {isa = PBXBuildFile; fileRef = 191E5FCF290A651D001A3B7C /* jplist.c */; }; - 191E6087290C7B50001A3B7C /* libminimuxer.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 191E5FB5290A5E1F001A3B7C /* libminimuxer.a */; }; 1920B04F2924AC8300744F60 /* Settings.bundle in Resources */ = {isa = PBXBuildFile; fileRef = 1920B04E2924AC8300744F60 /* Settings.bundle */; }; 19B9B7452845E6DF0076EF69 /* SelectTeamViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19B9B7442845E6DF0076EF69 /* SelectTeamViewController.swift */; }; 4879A95F2861046500FC1BBD /* AltSign in Frameworks */ = {isa = PBXBuildFile; productRef = 4879A95E2861046500FC1BBD /* AltSign */; }; 4879A9622861049C00FC1BBD /* OpenSSL in Frameworks */ = {isa = PBXBuildFile; productRef = 4879A9612861049C00FC1BBD /* OpenSSL */; }; 99C4EF4D2979132100CB538D /* SemanticVersion in Frameworks */ = {isa = PBXBuildFile; productRef = 99C4EF4C2979132100CB538D /* SemanticVersion */; }; + 99F87D0529D8B4E200B40039 /* minimuxer-helpers.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9961EC2D29BE9F2E00AF2C6F /* minimuxer-helpers.swift */; }; + 99F87D1829D8E4C900B40039 /* SwiftBridgeCore.swift in Sources */ = {isa = PBXBuildFile; fileRef = 99F87D1629D8E4C900B40039 /* SwiftBridgeCore.swift */; }; + 99F87D1929D8E4C900B40039 /* minimuxer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 99F87D1729D8E4C900B40039 /* minimuxer.swift */; }; B3146ED2284F581E00BBC3FD /* Roxas.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B3146ECD284F580500BBC3FD /* Roxas.framework */; }; B3146ED3284F581E00BBC3FD /* Roxas.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = B3146ECD284F580500BBC3FD /* Roxas.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; B33FFBA8295F8E98002259E6 /* libfragmentzip.a in Frameworks */ = {isa = PBXBuildFile; fileRef = B343F894295F7F9B002B1159 /* libfragmentzip.a */; }; @@ -504,13 +505,14 @@ 19104DB22909C06C00C49C7B /* libEmotionalDamage.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libEmotionalDamage.a; sourceTree = BUILT_PRODUCTS_DIR; }; 19104DB42909C06D00C49C7B /* EmotionalDamage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EmotionalDamage.swift; sourceTree = ""; }; 191E5FAB290A5D92001A3B7C /* libminimuxer.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libminimuxer.a; sourceTree = BUILT_PRODUCTS_DIR; }; - 191E5FAD290A5D92001A3B7C /* minimuxer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = minimuxer.swift; sourceTree = ""; }; - 191E5FB5290A5E1F001A3B7C /* libminimuxer.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libminimuxer.a; path = "Dependencies/minimuxer/target/aarch64-apple-ios/debug/libminimuxer.a"; sourceTree = ""; }; 191E5FCF290A651D001A3B7C /* jplist.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = jplist.c; path = Dependencies/libplist/src/jplist.c; sourceTree = SOURCE_ROOT; }; 191E5FD0290A651D001A3B7C /* jsmn.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = jsmn.c; path = Dependencies/libplist/src/jsmn.c; sourceTree = SOURCE_ROOT; }; 191E5FD1290A651D001A3B7C /* jsmn.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = jsmn.h; path = Dependencies/libplist/src/jsmn.h; sourceTree = SOURCE_ROOT; }; 1920B04E2924AC8300744F60 /* Settings.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; path = Settings.bundle; sourceTree = ""; }; 19B9B7442845E6DF0076EF69 /* SelectTeamViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SelectTeamViewController.swift; sourceTree = ""; }; + 9961EC2D29BE9F2E00AF2C6F /* minimuxer-helpers.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = "minimuxer-helpers.swift"; path = "Dependencies/minimuxer/minimuxer-helpers.swift"; sourceTree = SOURCE_ROOT; }; + 99F87D1629D8E4C900B40039 /* SwiftBridgeCore.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = SwiftBridgeCore.swift; path = Dependencies/minimuxer/SwiftBridgeCore.swift; sourceTree = SOURCE_ROOT; }; + 99F87D1729D8E4C900B40039 /* minimuxer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = minimuxer.swift; path = Dependencies/minimuxer/minimuxer.swift; sourceTree = SOURCE_ROOT; }; B3146EC6284F580500BBC3FD /* Roxas.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = Roxas.xcodeproj; path = Dependencies/Roxas/Roxas.xcodeproj; sourceTree = ""; }; B33FFBA9295F8F78002259E6 /* preboard.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = preboard.c; path = src/preboard.c; sourceTree = ""; }; B33FFBAB295F8F98002259E6 /* companion_proxy.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = companion_proxy.c; path = src/companion_proxy.c; sourceTree = ""; }; @@ -914,7 +916,6 @@ buildActionMask = 2147483647; files = ( B33FFBA8295F8E98002259E6 /* libfragmentzip.a in Frameworks */, - 191E6087290C7B50001A3B7C /* libminimuxer.a in Frameworks */, 191E5FB4290A5DA0001A3B7C /* libminimuxer.a in Frameworks */, 19104DBC2909C4E500C49C7B /* libEmotionalDamage.a in Frameworks */, 19104D952909BAEA00C49C7B /* libimobiledevice.a in Frameworks */, @@ -945,8 +946,9 @@ 191E5FAC290A5D92001A3B7C /* minimuxer */ = { isa = PBXGroup; children = ( + 9961EC2D29BE9F2E00AF2C6F /* minimuxer-helpers.swift */, + 99F87D1429D8E3F100B40039 /* Generated */, B343F847295F6321002B1159 /* minimuxer.xcodeproj */, - 191E5FAD290A5D92001A3B7C /* minimuxer.swift */, ); path = minimuxer; sourceTree = ""; @@ -968,6 +970,15 @@ path = "libimobiledevice-glue/src"; sourceTree = ""; }; + 99F87D1429D8E3F100B40039 /* Generated */ = { + isa = PBXGroup; + children = ( + 99F87D1629D8E4C900B40039 /* SwiftBridgeCore.swift */, + 99F87D1729D8E4C900B40039 /* minimuxer.swift */, + ); + name = Generated; + sourceTree = ""; + }; B3146EC7284F580500BBC3FD /* Products */ = { isa = PBXGroup; children = ( @@ -1567,7 +1578,6 @@ isa = PBXGroup; children = ( B343F86C295F759E002B1159 /* libresolv.tbd */, - 191E5FB5290A5E1F001A3B7C /* libminimuxer.a */, B39575F4284F29E20080B4FF /* Roxas.framework */, D533E8B62727841800A9B5DD /* libAppleArchive.tbd */, BF580497246A3D19008AE704 /* UIKit.framework */, @@ -1766,13 +1776,6 @@ /* End PBXGroup section */ /* Begin PBXHeadersBuildPhase section */ - 191E5FD4290A6EE0001A3B7C /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; BF4587272298D31600BD7491 /* Headers */ = { isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; @@ -1853,7 +1856,6 @@ isa = PBXNativeTarget; buildConfigurationList = 191E5FAF290A5D92001A3B7C /* Build configuration list for PBXNativeTarget "minimuxer" */; buildPhases = ( - 191E5FD4290A6EE0001A3B7C /* Headers */, 191E5FA7290A5D92001A3B7C /* Sources */, 191E5FA8290A5D92001A3B7C /* Frameworks */, ); @@ -1969,6 +1971,7 @@ isa = PBXNativeTarget; buildConfigurationList = BFD2477E2284B9A700981D42 /* Build configuration list for PBXNativeTarget "SideStore" */; buildPhases = ( + 99F87D0629D8B51400B40039 /* ShellScript */, BFD247662284B9A500981D42 /* Sources */, BFD247672284B9A500981D42 /* Frameworks */, BFD247682284B9A500981D42 /* Resources */, @@ -2220,6 +2223,27 @@ }; /* End PBXResourcesBuildPhase section */ +/* Begin PBXShellScriptBuildPhase section */ + 99F87D0629D8B51400B40039 /* ShellScript */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + ); + outputFileListPaths = ( + ); + outputPaths = ( + "./Dependencies/minimuxer/minimuxer-helpers.swift", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "bash ./Dependencies/fetch-prebuilt.sh minimuxer\n"; + }; +/* End PBXShellScriptBuildPhase section */ + /* Begin PBXSourcesBuildPhase section */ 19104DAE2909C06C00C49C7B /* Sources */ = { isa = PBXSourcesBuildPhase; @@ -2233,7 +2257,8 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 191E5FAE290A5D92001A3B7C /* minimuxer.swift in Sources */, + 99F87D1929D8E4C900B40039 /* minimuxer.swift in Sources */, + 99F87D1829D8E4C900B40039 /* SwiftBridgeCore.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -2484,6 +2509,7 @@ BFB39B5C252BC10E00D1BE50 /* Managed.swift in Sources */, BF770E5822BC3D0F002A40FE /* RefreshGroup.swift in Sources */, 19B9B7452845E6DF0076EF69 /* SelectTeamViewController.swift in Sources */, + 99F87D0529D8B4E200B40039 /* minimuxer-helpers.swift in Sources */, BF18B0F122E25DF9005C4CF5 /* ToastView.swift in Sources */, BF3D649F22E7B24C00E9056B /* CollapsingTextView.swift in Sources */, BF02419622F2199300129732 /* RefreshAttemptsViewController.swift in Sources */, @@ -2673,7 +2699,7 @@ PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; - SWIFT_OBJC_BRIDGING_HEADER = Dependencies/minimuxer/minimuxer.h; + SWIFT_OBJC_BRIDGING_HEADER = "Dependencies/minimuxer/minimuxer-Bridging-Header.h"; SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; }; @@ -2695,7 +2721,7 @@ OTHER_LDFLAGS = "-ObjC"; PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; - SWIFT_OBJC_BRIDGING_HEADER = Dependencies/minimuxer/minimuxer.h; + SWIFT_OBJC_BRIDGING_HEADER = "Dependencies/minimuxer/minimuxer-Bridging-Header.h"; SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; }; diff --git a/AltStore/LaunchViewController.swift b/AltStore/LaunchViewController.swift index 0aaf588ef..cece54c27 100644 --- a/AltStore/LaunchViewController.swift +++ b/AltStore/LaunchViewController.swift @@ -14,6 +14,8 @@ import minimuxer import AltStoreCore import UniformTypeIdentifiers +let pairingFileName = "ALTPairingFile.mobiledevicepairing" + final class LaunchViewController: RSTLaunchViewController, UIDocumentPickerDelegate { private var didFinishLaunching = false @@ -125,14 +127,11 @@ final class LaunchViewController: RSTLaunchViewController, UIDocumentPickerDeleg } // Save to a file for next launch - let filename = "ALTPairingFile.mobiledevicepairing" - let fm = FileManager.default - let documentsPath = fm.documentsDirectory.appendingPathComponent("/\(filename)") - try pairing_string?.write(to: documentsPath, atomically: true, encoding: String.Encoding.utf8) + let pairingFile = FileManager.default.documentsDirectory.appendingPathComponent("\(pairingFileName)") + try pairing_string?.write(to: pairingFile, atomically: true, encoding: String.Encoding.utf8) // Start minimuxer now that we have a file start_minimuxer_threads(pairing_string!) - } catch { displayError("Unable to read pairing file") } @@ -148,22 +147,15 @@ final class LaunchViewController: RSTLaunchViewController, UIDocumentPickerDeleg } func start_minimuxer_threads(_ pairing_file: String) { - set_usbmuxd_socket() - #if false // Retries - var res = start_minimuxer(pairing_file: pairing_file) - var attempts = 10 - while (attempts != 0 && res != 0) { - print("start_minimuxer `res` != 0, retry #\(attempts)") - res = start_minimuxer(pairing_file: pairing_file) - attempts -= 1 - } - #else - let res = start_minimuxer(pairing_file: pairing_file) - #endif - if res != 0 { - displayError("minimuxer failed to start. Incorrect arguments were passed.") + target_minimuxer_address() + let documentsDirectory = FileManager.default.documentsDirectory.absoluteString + do { + try start(pairing_file, documentsDirectory) + } catch { + try! FileManager.default.removeItem(at: FileManager.default.documentsDirectory.appendingPathComponent("\(pairingFileName)")) + displayError("minimuxer failed to start, please restart SideStore. \(minimuxerToOperationError(error).failureReason ?? "UNKNOWN ERROR!!!!!! REPORT TO GITHUB ISSUES!")") } - auto_mount_dev_image() + start_auto_mounter(documentsDirectory) } } diff --git a/AltStore/Operations/DeactivateAppOperation.swift b/AltStore/Operations/DeactivateAppOperation.swift index e96d1feea..5742ec877 100644 --- a/AltStore/Operations/DeactivateAppOperation.swift +++ b/AltStore/Operations/DeactivateAppOperation.swift @@ -44,14 +44,9 @@ final class DeactivateAppOperation: ResultOperation for profile in allIdentifiers { do { - let res = try remove_provisioning_profile(id: profile) - if case Uhoh.Bad(let code) = res { - self.finish(.failure(minimuxer_to_operation(code: code))) - } - } catch Uhoh.Bad(let code) { - self.finish(.failure(minimuxer_to_operation(code: code))) + try remove_provisioning_profile(profile) } catch { - self.finish(.failure(ALTServerError(.unknownResponse))) + return self.finish(.failure(minimuxerToOperationError(error))) } } diff --git a/AltStore/Operations/EnableJITOperation.swift b/AltStore/Operations/EnableJITOperation.swift index f89296bf5..1848109b1 100644 --- a/AltStore/Operations/EnableJITOperation.swift +++ b/AltStore/Operations/EnableJITOperation.swift @@ -45,23 +45,13 @@ final class EnableJITOperation: ResultOperation guard let installedApp = self.context.installedApp else { return self.finish(.failure(OperationError.invalidParameters)) } installedApp.managedObjectContext?.perform { - let v = minimuxer_to_operation(code: 1) - do { - var x = try debug_app(app_id: installedApp.resignedBundleIdentifier) - switch x { - case .Good: - self.finish(.success(())) - case .Bad(let code): - self.finish(.failure(minimuxer_to_operation(code: code))) - } - } catch Uhoh.Bad(let code) { - self.finish(.failure(minimuxer_to_operation(code: code))) + try debug_app(installedApp.resignedBundleIdentifier) } catch { - self.finish(.failure(OperationError.unknown)) + return self.finish(.failure(minimuxerToOperationError(error))) } - + self.finish(.success(())) } } } diff --git a/AltStore/Operations/InstallAppOperation.swift b/AltStore/Operations/InstallAppOperation.swift index f10c12725..c9ef8d508 100644 --- a/AltStore/Operations/InstallAppOperation.swift +++ b/AltStore/Operations/InstallAppOperation.swift @@ -11,6 +11,7 @@ import Network import AltStoreCore import AltSign import Roxas +import minimuxer @objc(InstallAppOperation) final class InstallAppOperation: ResultOperation @@ -148,17 +149,14 @@ final class InstallAppOperation: ResultOperation }) } - let ns_bundle = NSString(string: installedApp.bundleIdentifier) - let ns_bundle_ptr = UnsafeMutablePointer(mutating: ns_bundle.utf8String) - - let res = minimuxer_install_ipa(ns_bundle_ptr) - if res == 0 { - installedApp.refreshedDate = Date() - self.finish(.success(installedApp)) - - } else { - self.finish(.failure(minimuxer_to_operation(code: res))) + do { + try install_ipa(installedApp.bundleIdentifier) + } catch { + return self.finish(.failure(minimuxerToOperationError(error))) } + + installedApp.refreshedDate = Date() + self.finish(.success(installedApp)) } } @@ -174,10 +172,11 @@ final class InstallAppOperation: ResultOperation do { try FileManager.default.removeItem(at: fileURL) + print("Removed refreshed IPA") } catch { - print("Failed to remove refreshed .ipa:", error) + print("Failed to remove refreshed .ipa: \(error)") } } diff --git a/AltStore/Operations/OperationError.swift b/AltStore/Operations/OperationError.swift index 331db175c..4e7a86b2a 100644 --- a/AltStore/Operations/OperationError.swift +++ b/AltStore/Operations/OperationError.swift @@ -8,6 +8,7 @@ import Foundation import AltSign +import minimuxer enum OperationError: LocalizedError { @@ -42,9 +43,11 @@ enum OperationError: LocalizedError case uninstall case lookupApps case detach + case attach case functionArguments - case profileInstall + case profileManage case noConnection + case invalidPairingFile var failureReason: String? { switch self { @@ -70,9 +73,11 @@ enum OperationError: LocalizedError case .uninstall: return NSLocalizedString("Unable to uninstall the app", comment: "") case .lookupApps: return NSLocalizedString("Unable to fetch apps from the device", comment: "") case .detach: return NSLocalizedString("Unable to detach from the app's process", comment: "") + case .attach: return NSLocalizedString("Unable to attach to the app's process", comment: "") case .functionArguments: return NSLocalizedString("A function was passed invalid arguments", comment: "") - case .profileInstall: return NSLocalizedString("Unable to manage profiles on the device", comment: "") + case .profileManage: return NSLocalizedString("Unable to manage profiles on the device", comment: "") case .noConnection: return NSLocalizedString("Unable to connect to the device, make sure Wireguard is enabled and you're connected to WiFi", comment: "") + case .invalidPairingFile: return NSLocalizedString("Invalid pairing file. Your pairing file either didn't have a UDID, or it wasn't a valid plist. Please use jitterbugpair to generate it", comment: "") } } @@ -118,49 +123,50 @@ enum OperationError: LocalizedError } } -func minimuxer_to_operation(code: Int32) -> OperationError { - switch code { - case 1: +/// crashes if error is not a MinimuxerError +func minimuxerToOperationError(_ error: Error) -> OperationError { + switch error as! MinimuxerError { + case .NoDevice: return OperationError.noDevice - case 2: + case .NoConnection: + return OperationError.noConnection + case .PairingFile: + return OperationError.invalidPairingFile + case .CreateDebug: return OperationError.createService(name: "debug") - case 3: + case .CreateInstproxy: return OperationError.createService(name: "instproxy") - case 4: + case .LookupApps: return OperationError.getFromDevice(name: "installed apps") - case 5: + case .FindApp: return OperationError.getFromDevice(name: "path to the app") - case 6: + case .BundlePath: return OperationError.getFromDevice(name: "bundle path") - case 7: + case .MaxPacket: return OperationError.setArgument(name: "max packet") - case 8: + case .WorkingDirectory: return OperationError.setArgument(name: "working directory") - case 9: + case .Argv: return OperationError.setArgument(name: "argv") - case 10: + case .LaunchSuccess: return OperationError.getFromDevice(name: "launch success") - case 11: + case .Detach: return OperationError.detach - case 12: - return OperationError.functionArguments - case 13: + case .Attach: + return OperationError.attach + case .CreateAfc: return OperationError.createService(name: "AFC") - case 14: + case .RwAfc: return OperationError.afc - case 15: + case .InstallApp: return OperationError.install - case 16: + case .UninstallApp: return OperationError.uninstall - case 17: + case .CreateMisagent: return OperationError.createService(name: "misagent") - case 18: - return OperationError.profileInstall - case 19: - return OperationError.profileInstall - case 20: - return OperationError.noConnection - default: - return OperationError.unknown + case .ProfileInstall: + return OperationError.profileManage + case .ProfileRemove: + return OperationError.profileManage } } diff --git a/AltStore/Operations/RefreshAppOperation.swift b/AltStore/Operations/RefreshAppOperation.swift index 084e281cd..7747d2373 100644 --- a/AltStore/Operations/RefreshAppOperation.swift +++ b/AltStore/Operations/RefreshAppOperation.swift @@ -49,15 +49,12 @@ final class RefreshAppOperation: ResultOperation for p in profiles { do { - let x = try install_provisioning_profile(plist: p.value.data) - if case .Bad(let code) = x { - self.finish(.failure(minimuxer_to_operation(code: code))) - } - } catch Uhoh.Bad(let code) { - self.finish(.failure(minimuxer_to_operation(code: code))) + let bytes = p.value.data.toRustByteSlice() + try install_provisioning_profile(bytes.forRust()) } catch { - self.finish(.failure(OperationError.unknown)) + return self.finish(.failure(minimuxerToOperationError(error))) } + self.progress.completedUnitCount += 1 let predicate = NSPredicate(format: "%K == %@", #keyPath(InstalledApp.bundleIdentifier), app.bundleIdentifier) diff --git a/AltStore/Operations/RemoveAppOperation.swift b/AltStore/Operations/RemoveAppOperation.swift index 6ec3cba46..042828ecd 100644 --- a/AltStore/Operations/RemoveAppOperation.swift +++ b/AltStore/Operations/RemoveAppOperation.swift @@ -39,15 +39,11 @@ final class RemoveAppOperation: ResultOperation let resignedBundleIdentifier = installedApp.resignedBundleIdentifier do { - let res = try remove_app(app_id: resignedBundleIdentifier) - if case Uhoh.Bad(let code) = res { - self.finish(.failure(minimuxer_to_operation(code: code))) - } - } catch Uhoh.Bad(let code) { - self.finish(.failure(minimuxer_to_operation(code: code))) + try remove_app(resignedBundleIdentifier) } catch { - self.finish(.failure(ALTServerError(.appDeletionFailed))) + return self.finish(.failure(minimuxerToOperationError(error))) } + DatabaseManager.shared.persistentContainer.performBackgroundTask { (context) in self.progress.completedUnitCount += 1 diff --git a/AltStore/Operations/ResignAppOperation.swift b/AltStore/Operations/ResignAppOperation.swift index 8be28221f..a6098e004 100644 --- a/AltStore/Operations/ResignAppOperation.swift +++ b/AltStore/Operations/ResignAppOperation.swift @@ -61,6 +61,7 @@ final class ResignAppOperation: ResultOperation { let destinationURL = InstalledApp.refreshedIPAURL(for: app) try FileManager.default.copyItem(at: resignedURL, to: destinationURL, shouldReplace: true) + print("Successfully resigned app to \(destinationURL.absoluteString)") // Use appBundleURL since we need an app bundle, not .ipa. guard let resignedApplication = ALTApplication(fileURL: appBundleURL) else { throw OperationError.invalidApp } diff --git a/AltStore/Operations/SendAppOperation.swift b/AltStore/Operations/SendAppOperation.swift index fb239ba1b..dd366968b 100644 --- a/AltStore/Operations/SendAppOperation.swift +++ b/AltStore/Operations/SendAppOperation.swift @@ -9,6 +9,7 @@ import Foundation import Network import AltStoreCore +import minimuxer @objc(SendAppOperation) final class SendAppOperation: ResultOperation<()> @@ -44,24 +45,18 @@ final class SendAppOperation: ResultOperation<()> print("AFC App `fileURL`: \(fileURL.absoluteString)") - let ns_bundle = NSString(string: app.bundleIdentifier) - let ns_bundle_ptr = UnsafeMutablePointer(mutating: ns_bundle.utf8String) - if let data = NSData(contentsOf: fileURL) { - let pls = UnsafeMutablePointer.allocate(capacity: data.length) - for (index, data) in data.enumerated() { - pls[index] = data - } - let res = minimuxer_yeet_app_afc(ns_bundle_ptr, pls, UInt(data.length)) - if res == 0 { - print("minimuxer_yeet_app_afc `res` == \(res)") - self.progress.completedUnitCount += 1 - self.finish(.success(())) - } else { - self.finish(.failure(minimuxer_to_operation(code: res))) + do { + let bytes = Data(data).toRustByteSlice() + try yeet_app_afc(app.bundleIdentifier, bytes.forRust()) + } catch { + return self.finish(.failure(minimuxerToOperationError(error))) } + self.progress.completedUnitCount += 1 + self.finish(.success(())) } else { + print("IPA doesn't exist????") self.finish(.failure(ALTServerError(.underlyingError))) } } diff --git a/Build.xcconfig b/Build.xcconfig index 3c049de82..b0686dea0 100644 --- a/Build.xcconfig +++ b/Build.xcconfig @@ -14,11 +14,14 @@ ORG_IDENTIFIER = com.SideStore ORG_PREFIX = $(ORG_IDENTIFIER) PRODUCT_NAME = SideStore -EXTENSION_PREFIX = $(ORG_PREFIX).SideStore //PRODUCT_NAME[configuration=Debug] = Prov Debug PRODUCT_BUNDLE_IDENTIFIER = $(ORG_PREFIX).SideStore -//PRODUCT_BUNDLE_IDENTIFIER[configuration=Debug] = $(ORG_PREFIX).$(PROJECT_NAME:lower)-debug +// add team ID to bundle ID for debug builds since these will most likely be installed via Xcode +// SideStore will expect the team ID to be at the end of the bundle ID, but this doesn't happen when we install via Xcode +// we don't want to do this for release since those builds will most likely be installed via SideServer, which adds the team ID +PRODUCT_BUNDLE_IDENTIFIER[config=Debug] = $(ORG_PREFIX).SideStore.$(DEVELOPMENT_TEAM) -APP_GROUP_IDENTIFIER = $(ORG_PREFIX).SideStore +EXTENSION_PREFIX = $(PRODUCT_BUNDLE_IDENTIFIER) +APP_GROUP_IDENTIFIER = $(PRODUCT_BUNDLE_IDENTIFIER) ICLOUD_CONTAINER_IDENTIFIER = iCloud.$(ORG_PREFIX).$(PROJECT_NAME) diff --git a/Dependencies/fetch-prebuilt.sh b/Dependencies/fetch-prebuilt.sh index 0acbfae32..35760b950 100644 --- a/Dependencies/fetch-prebuilt.sh +++ b/Dependencies/fetch-prebuilt.sh @@ -16,8 +16,8 @@ check_for_update() { LAST_FETCH=`cat .last-prebuilt-fetch-$1 | perl -n -e '/([0-9]*),([^ ]*)$/ && print $1'` LAST_COMMIT=`cat .last-prebuilt-fetch-$1 | perl -n -e '/([0-9]*),([^ ]*)$/ && print $2'` - # fetch if last fetch was over 6 hours ago - if [[ $LAST_FETCH -lt $(expr $(date +%s) - 21600) ]] || [[ "$2" == "force" ]]; then + # fetch if last fetch was over 1 hour ago + if [[ $LAST_FETCH -lt $(expr $(date +%s) - 3600) ]] || [[ "$2" == "force" ]]; then echo "Checking $1 for update" echo LATEST_COMMIT=`curl https://api.github.com/repos/SideStore/$1/releases/latest | perl -n -e '/Commit: https:\\/\\/github\\.com\\/[^\\/]*\\/[^\\/]*\\/commit\\/([^"]*)/ && print $1'` @@ -27,16 +27,30 @@ check_for_update() { if [[ "$LAST_COMMIT" != "$LATEST_COMMIT" ]]; then echo "Found update, downloading binaries" echo - wget -O "$1/lib$1.a" "https://github.com/SideStore/$1/releases/latest/download/lib$1.a" wget -O "$1/lib$1-sim.a" "https://github.com/SideStore/$1/releases/latest/download/lib$1-sim.a" - wget -O "$1/$1.h" "https://github.com/SideStore/$1/releases/latest/download/$1.h" - echo + if [[ "$1" != "minimuxer" ]]; then + wget -O "$1/lib$1.a" "https://github.com/SideStore/$1/releases/latest/download/lib$1.a" + wget -O "$1/$1.h" "https://github.com/SideStore/$1/releases/latest/download/$1.h" + echo + else + wget -O "$1/lib$1-ios.a" "https://github.com/SideStore/$1/releases/latest/download/lib$1-ios.a" + wget -O "$1/generated.zip" "https://github.com/SideStore/$1/releases/latest/download/generated.zip" + echo + echo "Unzipping generated.zip" + cd "$1" + unzip ./generated.zip + mv -v generated/* . + rm generated.zip + rmdir generated/ + cd .. + echo "Done" + fi else echo "Up-to-date" fi echo "$(date +%s),$LATEST_COMMIT" > ".last-prebuilt-fetch-$1" else - echo "It hasn't been 6 hours and force was not specified, skipping update check for $1" + echo "It hasn't been 1 hour and force was not specified, skipping update check for $1" fi } diff --git a/Dependencies/minimuxer.xcodeproj/project.pbxproj b/Dependencies/minimuxer.xcodeproj/project.pbxproj index 062d1729a..0eecb844b 100644 --- a/Dependencies/minimuxer.xcodeproj/project.pbxproj +++ b/Dependencies/minimuxer.xcodeproj/project.pbxproj @@ -7,6 +7,7 @@ objects = { /* Begin PBXBuildFile section */ + 9961EC2829BE9C2000AF2C6F /* SwiftBridgeCore.h in Sources */ = {isa = PBXBuildFile; fileRef = 9961EC2729BE9C1200AF2C6F /* SwiftBridgeCore.h */; }; 9987603329A454B500818586 /* minimuxer.h in Sources */ = {isa = PBXBuildFile; fileRef = 9987603229A454B500818586 /* minimuxer.h */; }; /* End PBXBuildFile section */ @@ -28,12 +29,22 @@ /* End PBXBuildRule section */ /* Begin PBXFileReference section */ + 9961EC2729BE9C1200AF2C6F /* SwiftBridgeCore.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SwiftBridgeCore.h; path = minimuxer/SwiftBridgeCore.h; sourceTree = ""; }; 9987603229A454B500818586 /* minimuxer.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = minimuxer.h; path = minimuxer/minimuxer.h; sourceTree = ""; }; ADDEDBA66A6E1 /* libresolv.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libresolv.tbd; path = usr/lib/libresolv.tbd; sourceTree = SDKROOT; }; CA609C732349C7AAD9FA67C4 /* libminimuxer_static.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libminimuxer_static.a; sourceTree = BUILT_PRODUCTS_DIR; }; /* End PBXFileReference section */ /* Begin PBXGroup section */ + 99F87D1529D8E41100B40039 /* Generated */ = { + isa = PBXGroup; + children = ( + 9961EC2729BE9C1200AF2C6F /* SwiftBridgeCore.h */, + 9987603229A454B500818586 /* minimuxer.h */, + ); + name = Generated; + sourceTree = ""; + }; ADDEDBA66A6E2 /* Required for static linking */ = { isa = PBXGroup; children = ( @@ -61,7 +72,7 @@ CA6012A875F9D65BC3C892A8 = { isa = PBXGroup; children = ( - 9987603229A454B500818586 /* minimuxer.h */, + 99F87D1529D8E41100B40039 /* Generated */, CA6012A875F922869D176AE5 /* Products */, CA6012A875F998AF0B5890DB /* Frameworks */, ); @@ -74,7 +85,7 @@ isa = PBXNativeTarget; buildConfigurationList = CA600589A243A560B9642892 /* Build configuration list for PBXNativeTarget "minimuxer-staticlib" */; buildPhases = ( - 9987603629A4611D00818586 /* ShellScript */, + 9987603629A4611D00818586 /* Run Script */, CA600F638141A560B9642892 /* Sources */, CA6012A875F9AF6EBB7F357C /* Universal Binary lipo */, ); @@ -121,7 +132,7 @@ /* End PBXProject section */ /* Begin PBXShellScriptBuildPhase section */ - 9987603629A4611D00818586 /* ShellScript */ = { + 9987603629A4611D00818586 /* Run Script */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( @@ -130,10 +141,15 @@ ); inputPaths = ( ); + name = "Run Script"; outputFileListPaths = ( ); outputPaths = ( ./minimuxer/minimuxer.h, + ./minimuxer/SwiftBridgeCore.h, + ./minimuxer/minimuxer.swift, + ./minimuxer/SwiftBridgeCore.swift, + "./minimuxer/minimuxer-Bridging-Header.h", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; @@ -166,6 +182,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + 9961EC2829BE9C2000AF2C6F /* SwiftBridgeCore.h in Sources */, 9987603329A454B500818586 /* minimuxer.h in Sources */, ); runOnlyForDeploymentPostprocessing = 0; @@ -182,7 +199,7 @@ INSTALL_MODE_FLAG = ""; INSTALL_OWNER = ""; LIB_FILE_NAME = ""; - "LIB_FILE_NAME[sdk=iphoneos*]" = libminimuxer; + "LIB_FILE_NAME[sdk=iphoneos*]" = "libminimuxer-ios"; "LIB_FILE_NAME[sdk=iphonesimulator*]" = "libminimuxer-sim"; PRODUCT_NAME = minimuxer_static; SKIP_INSTALL = YES; @@ -199,7 +216,7 @@ INSTALL_MODE_FLAG = ""; INSTALL_OWNER = ""; LIB_FILE_NAME = ""; - "LIB_FILE_NAME[sdk=iphoneos*]" = libminimuxer; + "LIB_FILE_NAME[sdk=iphoneos*]" = "libminimuxer-ios"; "LIB_FILE_NAME[sdk=iphonesimulator*]" = "libminimuxer-sim"; PRODUCT_NAME = minimuxer_static; SKIP_INSTALL = YES; diff --git a/minimuxer/minimuxer.swift b/minimuxer/minimuxer.swift deleted file mode 100644 index fb024f632..000000000 --- a/minimuxer/minimuxer.swift +++ /dev/null @@ -1,111 +0,0 @@ -// -// minimuxer.swift -// minimuxer -// -// Created by Jackson Coxson on 10/27/22. -// - -import Foundation - -public enum Uhoh: Error { - case Good - case Bad(code: Int32) -} - -public func start_minimuxer(pairing_file: String) -> Int32 { - let pf = NSString(string: pairing_file) - let pf_pointer = UnsafeMutablePointer(mutating: pf.utf8String) - let u = NSString(string: getDocumentsDirectory().absoluteString) - let u_ptr = UnsafeMutablePointer(mutating: u.utf8String) - return minimuxer_c_start(pf_pointer, u_ptr) -} - -public func set_usbmuxd_socket() { - target_minimuxer_address() -} - -public func debug_app(app_id: String) throws -> Uhoh { - let ai = NSString(string: app_id) - let ai_pointer = UnsafeMutablePointer(mutating: ai.utf8String) - #if false // Retries - var res = minimuxer_debug_app(ai_pointer) - var attempts = 10 - while (attempts != 0 && res != 0) { - print("(JIT) ATTEMPTS: \(attempts)") - res = minimuxer_debug_app(ai_pointer) - attempts -= 1 - } - #else - let res = minimuxer_debug_app(ai_pointer) - #endif - if res != 0 { - throw Uhoh.Bad(code: res) - } - return Uhoh.Good -} - -public func install_provisioning_profile(plist: Data) throws -> Uhoh { - let pls = String(decoding: plist, as: UTF8.self) - print(pls) - print(plist) - #if false // Retries - var res = minimuxer_install_provisioning_profile(x, UInt32(plist.count)) - var attempts = 10 - while (attempts != 0 && res != 0) { - print("(INSTALL) ATTEMPTS: \(attempts)") - res = minimuxer_install_provisioning_profile(x, UInt32(plist.count)) - attempts -= 1 - } - #else - let x = plist.withUnsafeBytes { buf in UnsafeMutableRawPointer(mutating: buf) } - #endif - let res = minimuxer_install_provisioning_profile(x, UInt32(plist.count)) - if res != 0 { - throw Uhoh.Bad(code: res) - } - return Uhoh.Good -} - -public func remove_provisioning_profile(id: String) throws -> Uhoh { - let id_ns = NSString(string: id) - let id_pointer = UnsafeMutablePointer(mutating: id_ns.utf8String) - #if false // Retries - var res = minimuxer_remove_provisioning_profile(id_pointer) - var attempts = 10 - while (attempts != 0 && res != 0) { - print("(REMOVE PROFILE) ATTEMPTS: \(attempts)") - res = minimuxer_remove_provisioning_profile(id_pointer) - attempts -= 1 - } - #else - let res = minimuxer_remove_provisioning_profile(id_pointer) - #endif - if res != 0 { - throw Uhoh.Bad(code: res) - } - return Uhoh.Good -} - -public func remove_app(app_id: String) throws -> Uhoh { - let ai = NSString(string: app_id) - let ai_pointer = UnsafeMutablePointer(mutating: ai.utf8String) - let res = minimuxer_remove_app(ai_pointer) - if res != 0 { - throw Uhoh.Bad(code: res) - } - return Uhoh.Good -} - -public func auto_mount_dev_image() { - let u = NSString(string: getDocumentsDirectory().absoluteString) - let u_ptr = UnsafeMutablePointer(mutating: u.utf8String) - minimuxer_auto_mount(u_ptr) -} - -func getDocumentsDirectory() -> URL { - // find all possible documents directories for this user - let paths = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask) - - // just send back the first one, which ought to be the only one - return paths[0] -} From 40e1225b875922d8d0dfe0e713434e4150a26e03 Mon Sep 17 00:00:00 2001 From: naturecodevoid <44983869+naturecodevoid@users.noreply.github.com> Date: Sat, 1 Apr 2023 16:09:28 -0700 Subject: [PATCH 04/30] Don't reinstall on first SideStore refresh --- AltStore/Managing Apps/AppManager.swift | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/AltStore/Managing Apps/AppManager.swift b/AltStore/Managing Apps/AppManager.swift index 5bf39ed2e..f6fb71ceb 100644 --- a/AltStore/Managing Apps/AppManager.swift +++ b/AltStore/Managing Apps/AppManager.swift @@ -874,7 +874,11 @@ private extension AppManager // Check if backup app is installed in place of real app. let uti = UTTypeCopyDeclaration(app.installedBackupAppUTI as CFString)?.takeRetainedValue() as NSDictionary? - if app.certificateSerialNumber != group.context.certificate?.serialNumber || + // for some reason, `app.certificateSerialNumber != group.context.certificate?.serialNumber` is true on first SideStore refresh + // in most cases, the first refresh gets stuck since it is a full reinstall, and to fix it you must exit to home screen + // which finishes it but removes all app data + // so we want to ensure we don't reinstall for SideStore if it's true (it will still reinstall if needsResign is true) + if (app.certificateSerialNumber != group.context.certificate?.serialNumber && app.bundleIdentifier != StoreApp.altstoreAppID) || uti != nil || app.needsResign { From c3ea4940d7f22da854e36836ca4230c580360e8e Mon Sep 17 00:00:00 2001 From: naturecodevoid <44983869+naturecodevoid@users.noreply.github.com> Date: Mon, 27 Mar 2023 18:36:27 -0700 Subject: [PATCH 05/30] Reduce duplicate consts --- Shared/Extensions/Bundle+AltStore.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Shared/Extensions/Bundle+AltStore.swift b/Shared/Extensions/Bundle+AltStore.swift index cd3eff27d..6754f5c95 100644 --- a/Shared/Extensions/Bundle+AltStore.swift +++ b/Shared/Extensions/Bundle+AltStore.swift @@ -55,7 +55,7 @@ public extension Bundle public extension Bundle { - static var baseAltStoreAppGroupID = "group.com.SideStore.SideStore" + static var baseAltStoreAppGroupID = "group." + Bundle.Info.appbundleIdentifier var appGroups: [String] { return self.infoDictionary?[Bundle.Info.appGroups] as? [String] ?? [] From b8c3060037b7b79b4094aea3f07ae4ad7a46646b Mon Sep 17 00:00:00 2001 From: naturecodevoid <44983869+naturecodevoid@users.noreply.github.com> Date: Mon, 27 Mar 2023 18:36:39 -0700 Subject: [PATCH 06/30] Log provisioning profile application groups --- AltStore/Operations/FetchProvisioningProfilesOperation.swift | 1 + 1 file changed, 1 insertion(+) diff --git a/AltStore/Operations/FetchProvisioningProfilesOperation.swift b/AltStore/Operations/FetchProvisioningProfilesOperation.swift index 182cedec9..74bdeb3bd 100644 --- a/AltStore/Operations/FetchProvisioningProfilesOperation.swift +++ b/AltStore/Operations/FetchProvisioningProfilesOperation.swift @@ -397,6 +397,7 @@ extension FetchProvisioningProfilesOperation applicationGroups.append(Bundle.baseAltStoreAppGroupID) } } + print("Application groups: \(applicationGroups)") // Dispatch onto global queue to prevent appGroupsLock deadlock. DispatchQueue.global().async { From b1ed413c4ff94c18bec04173aa7d3947cb3fd7fb Mon Sep 17 00:00:00 2001 From: naturecodevoid <44983869+naturecodevoid@users.noreply.github.com> Date: Sat, 1 Apr 2023 16:15:04 -0700 Subject: [PATCH 07/30] Revert Joelle's fix --- Shared/Extensions/ALTApplication+AltStoreApp.swift | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/Shared/Extensions/ALTApplication+AltStoreApp.swift b/Shared/Extensions/ALTApplication+AltStoreApp.swift index 9a7ee78f9..dc983b66d 100644 --- a/Shared/Extensions/ALTApplication+AltStoreApp.swift +++ b/Shared/Extensions/ALTApplication+AltStoreApp.swift @@ -11,12 +11,9 @@ import AltSign extension ALTApplication { static let altstoreBundleID = Bundle.Info.appbundleIdentifier - static let altstoreBundleIDOriginal = "AltStore" - static let storeBundleID = "SideStore" - static let widgetID = "Widget" var isAltStoreApp: Bool { - let isAltStoreApp = ( self.bundleIdentifier.contains(ALTApplication.altstoreBundleID) || self.bundleIdentifier.contains(ALTApplication.altstoreBundleIDOriginal) || self.bundleIdentifier.contains(ALTApplication.storeBundleID) ) && !self.bundleIdentifier.contains(ALTApplication.widgetID) + let isAltStoreApp = self.bundleIdentifier.contains(ALTApplication.altstoreBundleID) return isAltStoreApp } } From 2ce639e7508bee0f85ce34cfebb27076d4236939 Mon Sep 17 00:00:00 2001 From: naturecodevoid <44983869+naturecodevoid@users.noreply.github.com> Date: Sat, 1 Apr 2023 20:03:15 -0700 Subject: [PATCH 08/30] Remove app groups that contain AltStore --- .../Operations/FetchProvisioningProfilesOperation.swift | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/AltStore/Operations/FetchProvisioningProfilesOperation.swift b/AltStore/Operations/FetchProvisioningProfilesOperation.swift index 74bdeb3bd..1b2de2f2f 100644 --- a/AltStore/Operations/FetchProvisioningProfilesOperation.swift +++ b/AltStore/Operations/FetchProvisioningProfilesOperation.swift @@ -382,8 +382,17 @@ extension FetchProvisioningProfilesOperation return completionHandler(.success(appID)) } + print("Application groups before app.isAltStoreApp: \(applicationGroups)") if app.isAltStoreApp { + // Remove app groups that contain AltStore since they can be problematic (cause SideStore to expire early) + for (index, group) in applicationGroups.enumerated() { + if group.contains("AltStore") { + print("Removing application group: \(group)") + applicationGroups.remove(at: index) + } + } + // Potentially updating app groups for this specific AltStore. // Find the (unique) AltStore app group, then replace it // with the correct "base" app group ID. From 20cf54bfcdfe926e2308f9f4e3ccd43d92ac4d31 Mon Sep 17 00:00:00 2001 From: naturecodevoid <44983869+naturecodevoid@users.noreply.github.com> Date: Sun, 2 Apr 2023 07:34:48 -0700 Subject: [PATCH 09/30] [skip ci] Rename and move the first application groups log --- AltStore/Operations/FetchProvisioningProfilesOperation.swift | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/AltStore/Operations/FetchProvisioningProfilesOperation.swift b/AltStore/Operations/FetchProvisioningProfilesOperation.swift index 1b2de2f2f..955282f40 100644 --- a/AltStore/Operations/FetchProvisioningProfilesOperation.swift +++ b/AltStore/Operations/FetchProvisioningProfilesOperation.swift @@ -382,9 +382,10 @@ extension FetchProvisioningProfilesOperation return completionHandler(.success(appID)) } - print("Application groups before app.isAltStoreApp: \(applicationGroups)") if app.isAltStoreApp { + print("Application groups before modifying for SideStore: \(applicationGroups)") + // Remove app groups that contain AltStore since they can be problematic (cause SideStore to expire early) for (index, group) in applicationGroups.enumerated() { if group.contains("AltStore") { From 5710cdf19c2fd16c26222b168b178149f811b458 Mon Sep 17 00:00:00 2001 From: naturecodevoid <44983869+naturecodevoid@users.noreply.github.com> Date: Sun, 2 Apr 2023 07:58:38 -0700 Subject: [PATCH 10/30] [skip ci] Fix PR commit suffix --- .github/workflows/pr.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index b91318e5f..9b2211fb8 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -23,7 +23,9 @@ jobs: run: brew install ldid - name: Add PR suffix to version - run: sed -e "/MARKETING_VERSION = .*/s/\$/-pr.${{ github.event.pull_request.number }}+$(git rev-parse --short HEAD)/" -i '' Build.xcconfig + run: sed -e "/MARKETING_VERSION = .*/s/\$/-pr.${{ github.event.pull_request.number }}+$(git rev-parse --short ${COMMIT:-HEAD})/" -i '' Build.xcconfig + env: + COMMIT: ${{ github.event.pull_request.head.sha }} - name: Setup Xcode uses: maxim-lobanov/setup-xcode@v1.4.1 From 9bfda3664748fb00d9e6209700d08cf2678e72af Mon Sep 17 00:00:00 2001 From: naturecodevoid <44983869+naturecodevoid@users.noreply.github.com> Date: Sun, 2 Apr 2023 08:00:11 -0700 Subject: [PATCH 11/30] [skip ci] Log version --- .github/workflows/beta.yml | 11 +++++++---- .github/workflows/nightly.yml | 11 +++++++---- .github/workflows/pr.yml | 7 +++++++ .github/workflows/stable.yml | 11 +++++++---- 4 files changed, 28 insertions(+), 12 deletions(-) diff --git a/.github/workflows/beta.yml b/.github/workflows/beta.yml index 0dec182ab..789f866fc 100644 --- a/.github/workflows/beta.yml +++ b/.github/workflows/beta.yml @@ -27,6 +27,13 @@ jobs: - name: Change version to tag run: sed -e '/MARKETING_VERSION = .*/s/= .*/= ${{ github.ref_name }}/' -i '' Build.xcconfig + - name: Get version + id: version + run: echo "version=$(grep MARKETING_VERSION Build.xcconfig | sed -e "s/MARKETING_VERSION = //g")" >> $GITHUB_OUTPUT + + - name: Echo version + run: echo "${{ steps.version.outputs.version }}" + - name: Setup Xcode uses: maxim-lobanov/setup-xcode@v1.4.1 with: @@ -53,10 +60,6 @@ jobs: name: SideStore-dSYM path: ./*.dSYM/ - - name: Get version - id: version - run: echo "version=$(grep MARKETING_VERSION Build.xcconfig | sed -e "s/MARKETING_VERSION = //g")" >> $GITHUB_OUTPUT - - name: Get current date id: date run: echo "date=$(date -u +'%c')" >> $GITHUB_OUTPUT diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 42555c0f5..c00ce2fb1 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -36,6 +36,13 @@ jobs: - name: Increase nightly build number and set as version run: bash .github/workflows/increase-nightly-build-num.sh + - name: Get version + id: version + run: echo "version=$(grep MARKETING_VERSION Build.xcconfig | sed -e "s/MARKETING_VERSION = //g")" >> $GITHUB_OUTPUT + + - name: Echo version + run: echo "${{ steps.version.outputs.version }}" + - name: Setup Xcode uses: maxim-lobanov/setup-xcode@v1.4.1 with: @@ -62,10 +69,6 @@ jobs: name: SideStore-dSYM path: ./*.dSYM/ - - name: Get version - id: version - run: echo "version=$(grep MARKETING_VERSION Build.xcconfig | sed -e "s/MARKETING_VERSION = //g")" >> $GITHUB_OUTPUT - - name: Get current date id: date run: echo "date=$(date -u +'%c')" >> $GITHUB_OUTPUT diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 9b2211fb8..eccf4b0dc 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -27,6 +27,13 @@ jobs: env: COMMIT: ${{ github.event.pull_request.head.sha }} + - name: Get version + id: version + run: echo "version=$(grep MARKETING_VERSION Build.xcconfig | sed -e "s/MARKETING_VERSION = //g")" >> $GITHUB_OUTPUT + + - name: Echo version + run: echo "${{ steps.version.outputs.version }}" + - name: Setup Xcode uses: maxim-lobanov/setup-xcode@v1.4.1 with: diff --git a/.github/workflows/stable.yml b/.github/workflows/stable.yml index 7db5cd49c..a0d1aeeaf 100644 --- a/.github/workflows/stable.yml +++ b/.github/workflows/stable.yml @@ -27,6 +27,13 @@ jobs: - name: Change version to tag run: sed -e '/MARKETING_VERSION = .*/s/= .*/= ${{ github.ref_name }}/' -i '' Build.xcconfig + - name: Get version + id: version + run: echo "version=$(grep MARKETING_VERSION Build.xcconfig | sed -e "s/MARKETING_VERSION = //g")" >> $GITHUB_OUTPUT + + - name: Echo version + run: echo "${{ steps.version.outputs.version }}" + - name: Setup Xcode uses: maxim-lobanov/setup-xcode@v1.4.1 with: @@ -53,10 +60,6 @@ jobs: name: SideStore-dSYM path: ./*.dSYM/ - - name: Get version - id: version - run: echo "version=$(grep MARKETING_VERSION Build.xcconfig | sed -e "s/MARKETING_VERSION = //g")" >> $GITHUB_OUTPUT - - name: Get current date id: date run: echo "date=$(date -u +'%c')" >> $GITHUB_OUTPUT From 98ccba53a254c9ab768fab0a62c1d293878fae15 Mon Sep 17 00:00:00 2001 From: naturecodevoid <44983869+naturecodevoid@users.noreply.github.com> Date: Sun, 2 Apr 2023 08:01:57 -0700 Subject: [PATCH 12/30] [skip ci] Add version to artifact name we can't do this for releases because some download URLs might rely on it being named SideStore.ipa Build Info will also have version anyways --- .github/workflows/beta.yml | 2 +- .github/workflows/nightly.yml | 2 +- .github/workflows/pr.yml | 2 +- .github/workflows/stable.yml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/beta.yml b/.github/workflows/beta.yml index 789f866fc..1973681b0 100644 --- a/.github/workflows/beta.yml +++ b/.github/workflows/beta.yml @@ -51,7 +51,7 @@ jobs: - name: Upload SideStore.ipa Artifact uses: actions/upload-artifact@v3.1.0 with: - name: SideStore.ipa + name: SideStore-${{ steps.version.outputs.version }}.ipa path: SideStore.ipa - name: Upload *.dSYM Artifact diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index c00ce2fb1..96acefed3 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -60,7 +60,7 @@ jobs: - name: Upload SideStore.ipa Artifact uses: actions/upload-artifact@v3.1.0 with: - name: SideStore.ipa + name: SideStore-${{ steps.version.outputs.version }}.ipa path: SideStore.ipa - name: Upload *.dSYM Artifact diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index eccf4b0dc..7e3df0ebf 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -51,7 +51,7 @@ jobs: - name: Upload SideStore.ipa Artifact uses: actions/upload-artifact@v3.1.0 with: - name: SideStore.ipa + name: SideStore-${{ steps.version.outputs.version }}.ipa path: SideStore.ipa - name: Upload *.dSYM Artifact diff --git a/.github/workflows/stable.yml b/.github/workflows/stable.yml index a0d1aeeaf..06a759aed 100644 --- a/.github/workflows/stable.yml +++ b/.github/workflows/stable.yml @@ -51,7 +51,7 @@ jobs: - name: Upload SideStore.ipa Artifact uses: actions/upload-artifact@v3.1.0 with: - name: SideStore.ipa + name: SideStore-${{ steps.version.outputs.version }}.ipa path: SideStore.ipa - name: Upload *.dSYM Artifact From b2a29ae606c44988393ead4a59c2bd139bc876ae Mon Sep 17 00:00:00 2001 From: naturecodevoid <44983869+naturecodevoid@users.noreply.github.com> Date: Sun, 2 Apr 2023 15:08:48 -0700 Subject: [PATCH 13/30] [skip ci] Include commit SHA in nightly version --- .github/workflows/increase-nightly-build-num.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/increase-nightly-build-num.sh b/.github/workflows/increase-nightly-build-num.sh index 4be78710f..4d152d07b 100644 --- a/.github/workflows/increase-nightly-build-num.sh +++ b/.github/workflows/increase-nightly-build-num.sh @@ -7,7 +7,7 @@ DATE=`date -u +'%Y.%m.%d'` BUILD_NUM=1 write() { - sed -e "/MARKETING_VERSION = .*/s/$/-nightly.$DATE.$BUILD_NUM/" -i '' Build.xcconfig + sed -e "/MARKETING_VERSION = .*/s/$/-nightly.$DATE.$BUILD_NUM+$(git rev-parse --short HEAD)/" -i '' Build.xcconfig echo "$DATE,$BUILD_NUM" > .nightly-build-num } From f5d82d9ef03635af4b281a2c0db3767414b133a5 Mon Sep 17 00:00:00 2001 From: f1shy-dev <56125930+f1shy-dev@users.noreply.github.com> Date: Thu, 6 Apr 2023 20:23:27 +0100 Subject: [PATCH 14/30] Update tempEnt.plist to change AltStore to SideStore Signed-off-by: f1shy-dev <56125930+f1shy-dev@users.noreply.github.com> --- AltStore/Resources/tempEnt.plist | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/AltStore/Resources/tempEnt.plist b/AltStore/Resources/tempEnt.plist index 2ae028031..ccb84c68e 100644 --- a/AltStore/Resources/tempEnt.plist +++ b/AltStore/Resources/tempEnt.plist @@ -12,9 +12,9 @@ A72ZC8AJ5X com.apple.security.application-groups - group.com.SideStore.AltStore + group.com.SideStore.SideStore get-task-allow - \ No newline at end of file + From 6146f1bdaa3720dea2cf856dce46f251f58e149b Mon Sep 17 00:00:00 2001 From: naturecodevoid <44983869+naturecodevoid@users.noreply.github.com> Date: Thu, 6 Apr 2023 12:42:37 -0700 Subject: [PATCH 15/30] Update tempEnt.plist --- AltStore/Resources/tempEnt.plist | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AltStore/Resources/tempEnt.plist b/AltStore/Resources/tempEnt.plist index ccb84c68e..a7b3b7dc2 100644 --- a/AltStore/Resources/tempEnt.plist +++ b/AltStore/Resources/tempEnt.plist @@ -3,7 +3,7 @@ application-identifier - A72ZC8AJ5X.com.SideStore.AltStore + A72ZC8AJ5X.com.SideStore.SideStore aps-environment development com.apple.developer.siri From 40bcef1dcb572498c98991d8adbbb2eae200006c Mon Sep 17 00:00:00 2001 From: naturecodevoid <44983869+naturecodevoid@users.noreply.github.com> Date: Thu, 6 Apr 2023 20:45:18 -0700 Subject: [PATCH 16/30] Use XYZ0123456 team ID for tempEnt.plist Signed-off-by: naturecodevoid <44983869+naturecodevoid@users.noreply.github.com> --- AltStore/Resources/tempEnt.plist | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/AltStore/Resources/tempEnt.plist b/AltStore/Resources/tempEnt.plist index a7b3b7dc2..8b3ff4bd2 100644 --- a/AltStore/Resources/tempEnt.plist +++ b/AltStore/Resources/tempEnt.plist @@ -3,13 +3,13 @@ application-identifier - A72ZC8AJ5X.com.SideStore.SideStore + XYZ0123456.com.SideStore.SideStore aps-environment development com.apple.developer.siri com.apple.developer.team-identifier - A72ZC8AJ5X + XYZ0123456 com.apple.security.application-groups group.com.SideStore.SideStore From b3d827f56a2839ebb09d5222805fb5eb0f3ee44f Mon Sep 17 00:00:00 2001 From: naturecodevoid <44983869+naturecodevoid@users.noreply.github.com> Date: Tue, 11 Apr 2023 21:04:07 -0700 Subject: [PATCH 17/30] refactor: remove minimuxerToOperationError in favor of extending MinimuxerError to be a LocalizedError and remove unused cases from OperationError --- AltStore/LaunchViewController.swift | 2 +- .../Operations/DeactivateAppOperation.swift | 2 +- AltStore/Operations/EnableJITOperation.swift | 2 +- AltStore/Operations/InstallAppOperation.swift | 2 +- AltStore/Operations/OperationError.swift | 135 ++++++++---------- AltStore/Operations/RefreshAppOperation.swift | 2 +- AltStore/Operations/RemoveAppOperation.swift | 2 +- AltStore/Operations/SendAppOperation.swift | 2 +- 8 files changed, 68 insertions(+), 81 deletions(-) diff --git a/AltStore/LaunchViewController.swift b/AltStore/LaunchViewController.swift index cece54c27..9c0abd060 100644 --- a/AltStore/LaunchViewController.swift +++ b/AltStore/LaunchViewController.swift @@ -153,7 +153,7 @@ final class LaunchViewController: RSTLaunchViewController, UIDocumentPickerDeleg try start(pairing_file, documentsDirectory) } catch { try! FileManager.default.removeItem(at: FileManager.default.documentsDirectory.appendingPathComponent("\(pairingFileName)")) - displayError("minimuxer failed to start, please restart SideStore. \(minimuxerToOperationError(error).failureReason ?? "UNKNOWN ERROR!!!!!! REPORT TO GITHUB ISSUES!")") + displayError("minimuxer failed to start, please restart SideStore. \((error as? LocalizedError)?.failureReason ?? "UNKNOWN ERROR!!!!!! REPORT TO GITHUB ISSUES!")") } start_auto_mounter(documentsDirectory) } diff --git a/AltStore/Operations/DeactivateAppOperation.swift b/AltStore/Operations/DeactivateAppOperation.swift index 5742ec877..6feec196a 100644 --- a/AltStore/Operations/DeactivateAppOperation.swift +++ b/AltStore/Operations/DeactivateAppOperation.swift @@ -46,7 +46,7 @@ final class DeactivateAppOperation: ResultOperation do { try remove_provisioning_profile(profile) } catch { - return self.finish(.failure(minimuxerToOperationError(error))) + return self.finish(.failure(error)) } } diff --git a/AltStore/Operations/EnableJITOperation.swift b/AltStore/Operations/EnableJITOperation.swift index 1848109b1..36081af14 100644 --- a/AltStore/Operations/EnableJITOperation.swift +++ b/AltStore/Operations/EnableJITOperation.swift @@ -48,7 +48,7 @@ final class EnableJITOperation: ResultOperation do { try debug_app(installedApp.resignedBundleIdentifier) } catch { - return self.finish(.failure(minimuxerToOperationError(error))) + return self.finish(.failure(error)) } self.finish(.success(())) diff --git a/AltStore/Operations/InstallAppOperation.swift b/AltStore/Operations/InstallAppOperation.swift index c9ef8d508..abe24a858 100644 --- a/AltStore/Operations/InstallAppOperation.swift +++ b/AltStore/Operations/InstallAppOperation.swift @@ -152,7 +152,7 @@ final class InstallAppOperation: ResultOperation do { try install_ipa(installedApp.bundleIdentifier) } catch { - return self.finish(.failure(minimuxerToOperationError(error))) + return self.finish(.failure(error)) } installedApp.refreshedDate = Date() diff --git a/AltStore/Operations/OperationError.swift b/AltStore/Operations/OperationError.swift index 4e7a86b2a..8de1f0ff5 100644 --- a/AltStore/Operations/OperationError.swift +++ b/AltStore/Operations/OperationError.swift @@ -34,21 +34,6 @@ enum OperationError: LocalizedError case openAppFailed(name: String) case missingAppGroup - case noDevice - case createService(name: String) - case getFromDevice(name: String) - case setArgument(name: String) - case afc - case install - case uninstall - case lookupApps - case detach - case attach - case functionArguments - case profileManage - case noConnection - case invalidPairingFile - var failureReason: String? { switch self { case .unknown: return NSLocalizedString("An unknown error occured.", comment: "") @@ -64,20 +49,6 @@ enum OperationError: LocalizedError case .openAppFailed(let name): return String(format: NSLocalizedString("SideStore was denied permission to launch %@.", comment: ""), name) case .missingAppGroup: return NSLocalizedString("SideStore's shared app group could not be found.", comment: "") case .maximumAppIDLimitReached: return NSLocalizedString("Cannot register more than 10 App IDs.", comment: "") - case .noDevice: return NSLocalizedString("Cannot fetch the device from the muxer", comment: "") - case .createService(let name): return String(format: NSLocalizedString("Cannot start a %@ server on the device.", comment: ""), name) - case .getFromDevice(let name): return String(format: NSLocalizedString("Cannot fetch %@ from the device.", comment: ""), name) - case .setArgument(let name): return String(format: NSLocalizedString("Cannot set %@ on the device.", comment: ""), name) - case .afc: return NSLocalizedString("AFC was unable to manage files on the device", comment: "") - case .install: return NSLocalizedString("Unable to install the app from the staging directory", comment: "") - case .uninstall: return NSLocalizedString("Unable to uninstall the app", comment: "") - case .lookupApps: return NSLocalizedString("Unable to fetch apps from the device", comment: "") - case .detach: return NSLocalizedString("Unable to detach from the app's process", comment: "") - case .attach: return NSLocalizedString("Unable to attach to the app's process", comment: "") - case .functionArguments: return NSLocalizedString("A function was passed invalid arguments", comment: "") - case .profileManage: return NSLocalizedString("Unable to manage profiles on the device", comment: "") - case .noConnection: return NSLocalizedString("Unable to connect to the device, make sure Wireguard is enabled and you're connected to WiFi", comment: "") - case .invalidPairingFile: return NSLocalizedString("Invalid pairing file. Your pairing file either didn't have a UDID, or it wasn't a valid plist. Please use jitterbugpair to generate it", comment: "") } } @@ -123,50 +94,66 @@ enum OperationError: LocalizedError } } -/// crashes if error is not a MinimuxerError -func minimuxerToOperationError(_ error: Error) -> OperationError { - switch error as! MinimuxerError { - case .NoDevice: - return OperationError.noDevice - case .NoConnection: - return OperationError.noConnection - case .PairingFile: - return OperationError.invalidPairingFile - case .CreateDebug: - return OperationError.createService(name: "debug") - case .CreateInstproxy: - return OperationError.createService(name: "instproxy") - case .LookupApps: - return OperationError.getFromDevice(name: "installed apps") - case .FindApp: - return OperationError.getFromDevice(name: "path to the app") - case .BundlePath: - return OperationError.getFromDevice(name: "bundle path") - case .MaxPacket: - return OperationError.setArgument(name: "max packet") - case .WorkingDirectory: - return OperationError.setArgument(name: "working directory") - case .Argv: - return OperationError.setArgument(name: "argv") - case .LaunchSuccess: - return OperationError.getFromDevice(name: "launch success") - case .Detach: - return OperationError.detach - case .Attach: - return OperationError.attach - case .CreateAfc: - return OperationError.createService(name: "AFC") - case .RwAfc: - return OperationError.afc - case .InstallApp: - return OperationError.install - case .UninstallApp: - return OperationError.uninstall - case .CreateMisagent: - return OperationError.createService(name: "misagent") - case .ProfileInstall: - return OperationError.profileManage - case .ProfileRemove: - return OperationError.profileManage +extension MinimuxerError: LocalizedError { + public var failureReason: String? { + switch self { + case .NoDevice: + return NSLocalizedString("Cannot fetch the device from the muxer", comment: "") + case .NoConnection: + return NSLocalizedString("Unable to connect to the device, make sure Wireguard is enabled and you're connected to WiFi", comment: "") + case .PairingFile: + return NSLocalizedString("Invalid pairing file. Your pairing file either didn't have a UDID, or it wasn't a valid plist. Please use jitterbugpair to generate it", comment: "") + + case .CreateDebug: + return self.createService(name: "debug") + case .LookupApps: + return self.getFromDevice(name: "installed apps") + case .FindApp: + return self.getFromDevice(name: "path to the app") + case .BundlePath: + return self.getFromDevice(name: "bundle path") + case .MaxPacket: + return self.setArgument(name: "max packet") + case .WorkingDirectory: + return self.setArgument(name: "working directory") + case .Argv: + return self.setArgument(name: "argv") + case .LaunchSuccess: + return self.getFromDevice(name: "launch success") + case .Detach: + return NSLocalizedString("Unable to detach from the app's process", comment: "") + case .Attach: + return NSLocalizedString("Unable to attach to the app's process", comment: "") + + case .CreateInstproxy: + return self.createService(name: "instproxy") + case .CreateAfc: + return self.createService(name: "AFC") + case .RwAfc: + return NSLocalizedString("AFC was unable to manage files on the device", comment: "") + case .InstallApp: + return NSLocalizedString("Unable to install the app from the staging directory", comment: "") + case .UninstallApp: + return NSLocalizedString("Unable to uninstall the app", comment: "") + + case .CreateMisagent: + return self.createService(name: "misagent") + case .ProfileInstall: + return NSLocalizedString("Unable to manage profiles on the device", comment: "") + case .ProfileRemove: + return NSLocalizedString("Unable to manage profiles on the device", comment: "") + } + } + + fileprivate func createService(name: String) -> String { + return String(format: NSLocalizedString("Cannot start a %@ server on the device.", comment: ""), name) + } + + fileprivate func getFromDevice(name: String) -> String { + return String(format: NSLocalizedString("Cannot fetch %@ from the device.", comment: ""), name) + } + + fileprivate func setArgument(name: String) -> String { + return String(format: NSLocalizedString("Cannot set %@ on the device.", comment: ""), name) } } diff --git a/AltStore/Operations/RefreshAppOperation.swift b/AltStore/Operations/RefreshAppOperation.swift index 7747d2373..edf6a9e5a 100644 --- a/AltStore/Operations/RefreshAppOperation.swift +++ b/AltStore/Operations/RefreshAppOperation.swift @@ -52,7 +52,7 @@ final class RefreshAppOperation: ResultOperation let bytes = p.value.data.toRustByteSlice() try install_provisioning_profile(bytes.forRust()) } catch { - return self.finish(.failure(minimuxerToOperationError(error))) + return self.finish(.failure(error)) } self.progress.completedUnitCount += 1 diff --git a/AltStore/Operations/RemoveAppOperation.swift b/AltStore/Operations/RemoveAppOperation.swift index 042828ecd..46400cfad 100644 --- a/AltStore/Operations/RemoveAppOperation.swift +++ b/AltStore/Operations/RemoveAppOperation.swift @@ -41,7 +41,7 @@ final class RemoveAppOperation: ResultOperation do { try remove_app(resignedBundleIdentifier) } catch { - return self.finish(.failure(minimuxerToOperationError(error))) + return self.finish(.failure(error)) } DatabaseManager.shared.persistentContainer.performBackgroundTask { (context) in diff --git a/AltStore/Operations/SendAppOperation.swift b/AltStore/Operations/SendAppOperation.swift index dd366968b..afa5e57f9 100644 --- a/AltStore/Operations/SendAppOperation.swift +++ b/AltStore/Operations/SendAppOperation.swift @@ -50,7 +50,7 @@ final class SendAppOperation: ResultOperation<()> let bytes = Data(data).toRustByteSlice() try yeet_app_afc(app.bundleIdentifier, bytes.forRust()) } catch { - return self.finish(.failure(minimuxerToOperationError(error))) + return self.finish(.failure(error)) } self.progress.completedUnitCount += 1 From d79b166a6a80dd99e36b001a983dcff4ecd06ef5 Mon Sep 17 00:00:00 2001 From: naturecodevoid <44983869+naturecodevoid@users.noreply.github.com> Date: Tue, 11 Apr 2023 21:05:53 -0700 Subject: [PATCH 18/30] chore: Remove old apps.json/app.json files --- AltStore.xcodeproj/project.pbxproj | 2 - AltStore/Resources/apps.json | 269 ----------------------------- app.json | 79 --------- 3 files changed, 350 deletions(-) delete mode 100644 AltStore/Resources/apps.json delete mode 100644 app.json diff --git a/AltStore.xcodeproj/project.pbxproj b/AltStore.xcodeproj/project.pbxproj index 8a12bc506..96c93b3d0 100644 --- a/AltStore.xcodeproj/project.pbxproj +++ b/AltStore.xcodeproj/project.pbxproj @@ -729,7 +729,6 @@ BF9ABA4A22DD137F008935CF /* NavigationBar.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NavigationBar.swift; sourceTree = ""; }; BF9ABA4C22DD16DE008935CF /* PillButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PillButton.swift; sourceTree = ""; }; BFA8172A23C5633D001B5953 /* FetchAnisetteDataOperation.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FetchAnisetteDataOperation.swift; sourceTree = ""; }; - BFB1169C22932DB100BB457C /* apps.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = apps.json; sourceTree = ""; }; BFB39B5B252BC10E00D1BE50 /* Managed.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Managed.swift; sourceTree = ""; }; BFB4323E22DE852000B7F8BC /* UpdateCollectionViewCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = UpdateCollectionViewCell.xib; sourceTree = ""; }; BFB6B21D231870160022A802 /* NewsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NewsViewController.swift; sourceTree = ""; }; @@ -1619,7 +1618,6 @@ isa = PBXGroup; children = ( BF44EEF2246B3A17002A52F2 /* AltBackup.ipa */, - BFB1169C22932DB100BB457C /* apps.json */, BFD247762284B9A700981D42 /* Assets.xcassets */, BF770E6822BD57DD002A40FE /* Silence.m4a */, ); diff --git a/AltStore/Resources/apps.json b/AltStore/Resources/apps.json deleted file mode 100644 index c7a3bad20..000000000 --- a/AltStore/Resources/apps.json +++ /dev/null @@ -1,269 +0,0 @@ -{ - "name": "AltStore", - "identifier": "com.rileytestut.AltStore", - "sourceURL": "https://cdn.altstore.io/file/altstore/apps.json", - "apps": [ - { - "name": "AltStore", - "bundleIdentifier": "com.rileytestut.AltStore", - "developerName": "Riley Testut", - "version": "1.5.1", - "versionDate": "2022-07-14T12:00:00-05:00", - "versionDescription": "This update fixes the following issues:\n\n• Using Apple IDs that contain capital letters\n• Using Apple IDs with 2FA enabled without any trusted devices\n• Repeatedly asking some users to sign in every refresh\n• \"Incorrect Apple ID or password\" error after changing Apple ID email address\n• “Application is missing application-identifier” error when sideloading or (de-)activating certain apps\n• Potential crash when receiving unknown error codes from AltServer", - "downloadURL": "https://cdn.altstore.io/file/altstore/apps/altstore/1_5_1.ipa", - "localizedDescription": "AltStore is an alternative app store for non-jailbroken devices. \n\nThis version of AltStore allows you to install Delta, an all-in-one emulator for iOS, as well as sideload other .ipa files from the Files app.", - "iconURL": "https://user-images.githubusercontent.com/705880/65270980-1eb96f80-dad1-11e9-9367-78ccd25ceb02.png", - "tintColor": "018084", - "size": 5465976, - "screenshotURLs": [ - "https://user-images.githubusercontent.com/705880/78942028-acf54300-7a6d-11ea-821c-5bb7a9b3e73a.PNG", - "https://user-images.githubusercontent.com/705880/78942222-0fe6da00-7a6e-11ea-9f2a-dda16157583c.PNG", - "https://user-images.githubusercontent.com/705880/65605577-332cba80-df5e-11e9-9f00-b369ce974f71.PNG" - ], - "permissions": [ - { - "type": "background-fetch", - "usageDescription": "AltStore periodically refreshes apps in the background to prevent them from expiring." - }, - { - "type": "background-audio", - "usageDescription": "Allows AltStore to run longer than 30 seconds when refreshing apps in background." - } - ] - }, - { - "name": "AltStore", - "bundleIdentifier": "com.rileytestut.AltStore.Beta", - "developerName": "Riley Testut", - "subtitle": "An alternative App Store for iOS.", - "version": "1.6b2", - "versionDate": "2022-09-21T13:00:00-05:00", - "versionDescription": "• Fixed “error migrating persistent store” issue on launch\n\nPREVIOUS VERSION\n\nLock Screen Widget (iOS 16+)\n• Counts down days until AltStore expires\n• Comes in 2 different styles: “icon” and “text”\n\nError Log\n• View past errors in more detail\n• Tap an error to copy the error message or error code\n• Search for error code directly in AltStore FAQ", - "downloadURL": "https://cdn.altstore.io/file/altstore/apps/altstore/1_6_b2.ipa", - "localizedDescription": "AltStore is an alternative app store for non-jailbroken devices. \n\nThis beta release of AltStore adds support for 3rd party sources, allowing you to download apps from other developers directly through AltStore.", - "iconURL": "https://user-images.githubusercontent.com/705880/65270980-1eb96f80-dad1-11e9-9367-78ccd25ceb02.png", - "tintColor": "018084", - "size": 5465933, - "beta": true, - "screenshotURLs": [ - "https://user-images.githubusercontent.com/705880/78942028-acf54300-7a6d-11ea-821c-5bb7a9b3e73a.PNG", - "https://user-images.githubusercontent.com/705880/78942222-0fe6da00-7a6e-11ea-9f2a-dda16157583c.PNG", - "https://user-images.githubusercontent.com/705880/65605577-332cba80-df5e-11e9-9f00-b369ce974f71.PNG" - ], - "permissions": [ - { - "type": "background-fetch", - "usageDescription": "AltStore periodically refreshes apps in the background to prevent them from expiring." - }, - { - "type": "background-audio", - "usageDescription": "Allows AltStore to run longer than 30 seconds when refreshing apps in background." - } - ] - }, - { - "name": "Delta", - "bundleIdentifier": "com.rileytestut.Delta", - "developerName": "Riley Testut", - "subtitle": "Classic games in your pocket.", - "version": "1.3.1", - "versionDate": "2021-12-02T13:30:00-08:00", - "versionDescription": "• Fixes game artwork not loading\n• Fixes using deprecated DeSmuME core over melonDS core for some users", - "downloadURL": "https://cdn.altstore.io/file/altstore/apps/delta/1_3_1.ipa", - "localizedDescription": "Delta is an all-in-one emulator for iOS. Delta builds upon the strengths of its predecessor, GBA4iOS, while expanding to include support for more game systems such as NES, SNES, and N64.\n\nFEATURES\n\nSupported Game Systems\n• Nintendo Entertainment System\n• Super Nintendo Entertainment System\n• Nintendo 64\n• Game Boy (Color)\n• Game Boy Advance\n• Nintendo DS\n• And plenty more to come!\n\nController Support\n• Supports PS4, PS5, Xbox One S, Xbox Series X, and MFi game controllers.\n• Supports bluetooth (and wired) keyboards, as well as the Apple Smart Keyboard.\n• Completely customize button mappings on a per-system, per-controller basis.\n• Map buttons to special “Quick Save”, “Quick Load,” and “Fast Forward” actions.\n\nSave States\n• Save and load save states for any game from the pause menu.\n• Lock save states to prevent them from being accidentally overwritten.\n• Automatically makes backup save states to ensure you never lose your progress.\n• Support for “Quick Saves,” save states that can be quickly saved/loaded with a single button press (requires external controller).\n\nCheats\n• Supports various types of cheat codes for each supported system:\n• NES: Game Genie\n• SNES: Game Genie, Pro Action Replay\n• N64: GameShark\n• GBC: Game Genie, GameShark\n• GBA: Action Replay, Code Breaker, GameShark\n• DS: Action Replay\n\nDelta Sync\n• Sync your games, game saves, save states, cheats, controller skins, and controller mappings between devices.\n• View version histories of everything you sync and optionally restore them to earlier versions.\n• Supports both Google Drive and Dropbox.\n\nCustom Controller Skins\n• Beautiful built-in controller skins for all systems.\n• Import controller skins made by others, or even make your own to share with the world!\n\nHold Button\n• Choose buttons for Delta to hold down on your behalf, freeing up your thumbs to press other buttons instead.\n• Perfect for games that typically require one button be held down constantly (ex: run button in Mario games, or the A button in Mario Kart).\n\nFast Forward\n• Speed through slower parts of games by running the game much faster than normal.\n• Easily enable or disable from the pause menu, or optionally with a mapped button on an external controller.\n\n3D/Haptic Touch\n• Use 3D or Haptic Touch to “peek” at games, save states, and cheat codes.\n• App icon shortcuts allow quick access to your most recently played games, or optionally customize the shortcuts to always include certain games.\n\nGame Artwork\n• Automatically displays appropriate box art for imported games.\n• Change a game’s artwork to anything you want, or select from the built-in game artwork database.\n\nMisc.\n• Gyroscope support (WarioWare: Twisted! only)\n• Microphone support (DS only)\n• Support for delta:// URL scheme to jump directly into a specific game.\n\n**Delta and AltStore LLC are in no way affiliated with Nintendo. The name \"Nintendo\" and all associated game console names are registered trademarks of Nintendo Co., Ltd.**", - "iconURL": "https://user-images.githubusercontent.com/705880/63391976-4d311700-c37a-11e9-91a8-4fb0c454413d.png", - "tintColor": "8A28F7", - "size": 19739373, - "permissions": [ - { - "type": "photos", - "usageDescription": "Allows Delta to use images from your Photo Library as game artwork." - } - ], - "screenshotURLs": [ - "https://user-images.githubusercontent.com/705880/65600448-f7d9be00-df54-11e9-9e3e-d4c31296da94.PNG", - "https://user-images.githubusercontent.com/705880/65813009-f2ae8600-e183-11e9-9eb7-704effc11173.png", - "https://user-images.githubusercontent.com/705880/65601117-58b5c600-df56-11e9-9c19-9a5ba5da54cf.PNG", - "https://user-images.githubusercontent.com/705880/65601125-5b182000-df56-11e9-9e7e-261480e893c0.PNG" - ] - }, - { - "name": "Delta", - "bundleIdentifier": "com.rileytestut.Delta.Beta", - "developerName": "Riley Testut", - "subtitle": "Classic games in your pocket.", - "version": "1.4b2", - "versionDate": "2022-08-16T08:00:00-05:00", - "versionDescription": "NEW\n• Supports Split View and Stage Manager multitasking on iPad\n• Automatically pauses + resumes emulation when switching between foreground apps with Stage Manager\n• Optimized full screen-width controller skins when using Split View, Slide Over, or Stage Manager\n• Supports controller skins with new `placement` parameter\n• Supports controller skins with custom screens that don’t have explicit `outputFrame`\n\nFIXED\n• Fixed not detecting keyboard presses when remapping inputs\n• Fixed potential crash rendering game screen after changing EAGLContext\n• Fixed incorrect game screen frame when software keyboard appears on iOS 16\n• Fixed software keyboard sometimes appearing when not emulating anything", - "downloadURL": "https://cdn.altstore.io/file/altstore/apps/delta/1_4_b2.ipa", - "localizedDescription": "The next consoles for Delta are coming: this beta version of Delta brings support for playing Nintendo DS and Sega Genesis games!\n\nPlease report any issues you find to support@altstore.io. Thanks!", - "iconURL": "https://user-images.githubusercontent.com/705880/63391976-4d311700-c37a-11e9-91a8-4fb0c454413d.png", - "tintColor": "8A28F7", - "size": 42968657, - "beta": true, - "permissions": [ - { - "type": "photos", - "usageDescription": "Allows Delta to use images from your Photo Library as game artwork." - } - ], - "screenshotURLs": [ - "https://user-images.githubusercontent.com/705880/65600448-f7d9be00-df54-11e9-9e3e-d4c31296da94.PNG", - "https://user-images.githubusercontent.com/705880/65601942-e5ad4f00-df57-11e9-9255-1463e0296e46.PNG", - "https://user-images.githubusercontent.com/705880/65813009-f2ae8600-e183-11e9-9eb7-704effc11173.png", - "https://user-images.githubusercontent.com/705880/65601117-58b5c600-df56-11e9-9c19-9a5ba5da54cf.PNG" - ] - }, - { - "name": "Clip", - "bundleIdentifier": "com.rileytestut.Clip", - "subtitle": "Manage your clipboard history with ease.", - "developerName": "Riley Testut", - "version": "1.0", - "versionDate": "2020-06-17T12:30:00-07:00", - "versionDescription": "Initial version 🎉", - "downloadURL": "https://f000.backblazeb2.com/file/altstore/apps/clip/1_0.ipa", - "localizedDescription": "Clip is a simple clipboard manager for iOS. \n\nUnlike other clipboard managers, Clip can continue monitoring your clipboard while in the background. No longer do you need to remember to manually open or share to an app to save your clipboard; just copy and paste as you would normally do, and Clip will have your back.\n\nIn addition to background monitoring, Clip also has these features:\n\n• Save text, URLs, and images copied to the clipboard.\n• Copy, delete, or share any clippings saved to Clip.\n• Customizable history limit.\n\nDownload Clip today, and never worry about losing your clipboard again!", - "iconURL": "https://user-images.githubusercontent.com/705880/63391981-5326f800-c37a-11e9-99d8-760fd06bb601.png", - "tintColor": "EC008C", - "size": 445056, - "permissions": [ - { - "type": "background-audio", - "usageDescription": "Allows Clip to continuously monitor your clipboard in the background." - } - ], - "screenshotURLs": [ - "https://user-images.githubusercontent.com/705880/63391950-34286600-c37a-11e9-965f-832efe3da507.png", - "https://user-images.githubusercontent.com/705880/70830209-8e738980-1da4-11ea-8b3b-6e5fbc78adff.png" - ] - }, - { - "name": "Clip", - "bundleIdentifier": "com.rileytestut.Clip.Beta", - "subtitle": "Manage your clipboard history with ease.", - "developerName": "Riley Testut", - "version": "1.1b1", - "versionDate": "2020-06-17T12:30:00-07:00", - "versionDescription": "This update adds a Custom Keyboard app extension for quick access to clippings when editing text.\n\nTo enable the keyboard, go to Settings > General > Keyboard > Keyboards > Add New Keyboard... and add \"ClipBoard\". Once added, make sure to then enable \"Allow Full Access\" for ClipBoard so it can access your clippings.", - "downloadURL": "https://f000.backblazeb2.com/file/altstore/apps/clip/1_1_b1.ipa", - "localizedDescription": "Clip is a simple clipboard manager for iOS. \n\nUnlike other clipboard managers, Clip can continue monitoring your clipboard while in the background. No longer do you need to remember to manually open or share to an app to save your clipboard; just copy and paste as you would normally do, and Clip will have your back.\n\nIn addition to background monitoring, Clip also has these features:\n\n• Save text, URLs, and images copied to the clipboard.\n• Copy, delete, or share any clippings saved to Clip.\n• Customizable history limit.\n\nDownload Clip today, and never worry about losing your clipboard again!", - "iconURL": "https://user-images.githubusercontent.com/705880/63391981-5326f800-c37a-11e9-99d8-760fd06bb601.png", - "tintColor": "EC008C", - "size": 462771, - "beta": true, - "permissions": [ - { - "type": "background-audio", - "usageDescription": "Allows Clip to continuously monitor your clipboard in the background." - } - ], - "screenshotURLs": [ - "https://user-images.githubusercontent.com/705880/63391950-34286600-c37a-11e9-965f-832efe3da507.png", - "https://user-images.githubusercontent.com/705880/70830209-8e738980-1da4-11ea-8b3b-6e5fbc78adff.png", - "https://user-images.githubusercontent.com/705880/84842227-70a80b00-aff9-11ea-8b04-bedb1f49c4a7.PNG", - "https://user-images.githubusercontent.com/705880/84842231-7271ce80-aff9-11ea-9272-e128aeceb95b.PNG" - ] - } - ], - "news": [ - { - "title": "Delta Gaining DS Support", - "identifier": "delta-ds-support", - "caption": "Available this Saturday for patrons, coming soon for everyone else.", - "tintColor": "8A28F7", - "imageURL": "https://user-images.githubusercontent.com/705880/65603159-0676a400-df5a-11e9-882e-dc5566f4d50a.png", - "date": "2019-09-25", - "notify": false - }, - { - "title": "Delta Now Available", - "identifier": "delta-now-available", - "caption": "Finally, relive your favorite NES, SNES, GB(C), GBA, and N64 games.", - "tintColor": "8A28F7", - "imageURL": "https://user-images.githubusercontent.com/705880/65604130-c1ec0800-df5b-11e9-8150-7657c474e3c3.png", - "appID": "com.rileytestut.Delta", - "date": "2019-09-28", - "notify": true - }, - { - "title": "Sideloading is Here!", - "identifier": "sideloading-is-here", - "caption": "Update to AltStore 1.3 to install any app directly from Files.", - "tintColor": "018084", - "imageURL": "https://user-images.githubusercontent.com/705880/79022069-02932380-7b32-11ea-8bad-49907cb97ece.png", - "date": "2020-04-10T13:00:00-07:00", - "notify": true - }, - { - "title": "iOS 13.4 Fixes App Crashes", - "identifier": "ios-13-4-now-available", - "caption": "Update to iOS 13.4 to fix some sideloaded apps crashing on launch.", - "tintColor": "34C759", - "date": "2020-04-10T13:30:00-07:00", - "notify": false - }, - { - "title": "Clip Now Available!", - "identifier": "clip-now-available", - "caption": "Finally, a clipboard manager that can run in the background — no jailbreak required.", - "tintColor": "EC008C", - "imageURL": "https://user-images.githubusercontent.com/705880/65606598-04afdf00-df60-11e9-8f93-af6345d39557.png", - "appID": "com.rileytestut.Clip", - "date": "2020-06-17", - "notify": true - }, - { - "title": "Delta, Meet Nintendo DS", - "identifier": "delta-meet-ds", - "caption": "Update to Delta 1.3 to relive all your favorite Nintendo DS games.", - "tintColor": "8A28F7", - "imageURL": "https://user-images.githubusercontent.com/705880/115617602-6ce2b600-a2a6-11eb-984e-2197a30c71e2.png", - "appID": "com.rileytestut.Delta", - "date": "2021-04-21", - "notify": true - }, - { - "title": "#StandWithUkraine", - "identifier": "support-ukraine", - "caption": "Find out how you can help support those impacted by the Russian invasion.", - "tintColor": "003e80", - "imageURL": "https://user-images.githubusercontent.com/705880/156053447-a158cac7-df5f-4497-8025-15c3c2e10b48.png", - "url": "https://linktr.ee/razomforukraine", - "date": "2022-03-01", - "notify": false - }, - { - "title": "The Biggest AltServer Update Yet!", - "identifier": "altserver-1-5", - "caption": "Update to AltServer 1.5 to use AltJIT and other exciting new features.", - "tintColor": "018084", - "imageURL": "https://user-images.githubusercontent.com/705880/166509576-744be578-6868-4b7d-b4fd-b9418c084327.png", - "url": "https://faq.altstore.io/release-notes/altserver", - "date": "2022-05-03", - "notify": true - }, - { - "title": "More Apps in AltStore!", - "identifier": "trusted-sources", - "caption": "Update to AltStore 1.5 to easily download some of our favorite apps.", - "tintColor": "00CAB3", - "imageURL": "https://user-images.githubusercontent.com/705880/167026375-ddcb004f-7160-405c-b3e3-87a6795d2f43.png", - "url": "https://faq.altstore.io/release-notes/altstore", - "date": "2022-05-05", - "notify": true - }, - { - "title": "New to AltStore?", - "identifier": "updated-faq", - "caption": "Check out our updated guide to learn how to sideload apps!", - "tintColor": "018084", - "url": "https://faq.altstore.io", - "date": "2022-07-28", - "notify": false - } - ], - "userInfo": { - "patreonAccessToken": "uqoDoTxH8dY1ImE8tK76wxrzKk67gjyjBAcK8sD3RLU" - } -} diff --git a/app.json b/app.json deleted file mode 100644 index f0b7dabb4..000000000 --- a/app.json +++ /dev/null @@ -1,79 +0,0 @@ -{ - "name": "SideStore Offical", - "identifier": "com.SideStore.SideStore", - "sourceURL": "https://apps.sidestore.io/", - "apps": [ - { - "name": "SideStore", - "bundleIdentifier": "com.SideStore.SideStore", - "developerName": "SideStore Team", - "version": "0.1.1", - "versionDate": "2022-010-15T12:00:00-05:00", - "versionDescription": "If you see this then please sideload the new version of SideStore via AltServer!", - "downloadURL": "https://github.com/SideStore/SideStore/releases/download/0.1.1/SideStore.ipa", - "localizedDescription": "SideStore is an alternative app store for non-jailbroken devices. \n\nSideStore allows you to sideload other .ipa files and apps from the Files app or via the SideStore Library", - "iconURL": "https://raw.githubusercontent.com/SideStore/apps.json/main/105070799.jpeg", - "tintColor": "8043FF", - "size": 5465976, - "screenshotURLs": [ - "https://user-images.githubusercontent.com/705880/78942028-acf54300-7a6d-11ea-821c-5bb7a9b3e73a.PNG", - "https://user-images.githubusercontent.com/705880/78942222-0fe6da00-7a6e-11ea-9f2a-dda16157583c.PNG", - "https://user-images.githubusercontent.com/705880/65605577-332cba80-df5e-11e9-9f00-b369ce974f71.PNG" - ], - "permissions": [ - { - "type": "background-fetch", - "usageDescription": "SideStore periodically refreshes apps in the background to prevent them from expiring." - }, - { - "type": "background-audio", - "usageDescription": "Allows SideStore to run longer than 30 seconds when refreshing apps in background." - } - ] - } - ], - "news": [ - { - "title": "Rick on the rocks", - "identifier": "rick", - "caption": "never gonna give ya rocks", - "tintColor": "912F8D", - "imageURL": "https://variety.com/wp-content/uploads/2021/07/Rick-Astley-Never-Gonna-Give-You-Up.png?w=681&h=383&crop=1", - "url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ", - "date": "2022-05-06", - "notify": false - }, - { - "title": "Rick waves his arms around", - "identifier": "no", - "caption": "never gonna", - "tintColor": "912F8D", - "imageURL": "https://variety.com/wp-content/uploads/2021/07/Rick-Astley-Never-Gonna-Give-You-Up.png?w=681&h=383&crop=1", - "url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ", - "date": "2022-05-05", - "notify": false - }, - { - "title": "#StandWithUkraine", - "identifier": "support-ukraine", - "caption": "Find out how you can help support those impacted by the Russian invasion.", - "tintColor": "003e80", - "imageURL": "https://user-images.githubusercontent.com/705880/156053447-a158cac7-df5f-4497-8025-15c3c2e10b48.png", - "url": "https://linktr.ee/razomforukraine", - "date": "2022-03-01", - "notify": false - }, - { - "title": "New to SideStore?", - "identifier": "updated-faq", - "caption": "Good luck!", - "tintColor": "8043FF", - "url": "https://faq.sidestore.io", - "date": "2050-07-28", - "notify": false - } - ], - "userInfo": { - "patreonAccessToken": "uqoDoTxH8dY1ImE8tK76wxrzKk67gjyjBAcK8sD3RLU" - } -} From 00f7a684a31e009103ca8b372329edad467af7f6 Mon Sep 17 00:00:00 2001 From: naturecodevoid <44983869+naturecodevoid@users.noreply.github.com> Date: Tue, 11 Apr 2023 21:09:32 -0700 Subject: [PATCH 19/30] [skip ci] chore: rename tempEnt.plist to ReleaseEntitlements.plist to reduce future confusion --- AltStore/Resources/{tempEnt.plist => ReleaseEntitlements.plist} | 0 Makefile | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) rename AltStore/Resources/{tempEnt.plist => ReleaseEntitlements.plist} (100%) diff --git a/AltStore/Resources/tempEnt.plist b/AltStore/Resources/ReleaseEntitlements.plist similarity index 100% rename from AltStore/Resources/tempEnt.plist rename to AltStore/Resources/ReleaseEntitlements.plist diff --git a/Makefile b/Makefile index 503859bf8..3163b86c7 100644 --- a/Makefile +++ b/Makefile @@ -170,7 +170,7 @@ build: fakesign: rm -rf archive.xcarchive/Products/Applications/SideStore.app/Frameworks/AltStoreCore.framework/Frameworks/ - ldid -SAltStore/Resources/tempEnt.plist archive.xcarchive/Products/Applications/SideStore.app/SideStore + ldid -SAltStore/Resources/ReleaseEntitlements.plist archive.xcarchive/Products/Applications/SideStore.app/SideStore ipa: mkdir Payload From 536f775baab49bccb59ffd21b93da3790e7af361 Mon Sep 17 00:00:00 2001 From: naturecodevoid <44983869+naturecodevoid@users.noreply.github.com> Date: Tue, 11 Apr 2023 21:12:01 -0700 Subject: [PATCH 20/30] Revert "Don't reinstall on first SideStore refresh" This reverts commit 40e1225b875922d8d0dfe0e713434e4150a26e03. --- AltStore/Managing Apps/AppManager.swift | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/AltStore/Managing Apps/AppManager.swift b/AltStore/Managing Apps/AppManager.swift index f6fb71ceb..5bf39ed2e 100644 --- a/AltStore/Managing Apps/AppManager.swift +++ b/AltStore/Managing Apps/AppManager.swift @@ -874,11 +874,7 @@ private extension AppManager // Check if backup app is installed in place of real app. let uti = UTTypeCopyDeclaration(app.installedBackupAppUTI as CFString)?.takeRetainedValue() as NSDictionary? - // for some reason, `app.certificateSerialNumber != group.context.certificate?.serialNumber` is true on first SideStore refresh - // in most cases, the first refresh gets stuck since it is a full reinstall, and to fix it you must exit to home screen - // which finishes it but removes all app data - // so we want to ensure we don't reinstall for SideStore if it's true (it will still reinstall if needsResign is true) - if (app.certificateSerialNumber != group.context.certificate?.serialNumber && app.bundleIdentifier != StoreApp.altstoreAppID) || + if app.certificateSerialNumber != group.context.certificate?.serialNumber || uti != nil || app.needsResign { From 3dd0735305e281b6920a120d8ae5574b1a14067a Mon Sep 17 00:00:00 2001 From: naturecodevoid <44983869+naturecodevoid@users.noreply.github.com> Date: Tue, 11 Apr 2023 21:50:15 -0700 Subject: [PATCH 21/30] fix: always reinstall when refreshing ourselves --- AltStore/Managing Apps/AppManager.swift | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/AltStore/Managing Apps/AppManager.swift b/AltStore/Managing Apps/AppManager.swift index 5bf39ed2e..fc28cfba1 100644 --- a/AltStore/Managing Apps/AppManager.swift +++ b/AltStore/Managing Apps/AppManager.swift @@ -876,7 +876,9 @@ private extension AppManager if app.certificateSerialNumber != group.context.certificate?.serialNumber || uti != nil || - app.needsResign + app.needsResign || + // We need to reinstall ourselves on refresh to ensure the new provisioning profile is used + app.bundleIdentifier == StoreApp.altstoreAppID { // Resign app instead of just refreshing profiles because either: // * Refreshing using different certificate From 8a97c409facda05aa676527b8cc2021fa5438ffb Mon Sep 17 00:00:00 2001 From: naturecodevoid <44983869+naturecodevoid@users.noreply.github.com> Date: Wed, 12 Apr 2023 07:46:14 -0700 Subject: [PATCH 22/30] fix: add .AltWidget to app group ID when modifying for SideStore --- .../FetchProvisioningProfilesOperation.swift | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/AltStore/Operations/FetchProvisioningProfilesOperation.swift b/AltStore/Operations/FetchProvisioningProfilesOperation.swift index 955282f40..2782a4675 100644 --- a/AltStore/Operations/FetchProvisioningProfilesOperation.swift +++ b/AltStore/Operations/FetchProvisioningProfilesOperation.swift @@ -394,17 +394,26 @@ extension FetchProvisioningProfilesOperation } } + // Make sure we add .AltWidget for the widget + var altStoreAppGroupID = Bundle.baseAltStoreAppGroupID + for (_, group) in applicationGroups.enumerated() { + if group.contains("AltWidget") { + altStoreAppGroupID += ".AltWidget" + break + } + } + // Potentially updating app groups for this specific AltStore. // Find the (unique) AltStore app group, then replace it // with the correct "base" app group ID. // Otherwise, we may append a duplicate team identifier to the end. if let index = applicationGroups.firstIndex(where: { $0.contains(Bundle.baseAltStoreAppGroupID) }) { - applicationGroups[index] = Bundle.baseAltStoreAppGroupID + applicationGroups[index] = altStoreAppGroupID } else { - applicationGroups.append(Bundle.baseAltStoreAppGroupID) + applicationGroups.append(altStoreAppGroupID) } } print("Application groups: \(applicationGroups)") From 0178c63f6ae3273ce227f147308eb2039de5fd14 Mon Sep 17 00:00:00 2001 From: naturecodevoid <44983869+naturecodevoid@users.noreply.github.com> Date: Wed, 12 Apr 2023 19:53:27 -0700 Subject: [PATCH 23/30] fix: hopefully reduce ApplicationVerificationFailed errors by removing _CodeSignature folders since those may cause a problem --- AltStore/Operations/ResignAppOperation.swift | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/AltStore/Operations/ResignAppOperation.swift b/AltStore/Operations/ResignAppOperation.swift index a6098e004..127602058 100644 --- a/AltStore/Operations/ResignAppOperation.swift +++ b/AltStore/Operations/ResignAppOperation.swift @@ -148,6 +148,14 @@ private extension ResignAppOperation infoDictionary[Bundle.Info.exportedUTIs] = exportedUTIs try (infoDictionary as NSDictionary).write(to: bundle.infoPlistURL) + + // Remove _CodeSignature folder (if it exists) because it will be added when resigning and it may have files that aren't overwritten when resigning + // These files might be the cause of some ApplicationVerificationFailed errors + let codeSignaturePath = bundle.bundleURL.appendingPathComponent("_CodeSignature").absoluteString + if FileManager.default.fileExists(atPath: codeSignaturePath) { + try FileManager.default.removeItem(atPath: codeSignaturePath) + print("Removed _CodeSignature folder at \(codeSignaturePath)") + } } DispatchQueue.global().async { From 1ca3aa3cdb50e73e830411850b843be926755e57 Mon Sep 17 00:00:00 2001 From: naturecodevoid <44983869+naturecodevoid@users.noreply.github.com> Date: Thu, 13 Apr 2023 07:20:36 -0700 Subject: [PATCH 24/30] fix: force close SideStore after 3 seconds if still reinstalling --- AltStore/Operations/InstallAppOperation.swift | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/AltStore/Operations/InstallAppOperation.swift b/AltStore/Operations/InstallAppOperation.swift index abe24a858..41deab1a2 100644 --- a/AltStore/Operations/InstallAppOperation.swift +++ b/AltStore/Operations/InstallAppOperation.swift @@ -149,9 +149,45 @@ final class InstallAppOperation: ResultOperation }) } + // Since reinstalling ourself will hang until we leave the app, force quit after 3 seconds if still installing + var installing = true + if installedApp.storeApp?.bundleIdentifier == Bundle.Info.appbundleIdentifier { + DispatchQueue.main.asyncAfter(deadline: .now() + 3) { + if installing { + print("We are still installing after 3 seconds") + + let alert = UIAlertController(title: "Finish Refresh", message: "To finish refreshing, SideStore must force close itself. Please reopen SideStore after continuing!", preferredStyle: .alert) + alert.addAction(UIAlertAction(title: NSLocalizedString("Continue", comment: ""), style: .default, handler: { _ in + if installing { + print("Closing SideStore since we are still installing") + exit(0) + } else { + print("Not closing SideStore since installing finished") + } + })) + + let keyWindow = UIApplication.shared.windows.filter { $0.isKeyWindow }.first + if var topController = keyWindow?.rootViewController { + while let presentedViewController = topController.presentedViewController { + topController = presentedViewController + } + + topController.present(alert, animated: true) + } else { + print("No key window? Closing SideStore") + exit(0) + } + } else { + print("Installing finished") + } + } + } + do { try install_ipa(installedApp.bundleIdentifier) + installing = false } catch { + installing = false return self.finish(.failure(error)) } From 51ed87086ab6165d3461a86656941edfb80f0983 Mon Sep 17 00:00:00 2001 From: naturecodevoid <44983869+naturecodevoid@users.noreply.github.com> Date: Thu, 13 Apr 2023 07:30:20 -0700 Subject: [PATCH 25/30] [skip ci] ci: fully rename SideStore.ipa, even after extracting the artifact zip --- .github/workflows/beta.yml | 27 +++++++++++++++------------ .github/workflows/nightly.yml | 27 +++++++++++++++------------ .github/workflows/pr.yml | 7 +++++-- .github/workflows/stable.yml | 27 +++++++++++++++------------ 4 files changed, 50 insertions(+), 38 deletions(-) diff --git a/.github/workflows/beta.yml b/.github/workflows/beta.yml index 1973681b0..e5792b550 100644 --- a/.github/workflows/beta.yml +++ b/.github/workflows/beta.yml @@ -48,18 +48,6 @@ jobs: - name: Convert to IPA run: make ipa - - name: Upload SideStore.ipa Artifact - uses: actions/upload-artifact@v3.1.0 - with: - name: SideStore-${{ steps.version.outputs.version }}.ipa - path: SideStore.ipa - - - name: Upload *.dSYM Artifact - uses: actions/upload-artifact@v3.1.0 - with: - name: SideStore-dSYM - path: ./*.dSYM/ - - name: Get current date id: date run: echo "date=$(date -u +'%c')" >> $GITHUB_OUTPUT @@ -91,3 +79,18 @@ jobs: Built at (UTC date): `${{ steps.date_altstore.outputs.date }}` Commit SHA: `${{ github.sha }}` Version: `${{ steps.version.outputs.version }}` + + - name: Add version to IPA file name + run: mv SideStore.ipa SideStore-${{ steps.version.outputs.version }}.ipa + + - name: Upload SideStore.ipa Artifact + uses: actions/upload-artifact@v3.1.0 + with: + name: SideStore-${{ steps.version.outputs.version }}.ipa + path: SideStore-${{ steps.version.outputs.version }}.ipa + + - name: Upload *.dSYM Artifact + uses: actions/upload-artifact@v3.1.0 + with: + name: SideStore-${{ steps.version.outputs.version }}-dSYM + path: ./*.dSYM/ diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 96acefed3..aea20363c 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -57,18 +57,6 @@ jobs: - name: Convert to IPA run: make ipa - - name: Upload SideStore.ipa Artifact - uses: actions/upload-artifact@v3.1.0 - with: - name: SideStore-${{ steps.version.outputs.version }}.ipa - path: SideStore.ipa - - - name: Upload *.dSYM Artifact - uses: actions/upload-artifact@v3.1.0 - with: - name: SideStore-dSYM - path: ./*.dSYM/ - - name: Get current date id: date run: echo "date=$(date -u +'%c')" >> $GITHUB_OUTPUT @@ -99,5 +87,20 @@ jobs: Commit SHA: `${{ github.sha }}` Version: `${{ steps.version.outputs.version }}` + - name: Add version to IPA file name + run: mv SideStore.ipa SideStore-${{ steps.version.outputs.version }}.ipa + + - name: Upload SideStore.ipa Artifact + uses: actions/upload-artifact@v3.1.0 + with: + name: SideStore-${{ steps.version.outputs.version }}.ipa + path: SideStore-${{ steps.version.outputs.version }}.ipa + + - name: Upload *.dSYM Artifact + uses: actions/upload-artifact@v3.1.0 + with: + name: SideStore-${{ steps.version.outputs.version }}-dSYM + path: ./*.dSYM/ + - name: Reset cache for apps.sidestore.io/nightly run: sleep 10 && curl https://apps.sidestore.io/reset-cache/nightly/${{ secrets.SIDESOURCE_KEY }} diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 7e3df0ebf..6befcfbbf 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -48,14 +48,17 @@ jobs: - name: Convert to IPA run: make ipa + - name: Add version to IPA file name + run: mv SideStore.ipa SideStore-${{ steps.version.outputs.version }}.ipa + - name: Upload SideStore.ipa Artifact uses: actions/upload-artifact@v3.1.0 with: name: SideStore-${{ steps.version.outputs.version }}.ipa - path: SideStore.ipa + path: SideStore-${{ steps.version.outputs.version }}.ipa - name: Upload *.dSYM Artifact uses: actions/upload-artifact@v3.1.0 with: - name: SideStore-dSYM + name: SideStore-${{ steps.version.outputs.version }}-dSYM path: ./*.dSYM/ diff --git a/.github/workflows/stable.yml b/.github/workflows/stable.yml index 06a759aed..d1a6d1e53 100644 --- a/.github/workflows/stable.yml +++ b/.github/workflows/stable.yml @@ -48,18 +48,6 @@ jobs: - name: Convert to IPA run: make ipa - - name: Upload SideStore.ipa Artifact - uses: actions/upload-artifact@v3.1.0 - with: - name: SideStore-${{ steps.version.outputs.version }}.ipa - path: SideStore.ipa - - - name: Upload *.dSYM Artifact - uses: actions/upload-artifact@v3.1.0 - with: - name: SideStore-dSYM - path: ./*.dSYM/ - - name: Get current date id: date run: echo "date=$(date -u +'%c')" >> $GITHUB_OUTPUT @@ -88,3 +76,18 @@ jobs: Built at (UTC date): `${{ steps.date_altstore.outputs.date }}` Commit SHA: `${{ github.sha }}` Version: `${{ steps.version.outputs.version }}` + + - name: Add version to IPA file name + run: mv SideStore.ipa SideStore-${{ steps.version.outputs.version }}.ipa + + - name: Upload SideStore.ipa Artifact + uses: actions/upload-artifact@v3.1.0 + with: + name: SideStore-${{ steps.version.outputs.version }}.ipa + path: SideStore-${{ steps.version.outputs.version }}.ipa + + - name: Upload *.dSYM Artifact + uses: actions/upload-artifact@v3.1.0 + with: + name: SideStore-${{ steps.version.outputs.version }}-dSYM + path: ./*.dSYM/ From f519d22d81b837a522add8e654aa8f80d96496b8 Mon Sep 17 00:00:00 2001 From: naturecodevoid <44983869+naturecodevoid@users.noreply.github.com> Date: Thu, 13 Apr 2023 21:21:51 -0700 Subject: [PATCH 26/30] fix: removing _CodeSignature folder before resigning --- AltStore/Operations/ResignAppOperation.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AltStore/Operations/ResignAppOperation.swift b/AltStore/Operations/ResignAppOperation.swift index 127602058..59336d869 100644 --- a/AltStore/Operations/ResignAppOperation.swift +++ b/AltStore/Operations/ResignAppOperation.swift @@ -151,7 +151,7 @@ private extension ResignAppOperation // Remove _CodeSignature folder (if it exists) because it will be added when resigning and it may have files that aren't overwritten when resigning // These files might be the cause of some ApplicationVerificationFailed errors - let codeSignaturePath = bundle.bundleURL.appendingPathComponent("_CodeSignature").absoluteString + let codeSignaturePath = bundle.bundleURL.appendingPathComponent("_CodeSignature").absoluteString.replacingOccurrences(of: "file://", with: "") if FileManager.default.fileExists(atPath: codeSignaturePath) { try FileManager.default.removeItem(atPath: codeSignaturePath) print("Removed _CodeSignature folder at \(codeSignaturePath)") From ee5ddd426481bed99652945755476e138b194b6b Mon Sep 17 00:00:00 2001 From: naturecodevoid <44983869+naturecodevoid@users.noreply.github.com> Date: Sun, 16 Apr 2023 09:29:12 -0700 Subject: [PATCH 27/30] fix: use a notification instead of an alert for force close --- AltStore/Operations/InstallAppOperation.swift | 29 +++++-------------- 1 file changed, 7 insertions(+), 22 deletions(-) diff --git a/AltStore/Operations/InstallAppOperation.swift b/AltStore/Operations/InstallAppOperation.swift index 41deab1a2..12db33263 100644 --- a/AltStore/Operations/InstallAppOperation.swift +++ b/AltStore/Operations/InstallAppOperation.swift @@ -154,29 +154,14 @@ final class InstallAppOperation: ResultOperation if installedApp.storeApp?.bundleIdentifier == Bundle.Info.appbundleIdentifier { DispatchQueue.main.asyncAfter(deadline: .now() + 3) { if installing { - print("We are still installing after 3 seconds") + print("We are still installing after 3 seconds, requesting notification and then closing") - let alert = UIAlertController(title: "Finish Refresh", message: "To finish refreshing, SideStore must force close itself. Please reopen SideStore after continuing!", preferredStyle: .alert) - alert.addAction(UIAlertAction(title: NSLocalizedString("Continue", comment: ""), style: .default, handler: { _ in - if installing { - print("Closing SideStore since we are still installing") - exit(0) - } else { - print("Not closing SideStore since installing finished") - } - })) - - let keyWindow = UIApplication.shared.windows.filter { $0.isKeyWindow }.first - if var topController = keyWindow?.rootViewController { - while let presentedViewController = topController.presentedViewController { - topController = presentedViewController - } - - topController.present(alert, animated: true) - } else { - print("No key window? Closing SideStore") - exit(0) - } + var content = UNMutableNotificationContent() + content.title = "Refreshing..." + content.body = "To finish refreshing, SideStore must force close itself. Please reopen SideStore after it is done refreshing!" + let notification = UNNotificationRequest(identifier: Bundle.Info.appbundleIdentifier + ".FinishRefreshNotification", content: content, trigger: UNTimeIntervalNotificationTrigger(timeInterval: 1, repeats: false)) + UNUserNotificationCenter.current().add(notification) + exit(0) } else { print("Installing finished") } From 07533e0365b04f3d797e2ea0e73287a84969dc96 Mon Sep 17 00:00:00 2001 From: naturecodevoid <44983869+naturecodevoid@users.noreply.github.com> Date: Sun, 16 Apr 2023 10:07:04 -0700 Subject: [PATCH 28/30] fix: ensure minimuxer is started when refreshing in the background --- AltStore/Operations/BackgroundRefreshAppsOperation.swift | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/AltStore/Operations/BackgroundRefreshAppsOperation.swift b/AltStore/Operations/BackgroundRefreshAppsOperation.swift index 0b3aa2090..e38a9a1c1 100644 --- a/AltStore/Operations/BackgroundRefreshAppsOperation.swift +++ b/AltStore/Operations/BackgroundRefreshAppsOperation.swift @@ -11,6 +11,7 @@ import CoreData import AltStoreCore import EmotionalDamage +import minimuxer enum RefreshError: LocalizedError { @@ -97,6 +98,14 @@ final class BackgroundRefreshAppsOperation: ResultOperation<[String: Result Date: Sat, 6 May 2023 19:25:37 -0700 Subject: [PATCH 29/30] fix: open Safari instead of force closing and provide a fallback for users with notifications disabled --- AltStore/Operations/InstallAppOperation.swift | 59 +++++++++++++++---- 1 file changed, 48 insertions(+), 11 deletions(-) diff --git a/AltStore/Operations/InstallAppOperation.swift b/AltStore/Operations/InstallAppOperation.swift index 12db33263..bc8664989 100644 --- a/AltStore/Operations/InstallAppOperation.swift +++ b/AltStore/Operations/InstallAppOperation.swift @@ -149,21 +149,58 @@ final class InstallAppOperation: ResultOperation }) } - // Since reinstalling ourself will hang until we leave the app, force quit after 3 seconds if still installing var installing = true if installedApp.storeApp?.bundleIdentifier == Bundle.Info.appbundleIdentifier { + // Reinstalling ourself will hang until we leave the app, so we need to exit it without force closing DispatchQueue.main.asyncAfter(deadline: .now() + 3) { - if installing { - print("We are still installing after 3 seconds, requesting notification and then closing") - - var content = UNMutableNotificationContent() - content.title = "Refreshing..." - content.body = "To finish refreshing, SideStore must force close itself. Please reopen SideStore after it is done refreshing!" - let notification = UNNotificationRequest(identifier: Bundle.Info.appbundleIdentifier + ".FinishRefreshNotification", content: content, trigger: UNTimeIntervalNotificationTrigger(timeInterval: 1, repeats: false)) - UNUserNotificationCenter.current().add(notification) - exit(0) - } else { + if UIApplication.shared.applicationState != .active { + print("We are not in the foreground, let's not do anything") + return + } + if !installing { print("Installing finished") + return + } + print("We are still installing after 3 seconds") + + UNUserNotificationCenter.current().getNotificationSettings { settings in + switch (settings.authorizationStatus) { + case .authorized, .ephemeral, .provisional: + print("Notifications are enabled") + + let content = UNMutableNotificationContent() + content.title = "Refreshing..." + content.body = "To finish refreshing, SideStore must be moved to the background, which it does by opening Safari. Please reopen SideStore after it is done refreshing!" + let notification = UNNotificationRequest(identifier: Bundle.Info.appbundleIdentifier + ".FinishRefreshNotification", content: content, trigger: UNTimeIntervalNotificationTrigger(timeInterval: 2, repeats: false)) + UNUserNotificationCenter.current().add(notification) + + DispatchQueue.main.async { UIApplication.shared.open(URL(string: "x-web-search://")!) } + + break + default: + print("Notifications are not enabled") + + let alert = UIAlertController(title: "Finish Refresh", message: "To finish refreshing, SideStore must be moved to the background. To do this, you can either go to the Home Screen or open Safari by pressing Continue. Please reopen SideStore after doing this.", preferredStyle: .alert) + alert.addAction(UIAlertAction(title: NSLocalizedString("Continue", comment: ""), style: .default, handler: { _ in + print("Opening Safari") + DispatchQueue.main.async { UIApplication.shared.open(URL(string: "x-web-search://")!) } + })) + + DispatchQueue.main.async { + let keyWindow = UIApplication.shared.windows.filter { $0.isKeyWindow }.first + if var topController = keyWindow?.rootViewController { + while let presentedViewController = topController.presentedViewController { + topController = presentedViewController + } + topController.present(alert, animated: true) + } else { + print("No key window? Let's just open Safari") + UIApplication.shared.open(URL(string: "x-web-search://")!) + } + } + + break + } } } } From dae0daecc042d46741f493bafe0f4f1095fbab3c Mon Sep 17 00:00:00 2001 From: Spidy123222 <64176728+Spidy123222@users.noreply.github.com> Date: Sun, 7 May 2023 00:32:40 -0700 Subject: [PATCH 30/30] Update Build.xcconfig Signed-off-by: Spidy123222 <64176728+Spidy123222@users.noreply.github.com> --- Build.xcconfig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Build.xcconfig b/Build.xcconfig index bbaf09e66..c463c8e83 100644 --- a/Build.xcconfig +++ b/Build.xcconfig @@ -1,8 +1,8 @@ // Configuration settings file format documentation can be found at: // https://help.apple.com/xcode/#/dev745c5c974 -MARKETING_VERSION = 0.3.2-f1shy-mdc-16 -CURRENT_PROJECT_VERSION = 3050 +MARKETING_VERSION = 0.3.2-f1shy-mdc-17 +CURRENT_PROJECT_VERSION = 3090 // Vars to be overwritten by `CodeSigning.xcconfig` if exists DEVELOPMENT_TEAM = S32Z3HMYVQ