mirror of
https://github.com/XcodesOrg/XcodesApp.git
synced 2026-03-25 08:55:46 +00:00
move and fix the NotInstalledStateButtonsView
This commit is contained in:
parent
d08d2d38e4
commit
d172df68e3
3 changed files with 76 additions and 2 deletions
|
|
@ -18,6 +18,7 @@
|
|||
B0403CF42AD9381D00137C09 /* SDKsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B0403CF32AD9381D00137C09 /* SDKsView.swift */; };
|
||||
B0403CF62AD9849E00137C09 /* CompilersView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B0403CF52AD9849E00137C09 /* CompilersView.swift */; };
|
||||
B0403CF82AD991F800137C09 /* UnselectedView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B0403CF72AD991F800137C09 /* UnselectedView.swift */; };
|
||||
B0403CFA2AD9942A00137C09 /* NotInstalledStateButtonsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B0403CF92AD9942A00137C09 /* NotInstalledStateButtonsView.swift */; };
|
||||
B0C6AD042AD6E65700E64698 /* ReleaseDateView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B0C6AD032AD6E65700E64698 /* ReleaseDateView.swift */; };
|
||||
B0C6AD0B2AD9178E00E64698 /* IdenticalBuildView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B0C6AD0A2AD9178E00E64698 /* IdenticalBuildView.swift */; };
|
||||
B0C6AD0D2AD91D7900E64698 /* IconView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B0C6AD0C2AD91D7900E64698 /* IconView.swift */; };
|
||||
|
|
@ -205,6 +206,7 @@
|
|||
B0403CF32AD9381D00137C09 /* SDKsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SDKsView.swift; sourceTree = "<group>"; };
|
||||
B0403CF52AD9849E00137C09 /* CompilersView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CompilersView.swift; sourceTree = "<group>"; };
|
||||
B0403CF72AD991F800137C09 /* UnselectedView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UnselectedView.swift; sourceTree = "<group>"; };
|
||||
B0403CF92AD9942A00137C09 /* NotInstalledStateButtonsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NotInstalledStateButtonsView.swift; 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>"; };
|
||||
B0C6AD0C2AD91D7900E64698 /* IconView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IconView.swift; sourceTree = "<group>"; };
|
||||
|
|
@ -637,6 +639,7 @@
|
|||
B0403CF12AD934B600137C09 /* CompatibilityView.swift */,
|
||||
CAFBDC67259A308B003DCC5A /* InfoPane.swift */,
|
||||
B0403CF72AD991F800137C09 /* UnselectedView.swift */,
|
||||
B0403CF92AD9942A00137C09 /* NotInstalledStateButtonsView.swift */,
|
||||
E8E98A9525D863D700EC89A0 /* InstallationStepDetailView.swift */,
|
||||
B0C6AD032AD6E65700E64698 /* ReleaseDateView.swift */,
|
||||
B0C6AD0A2AD9178E00E64698 /* IdenticalBuildView.swift */,
|
||||
|
|
@ -925,6 +928,7 @@
|
|||
CABFA9CF2592EEEA00380FEE /* Process.swift in Sources */,
|
||||
CAFFFED8259CDA5000903F81 /* XcodeListViewRow.swift in Sources */,
|
||||
CABFA9C72592EEEA00380FEE /* Entry+.swift in Sources */,
|
||||
B0403CFA2AD9942A00137C09 /* NotInstalledStateButtonsView.swift in Sources */,
|
||||
CAE424B4259A764700B8B246 /* AppState+Install.swift in Sources */,
|
||||
CAE42487259A68A300B8B246 /* XcodeListCategory.swift in Sources */,
|
||||
CAA858C425A2BE4E00ACF8C0 /* Downloader.swift in Sources */,
|
||||
|
|
|
|||
|
|
@ -21,8 +21,10 @@ struct InfoPane: View {
|
|||
|
||||
switch xcode.installState {
|
||||
case .notInstalled:
|
||||
InstallButton(xcode: xcode)
|
||||
downloadFileSize(for: xcode)
|
||||
NotInstalledStateButtonsView(
|
||||
downloadFileSizeString: xcode.downloadFileSizeString,
|
||||
id: xcode.id
|
||||
)
|
||||
case let .installing(installationStep):
|
||||
InstallationStepDetailView(installationStep: installationStep)
|
||||
.fixedSize(horizontal: false, vertical: true)
|
||||
|
|
|
|||
68
Xcodes/Frontend/InfoPane/NotInstalledStateButtonsView.swift
Normal file
68
Xcodes/Frontend/InfoPane/NotInstalledStateButtonsView.swift
Normal file
|
|
@ -0,0 +1,68 @@
|
|||
//
|
||||
// NotInstalledStateButtonsView.swift
|
||||
// Xcodes
|
||||
//
|
||||
// Created by Duong Thai on 13/10/2023.
|
||||
// Copyright © 2023 Robots and Pencils. All rights reserved.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
import Version
|
||||
|
||||
struct NotInstalledStateButtonsView: View {
|
||||
let downloadFileSizeString: String?
|
||||
let id: Version
|
||||
|
||||
@EnvironmentObject var appState: AppState
|
||||
|
||||
var body: some View {
|
||||
VStack(alignment: .leading) {
|
||||
Button {
|
||||
appState.checkMinVersionAndInstall(id: id)
|
||||
} label: {
|
||||
Text("Install") .help("Install")
|
||||
}
|
||||
if let size = downloadFileSizeString {
|
||||
|
||||
Text("DownloadSize")
|
||||
.font(.headline)
|
||||
Text(size)
|
||||
.font(.subheadline)
|
||||
} else {
|
||||
EmptyView()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
struct NotInstalledStateButtonsView_Preview: PreviewProvider {
|
||||
static var previews: some View {
|
||||
WrapperView()
|
||||
}
|
||||
}
|
||||
|
||||
private struct WrapperView: View {
|
||||
@State var isSizeNil = false
|
||||
|
||||
var downloadFileSizeString: String? {
|
||||
isSizeNil
|
||||
? nil
|
||||
: "1,19 GB"
|
||||
}
|
||||
|
||||
var body: some View {
|
||||
VStack {
|
||||
NotInstalledStateButtonsView(
|
||||
downloadFileSizeString: downloadFileSizeString,
|
||||
id: Version(major: 12, minor: 3, patch: 0)
|
||||
)
|
||||
.border(.red)
|
||||
Spacer()
|
||||
Toggle(isOn: $isSizeNil) {
|
||||
Text("Is Size Nil?")
|
||||
}
|
||||
}
|
||||
.frame(width: 200, height: 100)
|
||||
.padding()
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue