Multiple servers can be added to Ferrite to playback from any Kodi server that the user wants. This also adds the ability to have friendly names which makes it easier to select what server to play on. Each server shows the user whether it's online or not through Kodi's JSONRPC ping method. Signed-off-by: kingbri <bdashore3@proton.me>
77 lines
1.6 KiB
Swift
77 lines
1.6 KiB
Swift
//
|
|
// ListRowViews.swift
|
|
// Ferrite
|
|
//
|
|
// Created by Brian Dashore on 7/26/22.
|
|
//
|
|
// List row button, text, and link boilerplate
|
|
//
|
|
|
|
import SwiftUI
|
|
|
|
struct ListRowLinkView: View {
|
|
let text: String
|
|
let link: String
|
|
|
|
var body: some View {
|
|
HStack {
|
|
Link(text, destination: URL(string: link)!)
|
|
.foregroundColor(.primary)
|
|
|
|
Spacer()
|
|
|
|
Image(systemName: "arrow.up.forward.app.fill")
|
|
.foregroundColor(.gray)
|
|
}
|
|
.padding(.trailing, -5)
|
|
}
|
|
}
|
|
|
|
struct ListRowButtonView: View {
|
|
let text: String
|
|
let systemImage: String?
|
|
let action: () -> Void
|
|
|
|
init(_ text: String, systemImage: String? = nil, action: @escaping () -> Void) {
|
|
self.text = text
|
|
self.systemImage = systemImage
|
|
self.action = action
|
|
}
|
|
|
|
var body: some View {
|
|
HStack {
|
|
Button(text) {
|
|
action()
|
|
}
|
|
|
|
Spacer()
|
|
|
|
if let imageName = systemImage {
|
|
Image(systemName: imageName)
|
|
.foregroundColor(.gray)
|
|
}
|
|
}
|
|
.padding(.trailing, -5)
|
|
}
|
|
}
|
|
|
|
struct ListRowTextView: View {
|
|
let leftText: String
|
|
var rightText: String?
|
|
var rightSymbol: String?
|
|
|
|
var body: some View {
|
|
HStack {
|
|
Text(leftText)
|
|
|
|
Spacer()
|
|
|
|
if let rightText {
|
|
Text(rightText)
|
|
} else if let rightSymbol {
|
|
Image(systemName: rightSymbol)
|
|
}
|
|
}
|
|
.padding(.trailing, -5)
|
|
}
|
|
}
|