mirror of
https://github.com/SideStore/SideStore.git
synced 2026-02-09 06:43:25 +01:00
65 lines
2.2 KiB
Objective-C
65 lines
2.2 KiB
Objective-C
//
|
|
// NSError+ALTServerError.m
|
|
// AltStore
|
|
//
|
|
// Created by Riley Testut on 5/30/19.
|
|
// Copyright © 2019 Riley Testut. All rights reserved.
|
|
//
|
|
|
|
#import "NSError+ALTServerError.h"
|
|
|
|
NSErrorDomain const AltServerErrorDomain = @"com.rileytestut.AltServer";
|
|
NSErrorDomain const AltServerInstallationErrorDomain = @"com.rileytestut.AltServer.Installation";
|
|
|
|
@implementation NSError (ALTServerError)
|
|
|
|
+ (void)load
|
|
{
|
|
[NSError setUserInfoValueProviderForDomain:AltServerErrorDomain provider:^id _Nullable(NSError * _Nonnull error, NSErrorUserInfoKey _Nonnull userInfoKey) {
|
|
if ([userInfoKey isEqualToString:NSLocalizedDescriptionKey])
|
|
{
|
|
return [error alt_localizedDescription];
|
|
}
|
|
|
|
return nil;
|
|
}];
|
|
}
|
|
|
|
- (nullable NSString *)alt_localizedDescription
|
|
{
|
|
switch ((ALTServerError)self.code)
|
|
{
|
|
case ALTServerErrorUnknown:
|
|
return NSLocalizedString(@"An unknown error occured.", @"");
|
|
|
|
case ALTServerErrorConnectionFailed:
|
|
return NSLocalizedString(@"Could not connect to AltServer.", @"");
|
|
|
|
case ALTServerErrorLostConnection:
|
|
return NSLocalizedString(@"Lost connection to AltServer.", @"");
|
|
|
|
case ALTServerErrorDeviceNotFound:
|
|
return NSLocalizedString(@"AltServer could not locate this device.", @"");
|
|
|
|
case ALTServerErrorDeviceWriteFailed:
|
|
return NSLocalizedString(@"Failed to write app data to phone.", @"");
|
|
|
|
case ALTServerErrorInvalidRequest:
|
|
return NSLocalizedString(@"AltServer received an invalid request.", @"");
|
|
|
|
case ALTServerErrorInvalidResponse:
|
|
return NSLocalizedString(@"AltServer sent an invalid response.", @"");
|
|
|
|
case ALTServerErrorInvalidApp:
|
|
return NSLocalizedString(@"The app is invalid.", @"");
|
|
|
|
case ALTServerErrorInstallationFailed:
|
|
return NSLocalizedString(@"An error occured while installing the app.", @"");
|
|
|
|
case ALTServerErrorMaximumFreeAppLimitReached:
|
|
return NSLocalizedString(@"You have reached the limit of 3 apps per device.", @"");
|
|
}
|
|
}
|
|
|
|
@end
|