Files
SideStore/AltKit/ServerProtocol.swift
Riley Testut 39c84e623a Prioritizes app refresh order
Tries to refresh apps that are about to expire first, and then always refreshes AltStore itself last, since refreshing AltStore means that the app will quit.
2019-06-21 11:20:29 -07:00

71 lines
1.5 KiB
Swift

//
// ServerProtocol.swift
// AltServer
//
// Created by Riley Testut on 5/24/19.
// Copyright © 2019 Riley Testut. All rights reserved.
//
import Foundation
public let ALTServerServiceType = "_altserver._tcp"
// Can only automatically conform ALTServerError.Code to Codable, not ALTServerError itself
extension ALTServerError.Code: Codable {}
protocol ServerMessage: Codable
{
var version: Int { get }
var identifier: String { get }
}
public struct PrepareAppRequest: ServerMessage
{
public var version = 1
public var identifier = "PrepareApp"
public var udid: String
public var contentSize: Int
public init(udid: String, contentSize: Int)
{
self.udid = udid
self.contentSize = contentSize
}
}
public struct BeginInstallationRequest: ServerMessage
{
public var version = 1
public var identifier = "BeginInstallation"
public init()
{
}
}
public struct ServerResponse: ServerMessage
{
public var version = 1
public var identifier = "ServerResponse"
public var progress: Double
public var error: ALTServerError? {
get {
guard let code = self.errorCode else { return nil }
return ALTServerError(code)
}
set {
self.errorCode = newValue?.code
}
}
private var errorCode: ALTServerError.Code?
public init(progress: Double, error: ALTServerError?)
{
self.progress = progress
self.error = error
}
}