Commit b0ba9d0cc4
Unsigned
Layout: unified · split
Hutch.xcodeproj/project.pbxproj +8 −8
| @@ -515,7 +515,7 @@ | ||
| 515 | 515 | ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; |
| 516 | 516 | CODE_SIGN_ENTITLEMENTS = Hutch/Hutch.entitlements; |
| 517 | 517 | CODE_SIGN_STYLE = Automatic; |
| 518 | CURRENT_PROJECT_VERSION = 71; | |
| 518 | CURRENT_PROJECT_VERSION = 72; | |
| 519 | 519 | DEVELOPMENT_TEAM = ZCNAX3VL9D; |
| 520 | 520 | ENABLE_PREVIEWS = YES; |
| 521 | 521 | GENERATE_INFOPLIST_FILE = YES; |
| @@ -532,7 +532,7 @@ | ||
| 532 | 532 | "$(inherited)", |
| 533 | 533 | "@executable_path/Frameworks", |
| 534 | 534 | ); |
| 535 | MARKETING_VERSION = 3.1.3; | |
| 535 | MARKETING_VERSION = 3.1.4; | |
| 536 | 536 | PRODUCT_BUNDLE_IDENTIFIER = net.cleberg.Hutch; |
| 537 | 537 | PRODUCT_NAME = "$(TARGET_NAME)"; |
| 538 | 538 | STRING_CATALOG_GENERATE_SYMBOLS = YES; |
| @@ -552,7 +552,7 @@ | ||
| 552 | 552 | ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; |
| 553 | 553 | CODE_SIGN_ENTITLEMENTS = Hutch/Hutch.entitlements; |
| 554 | 554 | CODE_SIGN_STYLE = Automatic; |
| 555 | CURRENT_PROJECT_VERSION = 71; | |
| 555 | CURRENT_PROJECT_VERSION = 72; | |
| 556 | 556 | DEVELOPMENT_TEAM = ZCNAX3VL9D; |
| 557 | 557 | ENABLE_PREVIEWS = YES; |
| 558 | 558 | GENERATE_INFOPLIST_FILE = YES; |
| @@ -569,7 +569,7 @@ | ||
| 569 | 569 | "$(inherited)", |
| 570 | 570 | "@executable_path/Frameworks", |
| 571 | 571 | ); |
| 572 | MARKETING_VERSION = 3.1.3; | |
| 572 | MARKETING_VERSION = 3.1.4; | |
| 573 | 573 | PRODUCT_BUNDLE_IDENTIFIER = net.cleberg.Hutch; |
| 574 | 574 | PRODUCT_NAME = "$(TARGET_NAME)"; |
| 575 | 575 | STRING_CATALOG_GENERATE_SYMBOLS = YES; |
| @@ -632,7 +632,7 @@ | ||
| 632 | 632 | APPLICATION_EXTENSION_API_ONLY = YES; |
| 633 | 633 | CODE_SIGN_ENTITLEMENTS = HutchWidgetExtension/HutchWidgetExtension.entitlements; |
| 634 | 634 | CODE_SIGN_STYLE = Automatic; |
| 635 | CURRENT_PROJECT_VERSION = 71; | |
| 635 | CURRENT_PROJECT_VERSION = 72; | |
| 636 | 636 | DEVELOPMENT_TEAM = ZCNAX3VL9D; |
| 637 | 637 | GENERATE_INFOPLIST_FILE = NO; |
| 638 | 638 | INFOPLIST_FILE = HutchWidgetExtension/Info.plist; |
| @@ -642,7 +642,7 @@ | ||
| 642 | 642 | "@executable_path/Frameworks", |
| 643 | 643 | "@executable_path/../../Frameworks", |
| 644 | 644 | ); |
| 645 | MARKETING_VERSION = 3.1.3; | |
| 645 | MARKETING_VERSION = 3.1.4; | |
| 646 | 646 | PRODUCT_BUNDLE_IDENTIFIER = net.cleberg.Hutch.HutchWidgetExtension; |
| 647 | 647 | PRODUCT_NAME = "$(TARGET_NAME)"; |
| 648 | 648 | SKIP_INSTALL = YES; |
| @@ -661,7 +661,7 @@ | ||
| 661 | 661 | APPLICATION_EXTENSION_API_ONLY = YES; |
| 662 | 662 | CODE_SIGN_ENTITLEMENTS = HutchWidgetExtension/HutchWidgetExtension.entitlements; |
| 663 | 663 | CODE_SIGN_STYLE = Automatic; |
| 664 | CURRENT_PROJECT_VERSION = 71; | |
| 664 | CURRENT_PROJECT_VERSION = 72; | |
| 665 | 665 | DEVELOPMENT_TEAM = ZCNAX3VL9D; |
| 666 | 666 | GENERATE_INFOPLIST_FILE = NO; |
| 667 | 667 | INFOPLIST_FILE = HutchWidgetExtension/Info.plist; |
| @@ -671,7 +671,7 @@ | ||
| 671 | 671 | "@executable_path/Frameworks", |
| 672 | 672 | "@executable_path/../../Frameworks", |
| 673 | 673 | ); |
| 674 | MARKETING_VERSION = 3.1.3; | |
| 674 | MARKETING_VERSION = 3.1.4; | |
| 675 | 675 | PRODUCT_BUNDLE_IDENTIFIER = net.cleberg.Hutch.HutchWidgetExtension; |
| 676 | 676 | PRODUCT_NAME = "$(TARGET_NAME)"; |
| 677 | 677 | SKIP_INSTALL = YES; |
Hutch/Models/Git.swift +2 −2
| @@ -4,9 +4,9 @@ import Foundation | ||
| 4 | 4 | |
| 5 | 5 | /// Repository visibility level. |
| 6 | 6 | enum Visibility: String, Codable, Sendable { |
| 7 | case `public` = "PUBLIC" | |
| 7 | case publicVisibility = "PUBLIC" | |
| 8 | 8 | case unlisted = "UNLISTED" |
| 9 | case `private` = "PRIVATE" | |
| 9 | case privateVisibility = "PRIVATE" | |
| 10 | 10 | } |
| 11 | 11 | |
| 12 | 12 | /// Repository access mode. |
Hutch/Models/Project.swift +2 −2
| @@ -230,11 +230,11 @@ extension String { | ||
| 230 | 230 | extension Visibility { |
| 231 | 231 | var displayName: String { |
| 232 | 232 | switch self { |
| 233 | case .public: | |
| 233 | case .publicVisibility: | |
| 234 | 234 | "Public" |
| 235 | 235 | case .unlisted: |
| 236 | 236 | "Unlisted" |
| 237 | case .private: | |
| 237 | case .privateVisibility: | |
| 238 | 238 | "Private" |
| 239 | 239 | } |
| 240 | 240 | } |
Hutch/Models/RepositorySummary.swift +34 −29
| @@ -20,26 +20,29 @@ struct RepositorySummary: Codable, Sendable, Identifiable, Hashable { | ||
| 20 | 20 | case head = "HEAD" |
| 21 | 21 | } |
| 22 | 22 | |
| 23 | init( | |
| 24 | id: Int, | |
| 25 | rid: String, | |
| 26 | service: SRHTService, | |
| 27 | name: String, | |
| 28 | description: String?, | |
| 29 | visibility: Visibility, | |
| 30 | updated: Date, | |
| 31 | owner: Entity, | |
| 32 | head: Reference? | |
| 33 | ) { | |
| 34 | self.id = id | |
| 35 | self.rid = rid | |
| 36 | self.service = service | |
| 37 | self.name = name | |
| 38 | self.description = description | |
| 39 | self.visibility = visibility | |
| 40 | self.updated = updated | |
| 41 | self.owner = owner | |
| 42 | self.head = head | |
| 23 | /// Grouped initializer fields (single parameter keeps APIs explicit without exceeding parameter-count limits). | |
| 24 | struct Fields: Sendable, Hashable { | |
| 25 | let id: Int | |
| 26 | let rid: String | |
| 27 | let service: SRHTService | |
| 28 | let name: String | |
| 29 | let description: String? | |
| 30 | let visibility: Visibility | |
| 31 | let updated: Date | |
| 32 | let owner: Entity | |
| 33 | let head: Reference? | |
| 34 | } | |
| 35 | ||
| 36 | init(fields: Fields) { | |
| 37 | id = fields.id | |
| 38 | rid = fields.rid | |
| 39 | service = fields.service | |
| 40 | name = fields.name | |
| 41 | description = fields.description | |
| 42 | visibility = fields.visibility | |
| 43 | updated = fields.updated | |
| 44 | owner = fields.owner | |
| 45 | head = fields.head | |
| 43 | 46 | } |
| 44 | 47 | |
| 45 | 48 | init(from decoder: any Decoder) throws { |
| @@ -69,15 +72,17 @@ extension RepositorySummary { | ||
| 69 | 72 | head: Reference? = nil |
| 70 | 73 | ) -> RepositorySummary { |
| 71 | 74 | RepositorySummary( |
| 72 | id: id, | |
| 73 | rid: rid, | |
| 74 | service: service, | |
| 75 | name: name ?? self.name, | |
| 76 | description: description ?? self.description, | |
| 77 | visibility: visibility ?? self.visibility, | |
| 78 | updated: updated ?? self.updated, | |
| 79 | owner: owner, | |
| 80 | head: head ?? self.head | |
| 75 | fields: .init( | |
| 76 | id: id, | |
| 77 | rid: rid, | |
| 78 | service: service, | |
| 79 | name: name ?? self.name, | |
| 80 | description: description ?? self.description, | |
| 81 | visibility: visibility ?? self.visibility, | |
| 82 | updated: updated ?? self.updated, | |
| 83 | owner: owner, | |
| 84 | head: head ?? self.head | |
| 85 | ) | |
| 81 | 86 | ) |
| 82 | 87 | } |
| 83 | 88 | |
Hutch/Networking/ProjectService.swift +5 −5
| @@ -49,7 +49,7 @@ private struct ProjectSummaryPayload: Decodable, Sendable { | ||
| 49 | 49 | name = try container.decodeIfPresent(String.self, forKey: .name) ?? "" |
| 50 | 50 | description = try container.decodeIfPresent(String.self, forKey: .description) |
| 51 | 51 | website = try container.decodeIfPresent(String.self, forKey: .website) |
| 52 | visibility = try container.decodeIfPresent(Visibility.self, forKey: .visibility) ?? .public | |
| 52 | visibility = try container.decodeIfPresent(Visibility.self, forKey: .visibility) ?? .publicVisibility | |
| 53 | 53 | tags = try container.decodeIfPresent([String].self, forKey: .tags) ?? [] |
| 54 | 54 | updated = try container.decodeIfPresent(Date.self, forKey: .updated) ?? .distantPast |
| 55 | 55 | } |
| @@ -90,7 +90,7 @@ private struct ProjectDetailPayload: Decodable, Sendable { | ||
| 90 | 90 | name = try container.decodeIfPresent(String.self, forKey: .name) ?? "" |
| 91 | 91 | description = try container.decodeIfPresent(String.self, forKey: .description) |
| 92 | 92 | website = try container.decodeIfPresent(String.self, forKey: .website) |
| 93 | visibility = try container.decodeIfPresent(Visibility.self, forKey: .visibility) ?? .public | |
| 93 | visibility = try container.decodeIfPresent(Visibility.self, forKey: .visibility) ?? .publicVisibility | |
| 94 | 94 | tags = try container.decodeIfPresent([String].self, forKey: .tags) ?? [] |
| 95 | 95 | updated = try container.decodeIfPresent(Date.self, forKey: .updated) ?? .distantPast |
| 96 | 96 | mailingLists = try container.decodeIfPresent(ProjectMailingListPage.self, forKey: .mailingLists) ?? .empty |
| @@ -126,7 +126,7 @@ private struct ProjectMailingListPayload: Decodable, Sendable { | ||
| 126 | 126 | rid = try container.decode(String.self, forKey: .rid) |
| 127 | 127 | name = try container.decodeIfPresent(String.self, forKey: .name) ?? "" |
| 128 | 128 | description = try container.decodeIfPresent(String.self, forKey: .description) |
| 129 | visibility = try container.decodeIfPresent(Visibility.self, forKey: .visibility) ?? .public | |
| 129 | visibility = try container.decodeIfPresent(Visibility.self, forKey: .visibility) ?? .publicVisibility | |
| 130 | 130 | owner = try container.decodeIfPresent(Entity.self, forKey: .owner) ?? Entity(canonicalName: "~unknown") |
| 131 | 131 | } |
| 132 | 132 | } |
| @@ -160,7 +160,7 @@ private struct ProjectSourcePayload: Decodable, Sendable { | ||
| 160 | 160 | rid = try container.decode(String.self, forKey: .rid) |
| 161 | 161 | name = try container.decodeIfPresent(String.self, forKey: .name) ?? "" |
| 162 | 162 | description = try container.decodeIfPresent(String.self, forKey: .description) |
| 163 | visibility = try container.decodeIfPresent(Visibility.self, forKey: .visibility) ?? .public | |
| 163 | visibility = try container.decodeIfPresent(Visibility.self, forKey: .visibility) ?? .publicVisibility | |
| 164 | 164 | owner = try container.decodeIfPresent(Entity.self, forKey: .owner) ?? Entity(canonicalName: "~unknown") |
| 165 | 165 | repoType = try container.decodeIfPresent(Project.SourceRepo.RepoType.self, forKey: .repoType) ?? .git |
| 166 | 166 | } |
| @@ -193,7 +193,7 @@ private struct ProjectTrackerPayload: Decodable, Sendable { | ||
| 193 | 193 | rid = try container.decode(String.self, forKey: .rid) |
| 194 | 194 | name = try container.decodeIfPresent(String.self, forKey: .name) ?? "" |
| 195 | 195 | description = try container.decodeIfPresent(String.self, forKey: .description) |
| 196 | visibility = try container.decodeIfPresent(Visibility.self, forKey: .visibility) ?? .public | |
| 196 | visibility = try container.decodeIfPresent(Visibility.self, forKey: .visibility) ?? .publicVisibility | |
| 197 | 197 | owner = try container.decodeIfPresent(Entity.self, forKey: .owner) ?? Entity(canonicalName: "~unknown") |
| 198 | 198 | } |
| 199 | 199 | } |
Hutch/Networking/SRHTClient.swift +19 −29
| @@ -57,7 +57,7 @@ final class SRHTClient: Sendable { | ||
| 57 | 57 | service: SRHTService, |
| 58 | 58 | query: String, |
| 59 | 59 | variables: [String: any Sendable]? = nil, |
| 60 | responseType: T.Type | |
| 60 | responseType _: T.Type | |
| 61 | 61 | ) async throws -> T { |
| 62 | 62 | guard let token = _token.withLock({ $0 }), !token.isEmpty else { |
| 63 | 63 | throw SRHTError.unauthorized |
| @@ -164,20 +164,14 @@ final class SRHTClient: Sendable { | ||
| 164 | 164 | /// - service: The target SourceHut service. |
| 165 | 165 | /// - query: The GraphQL mutation string. |
| 166 | 166 | /// - variables: Variables dict; the file variable should be set to `nil`. |
| 167 | /// - fileVariablePath: The dot-separated path to the file variable (e.g. "input.avatar"). | |
| 168 | /// - fileData: The raw file data (e.g. JPEG). | |
| 169 | /// - fileName: The file name to send (e.g. "avatar.jpg"). | |
| 170 | /// - mimeType: The MIME type (e.g. "image/jpeg"). | |
| 167 | /// - file: Multipart file payload (`variablePath` is the dot-separated GraphQL variable, e.g. `input.avatar`). | |
| 171 | 168 | /// - responseType: The expected `Decodable` type nested under `data`. |
| 172 | 169 | func executeMultipart<T: Decodable>( |
| 173 | 170 | service: SRHTService, |
| 174 | 171 | query: String, |
| 175 | 172 | variables: [String: any Sendable], |
| 176 | fileVariablePath: String, | |
| 177 | fileData: Data, | |
| 178 | fileName: String, | |
| 179 | mimeType: String, | |
| 180 | responseType: T.Type | |
| 173 | file: MultipartUploadFile, | |
| 174 | responseType _: T.Type | |
| 181 | 175 | ) async throws -> T { |
| 182 | 176 | guard let token = _token.withLock({ $0 }), !token.isEmpty else { |
| 183 | 177 | throw SRHTError.unauthorized |
| @@ -197,8 +191,8 @@ final class SRHTClient: Sendable { | ||
| 197 | 191 | ) |
| 198 | 192 | let operationsData = try encoder.encode(operationsBody) |
| 199 | 193 | |
| 200 | // Build the map JSON: { "0": ["variables.<fileVariablePath>"] } | |
| 201 | let mapDict = ["0": ["variables.\(fileVariablePath)"]] | |
| 194 | // Build the map JSON: { "0": ["variables.<variablePath>"] } | |
| 195 | let mapDict = ["0": ["variables.\(file.variablePath)"]] | |
| 202 | 196 | let mapData = try encoder.encode(mapDict) |
| 203 | 197 | |
| 204 | 198 | // Assemble multipart body |
| @@ -220,9 +214,9 @@ final class SRHTClient: Sendable { | ||
| 220 | 214 | |
| 221 | 215 | // Part: file |
| 222 | 216 | body.append("--\(boundary)\r\n") |
| 223 | body.append("Content-Disposition: form-data; name=\"0\"; filename=\"\(fileName)\"\r\n") | |
| 224 | body.append("Content-Type: \(mimeType)\r\n\r\n") | |
| 225 | body.append(fileData) | |
| 217 | body.append("Content-Disposition: form-data; name=\"0\"; filename=\"\(file.fileName)\"\r\n") | |
| 218 | body.append("Content-Type: \(file.mimeType)\r\n\r\n") | |
| 219 | body.append(file.fileData) | |
| 226 | 220 | body.append("\r\n") |
| 227 | 221 | |
| 228 | 222 | // Closing boundary |
| @@ -311,7 +305,7 @@ final class SRHTClient: Sendable { | ||
| 311 | 305 | query: String, |
| 312 | 306 | variables: [String: any Sendable], |
| 313 | 307 | files: [MultipartUploadFile], |
| 314 | responseType: T.Type | |
| 308 | responseType _: T.Type | |
| 315 | 309 | ) async throws -> T { |
| 316 | 310 | guard let token = _token.withLock({ $0 }), !token.isEmpty else { |
| 317 | 311 | throw SRHTError.unauthorized |
| @@ -408,15 +402,14 @@ final class SRHTClient: Sendable { | ||
| 408 | 402 | service: SRHTService, |
| 409 | 403 | query: String, |
| 410 | 404 | variables: [String: any Sendable]? = nil, |
| 411 | responseType: T.Type, | |
| 405 | responseType _: T.Type, | |
| 412 | 406 | cacheKey: String |
| 413 | 407 | ) async throws -> T { |
| 414 | 408 | // Try cache first |
| 415 | if let cachedData = responseCache.get(forKey: cacheKey) { | |
| 416 | if let cached = try? decoder.decode(GraphQLResponse<T>.self, from: cachedData), | |
| 417 | let data = cached.data { | |
| 418 | return data | |
| 419 | } | |
| 409 | if let cachedData = responseCache.get(forKey: cacheKey), | |
| 410 | let cached = try? decoder.decode(GraphQLResponse<T>.self, from: cachedData), | |
| 411 | let data = cached.data { | |
| 412 | return data | |
| 420 | 413 | } |
| 421 | 414 | |
| 422 | 415 | // No cache hit — fetch normally |
| @@ -434,7 +427,7 @@ final class SRHTClient: Sendable { | ||
| 434 | 427 | service: SRHTService, |
| 435 | 428 | query: String, |
| 436 | 429 | variables: [String: any Sendable]? = nil, |
| 437 | responseType: T.Type, | |
| 430 | responseType _: T.Type, | |
| 438 | 431 | cacheKey: String |
| 439 | 432 | ) async throws -> T { |
| 440 | 433 | guard let token = _token.withLock({ $0 }), !token.isEmpty else { |
| @@ -580,8 +573,7 @@ final class SRHTClient: Sendable { | ||
| 580 | 573 | service: SRHTService, |
| 581 | 574 | query: String, |
| 582 | 575 | variables: [String: any Sendable]? = nil, |
| 583 | resultKeyPath: String, | |
| 584 | type: T.Type | |
| 576 | resultKeyPath: String | |
| 585 | 577 | ) -> SRHTPaginatedSequence<T> { |
| 586 | 578 | SRHTPaginatedSequence( |
| 587 | 579 | client: self, |
| @@ -598,16 +590,14 @@ final class SRHTClient: Sendable { | ||
| 598 | 590 | service: SRHTService, |
| 599 | 591 | query: String, |
| 600 | 592 | variables: [String: any Sendable]? = nil, |
| 601 | resultKeyPath: String, | |
| 602 | type: T.Type | |
| 593 | resultKeyPath: String | |
| 603 | 594 | ) async throws -> [T] { |
| 604 | 595 | var all: [T] = [] |
| 605 | 596 | for try await element in paginated( |
| 606 | 597 | service: service, |
| 607 | 598 | query: query, |
| 608 | 599 | variables: variables, |
| 609 | resultKeyPath: resultKeyPath, | |
| 610 | type: type | |
| 600 | resultKeyPath: resultKeyPath | |
| 611 | 601 | ) { |
| 612 | 602 | all.append(element) |
| 613 | 603 | } |
Hutch/Views/Builds/BuildDetailView.swift +3 −3
| @@ -468,7 +468,7 @@ private struct EditResubmitBuildSheet: View { | ||
| 468 | 468 | _manifest = State(initialValue: job.manifest ?? "") |
| 469 | 469 | _tagsText = State(initialValue: job.tags.joined(separator: ", ")) |
| 470 | 470 | _note = State(initialValue: job.note ?? "") |
| 471 | _visibility = State(initialValue: job.visibility ?? .public) | |
| 471 | _visibility = State(initialValue: job.visibility ?? .publicVisibility) | |
| 472 | 472 | } |
| 473 | 473 | |
| 474 | 474 | var body: some View { |
| @@ -491,9 +491,9 @@ private struct EditResubmitBuildSheet: View { | ||
| 491 | 491 | .autocorrectionDisabled() |
| 492 | 492 | .themedRow() |
| 493 | 493 | Picker("Visibility", selection: $visibility) { |
| 494 | Text("Public").tag(Visibility.public) | |
| 494 | Text("Public").tag(Visibility.publicVisibility) | |
| 495 | 495 | Text("Unlisted").tag(Visibility.unlisted) |
| 496 | Text("Private").tag(Visibility.private) | |
| 496 | Text("Private").tag(Visibility.privateVisibility) | |
| 497 | 497 | } |
| 498 | 498 | .themedRow() |
| 499 | 499 | Toggle("Start build now", isOn: $execute) |
Hutch/Views/Builds/BuildListView.swift +3 −3
| @@ -265,7 +265,7 @@ private struct SubmitBuildSheet: View { | ||
| 265 | 265 | @State private var note = "" |
| 266 | 266 | @State private var secrets = false |
| 267 | 267 | @State private var execute = true |
| 268 | @State private var visibility: Visibility = .public | |
| 268 | @State private var visibility: Visibility = .publicVisibility | |
| 269 | 269 | |
| 270 | 270 | init(viewModel: BuildListViewModel, onSubmitted: @escaping (Int) -> Void) { |
| 271 | 271 | self.viewModel = viewModel |
| @@ -293,9 +293,9 @@ private struct SubmitBuildSheet: View { | ||
| 293 | 293 | .autocorrectionDisabled() |
| 294 | 294 | .themedRow() |
| 295 | 295 | Picker("Visibility", selection: $visibility) { |
| 296 | Text("Public").tag(Visibility.public) | |
| 296 | Text("Public").tag(Visibility.publicVisibility) | |
| 297 | 297 | Text("Unlisted").tag(Visibility.unlisted) |
| 298 | Text("Private").tag(Visibility.private) | |
| 298 | Text("Private").tag(Visibility.privateVisibility) | |
| 299 | 299 | } |
| 300 | 300 | .themedRow() |
| 301 | 301 | Toggle("Start build now", isOn: $execute) |
Hutch/Views/Lookup/LookupView.swift +11 −9
| @@ -233,15 +233,17 @@ final class LookupViewModel { | ||
| 233 | 233 | |
| 234 | 234 | let repository = try await appState.resolveRepository(owner: owner, name: name, service: service) |
| 235 | 235 | let resolvedRepository = RepositorySummary( |
| 236 | id: repository.id, | |
| 237 | rid: repository.rid, | |
| 238 | service: service, | |
| 239 | name: repository.name, | |
| 240 | description: repository.description, | |
| 241 | visibility: repository.visibility, | |
| 242 | updated: repository.updated, | |
| 243 | owner: repository.owner, | |
| 244 | head: repository.head | |
| 236 | fields: .init( | |
| 237 | id: repository.id, | |
| 238 | rid: repository.rid, | |
| 239 | service: service, | |
| 240 | name: repository.name, | |
| 241 | description: repository.description, | |
| 242 | visibility: repository.visibility, | |
| 243 | updated: repository.updated, | |
| 244 | owner: repository.owner, | |
| 245 | head: repository.head | |
| 246 | ) | |
| 245 | 247 | ) |
| 246 | 248 | |
| 247 | 249 | return .repository(resolvedRepository) |
Hutch/Views/Lookup/UserProfileViewModel.swift +11 −9
| @@ -179,15 +179,17 @@ final class UserProfileViewModel { | ||
| 179 | 179 | |
| 180 | 180 | func repositorySummary(service: SRHTService) -> RepositorySummary { |
| 181 | 181 | RepositorySummary( |
| 182 | id: id, | |
| 183 | rid: rid, | |
| 184 | service: service, | |
| 185 | name: name, | |
| 186 | description: description, | |
| 187 | visibility: visibility, | |
| 188 | updated: updated, | |
| 189 | owner: owner, | |
| 190 | head: head | |
| 182 | fields: .init( | |
| 183 | id: id, | |
| 184 | rid: rid, | |
| 185 | service: service, | |
| 186 | name: name, | |
| 187 | description: description, | |
| 188 | visibility: visibility, | |
| 189 | updated: updated, | |
| 190 | owner: owner, | |
| 191 | head: head | |
| 192 | ) | |
| 191 | 193 | ) |
| 192 | 194 | } |
| 193 | 195 | } |
Hutch/Views/Pastes/PasteDetailView.swift +5 −5
| @@ -442,27 +442,27 @@ private struct PasteVisibilitySheet: View { | ||
| 442 | 442 | } |
| 443 | 443 | |
| 444 | 444 | private var visibilityOptions: [Visibility] { |
| 445 | [.public, .unlisted, .private] | |
| 445 | [.publicVisibility, .unlisted, .privateVisibility] | |
| 446 | 446 | } |
| 447 | 447 | |
| 448 | 448 | private func title(for visibility: Visibility) -> String { |
| 449 | 449 | switch visibility { |
| 450 | case .public: | |
| 450 | case .publicVisibility: | |
| 451 | 451 | "Public" |
| 452 | 452 | case .unlisted: |
| 453 | 453 | "Unlisted" |
| 454 | case .private: | |
| 454 | case .privateVisibility: | |
| 455 | 455 | "Private" |
| 456 | 456 | } |
| 457 | 457 | } |
| 458 | 458 | |
| 459 | 459 | private func description(for visibility: Visibility) -> String { |
| 460 | 460 | switch visibility { |
| 461 | case .public: | |
| 461 | case .publicVisibility: | |
| 462 | 462 | "Visible to everyone and listed on your profile." |
| 463 | 463 | case .unlisted: |
| 464 | 464 | "Visible to anyone with the URL, but not listed on your profile." |
| 465 | case .private: | |
| 465 | case .privateVisibility: | |
| 466 | 466 | "Visible only to explicitly allowed viewers." |
| 467 | 467 | } |
| 468 | 468 | } |
Hutch/Views/Pastes/PasteListView.swift +8 −8
| @@ -179,33 +179,33 @@ struct PasteListView: View { | ||
| 179 | 179 | |
| 180 | 180 | private func nextVisibilityLabel(for visibility: Visibility) -> String { |
| 181 | 181 | switch visibility { |
| 182 | case .public: | |
| 182 | case .publicVisibility: | |
| 183 | 183 | return "Make Unlisted" |
| 184 | 184 | case .unlisted: |
| 185 | 185 | return "Make Private" |
| 186 | case .private: | |
| 186 | case .privateVisibility: | |
| 187 | 187 | return "Make Public" |
| 188 | 188 | } |
| 189 | 189 | } |
| 190 | 190 | |
| 191 | 191 | private func nextVisibilityIcon(for visibility: Visibility) -> String { |
| 192 | 192 | switch visibility { |
| 193 | case .public: | |
| 193 | case .publicVisibility: | |
| 194 | 194 | return "eye.slash" |
| 195 | 195 | case .unlisted: |
| 196 | 196 | return "lock" |
| 197 | case .private: | |
| 197 | case .privateVisibility: | |
| 198 | 198 | return "globe" |
| 199 | 199 | } |
| 200 | 200 | } |
| 201 | 201 | |
| 202 | 202 | private func nextVisibilityColor(for visibility: Visibility) -> Color { |
| 203 | 203 | switch visibility { |
| 204 | case .public: | |
| 204 | case .publicVisibility: | |
| 205 | 205 | return .orange |
| 206 | 206 | case .unlisted: |
| 207 | 207 | return .red |
| 208 | case .private: | |
| 208 | case .privateVisibility: | |
| 209 | 209 | return .green |
| 210 | 210 | } |
| 211 | 211 | } |
| @@ -316,9 +316,9 @@ private struct CreatePasteSheet: View { | ||
| 316 | 316 | |
| 317 | 317 | Section("Visibility") { |
| 318 | 318 | Picker("Visibility", selection: $visibility) { |
| 319 | Text("Public").tag(Visibility.public) | |
| 319 | Text("Public").tag(Visibility.publicVisibility) | |
| 320 | 320 | Text("Unlisted").tag(Visibility.unlisted) |
| 321 | Text("Private").tag(Visibility.private) | |
| 321 | Text("Private").tag(Visibility.privateVisibility) | |
| 322 | 322 | } |
| 323 | 323 | .themedRow() |
| 324 | 324 | } |
Hutch/Views/Pastes/PasteListViewModel.swift +4 −4
| @@ -131,12 +131,12 @@ final class PasteListViewModel { | ||
| 131 | 131 | func cycleVisibility(for paste: Paste) async { |
| 132 | 132 | let next: Visibility |
| 133 | 133 | switch paste.visibility { |
| 134 | case .public: | |
| 134 | case .publicVisibility: | |
| 135 | 135 | next = .unlisted |
| 136 | 136 | case .unlisted: |
| 137 | next = .private | |
| 138 | case .private: | |
| 139 | next = .public | |
| 137 | next = .privateVisibility | |
| 138 | case .privateVisibility: | |
| 139 | next = .publicVisibility | |
| 140 | 140 | } |
| 141 | 141 | |
| 142 | 142 | let original = pastes |
Hutch/Views/Repositories/FileTreeViewModel.swift +1 −4
| @@ -327,14 +327,11 @@ final class FileTreeViewModel { | ||
| 327 | 327 | } |
| 328 | 328 | |
| 329 | 329 | case .binaryBlob(let blob): |
| 330 | if blob.content != nil { | |
| 330 | if blob.content != nil || blob.id == nil { | |
| 331 | 331 | viewingEntry = entry |
| 332 | 332 | viewingObject = object |
| 333 | 333 | } else if let blobId = blob.id { |
| 334 | 334 | await loadBlob(entry: entry, blobId: blobId) |
| 335 | } else { | |
| 336 | viewingEntry = entry | |
| 337 | viewingObject = object | |
| 338 | 335 | } |
| 339 | 336 | |
| 340 | 337 | case .unknown: |
Hutch/Views/Repositories/HgRepositorySettingsView.swift +2 −2
| @@ -121,9 +121,9 @@ struct HgRepositorySettingsView: View { | ||
| 121 | 121 | .themedRow() |
| 122 | 122 | |
| 123 | 123 | Picker("Visibility", selection: Bindable(viewModel).editedVisibility) { |
| 124 | Text("Public").tag(Visibility.public) | |
| 124 | Text("Public").tag(Visibility.publicVisibility) | |
| 125 | 125 | Text("Unlisted").tag(Visibility.unlisted) |
| 126 | Text("Private").tag(Visibility.private) | |
| 126 | Text("Private").tag(Visibility.privateVisibility) | |
| 127 | 127 | } |
| 128 | 128 | .themedRow() |
| 129 | 129 | |
Hutch/Views/Repositories/ReadmeView.swift +1 −1
| @@ -1828,7 +1828,7 @@ private final class HTMLWebViewCoordinator: NSObject, WKNavigationDelegate, @unc | ||
| 1828 | 1828 | } |
| 1829 | 1829 | |
| 1830 | 1830 | func webView( |
| 1831 | _ webView: WKWebView, | |
| 1831 | _: WKWebView, | |
| 1832 | 1832 | decidePolicyFor navigationAction: WKNavigationAction, |
| 1833 | 1833 | decisionHandler: @escaping @MainActor (WKNavigationActionPolicy) -> Void |
| 1834 | 1834 | ) { |
Hutch/Views/Repositories/RepositoryListView.swift +3 −3
| @@ -214,7 +214,7 @@ private struct CreateRepositorySheet: View { | ||
| 214 | 214 | @State private var name = "" |
| 215 | 215 | @State private var description = "" |
| 216 | 216 | @State private var cloneURL = "" |
| 217 | @State private var visibility: Visibility = .public | |
| 217 | @State private var visibility: Visibility = .publicVisibility | |
| 218 | 218 | @State private var service: RepositoryCreationService = .git |
| 219 | 219 | |
| 220 | 220 | var body: some View { |
| @@ -235,9 +235,9 @@ private struct CreateRepositorySheet: View { | ||
| 235 | 235 | .lineLimit(2...4) |
| 236 | 236 | .themedRow() |
| 237 | 237 | Picker("Visibility", selection: $visibility) { |
| 238 | Text("Public").tag(Visibility.public) | |
| 238 | Text("Public").tag(Visibility.publicVisibility) | |
| 239 | 239 | Text("Unlisted").tag(Visibility.unlisted) |
| 240 | Text("Private").tag(Visibility.private) | |
| 240 | Text("Private").tag(Visibility.privateVisibility) | |
| 241 | 241 | } |
| 242 | 242 | .themedRow() |
| 243 | 243 | } |
Hutch/Views/Repositories/RepositoryListViewModel.swift +39 −56
| @@ -397,15 +397,17 @@ final class RepositoryListViewModel { | ||
| 397 | 397 | |
| 398 | 398 | func repositorySummary(service: SRHTService) -> RepositorySummary { |
| 399 | 399 | RepositorySummary( |
| 400 | id: id, | |
| 401 | rid: rid, | |
| 402 | service: service, | |
| 403 | name: name, | |
| 404 | description: description, | |
| 405 | visibility: visibility, | |
| 406 | updated: updated, | |
| 407 | owner: owner, | |
| 408 | head: head | |
| 400 | fields: .init( | |
| 401 | id: id, | |
| 402 | rid: rid, | |
| 403 | service: service, | |
| 404 | name: name, | |
| 405 | description: description, | |
| 406 | visibility: visibility, | |
| 407 | updated: updated, | |
| 408 | owner: owner, | |
| 409 | head: head | |
| 410 | ) | |
| 409 | 411 | ) |
| 410 | 412 | } |
| 411 | 413 | } |
| @@ -422,15 +424,17 @@ final class RepositoryListViewModel { | ||
| 422 | 424 | |
| 423 | 425 | func repositorySummary(service: SRHTService) -> RepositorySummary { |
| 424 | 426 | RepositorySummary( |
| 425 | id: id, | |
| 426 | rid: rid, | |
| 427 | service: service, | |
| 428 | name: name, | |
| 429 | description: description, | |
| 430 | visibility: visibility, | |
| 431 | updated: updated, | |
| 432 | owner: owner, | |
| 433 | head: tip.map { Reference(name: $0.branch, target: nil) } | |
| 427 | fields: .init( | |
| 428 | id: id, | |
| 429 | rid: rid, | |
| 430 | service: service, | |
| 431 | name: name, | |
| 432 | description: description, | |
| 433 | visibility: visibility, | |
| 434 | updated: updated, | |
| 435 | owner: owner, | |
| 436 | head: tip.map { Reference(name: $0.branch, target: nil) } | |
| 437 | ) | |
| 434 | 438 | ) |
| 435 | 439 | } |
| 436 | 440 | } |
| @@ -463,17 +467,7 @@ final class RepositoryListViewModel { | ||
| 463 | 467 | } |
| 464 | 468 | |
| 465 | 469 | if useCache && cursor == nil { |
| 466 | switch service { | |
| 467 | case .git: | |
| 468 | let result = try await client.executeAndCache( | |
| 469 | service: service, | |
| 470 | query: Self.gitQuery, | |
| 471 | variables: variables.isEmpty ? nil : variables, | |
| 472 | responseType: RepositoriesResponse.self, | |
| 473 | cacheKey: cacheKey(for: service) | |
| 474 | ) | |
| 475 | return result.repositories ?? Self.emptyPage | |
| 476 | case .hg: | |
| 470 | if service == .hg { | |
| 477 | 471 | let hgVariables = cursor.map { ["cursor": $0 as any Sendable] } |
| 478 | 472 | let result = try await client.executeAndCache( |
| 479 | 473 | service: service, |
| @@ -497,27 +491,17 @@ final class RepositoryListViewModel { | ||
| 497 | 491 | } ?? [], |
| 498 | 492 | cursor: result.repositories?.cursor |
| 499 | 493 | ) |
| 500 | default: | |
| 501 | let result = try await client.executeAndCache( | |
| 502 | service: service, | |
| 503 | query: Self.gitQuery, | |
| 504 | variables: variables.isEmpty ? nil : variables, | |
| 505 | responseType: RepositoriesResponse.self, | |
| 506 | cacheKey: cacheKey(for: service) | |
| 507 | ) | |
| 508 | return result.repositories ?? Self.emptyPage | |
| 509 | 494 | } |
| 495 | let result = try await client.executeAndCache( | |
| 496 | service: service, | |
| 497 | query: Self.gitQuery, | |
| 498 | variables: variables.isEmpty ? nil : variables, | |
| 499 | responseType: RepositoriesResponse.self, | |
| 500 | cacheKey: cacheKey(for: service) | |
| 501 | ) | |
| 502 | return result.repositories ?? Self.emptyPage | |
| 510 | 503 | } else { |
| 511 | switch service { | |
| 512 | case .git: | |
| 513 | let result = try await client.execute( | |
| 514 | service: service, | |
| 515 | query: Self.gitQuery, | |
| 516 | variables: variables.isEmpty ? nil : variables, | |
| 517 | responseType: RepositoriesResponse.self | |
| 518 | ) | |
| 519 | return result.repositories ?? Self.emptyPage | |
| 520 | case .hg: | |
| 504 | if service == .hg { | |
| 521 | 505 | let hgVariables = cursor.map { ["cursor": $0 as any Sendable] } |
| 522 | 506 | let result = try await client.execute( |
| 523 | 507 | service: service, |
| @@ -540,15 +524,14 @@ final class RepositoryListViewModel { | ||
| 540 | 524 | } ?? [], |
| 541 | 525 | cursor: result.repositories?.cursor |
| 542 | 526 | ) |
| 543 | default: | |
| 544 | let result = try await client.execute( | |
| 545 | service: service, | |
| 546 | query: Self.gitQuery, | |
| 547 | variables: variables.isEmpty ? nil : variables, | |
| 548 | responseType: RepositoriesResponse.self | |
| 549 | ) | |
| 550 | return result.repositories ?? Self.emptyPage | |
| 551 | 527 | } |
| 528 | let result = try await client.execute( | |
| 529 | service: service, | |
| 530 | query: Self.gitQuery, | |
| 531 | variables: variables.isEmpty ? nil : variables, | |
| 532 | responseType: RepositoriesResponse.self | |
| 533 | ) | |
| 534 | return result.repositories ?? Self.emptyPage | |
| 552 | 535 | } |
| 553 | 536 | } |
| 554 | 537 | |
Hutch/Views/Repositories/RepositoryRowView.swift +4 −4
| @@ -154,17 +154,17 @@ struct VisibilityBadge: View { | ||
| 154 | 154 | |
| 155 | 155 | private var label: String { |
| 156 | 156 | switch visibility { |
| 157 | case .public: "PUBLIC" | |
| 157 | case .publicVisibility: "PUBLIC" | |
| 158 | 158 | case .unlisted: "UNLISTED" |
| 159 | case .private: "PRIVATE" | |
| 159 | case .privateVisibility: "PRIVATE" | |
| 160 | 160 | } |
| 161 | 161 | } |
| 162 | 162 | |
| 163 | 163 | private var color: Color { |
| 164 | 164 | switch visibility { |
| 165 | case .public: .green | |
| 165 | case .publicVisibility: .green | |
| 166 | 166 | case .unlisted: .orange |
| 167 | case .private: .red | |
| 167 | case .privateVisibility: .red | |
| 168 | 168 | } |
| 169 | 169 | } |
| 170 | 170 | } |
Hutch/Views/Repositories/RepositorySettingsView.swift +4 −4
| @@ -227,9 +227,9 @@ struct RepositorySettingsView: View { | ||
| 227 | 227 | private func visibilitySection(_ viewModel: RepositorySettingsViewModel) -> some View { |
| 228 | 228 | Section { |
| 229 | 229 | Picker("Visibility", selection: Bindable(viewModel).editedVisibility) { |
| 230 | Text("Public").tag(Visibility.public) | |
| 230 | Text("Public").tag(Visibility.publicVisibility) | |
| 231 | 231 | Text("Unlisted").tag(Visibility.unlisted) |
| 232 | Text("Private").tag(Visibility.private) | |
| 232 | Text("Private").tag(Visibility.privateVisibility) | |
| 233 | 233 | } |
| 234 | 234 | .themedRow() |
| 235 | 235 | |
| @@ -283,11 +283,11 @@ struct RepositorySettingsView: View { | ||
| 283 | 283 | |
| 284 | 284 | private func visibilityConfirmationMessage(for viewModel: RepositorySettingsViewModel) -> String { |
| 285 | 285 | switch viewModel.editedVisibility { |
| 286 | case .public: | |
| 286 | case .publicVisibility: | |
| 287 | 287 | "Anyone will be able to find and view this repository." |
| 288 | 288 | case .unlisted: |
| 289 | 289 | "People with the link can view this repository, but it won't appear in public listings." |
| 290 | case .private: | |
| 290 | case .privateVisibility: | |
| 291 | 291 | "Only people with explicit access will be able to view this repository." |
| 292 | 292 | } |
| 293 | 293 | } |
Hutch/Views/Repositories/RepositorySettingsViewModel.swift +11 −9
| @@ -20,15 +20,17 @@ private struct UpdatedRepositoryPayload: Decodable, Sendable { | ||
| 20 | 20 | |
| 21 | 21 | func repositorySummary(using owner: Entity, service: SRHTService) -> RepositorySummary { |
| 22 | 22 | RepositorySummary( |
| 23 | id: id, | |
| 24 | rid: rid, | |
| 25 | service: service, | |
| 26 | name: name, | |
| 27 | description: description, | |
| 28 | visibility: visibility, | |
| 29 | updated: updated, | |
| 30 | owner: owner, | |
| 31 | head: head | |
| 23 | fields: .init( | |
| 24 | id: id, | |
| 25 | rid: rid, | |
| 26 | service: service, | |
| 27 | name: name, | |
| 28 | description: description, | |
| 29 | visibility: visibility, | |
| 30 | updated: updated, | |
| 31 | owner: owner, | |
| 32 | head: head | |
| 33 | ) | |
| 32 | 34 | ) |
| 33 | 35 | } |
| 34 | 36 | } |
Hutch/Views/Repositories/RepositorySummarySupport.swift +2 −2
| @@ -37,11 +37,11 @@ func repositoryCloneURLs(for repository: RepositorySummary) -> RepositoryCloneUR | ||
| 37 | 37 | |
| 38 | 38 | func repositoryVisibilityLabel(_ visibility: Visibility) -> String { |
| 39 | 39 | switch visibility { |
| 40 | case .public: | |
| 40 | case .publicVisibility: | |
| 41 | 41 | return "Public" |
| 42 | 42 | case .unlisted: |
| 43 | 43 | return "Unlisted" |
| 44 | case .private: | |
| 44 | case .privateVisibility: | |
| 45 | 45 | return "Private" |
| 46 | 46 | } |
| 47 | 47 | } |
Hutch/Views/Settings/SettingsViewModel.swift +6 −4
| @@ -228,10 +228,12 @@ final class SettingsViewModel { | ||
| 228 | 228 | service: .meta, |
| 229 | 229 | query: Self.updateUserMutation, |
| 230 | 230 | variables: ["input": input], |
| 231 | fileVariablePath: "input.avatar", | |
| 232 | fileData: jpegData, | |
| 233 | fileName: "avatar.jpg", | |
| 234 | mimeType: "image/jpeg", | |
| 231 | file: MultipartUploadFile( | |
| 232 | variablePath: "input.avatar", | |
| 233 | fileData: jpegData, | |
| 234 | fileName: "avatar.jpg", | |
| 235 | mimeType: "image/jpeg" | |
| 236 | ), | |
| 235 | 237 | responseType: UpdateUserResponse.self |
| 236 | 238 | ) |
| 237 | 239 | let updated = result.updateUser |
Hutch/Views/Tickets/TicketListView.swift +2
| @@ -1400,11 +1400,13 @@ struct FlowLayout: Layout { | ||
| 1400 | 1400 | var spacing: CGFloat = 4 |
| 1401 | 1401 | |
| 1402 | 1402 | func sizeThatFits(proposal: ProposedViewSize, subviews: Subviews, cache: inout ()) -> CGSize { |
| 1403 | _ = cache | |
| 1403 | 1404 | let result = layoutSubviews(proposal: proposal, subviews: subviews) |
| 1404 | 1405 | return result.size |
| 1405 | 1406 | } |
| 1406 | 1407 | |
| 1407 | 1408 | func placeSubviews(in bounds: CGRect, proposal: ProposedViewSize, subviews: Subviews, cache: inout ()) { |
| 1409 | _ = cache | |
| 1408 | 1410 | let result = layoutSubviews(proposal: proposal, subviews: subviews) |
| 1409 | 1411 | for (index, position) in result.positions.enumerated() { |
| 1410 | 1412 | subviews[index].place( |
Hutch/Views/Tickets/TrackerListView.swift +1 −1
| @@ -37,7 +37,7 @@ struct TrackerListView: View { | ||
| 37 | 37 | error: viewModel.error, |
| 38 | 38 | initialName: "", |
| 39 | 39 | initialDescription: "", |
| 40 | initialVisibility: .public | |
| 40 | initialVisibility: .publicVisibility | |
| 41 | 41 | ) { name, description, visibility in |
| 42 | 42 | if let tracker = await viewModel.createTracker( |
| 43 | 43 | name: name, |
Hutch/Views/Tickets/TrackerManagementView.swift +2 −2
| @@ -659,9 +659,9 @@ struct TrackerEditorSheet: View { | ||
| 659 | 659 | .lineLimit(2...4) |
| 660 | 660 | .themedRow() |
| 661 | 661 | Picker("Visibility", selection: $visibility) { |
| 662 | Text("Public").tag(Visibility.public) | |
| 662 | Text("Public").tag(Visibility.publicVisibility) | |
| 663 | 663 | Text("Unlisted").tag(Visibility.unlisted) |
| 664 | Text("Private").tag(Visibility.private) | |
| 664 | Text("Private").tag(Visibility.privateVisibility) | |
| 665 | 665 | } |
| 666 | 666 | .themedRow() |
| 667 | 667 | } |
HutchTests/AppStateTests.swift +12 −10
| @@ -39,22 +39,24 @@ struct AppStateTests { | ||
| 39 | 39 | func navigationHelpersQueueExpectedTargets() { |
| 40 | 40 | let appState = AppState() |
| 41 | 41 | let repository = RepositorySummary( |
| 42 | id: 1, | |
| 43 | rid: "repo", | |
| 44 | service: .git, | |
| 45 | name: "hutch", | |
| 46 | description: nil, | |
| 47 | visibility: .public, | |
| 48 | updated: .distantPast, | |
| 49 | owner: Entity(canonicalName: "~owner"), | |
| 50 | head: nil | |
| 42 | fields: .init( | |
| 43 | id: 1, | |
| 44 | rid: "repo", | |
| 45 | service: .git, | |
| 46 | name: "hutch", | |
| 47 | description: nil, | |
| 48 | visibility: .publicVisibility, | |
| 49 | updated: .distantPast, | |
| 50 | owner: Entity(canonicalName: "~owner"), | |
| 51 | head: nil | |
| 52 | ) | |
| 51 | 53 | ) |
| 52 | 54 | let tracker = TrackerSummary( |
| 53 | 55 | id: 2, |
| 54 | 56 | rid: "tracker", |
| 55 | 57 | name: "todo", |
| 56 | 58 | description: nil, |
| 57 | visibility: .public, | |
| 59 | visibility: .publicVisibility, | |
| 58 | 60 | updated: .distantPast, |
| 59 | 61 | owner: Entity(canonicalName: "~owner") |
| 60 | 62 | ) |
HutchTests/ProjectTests.swift +6 −6
| @@ -15,7 +15,7 @@ struct ProjectTests { | ||
| 15 | 15 | name: "Hutch", |
| 16 | 16 | description: nil, |
| 17 | 17 | website: nil, |
| 18 | visibility: .public, | |
| 18 | visibility: .publicVisibility, | |
| 19 | 19 | tags: [], |
| 20 | 20 | updated: Date(timeIntervalSince1970: 0) |
| 21 | 21 | ), |
| @@ -25,7 +25,7 @@ struct ProjectTests { | ||
| 25 | 25 | id: "list-1", |
| 26 | 26 | name: "hutch-devel", |
| 27 | 27 | description: nil, |
| 28 | visibility: .public, | |
| 28 | visibility: .publicVisibility, | |
| 29 | 29 | owner: Entity(canonicalName: "~owner") |
| 30 | 30 | ) |
| 31 | 31 | ], |
| @@ -34,7 +34,7 @@ struct ProjectTests { | ||
| 34 | 34 | id: "repo-1", |
| 35 | 35 | name: "hutch", |
| 36 | 36 | description: nil, |
| 37 | visibility: .public, | |
| 37 | visibility: .publicVisibility, | |
| 38 | 38 | owner: Entity(canonicalName: "~owner"), |
| 39 | 39 | repoType: .git |
| 40 | 40 | ), |
| @@ -42,7 +42,7 @@ struct ProjectTests { | ||
| 42 | 42 | id: "repo-2", |
| 43 | 43 | name: "hutch-web", |
| 44 | 44 | description: nil, |
| 45 | visibility: .public, | |
| 45 | visibility: .publicVisibility, | |
| 46 | 46 | owner: Entity(canonicalName: "~owner"), |
| 47 | 47 | repoType: .git |
| 48 | 48 | ) |
| @@ -52,7 +52,7 @@ struct ProjectTests { | ||
| 52 | 52 | id: "tracker-1", |
| 53 | 53 | name: "bugs", |
| 54 | 54 | description: nil, |
| 55 | visibility: .public, | |
| 55 | visibility: .publicVisibility, | |
| 56 | 56 | owner: Entity(canonicalName: "~owner") |
| 57 | 57 | ) |
| 58 | 58 | ], |
| @@ -71,7 +71,7 @@ struct ProjectTests { | ||
| 71 | 71 | name: "Docs", |
| 72 | 72 | description: nil, |
| 73 | 73 | website: Fixture.exampleWebsite, |
| 74 | visibility: .public, | |
| 74 | visibility: .publicVisibility, | |
| 75 | 75 | tags: [], |
| 76 | 76 | updated: Date(timeIntervalSince1970: 0) |
| 77 | 77 | ), |
HutchTests/RepositoryACLViewModelTests.swift +11 −9
| @@ -110,15 +110,17 @@ struct RepositoryACLViewModelTests { | ||
| 110 | 110 | @MainActor |
| 111 | 111 | private func makeRepository() -> RepositorySummary { |
| 112 | 112 | RepositorySummary( |
| 113 | id: 1, | |
| 114 | rid: "rid-1", | |
| 115 | service: .git, | |
| 116 | name: "repo", | |
| 117 | description: nil, | |
| 118 | visibility: .public, | |
| 119 | updated: .now, | |
| 120 | owner: Entity(canonicalName: "~owner"), | |
| 121 | head: nil | |
| 113 | fields: .init( | |
| 114 | id: 1, | |
| 115 | rid: "rid-1", | |
| 116 | service: .git, | |
| 117 | name: "repo", | |
| 118 | description: nil, | |
| 119 | visibility: .publicVisibility, | |
| 120 | updated: .now, | |
| 121 | owner: Entity(canonicalName: "~owner"), | |
| 122 | head: nil | |
| 123 | ) | |
| 122 | 124 | ) |
| 123 | 125 | } |
| 124 | 126 | } |
HutchTests/RepositoryListViewModelTests.swift +11 −9
| @@ -79,15 +79,17 @@ struct RepositoryListViewModelTests { | ||
| 79 | 79 | branch: String = "main" |
| 80 | 80 | ) -> RepositorySummary { |
| 81 | 81 | RepositorySummary( |
| 82 | id: id, | |
| 83 | rid: "rid-\(id)", | |
| 84 | service: service, | |
| 85 | name: name, | |
| 86 | description: description, | |
| 87 | visibility: .public, | |
| 88 | updated: Date(timeIntervalSince1970: TimeInterval(id)), | |
| 89 | owner: Entity(canonicalName: owner), | |
| 90 | head: Reference(name: branch, target: nil) | |
| 82 | fields: .init( | |
| 83 | id: id, | |
| 84 | rid: "rid-\(id)", | |
| 85 | service: service, | |
| 86 | name: name, | |
| 87 | description: description, | |
| 88 | visibility: .publicVisibility, | |
| 89 | updated: Date(timeIntervalSince1970: TimeInterval(id)), | |
| 90 | owner: Entity(canonicalName: owner), | |
| 91 | head: Reference(name: branch, target: nil) | |
| 92 | ) | |
| 91 | 93 | ) |
| 92 | 94 | } |
| 93 | 95 | } |
HutchTests/RepositorySettingsViewModelTests.swift +11 −9
| @@ -118,15 +118,17 @@ struct RepositorySettingsViewModelTests { | ||
| 118 | 118 | @MainActor |
| 119 | 119 | private func makeRepository(headName: String?) -> RepositorySummary { |
| 120 | 120 | RepositorySummary( |
| 121 | id: 1, | |
| 122 | rid: "rid-1", | |
| 123 | service: .git, | |
| 124 | name: "repo", | |
| 125 | description: "desc", | |
| 126 | visibility: .public, | |
| 127 | updated: .now, | |
| 128 | owner: Entity(canonicalName: "~owner"), | |
| 129 | head: headName.map { Reference(name: $0, target: nil) } | |
| 121 | fields: .init( | |
| 122 | id: 1, | |
| 123 | rid: "rid-1", | |
| 124 | service: .git, | |
| 125 | name: "repo", | |
| 126 | description: "desc", | |
| 127 | visibility: .publicVisibility, | |
| 128 | updated: .now, | |
| 129 | owner: Entity(canonicalName: "~owner"), | |
| 130 | head: headName.map { Reference(name: $0, target: nil) } | |
| 131 | ) | |
| 130 | 132 | ) |
| 131 | 133 | } |
| 132 | 134 | } |
HutchTests/SRHTWebURLTests.swift +12 −10
| @@ -14,22 +14,24 @@ struct SRHTWebURLTests { | ||
| 14 | 14 | } |
| 15 | 15 | |
| 16 | 16 | private let repository = RepositorySummary( |
| 17 | id: 1, | |
| 18 | rid: "repo-1", | |
| 19 | service: .git, | |
| 20 | name: "hutch", | |
| 21 | description: nil, | |
| 22 | visibility: .public, | |
| 23 | updated: .distantPast, | |
| 24 | owner: Entity(canonicalName: "~ccleberg"), | |
| 25 | head: nil | |
| 17 | fields: .init( | |
| 18 | id: 1, | |
| 19 | rid: "repo-1", | |
| 20 | service: .git, | |
| 21 | name: "hutch", | |
| 22 | description: nil, | |
| 23 | visibility: .publicVisibility, | |
| 24 | updated: .distantPast, | |
| 25 | owner: Entity(canonicalName: "~ccleberg"), | |
| 26 | head: nil | |
| 27 | ) | |
| 26 | 28 | ) |
| 27 | 29 | private let tracker = TrackerSummary( |
| 28 | 30 | id: 2, |
| 29 | 31 | rid: "tracker-1", |
| 30 | 32 | name: "todo", |
| 31 | 33 | description: nil, |
| 32 | visibility: .public, | |
| 34 | visibility: .publicVisibility, | |
| 33 | 35 | updated: .distantPast, |
| 34 | 36 | owner: Entity(canonicalName: "~ccleberg") |
| 35 | 37 | ) |
HutchTests/TrackerListViewModelTests.swift +1 −1
| @@ -66,7 +66,7 @@ struct TrackerListViewModelTests { | ||
| 66 | 66 | rid: "rid-\(id)", |
| 67 | 67 | name: name, |
| 68 | 68 | description: description, |
| 69 | visibility: .public, | |
| 69 | visibility: .publicVisibility, | |
| 70 | 70 | updated: Date(), |
| 71 | 71 | owner: Entity(canonicalName: owner) |
| 72 | 72 | ) |