package Ġcom . nie k am . smart meter . tools . ads Ċ Ċ import Ġandroid . content . Context Ċ import Ġandroidx . core . content . edit Ċ import Ġcom . nie k am . smart meter . Build Config Ċ import Ġcom . nie k am . smart meter . tools . now Ċ Ċ fun ĠContext . get Ad Preferences (): ĠA ds Preferences Ġ= ĠA ds Preferences ( this ) Ċ Ċ private Ġconst Ġval ĠAD _ PRE FS Ġ= Ġ"${ Build Config . APPLICATION _ ID }. AD _ PRE FS " Ċ private Ġconst Ġval ĠSHOW _ ADS Ġ= Ġ"${ Build Config . APPLICATION _ ID }. SHOW _ ADS " Ċ private Ġconst Ġval ĠFIRST _ USAGE Ġ= Ġ"${ Build Config . APPLICATION _ ID }. FIRST _ USAGE " Ċ Ċ class ĠA ds Preferences ( context : ĠContext ) Ġ{ ĊĠĠĠ Ġprivate Ġval Ġprefs Ġ= Ġcontext . get SharedPreferences ( AD _ PRE FS , ĠContext . MODE _ PRIVATE ) ĊĊĠĠĠ Ġfun Ġshould Show Ad (): ĠBoolean Ġ= Ġprefs . getBoolean ( SHOW _ ADS , Ġfalse ) ĊĠĠĠ Ġfun Ġfirst Usage Timestamp (): ĠLong Ġ= Ġprefs . getLong ( FIRST _ USAGE , Ġ 0 ) ĊĊĠĠĠ Ġfun Ġsave First Usage Timestamp () Ġ{ ĊĠĠĠĠĠĠĠ Ġprefs . edit Ġ{ Ġput Long ( FIRST _ USAGE , Ġnow ()) Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġenable Ads () Ġ= Ġprefs . edit Ġ{ Ġput Boolean ( SHOW _ ADS , Ġtrue ) Ġ} Ċ }