source-code

This commit is contained in:
Thunder7yoshi
2020-06-09 23:38:02 +02:00
parent 3e3f9ab752
commit 06a8d21b98
346 changed files with 26230 additions and 0 deletions

View File

@@ -0,0 +1,59 @@
//
// RefreshAttempt.swift
// AltStore
//
// Created by Riley Testut on 7/31/19.
// Copyright © 2019 Riley Testut. All rights reserved.
//
import CoreData
@objc(RefreshAttempt)
class RefreshAttempt: NSManagedObject, Fetchable
{
@NSManaged var identifier: String
@NSManaged var date: Date
@NSManaged var isSuccess: Bool
@NSManaged var errorDescription: String?
private override init(entity: NSEntityDescription, insertInto context: NSManagedObjectContext?)
{
super.init(entity: entity, insertInto: context)
}
init(identifier: String, result: Result<[String: Result<InstalledApp, Error>], Error>, context: NSManagedObjectContext)
{
super.init(entity: RefreshAttempt.entity(), insertInto: context)
self.identifier = identifier
self.date = Date()
do
{
let results = try result.get()
for (_, result) in results
{
guard case let .failure(error) = result else { continue }
throw error
}
self.isSuccess = true
self.errorDescription = nil
}
catch
{
self.isSuccess = false
self.errorDescription = error.localizedDescription
}
}
}
extension RefreshAttempt
{
@nonobjc class func fetchRequest() -> NSFetchRequest<RefreshAttempt>
{
return NSFetchRequest<RefreshAttempt>(entityName: "RefreshAttempt")
}
}