回退搜索历史清除确认对话框

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
This commit is contained in:
beyondandClaude Opus 5 committed 2026-09-06 17:12:32 +08:00
1 parent 3a01b42aeb
commit 85da03360d
1 file changed
+4 -19
@@ -58,7 +58,6 @@ import com.example.myapplication.data.EmbyServer
import com.example.myapplication.ui.GlassSearchField
import com.example.myapplication.ui.GlassTokens
import com.example.myapplication.ui.LiquidGlassTopBar
import com.example.myapplication.ui.GlassConfirmDialog
import com.example.myapplication.ui.LumaEmptyStateContainer
import com.example.myapplication.ui.bottomBarContentPadding
import com.example.myapplication.ui.design.LumaColors
@@ -194,7 +193,6 @@ fun SearchScreen(
val completedIds = remember { mutableSetOf<String>() }
var searching by remember { mutableStateOf(false) }
var historyVersion by remember { mutableIntStateOf(0) }
var showClearHistoryConfirm by remember { mutableStateOf(false) }
var lastSearchedQuery by remember { mutableStateOf("") }
// Stabilize LaunchedEffect key — use only server IDs, not list reference
@@ -350,7 +348,10 @@ fun SearchScreen(
query.isBlank() && history.isNotEmpty() -> SearchHistoryList(
history = history,
onSelect = { onQueryChange(it) },
onClear = { showClearHistoryConfirm = true },
onClear = {
clearSearchHistory(context)
historyVersion++
},
)
// ★ KEY FIX: searching = true always shows loading, never error/empty
// This prevents the flash of error/empty state during transitions
@@ -386,22 +387,6 @@ fun SearchScreen(
}
}
}
// Clear history confirmation dialog
if (showClearHistoryConfirm) {
GlassConfirmDialog(
title = stringResource(Res.string.search_history_clear),
message = stringResource(Res.string.search_history_clear),
confirmText = stringResource(Res.string.confirm_delete),
dismissText = stringResource(Res.string.confirm_cancel),
onConfirm = {
clearSearchHistory(context)
historyVersion++
showClearHistoryConfirm = false
},
onDismissRequest = { showClearHistoryConfirm = false },
)
}
}
// ─── Centered Loading ───────────────────────────────────────────────────────