Since protocols can't be observed in SwiftUI, use a roundabout way to check if a user is logged in. Maybe this should be changed in the future, but it works for now. Signed-off-by: kingbri <bdashore3@proton.me>
31 lines
709 B
Swift
31 lines
709 B
Swift
//
|
|
// SettingsDebridLinkView.swift
|
|
// Ferrite
|
|
//
|
|
// Created by Brian Dashore on 11/27/24.
|
|
//
|
|
|
|
import SwiftUI
|
|
|
|
struct SettingsDebridLinkView: View {
|
|
var debridSource: DebridSource
|
|
|
|
// TODO: Use a roundabout state for now
|
|
@State private var isLoggedIn = false
|
|
|
|
var body: some View {
|
|
NavigationLink {
|
|
SettingsDebridInfoView(debridSource: debridSource)
|
|
} label: {
|
|
HStack {
|
|
Text(debridSource.id)
|
|
Spacer()
|
|
Text(isLoggedIn ? "Enabled" : "Disabled")
|
|
.foregroundColor(.secondary)
|
|
}
|
|
}
|
|
.onAppear {
|
|
isLoggedIn = debridSource.isLoggedIn
|
|
}
|
|
}
|
|
}
|