Improves ALTServerError.maximumFreeAppLimitReached error message

AltServer once again displays the list of installed sideloaded apps in error alert.
This commit is contained in:
Riley Testut
2021-10-04 15:21:57 -07:00
parent eac35ef8f4
commit c6b8f69ef2
3 changed files with 20 additions and 6 deletions

View File

@@ -279,6 +279,13 @@ private extension AppDelegate
var messageComponents = [String]() var messageComponents = [String]()
let separator: String
switch error
{
case ALTServerError.maximumFreeAppLimitReached: separator = "\n\n"
default: separator = " "
}
if let errorFailure = nsError.localizedFailure if let errorFailure = nsError.localizedFailure
{ {
if let failureReason = nsError.localizedFailureReason if let failureReason = nsError.localizedFailureReason
@@ -322,7 +329,7 @@ private extension AppDelegate
messageComponents.append(recoverySuggestion) messageComponents.append(recoverySuggestion)
} }
let informativeText = messageComponents.joined(separator: " ") let informativeText = messageComponents.joined(separator: separator)
alert.informativeText = informativeText alert.informativeText = informativeText
NSRunningApplication.current.activate(options: .activateIgnoringOtherApps) NSRunningApplication.current.activate(options: .activateIgnoringOtherApps)

View File

@@ -1597,15 +1597,18 @@ void ALTDeviceManagerUpdateStatus(plist_t command, plist_t status, void *uuid)
void (^completionHandler)(NSError *) = ALTDeviceManager.sharedManager.installationCompletionHandlers[UUID]; void (^completionHandler)(NSError *) = ALTDeviceManager.sharedManager.installationCompletionHandlers[UUID];
if (completionHandler != nil) if (completionHandler != nil)
{ {
NSString *localizedDescription = @(description ?: "");
if (code != 0 || name != NULL) if (code != 0 || name != NULL)
{ {
NSLog(@"Error installing app. %@ (%@). %@", @(code), @(name ?: ""), @(description ?: "")); NSLog(@"Error installing app. %@ (%@). %@", @(code), @(name ?: ""), localizedDescription);
NSError *error = nil; NSError *error = nil;
if (code == 3892346913) if (code == 3892346913)
{ {
error = [NSError errorWithDomain:AltServerErrorDomain code:ALTServerErrorMaximumFreeAppLimitReached userInfo:nil]; NSDictionary *userInfo = (localizedDescription.length != 0) ? @{NSLocalizedDescriptionKey: localizedDescription} : nil;
error = [NSError errorWithDomain:AltServerErrorDomain code:ALTServerErrorMaximumFreeAppLimitReached userInfo:userInfo];
} }
else else
{ {
@@ -1616,7 +1619,7 @@ void ALTDeviceManagerUpdateStatus(plist_t command, plist_t status, void *uuid)
} }
else else
{ {
NSError *underlyingError = [NSError errorWithDomain:AltServerInstallationErrorDomain code:code userInfo:@{NSLocalizedDescriptionKey: @(description ?: "")}]; NSError *underlyingError = [NSError errorWithDomain:AltServerInstallationErrorDomain code:code userInfo:@{NSLocalizedDescriptionKey: localizedDescription}];
error = [NSError errorWithDomain:AltServerErrorDomain code:ALTServerErrorInstallationFailed userInfo:@{NSUnderlyingErrorKey: underlyingError}]; error = [NSError errorWithDomain:AltServerErrorDomain code:ALTServerErrorInstallationFailed userInfo:@{NSUnderlyingErrorKey: underlyingError}];
} }
} }

View File

@@ -102,7 +102,7 @@ NSErrorUserInfoKey const ALTDeviceNameErrorKey = @"deviceName";
return NSLocalizedString(@"An error occured while installing the app.", @""); return NSLocalizedString(@"An error occured while installing the app.", @"");
case ALTServerErrorMaximumFreeAppLimitReached: case ALTServerErrorMaximumFreeAppLimitReached:
return NSLocalizedString(@"Cannot activate more than 3 apps and app extensions.", @""); return NSLocalizedString(@"Cannot activate more than 3 apps with a non-developer Apple ID.", @"");
case ALTServerErrorUnsupportediOSVersion: case ALTServerErrorUnsupportediOSVersion:
return NSLocalizedString(@"Your device must be running iOS 12.2 or later to install AltStore.", @""); return NSLocalizedString(@"Your device must be running iOS 12.2 or later to install AltStore.", @"");
@@ -146,7 +146,11 @@ NSErrorUserInfoKey const ALTDeviceNameErrorKey = @"deviceName";
return NSLocalizedString(@"Make sure Mail is running and the plug-in is enabled in Mail's preferences.", @""); return NSLocalizedString(@"Make sure Mail is running and the plug-in is enabled in Mail's preferences.", @"");
case ALTServerErrorMaximumFreeAppLimitReached: case ALTServerErrorMaximumFreeAppLimitReached:
return NSLocalizedString(@"Make sure “Offload Unused Apps” is disabled in Settings > iTunes & App Stores, then install or delete all offloaded apps.", @""); #if TARGET_OS_OSX
return NSLocalizedString(@"Please deactivate a sideloaded app with AltStore in order to install another app.\n\nIf you're running iOS 13.5 or later, make sure 'Offload Unused Apps' is disabled in Settings > iTunes & App Stores, then install or delete all offloaded apps to prevent them from erroneously counting towards this limit.", @"");
#else
return NSLocalizedString(@"Please deactivate a sideloaded app in order to install another one.\n\nIf you're running iOS 13.5 or later, make sure “Offload Unused Apps” is disabled in Settings > iTunes & App Stores, then install or delete all offloaded apps.", @"");
#endif
case ALTServerErrorRequestedAppNotRunning: case ALTServerErrorRequestedAppNotRunning:
{ {