Prioritizes AltServer that originally installed AltStore over others

This commit is contained in:
Riley Testut
2019-09-03 23:47:47 -07:00
parent d03f963d9b
commit 0c1f469dfa
6 changed files with 90 additions and 9 deletions

View File

@@ -44,8 +44,20 @@ enum ConnectionError: LocalizedError
struct Server: Equatable
{
var identifier: String
var service: NetService
var isPreferred = false
init?(service: NetService, txtData: Data)
{
let txtDictionary = NetService.dictionary(fromTXTRecord: txtData)
guard let identifierData = txtDictionary["serverID"], let identifier = String(data: identifierData, encoding: .utf8) else { return nil }
self.identifier = identifier
self.service = service
}
func send<T: Encodable>(_ payload: T, via connection: NWConnection, prependSize: Bool = true, completionHandler: @escaping (Result<Void, Error>) -> Void)
{
do