Debrid: Remove redundant logout functions
Logout is now handled in the debrid class itself. Signed-off-by: kingbri <bdashore3@proton.me>
This commit is contained in:
parent
f00ffb1b8c
commit
d54a2b4e37
2 changed files with 1 additions and 40 deletions
|
|
@ -404,45 +404,6 @@ public class DebridManager: ObservableObject {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// MARK: - Logout UI linked functions
|
|
||||||
|
|
||||||
// Common function to delegate what debrid service to logout of
|
|
||||||
public func logoutDebrid(debridType: DebridType) async {
|
|
||||||
switch debridType {
|
|
||||||
case .realDebrid:
|
|
||||||
await logoutRd()
|
|
||||||
case .allDebrid:
|
|
||||||
logoutAd()
|
|
||||||
case .premiumize:
|
|
||||||
logoutPm()
|
|
||||||
}
|
|
||||||
|
|
||||||
// Automatically resets the preferred debrid service if it was set to the logged out service
|
|
||||||
if selectedDebridType == debridType {
|
|
||||||
selectedDebridType = nil
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private func logoutRd() async {
|
|
||||||
await realDebrid.logout()
|
|
||||||
enabledDebrids.remove(.realDebrid)
|
|
||||||
}
|
|
||||||
|
|
||||||
private func logoutAd() {
|
|
||||||
allDebrid.logout()
|
|
||||||
enabledDebrids.remove(.allDebrid)
|
|
||||||
|
|
||||||
logManager?.info(
|
|
||||||
"AllDebrid: Logged out, API key needs to be removed",
|
|
||||||
description: "Please manually delete the AllDebrid API key"
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
private func logoutPm() {
|
|
||||||
premiumize.logout()
|
|
||||||
enabledDebrids.remove(.premiumize)
|
|
||||||
}
|
|
||||||
|
|
||||||
// MARK: - Debrid fetch UI linked functions
|
// MARK: - Debrid fetch UI linked functions
|
||||||
|
|
||||||
// Common function to delegate what debrid service to fetch from
|
// Common function to delegate what debrid service to fetch from
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ struct SettingsDebridInfoView: View {
|
||||||
Button {
|
Button {
|
||||||
Task {
|
Task {
|
||||||
if debridSource.isLoggedIn {
|
if debridSource.isLoggedIn {
|
||||||
//await debridManager.logoutDebrid(debridType: debridType)
|
await debridSource.logout()
|
||||||
} else if !debridSource.authProcessing {
|
} else if !debridSource.authProcessing {
|
||||||
//await debridManager.authenticateDebrid(debridType: debridType, apiKey: nil)
|
//await debridManager.authenticateDebrid(debridType: debridType, apiKey: nil)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue