mirror of
https://github.com/KRTirtho/spotube.git
synced 2026-09-20 14:44:00 +00:00
fix(plugin): handle service closure exception during authentication check
This commit is contained in:
parent
0a76abba65
commit
11cc5e2457
@ -676,16 +676,20 @@ fun PluginScreen(
|
|||||||
val service =
|
val service =
|
||||||
selectedService ?: return@LaunchedEffect
|
selectedService ?: return@LaunchedEffect
|
||||||
|
|
||||||
|
try {
|
||||||
|
service.use {
|
||||||
|
val pluginRequiresAuth =
|
||||||
|
coreAPI.requiresAuthentication
|
||||||
|
requiresAuth = pluginRequiresAuth
|
||||||
|
if (!pluginRequiresAuth) return@use
|
||||||
|
|
||||||
service.use {
|
coreAPI.loggedInFlow.collect { loggedIn ->
|
||||||
val pluginRequiresAuth =
|
isLoggedIn = loggedIn
|
||||||
coreAPI.requiresAuthentication
|
}
|
||||||
requiresAuth = pluginRequiresAuth
|
|
||||||
if (!pluginRequiresAuth) return@use
|
|
||||||
|
|
||||||
coreAPI.loggedInFlow.collect { loggedIn ->
|
|
||||||
isLoggedIn = loggedIn
|
|
||||||
}
|
}
|
||||||
|
} catch (_: Exception) {
|
||||||
|
// Service may have been stopped/closed
|
||||||
|
// concurrently when the plugin selection changed
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user