mirror of
https://github.com/SideStore/SideStore.git
synced 2026-02-08 22:33:26 +01:00
[AltServer] Ignores incompatible cached developer disks
Fixes issue where AltServer would always use cached developer disk, even if it isn’t compatible with the device’s operating system version.
This commit is contained in:
@@ -17,6 +17,8 @@ extern NSErrorUserInfoKey const ALTUnderlyingErrorCodeErrorKey;
|
||||
extern NSErrorUserInfoKey const ALTProvisioningProfileBundleIDErrorKey;
|
||||
extern NSErrorUserInfoKey const ALTAppNameErrorKey;
|
||||
extern NSErrorUserInfoKey const ALTDeviceNameErrorKey;
|
||||
extern NSErrorUserInfoKey const ALTOperatingSystemNameErrorKey;
|
||||
extern NSErrorUserInfoKey const ALTOperatingSystemVersionErrorKey;
|
||||
|
||||
typedef NS_ERROR_ENUM(AltServerErrorDomain, ALTServerError)
|
||||
{
|
||||
@@ -48,6 +50,7 @@ typedef NS_ERROR_ENUM(AltServerErrorDomain, ALTServerError)
|
||||
ALTServerErrorAppDeletionFailed = 16,
|
||||
|
||||
ALTServerErrorRequestedAppNotRunning = 100,
|
||||
ALTServerErrorIncompatibleDeveloperDisk = 101
|
||||
};
|
||||
|
||||
typedef NS_ERROR_ENUM(AltServerConnectionErrorDomain, ALTServerConnectionError)
|
||||
|
||||
@@ -17,6 +17,8 @@ NSErrorUserInfoKey const ALTUnderlyingErrorCodeErrorKey = @"underlyingErrorCode"
|
||||
NSErrorUserInfoKey const ALTProvisioningProfileBundleIDErrorKey = @"bundleIdentifier";
|
||||
NSErrorUserInfoKey const ALTAppNameErrorKey = @"appName";
|
||||
NSErrorUserInfoKey const ALTDeviceNameErrorKey = @"deviceName";
|
||||
NSErrorUserInfoKey const ALTOperatingSystemNameErrorKey = @"ALTOperatingSystemName";
|
||||
NSErrorUserInfoKey const ALTOperatingSystemVersionErrorKey = @"ALTOperatingSystemVersion";
|
||||
|
||||
@implementation NSError (ALTServerError)
|
||||
|
||||
@@ -131,6 +133,13 @@ NSErrorUserInfoKey const ALTDeviceNameErrorKey = @"deviceName";
|
||||
NSString *deviceName = self.userInfo[ALTDeviceNameErrorKey] ?: NSLocalizedString(@"the device", @"");
|
||||
return [NSString stringWithFormat:NSLocalizedString(@"%@ is not currently running on %@.", ""), appName, deviceName];
|
||||
}
|
||||
|
||||
case ALTServerErrorIncompatibleDeveloperDisk:
|
||||
{
|
||||
NSString *osVersion = [self altserver_osVersion] ?: NSLocalizedString(@"this device's OS version", @"");
|
||||
NSString *failureReason = [NSString stringWithFormat:NSLocalizedString(@"The disk is incompatible with %@.", @""), osVersion];
|
||||
return failureReason;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -180,6 +189,19 @@ NSErrorUserInfoKey const ALTDeviceNameErrorKey = @"deviceName";
|
||||
return localizedDescription;
|
||||
}
|
||||
|
||||
- (nullable NSString *)altserver_osVersion
|
||||
{
|
||||
NSString *osName = self.userInfo[ALTOperatingSystemNameErrorKey];
|
||||
NSString *versionString = self.userInfo[ALTOperatingSystemVersionErrorKey];
|
||||
if (osName == nil || versionString == nil)
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
|
||||
NSString *osVersion = [NSString stringWithFormat:@"%@ %@", osName, versionString];
|
||||
return osVersion;
|
||||
}
|
||||
|
||||
#pragma mark - AltServerConnectionErrorDomain -
|
||||
|
||||
- (nullable NSString *)altserver_connection_localizedDescription
|
||||
|
||||
Reference in New Issue
Block a user