2019-05-30 17:10:50 -07:00
//
// 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" ;
2019-06-18 16:37:54 -07:00
NSErrorDomain const AltServerInstallationErrorDomain = @ "com.rileytestut.AltServer.Installation" ;
2019-05-30 17:10:50 -07:00
@ implementation NSError ( ALTServerError )
2019-06-18 16:37:54 -07:00
+ ( void ) load
{
[ NSError setUserInfoValueProviderForDomain : AltServerErrorDomain provider : ^ id _Nullable ( NSError * _Nonnull error , NSErrorUserInfoKey _Nonnull userInfoKey ) {
2019-07-19 16:05:34 -07:00
if ( [ userInfoKey isEqualToString : NSLocalizedDescriptionKey ] )
2019-06-18 16:37:54 -07:00
{
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 :
2019-09-03 21:59:54 -07:00
return NSLocalizedString ( @ "AltServer could not find this device." , @ "" ) ;
2019-06-18 16:37:54 -07:00
case ALTServerErrorDeviceWriteFailed :
2019-09-03 21:59:54 -07:00
return NSLocalizedString ( @ "Failed to write app data to device." , @ "" ) ;
2019-06-18 16:37:54 -07:00
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." , @ "" ) ;
2019-09-13 14:25:26 -07:00
case ALTServerErrorUnsupportediOSVersion :
return NSLocalizedString ( @ "Your device must be running iOS 12.2 or later to install AltStore." , @ "" ) ;
2019-11-18 14:49:17 -08:00
case ALTServerErrorUnknownRequest :
return NSLocalizedString ( @ "AltServer does not support this request." , @ "" ) ;
case ALTServerErrorUnknownResponse :
return NSLocalizedString ( @ "Received an unknown response from AltServer." , @ "" ) ;
case ALTServerErrorInvalidAnisetteData :
return NSLocalizedString ( @ "Invalid anisette data." , @ "" ) ;
case ALTServerErrorPluginNotFound :
2020-02-13 21:41:31 -08:00
return NSLocalizedString ( @ "Could not connect to Mail plug-in. Please make sure Mail is running and that you've enabled the plug-in in Mail's preferences, then try again." , @ "" ) ;
2019-06-18 16:37:54 -07:00
}
}
2019-05-30 17:10:50 -07:00
@ end