package Ġcom . f ager berg . j ason . profile . repository Ċ Ċ import Ġcom . f ager berg . j ason . common . android . N ights Out Activity Ċ import Ġcom . f ager berg . j ason . common . android . N ights Out SharedPreferences Ċ import Ġcom . f ager berg . j ason . common . android . getN ights Out SharedPreferences Ċ import Ġcom . f ager berg . j ason . common . models . Dr ink Ċ import Ġcom . f ager berg . j ason . common . models . Weight Measurement Ċ import Ġcom . wit . j ason f ager berg . n ights out . db . FA V OR ITES _ TABLE Ċ import Ġcom . wit . j ason f ager berg . n ights out . db . Simple Database Manager Ċ import Ġio . reactivex . Observable Ċ Ċ class ĠProfile Fragment Repository ( private Ġval Ġactivity : ĠN ights Out Activity ) Ġ{ ĊĊĠĠĠ Ġprivate Ġlateinit Ġvar Ġshared Preferences : ĠN ights Out SharedPreferences ĊĠĠĠ Ġprivate Ġval Ġdatabase Manager Ġ= ĠSimple Database Manager ( context Ġ= Ġactivity ) ĊĊĠĠĠ Ġfun Ġget Shared Prefs (): ĠObservable < N ights Out SharedPreferences > Ġ= ĊĠĠĠĠĠĠĠ ĠObservable . just ( activity . getN ights Out SharedPreferences ()). do On Next Ġ{ Ġshared Preferences Ġ= Ġit Ġ} ĊĊĠĠĠ Ġfun Ġget F avorites () Ġ= ĊĠĠĠĠĠĠĠ ĠObservable . just ( database Manager . read Favorite Dr inks ()) ĊĊĠĠĠ Ġfun Ġclear F avorites () Ġ= ĊĠĠĠĠĠĠĠ ĠObservable . just ( database Manager . delete Rows In Table ( tableName Ġ= ĠF AV OR ITES _ TABLE )) ĊĊĠĠĠ Ġfun Ġsave Shared Prefs ( ĊĠĠĠĠĠĠĠ Ġsex : ĠBoolean , ĊĠĠĠĠĠĠĠ Ġweight : ĠDouble , ĊĠĠĠĠĠĠĠ Ġweight Measurement : ĠWeight Measurement ĊĠĠĠ Ġ): ĠObservable < N ights Out SharedPreferences > Ġ= ĊĠĠĠĠĠĠĠ ĠObservable . just ( ĊĠĠĠĠĠĠĠĠĠĠĠ Ġshared Preferences . update ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġsex Ġ= Ġsex , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġweight Ġ= Ġweight , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġweight Measurement Ġ= Ġweight Measurement ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠ Ġ). do On Next Ġ{ Ġshared Preferences Ġ= Ġit Ġ} ĊĊĠĠĠ Ġfun Ġremove Favorite Dr ink ( dr ink : ĠD rink ) Ġ= ĠObservable . just ( ĊĠĠĠĠĠĠĠ Ġdatabase Manager . delete Rows In Table ( FA V OR ITES _ TABLE , Ġ" dr ink _ name =\" ${ dr ink . name }\" ") ĊĠĠĠ Ġ) Ċ Ċ } Ċ