mirror of
https://github.com/Ferrite-iOS/Ferrite.git
synced 2026-04-21 00:42:07 +00:00
Settings: Switch NavigationLink initializers
Update to modern initializers instead of using deprecated ones. Signed-off-by: kingbri <bdashore3@proton.me>
This commit is contained in:
parent
4ba58dc67f
commit
e650bbd2bb
1 changed files with 63 additions and 54 deletions
|
|
@ -37,30 +37,30 @@ struct SettingsView: View {
|
||||||
Form {
|
Form {
|
||||||
Section(header: InlineHeader("Debrid services")) {
|
Section(header: InlineHeader("Debrid services")) {
|
||||||
ForEach(DebridType.allCases, id: \.self) { debridType in
|
ForEach(DebridType.allCases, id: \.self) { debridType in
|
||||||
NavigationLink(
|
NavigationLink {
|
||||||
destination: SettingsDebridInfoView(
|
SettingsDebridInfoView(debridType: debridType)
|
||||||
debridType: debridType
|
} label: {
|
||||||
), label: {
|
HStack {
|
||||||
HStack {
|
Text(debridType.toString())
|
||||||
Text(debridType.toString())
|
Spacer()
|
||||||
Spacer()
|
Text(debridManager.enabledDebrids.contains(debridType) ? "Enabled" : "Disabled")
|
||||||
Text(debridManager.enabledDebrids.contains(debridType) ? "Enabled" : "Disabled")
|
.foregroundColor(.secondary)
|
||||||
.foregroundColor(.secondary)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
)
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Section(header: InlineHeader("Playback services")) {
|
Section(header: InlineHeader("Playback services")) {
|
||||||
NavigationLink(destination: SettingsKodiView(kodiServers: kodiServers), label: {
|
NavigationLink{
|
||||||
|
SettingsKodiView(kodiServers: kodiServers)
|
||||||
|
} label: {
|
||||||
HStack {
|
HStack {
|
||||||
Text("Kodi")
|
Text("Kodi")
|
||||||
Spacer()
|
Spacer()
|
||||||
Text(kodiServers.isEmpty ? "Disabled" : "Enabled")
|
Text(kodiServers.isEmpty ? "Disabled" : "Enabled")
|
||||||
.foregroundColor(.secondary)
|
.foregroundColor(.secondary)
|
||||||
}
|
}
|
||||||
})
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Section(header: InlineHeader("Behavior")) {
|
Section(header: InlineHeader("Behavior")) {
|
||||||
|
|
@ -74,51 +74,25 @@ struct SettingsView: View {
|
||||||
}
|
}
|
||||||
|
|
||||||
Section(header: InlineHeader("Plugin management")) {
|
Section(header: InlineHeader("Plugin management")) {
|
||||||
NavigationLink("Plugin lists", destination: SettingsPluginListView())
|
NavigationLink("Plugin lists") {
|
||||||
|
SettingsPluginListView()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Section(header: InlineHeader("Default actions")) {
|
Section(header: InlineHeader("Default actions")) {
|
||||||
if debridManager.enabledDebrids.count > 0 {
|
if debridManager.enabledDebrids.count > 0 {
|
||||||
NavigationLink(
|
NavigationLink {
|
||||||
destination: DefaultActionPickerView(
|
DefaultActionPickerView(
|
||||||
actionRequirement: .debrid,
|
actionRequirement: .debrid,
|
||||||
defaultAction: $defaultDebridAction.value
|
defaultAction: $defaultDebridAction.value
|
||||||
),
|
)
|
||||||
label: {
|
} label: {
|
||||||
HStack {
|
|
||||||
Text("Debrid action")
|
|
||||||
Spacer()
|
|
||||||
|
|
||||||
Group {
|
|
||||||
switch defaultDebridAction.value {
|
|
||||||
case .none:
|
|
||||||
Text("User choice")
|
|
||||||
case .share:
|
|
||||||
Text("Share")
|
|
||||||
case .kodi:
|
|
||||||
Text("Kodi")
|
|
||||||
case let .custom(name, _):
|
|
||||||
Text(name)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.foregroundColor(.secondary)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
NavigationLink(
|
|
||||||
destination: DefaultActionPickerView(
|
|
||||||
actionRequirement: .magnet,
|
|
||||||
defaultAction: $defaultMagnetAction.value
|
|
||||||
),
|
|
||||||
label: {
|
|
||||||
HStack {
|
HStack {
|
||||||
Text("Magnet action")
|
Text("Debrid action")
|
||||||
Spacer()
|
Spacer()
|
||||||
|
|
||||||
Group {
|
Group {
|
||||||
switch defaultMagnetAction.value {
|
switch defaultDebridAction.value {
|
||||||
case .none:
|
case .none:
|
||||||
Text("User choice")
|
Text("User choice")
|
||||||
case .share:
|
case .share:
|
||||||
|
|
@ -132,12 +106,38 @@ struct SettingsView: View {
|
||||||
.foregroundColor(.secondary)
|
.foregroundColor(.secondary)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
}
|
||||||
|
|
||||||
|
NavigationLink {
|
||||||
|
DefaultActionPickerView(
|
||||||
|
actionRequirement: .magnet,
|
||||||
|
defaultAction: $defaultMagnetAction.value
|
||||||
|
)
|
||||||
|
} label: {
|
||||||
|
HStack {
|
||||||
|
Text("Magnet action")
|
||||||
|
Spacer()
|
||||||
|
|
||||||
|
Group {
|
||||||
|
switch defaultMagnetAction.value {
|
||||||
|
case .none:
|
||||||
|
Text("User choice")
|
||||||
|
case .share:
|
||||||
|
Text("Share")
|
||||||
|
case .kodi:
|
||||||
|
Text("Kodi")
|
||||||
|
case let .custom(name, _):
|
||||||
|
Text(name)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.foregroundColor(.secondary)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Section(header: InlineHeader("Backups")) {
|
Section(header: InlineHeader("Backups")) {
|
||||||
NavigationLink(destination: BackupsView()) {
|
NavigationLink("Backups") {
|
||||||
Text("Backups")
|
BackupsView()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -145,17 +145,26 @@ struct SettingsView: View {
|
||||||
Toggle(isOn: $autoUpdateNotifs) {
|
Toggle(isOn: $autoUpdateNotifs) {
|
||||||
Text("Show update alerts")
|
Text("Show update alerts")
|
||||||
}
|
}
|
||||||
NavigationLink("Version history", destination: SettingsAppVersionView())
|
|
||||||
|
NavigationLink("Version history") {
|
||||||
|
SettingsAppVersionView()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Section(header: InlineHeader("Information")) {
|
Section(header: InlineHeader("Information")) {
|
||||||
ListRowLinkView(text: "Donate", link: "https://ko-fi.com/kingbri")
|
ListRowLinkView(text: "Donate", link: "https://ko-fi.com/kingbri")
|
||||||
ListRowLinkView(text: "Report issues", link: "https://github.com/bdashore3/Ferrite/issues")
|
ListRowLinkView(text: "Report issues", link: "https://github.com/bdashore3/Ferrite/issues")
|
||||||
NavigationLink("About", destination: AboutView())
|
|
||||||
|
NavigationLink("About") {
|
||||||
|
AboutView()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Section(header: InlineHeader("Debug")) {
|
Section(header: InlineHeader("Debug")) {
|
||||||
NavigationLink("Logs", destination: SettingsLogView())
|
NavigationLink("Logs") {
|
||||||
|
SettingsLogView()
|
||||||
|
}
|
||||||
|
|
||||||
Toggle("Show error alerts", isOn: $showErrorToasts)
|
Toggle("Show error alerts", isOn: $showErrorToasts)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue