package Ġfi . ket j us ov ell us . ket j up ilo tti . on boarding Ċ Ċ import Ġandroid . content . SharedPreferences Ċ import Ġandroidx . lifecycle . Mutable LiveData Ċ import Ġandroidx . lifecycle . ViewModel Ċ import Ġfi . ket j us ov ell us . ket j up ilo tti . utils . Preferences Constants Ċ Ċ class ĠOn boarding ViewModel ( ĊĠĠĠ Ġprivate Ġval Ġshared Preferences : ĠSharedPreferences Ċ ) Ġ: ĠViewModel () Ġ{ ĊĊĠĠĠ Ġval Ġid Valid Ġ= ĠMutable LiveData < Boolean >() ĊĊĠĠĠ Ġfun Ġset On boarding Completed ( completed : ĠBoolean ) Ġ= ĊĠĠĠĠĠĠĠ Ġshared Preferences . edit (). put Boolean ( Preferences Constants . PRE F _ ON BOARD ING _ KEY , Ġcompleted ). apply () ĊĊĠĠĠ Ġfun Ġon boarding Completed (): ĠBoolean Ġ= ĊĠĠĠĠĠĠĠ Ġshared Preferences . getBoolean ( Preferences Constants . PRE F _ ON BOARD ING _ KEY , Ġfalse ) ĊĊĠĠĠ Ġfun Ġsave E ph ID test Prefix ( prefix : ĠString ) Ġ= ĊĠĠĠĠĠĠĠ Ġshared Preferences . edit (). putString ( Preferences Constants . PRE F _ E PH ID _ PREFIX , Ġprefix ). apply () ĊĊĠĠĠ Ġfun Ġvalidate ID ( id : ĠCharSequence ?) Ġ{ ĊĠĠĠĠĠĠĠ Ġval ĠisValid Ġ= Ġ( id ?. length Ġ== Ġ 4 ) ĊĠĠĠĠĠĠĠ Ġif Ġ( isValid ) Ġsave E ph ID test Prefix ( id . toString ()) ĊĠĠĠĠĠĠĠ Ġid Valid . value Ġ= ĠisValid ĊĠĠĠ Ġ} Ċ } Ċ