mirror of
https://github.com/XcodesOrg/XcodesApp.git
synced 2026-02-06 20:28:39 +01:00
- Define enumerations for preferences that can be managed in an enterprise environment using MDM - Add methods in AppState to check for managed preferences - Update Advanced, Download, Experiments and Update preference panes to disable controls to modify any of the managed preferences - Update Xcode category list button to be disabled if preference is managed
65 lines
2.2 KiB
Swift
65 lines
2.2 KiB
Swift
import AppleAPI
|
|
import SwiftUI
|
|
|
|
struct DownloadPreferencePane: View {
|
|
@EnvironmentObject var appState: AppState
|
|
|
|
@AppStorage("dataSource") var dataSource: DataSource = .xcodeReleases
|
|
@AppStorage("downloader") var downloader: Downloader = .aria2
|
|
|
|
var body: some View {
|
|
VStack(alignment: .leading) {
|
|
GroupBox(label: Text("DataSource")) {
|
|
VStack(alignment: .leading) {
|
|
Picker("DataSource", selection: $dataSource) {
|
|
ForEach(DataSource.allCases) { dataSource in
|
|
Text(dataSource.description)
|
|
.tag(dataSource)
|
|
}
|
|
}
|
|
.labelsHidden()
|
|
.fixedSize()
|
|
|
|
Text("DataSourceDescription")
|
|
.font(.footnote)
|
|
.foregroundStyle(.secondary)
|
|
.fixedSize(horizontal: false, vertical: true)
|
|
}
|
|
}
|
|
.groupBoxStyle(PreferencesGroupBoxStyle())
|
|
.disabled(dataSource.isManaged)
|
|
|
|
GroupBox(label: Text("Downloader")) {
|
|
VStack(alignment: .leading) {
|
|
Picker("Downloader", selection: $downloader) {
|
|
ForEach(Downloader.allCases) { downloader in
|
|
Text(downloader.description)
|
|
.tag(downloader)
|
|
}
|
|
}
|
|
.labelsHidden()
|
|
.fixedSize()
|
|
|
|
Text("DownloaderDescription")
|
|
.font(.footnote)
|
|
.foregroundStyle(.secondary)
|
|
.fixedSize(horizontal: false, vertical: true)
|
|
}
|
|
}
|
|
.groupBoxStyle(PreferencesGroupBoxStyle())
|
|
.disabled(downloader.isManaged)
|
|
}
|
|
}
|
|
}
|
|
|
|
struct DownloadPreferencePane_Previews: PreviewProvider {
|
|
static var previews: some View {
|
|
Group {
|
|
DownloadPreferencePane()
|
|
.environmentObject(AppState())
|
|
.frame(maxWidth: 600)
|
|
.frame(minHeight: 300)
|
|
}
|
|
}
|
|
}
|