package Ġcom . dav ion . jet pack . my gps . view model Ċ Ċ import Ġandroid . app . Application Ċ import Ġandroidx . lifecycle . Android ViewModel Ċ import Ġcom . dav ion . jet pack . my gps . Location Tracking Repository Ċ import Ġcom . dav ion . jet pack . my gps . Location Worker Ċ import Ġcom . dav ion . jet pack . my gps . util . Preference Ċ import Ġcom . dav ion . jet pack . my gps . util . Preference Key Ċ import Ġdagger . h ilt . android . lifecycle . H ilt ViewModel Ċ import Ġjavax . inject . Inject Ċ Ċ @ H ilt ViewModel Ċ class ĠHome ViewModel Ġ@ Inject Ġconstructor ( application : ĠApplication , Ġprivate Ġval Ġrepository : ĠLocation Tracking Repository ) Ġ: ĠAndroid ViewModel ( application ){ ĊĠĠĠ Ġfun Ġset Time ( time : ĠLong ) Ġ{ ĊĠĠĠĠĠĠĠ ĠPreference . setString ( Preference Key . STORE _ TIME _ DELAY , Ġtime . toString ()) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġrun Worker () Ġ{ ĊĠĠĠĠĠĠĠ ĠLocation Worker . run At ( getApplication (), Ġrepository ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġcancel Worker () Ġ{ ĊĠĠĠĠĠĠĠ ĠLocation Worker . cancel ( getApplication ()) ĊĠĠĠ Ġ} Ċ }