package Ġcom . whats help . ui . history Ċ Ċ import Ġandroidx . lifecycle .* Ċ import Ġcom . whats help . data . db . entity . History Ċ import Ġcom . whats help . data . repo . Wh ats Help Repo Ċ import Ġdagger . h ilt . android . lifecycle . H ilt ViewModel Ċ import Ġkotlinx . coroutines . launch Ċ import Ġjavax . inject . Inject Ċ Ċ @ H ilt ViewModel Ċ class ĠHistory ViewModel Ġ@ Inject Ġconstructor ( private Ġval Ġwh ats Help Repo : ĠWh ats Help Repo ) Ġ: ĠViewModel () Ġ{ ĊĊĠĠĠ Ġval Ġhistory : ĠLive Data < List < History >> Ġ= Ġwh ats Help Repo . get History (). as LiveData () ĊĊĠĠĠ Ġfun Ġdelete History ( position : Int ) Ġ= ĠviewModel Scope . launch Ġ{ ĊĠĠĠĠĠĠĠ Ġhistory . value ?. get ( position )?. let Ġ{ Ġwh ats Help Repo . delete History ( it ) Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġclear History () Ġ= ĠviewModel Scope . launch Ġ{ ĊĠĠĠĠĠĠĠ Ġwh ats Help Repo . clear History () ĊĠĠĠ Ġ} Ċ }