mirror of
https://github.com/XcodesOrg/XcodesApp.git
synced 2026-03-25 08:55:46 +00:00
move identical builds view to IdenticalBuildView.swift
This commit is contained in:
parent
7079e062d2
commit
e56d83dbe3
3 changed files with 88 additions and 29 deletions
|
|
@ -14,6 +14,7 @@
|
|||
53CBAB2C263DCC9100410495 /* XcodesAlert.swift in Sources */ = {isa = PBXBuildFile; fileRef = 53CBAB2B263DCC9100410495 /* XcodesAlert.swift */; };
|
||||
63EAA4EB259944450046AB8F /* ProgressButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 63EAA4EA259944450046AB8F /* ProgressButton.swift */; };
|
||||
B0C6AD042AD6E65700E64698 /* ReleaseDateView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B0C6AD032AD6E65700E64698 /* ReleaseDateView.swift */; };
|
||||
B0C6AD0B2AD9178E00E64698 /* IdenticalBuildView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B0C6AD0A2AD9178E00E64698 /* IdenticalBuildView.swift */; };
|
||||
CA11E7BA2598476C00D2EE1C /* XcodeCommands.swift in Sources */ = {isa = PBXBuildFile; fileRef = CA11E7B92598476C00D2EE1C /* XcodeCommands.swift */; };
|
||||
CA2518EC25A7FF2B00F08414 /* AppStateUpdateTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = CA2518EB25A7FF2B00F08414 /* AppStateUpdateTests.swift */; };
|
||||
CA25192A25A9644800F08414 /* XcodeInstallState.swift in Sources */ = {isa = PBXBuildFile; fileRef = CA25192925A9644800F08414 /* XcodeInstallState.swift */; };
|
||||
|
|
@ -194,6 +195,7 @@
|
|||
AAB037D32839BD4700017680 /* ko */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ko; path = ko.lproj/Localizable.strings; sourceTree = "<group>"; };
|
||||
AB4EB0DE28541FA000FF3B1D /* ja */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ja; path = ja.lproj/Localizable.strings; sourceTree = "<group>"; };
|
||||
B0C6AD032AD6E65700E64698 /* ReleaseDateView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ReleaseDateView.swift; sourceTree = "<group>"; };
|
||||
B0C6AD0A2AD9178E00E64698 /* IdenticalBuildView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IdenticalBuildView.swift; sourceTree = "<group>"; };
|
||||
B648F22B2810C1130096781B /* fr */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = fr; path = fr.lproj/Localizable.strings; sourceTree = "<group>"; };
|
||||
C0AE7FA4283002DC00DA63D2 /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/Localizable.strings"; sourceTree = "<group>"; };
|
||||
CA11E7B92598476C00D2EE1C /* XcodeCommands.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = XcodeCommands.swift; sourceTree = "<group>"; };
|
||||
|
|
@ -620,6 +622,7 @@
|
|||
CAFBDC67259A308B003DCC5A /* InfoPane.swift */,
|
||||
E8E98A9525D863D700EC89A0 /* InstallationStepDetailView.swift */,
|
||||
B0C6AD032AD6E65700E64698 /* ReleaseDateView.swift */,
|
||||
B0C6AD0A2AD9178E00E64698 /* IdenticalBuildView.swift */,
|
||||
);
|
||||
path = InfoPane;
|
||||
sourceTree = "<group>";
|
||||
|
|
@ -891,6 +894,7 @@
|
|||
E87DD6EB25D053FA00D86808 /* Progress+.swift in Sources */,
|
||||
CAC281CD259F97FA00B8AB0B /* ObservingProgressIndicator.swift in Sources */,
|
||||
CABFA9C22592EEEA00380FEE /* Publisher+Resumable.swift in Sources */,
|
||||
B0C6AD0B2AD9178E00E64698 /* IdenticalBuildView.swift in Sources */,
|
||||
CAFBDC68259A308B003DCC5A /* InfoPane.swift in Sources */,
|
||||
E87AB3C52939B65E00D72F43 /* Hardware.swift in Sources */,
|
||||
CAA1CB4D255A5CFD003FD669 /* SignInPhoneListView.swift in Sources */,
|
||||
|
|
|
|||
83
Xcodes/Frontend/InfoPane/IdenticalBuildView.swift
Normal file
83
Xcodes/Frontend/InfoPane/IdenticalBuildView.swift
Normal file
|
|
@ -0,0 +1,83 @@
|
|||
//
|
||||
// IdenticalBuildView.swift
|
||||
// Xcodes
|
||||
//
|
||||
// Created by Duong Thai on 11/10/2023.
|
||||
// Copyright © 2023 Robots and Pencils. All rights reserved.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
import Version
|
||||
|
||||
struct IdenticalBuildsView: View {
|
||||
let builds: [Version]
|
||||
private let isEmpty: Bool
|
||||
private let accessibilityDescription: String
|
||||
|
||||
var body: some View {
|
||||
if isEmpty {
|
||||
EmptyView()
|
||||
} else {
|
||||
VStack(alignment: .leading) {
|
||||
HStack {
|
||||
Text("IdenticalBuilds")
|
||||
Image(systemName: "square.fill.on.square.fill")
|
||||
.foregroundColor(.secondary)
|
||||
.accessibility(hidden: true)
|
||||
.help("IdenticalBuilds.help")
|
||||
}
|
||||
.font(.headline)
|
||||
|
||||
ForEach(builds, id: \.description) { version in
|
||||
Text("• \(version.appleDescription)")
|
||||
.font(.subheadline)
|
||||
}
|
||||
}
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
.accessibilityElement()
|
||||
.accessibility(label: Text("IdenticalBuilds"))
|
||||
.accessibility(value: Text(accessibilityDescription))
|
||||
.accessibility(hint: Text("IdenticalBuilds.help"))
|
||||
}
|
||||
}
|
||||
|
||||
init(builds: [Version]) {
|
||||
self.builds = builds
|
||||
self.isEmpty = builds.isEmpty
|
||||
self.accessibilityDescription = builds
|
||||
.map(\.appleDescription)
|
||||
.joined(separator: ", ")
|
||||
}
|
||||
}
|
||||
|
||||
struct IdenticalBuildsView_Preview: PreviewProvider {
|
||||
static var previews: some View {
|
||||
WrapperView()
|
||||
}
|
||||
}
|
||||
|
||||
private struct WrapperView: View {
|
||||
@State var isEmpty = false
|
||||
var builds: [Version] {
|
||||
isEmpty
|
||||
? []
|
||||
: [.init(xcodeVersion: "15.0")!,
|
||||
.init(xcodeVersion: "15.1")!]
|
||||
}
|
||||
|
||||
var body: some View {
|
||||
VStack {
|
||||
HStack {
|
||||
IdenticalBuildsView(builds: builds)
|
||||
.border(.red)
|
||||
}
|
||||
Spacer()
|
||||
Toggle(isOn: $isEmpty) {
|
||||
Text("Is Empty?")
|
||||
}
|
||||
}
|
||||
.animation(.default)
|
||||
.frame(width: 300, height: 100)
|
||||
.padding()
|
||||
}
|
||||
}
|
||||
|
|
@ -57,7 +57,7 @@ struct InfoPane: View {
|
|||
releaseNotes(for: xcode)
|
||||
ReleaseDateView(date: xcode.releaseDate)
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
identicalBuilds(for: xcode)
|
||||
IdenticalBuildsView(builds: xcode.identicalBuilds)
|
||||
compatibility(for: xcode)
|
||||
sdks(for: xcode)
|
||||
compilers(for: xcode)
|
||||
|
|
@ -86,34 +86,6 @@ struct InfoPane: View {
|
|||
}
|
||||
}
|
||||
|
||||
@ViewBuilder
|
||||
private func identicalBuilds(for xcode: Xcode) -> some View {
|
||||
if !xcode.identicalBuilds.isEmpty {
|
||||
VStack(alignment: .leading) {
|
||||
HStack {
|
||||
Text("IdenticalBuilds")
|
||||
Image(systemName: "square.fill.on.square.fill")
|
||||
.foregroundColor(.secondary)
|
||||
.accessibility(hidden: true)
|
||||
.help("IdenticalBuilds.help")
|
||||
}
|
||||
.font(.headline)
|
||||
|
||||
ForEach(xcode.identicalBuilds, id: \.description) { version in
|
||||
Text("• \(version.appleDescription)")
|
||||
.font(.subheadline)
|
||||
}
|
||||
}
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
.accessibilityElement()
|
||||
.accessibility(label: Text("IdenticalBuilds"))
|
||||
.accessibility(value: Text(xcode.identicalBuilds.map(\.appleDescription).joined(separator: ", ")))
|
||||
.accessibility(hint: Text("IdenticalBuilds.help"))
|
||||
} else {
|
||||
EmptyView()
|
||||
}
|
||||
}
|
||||
|
||||
@ViewBuilder
|
||||
private func releaseNotes(for xcode: Xcode) -> some View {
|
||||
if let releaseNotesURL = xcode.releaseNotesURL {
|
||||
|
|
|
|||
Loading…
Reference in a new issue