diff --git a/app/src/main/kotlin/com/example/myapplication/screens/SearchScreen.kt b/app/src/main/kotlin/com/example/myapplication/screens/SearchScreen.kt index 7d6f984..af926e6 100644 --- a/app/src/main/kotlin/com/example/myapplication/screens/SearchScreen.kt +++ b/app/src/main/kotlin/com/example/myapplication/screens/SearchScreen.kt @@ -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() } 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 ───────────────────────────────────────────────────────