Files
yattee/Yattee/Services/Credentials/InstanceCredentialsManager.swift
Arkadiusz Fal 4770bbe3b9 Remove dead code found by Periphery on all platforms
Delete declarations that Periphery reports unused on every platform that
compiles them (iOS, macOS, tvOS), including nine views used only by their
own previews. Platform-gated code still used on another platform, device-
only MPV render paths, migration models, CloudKit record names, App
Intents metadata and unused parameters are kept.
2026-10-08 23:57:56 +02:00

36 lines
1.4 KiB
Swift

//
// InstanceCredentialsManager.swift
// Yattee
//
// Protocol defining the common interface for instance-specific credentials management.
// Both InvidiousCredentialsManager and PipedCredentialsManager conform to this protocol.
//
import Foundation
/// Protocol for instance-specific credentials management.
/// Provides a unified interface for storing and retrieving authentication credentials
/// across different instance types (Invidious, Piped, etc.).
@MainActor
protocol InstanceCredentialsManager: AnyObject, Observable {
/// Stores a credential (SID for Invidious, token for Piped) for an instance.
/// - Parameters:
/// - credential: The credential value to store
/// - instance: The instance to associate the credential with
func setCredential(_ credential: String, for instance: Instance)
/// Retrieves the stored credential for an instance.
/// - Parameter instance: The instance to retrieve the credential for
/// - Returns: The stored credential, or nil if not logged in
func credential(for instance: Instance) -> String?
/// Deletes the stored credential for an instance (logout).
/// - Parameter instance: The instance to log out from
func deleteCredential(for instance: Instance)
/// Checks if an instance has a stored credential.
/// - Parameter instance: The instance to check
/// - Returns: true if logged in, false otherwise
func isLoggedIn(for instance: Instance) -> Bool
}