forked from altstoreio/AltStore
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTeam.swift
More file actions
80 lines (65 loc) · 1.95 KB
/
Team.swift
File metadata and controls
80 lines (65 loc) · 1.95 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
//
// Team.swift
// AltStore
//
// Created by Riley Testut on 5/31/19.
// Copyright © 2019 Riley Testut. All rights reserved.
//
import Foundation
import CoreData
import AltSign
public extension ALTTeamType
{
var localizedDescription: String {
switch self
{
case .free: return NSLocalizedString("Free Developer Account", comment: "")
case .individual: return NSLocalizedString("Developer", comment: "")
case .organization: return NSLocalizedString("Organization", comment: "")
case .unknown: fallthrough
@unknown default: return NSLocalizedString("Unknown", comment: "")
}
}
}
public extension Team
{
static let maximumFreeAppIDs = 10
}
@objc(Team)
public class Team: NSManagedObject, Fetchable
{
/* Properties */
@NSManaged public var name: String
@NSManaged public var identifier: String
@NSManaged public var type: ALTTeamType
@NSManaged public var isActiveTeam: Bool
/* Relationships */
@NSManaged public private(set) var account: Account!
@NSManaged public var installedApps: Set<InstalledApp>
@NSManaged public private(set) var appIDs: Set<AppID>
public var altTeam: ALTTeam?
private override init(entity: NSEntityDescription, insertInto context: NSManagedObjectContext?)
{
super.init(entity: entity, insertInto: context)
}
public init(_ team: ALTTeam, account: Account, context: NSManagedObjectContext)
{
super.init(entity: Team.entity(), insertInto: context)
self.account = account
self.update(team: team)
}
public func update(team: ALTTeam)
{
self.altTeam = team
self.name = team.name
self.identifier = team.identifier
self.type = team.type
}
}
public extension Team
{
@nonobjc class func fetchRequest() -> NSFetchRequest<Team>
{
return NSFetchRequest<Team>(entityName: "Team")
}
}