|
|
|
|
@@ -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)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|