mirror of
https://github.com/JustinZeus/Wholphin.git
synced 2026-11-06 18:54:49 +01:00
Two more bug fixes (#1521)
## Description Fixes bugs: - Follow up to #1487 since the 404 exception can be ignored in some cases - Fixes a only-on-main-thread exception when clearing the secure flag in some cases ### Related issues Related to #1469 ### Testing Emulator ## Screenshots N/A ## AI or LLM usage None
This commit is contained in:
parent
0842c35e34
commit
e2a6ae6be4
2 changed files with 25 additions and 14 deletions
|
|
@ -50,7 +50,6 @@ import com.github.damontecres.wholphin.services.hilt.AuthOkHttpClient
|
||||||
import com.github.damontecres.wholphin.services.tvprovider.TvProviderSchedulerService
|
import com.github.damontecres.wholphin.services.tvprovider.TvProviderSchedulerService
|
||||||
import com.github.damontecres.wholphin.ui.CoilConfig
|
import com.github.damontecres.wholphin.ui.CoilConfig
|
||||||
import com.github.damontecres.wholphin.ui.LocalImageUrlService
|
import com.github.damontecres.wholphin.ui.LocalImageUrlService
|
||||||
import com.github.damontecres.wholphin.ui.collectLatestIn
|
|
||||||
import com.github.damontecres.wholphin.ui.components.LoadingPage
|
import com.github.damontecres.wholphin.ui.components.LoadingPage
|
||||||
import com.github.damontecres.wholphin.ui.detail.series.SeasonEpisodeIds
|
import com.github.damontecres.wholphin.ui.detail.series.SeasonEpisodeIds
|
||||||
import com.github.damontecres.wholphin.ui.launchDefault
|
import com.github.damontecres.wholphin.ui.launchDefault
|
||||||
|
|
@ -169,16 +168,19 @@ class MainActivity : AppCompatActivity() {
|
||||||
navigationManager.backStack = NavBackStack(startDestination)
|
navigationManager.backStack = NavBackStack(startDestination)
|
||||||
}
|
}
|
||||||
|
|
||||||
viewModel.serverRepository.currentUserFlow.collectLatestIn(lifecycleScope) { user ->
|
viewModel.serverRepository.currentUserFlow
|
||||||
if (user?.hasPin == true) {
|
.onEach { user ->
|
||||||
window?.setFlags(
|
withContext(Dispatchers.Main) {
|
||||||
WindowManager.LayoutParams.FLAG_SECURE,
|
if (user?.hasPin == true) {
|
||||||
WindowManager.LayoutParams.FLAG_SECURE,
|
window.addFlags(WindowManager.LayoutParams.FLAG_SECURE)
|
||||||
)
|
} else {
|
||||||
} else {
|
window.clearFlags(WindowManager.LayoutParams.FLAG_SECURE)
|
||||||
window?.clearFlags(WindowManager.LayoutParams.FLAG_SECURE)
|
}
|
||||||
}
|
}
|
||||||
}
|
}.catch { ex ->
|
||||||
|
Timber.e(ex, "Error with settings flag secure")
|
||||||
|
}.launchIn(lifecycleScope)
|
||||||
|
|
||||||
screensaverService.keepScreenOn
|
screensaverService.keepScreenOn
|
||||||
.onEach { keepScreenOn ->
|
.onEach { keepScreenOn ->
|
||||||
Timber.v("keepScreenOn: %s", keepScreenOn)
|
Timber.v("keepScreenOn: %s", keepScreenOn)
|
||||||
|
|
|
||||||
|
|
@ -553,8 +553,10 @@ class HomeSettingsService
|
||||||
): StringProvider =
|
): StringProvider =
|
||||||
try {
|
try {
|
||||||
api.userLibraryApi
|
api.userLibraryApi
|
||||||
.getItem(itemId = itemId)
|
.getItem(
|
||||||
.content.name
|
userId = serverRepository.currentUser?.id,
|
||||||
|
itemId = itemId,
|
||||||
|
).content.name
|
||||||
?.let {
|
?.let {
|
||||||
if (stringRes == null) {
|
if (stringRes == null) {
|
||||||
StringStringProvider(it)
|
StringStringProvider(it)
|
||||||
|
|
@ -876,8 +878,15 @@ class HomeSettingsService
|
||||||
fields = DefaultItemFields,
|
fields = DefaultItemFields,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// Not using getItemName because we want to throw the 404
|
||||||
val title =
|
val title =
|
||||||
getItemName(null, row.parentId, ResStringProvider(R.string.collection))
|
api.userLibraryApi
|
||||||
|
.getItem(
|
||||||
|
userId = serverRepository.currentUser?.id,
|
||||||
|
itemId = row.parentId,
|
||||||
|
).content.name
|
||||||
|
?.let { StringStringProvider(it) }
|
||||||
|
?: ResStringProvider(R.string.collection)
|
||||||
if (usePaging) {
|
if (usePaging) {
|
||||||
ApiRequestPager(
|
ApiRequestPager(
|
||||||
api,
|
api,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue