package Ġcom . av test app . android . android base . utils Ċ Ċ import Ġcom . av test app . android . android base . Pref Keys Ċ import Ġcom . av test app . android . android base . av _ test . models . Book Marked Questions Ċ import Ġcom . av test app . android . android base . av _ test . models . Current Session Details Ċ import Ġcom . av test app . android . android base . av _ test . models . Current Session Questions Ċ import Ġcom . av test app . android . android base . av _ test . models . response . Login SignUp Response Ċ import Ġcom . av test app . android . android base . av _ test . models . response . Option Ċ import Ġcom . av test app . android . android base . av _ test . models . response . Profile Response Ċ import Ġjava . util .* Ċ import Ġjavax . inject . Inject Ċ Ċ class ĠCommon Shared Prefs Ġ@ Inject Ġconstructor ( val Ġprefs Utils : ĠP refs Utils ) Ġ{ ĊĊĊĊĠĠĠ Ġfun Ġsave If User Has LoggedIn Before ( user LoggedIn Before : ĠBoolean Ġ= Ġtrue ) Ġ{ ĊĠĠĠĠĠĠĠ Ġif Ġ( prefs Utils . does Contain ( Pref Keys . HAS _ LOG GED _ IN _ BEFORE )) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġprefs Utils . remove Pref ( Pref Keys . HAS _ LOG GED _ IN _ BEFORE ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġprefs Utils . put Boolean ( Pref Keys . HAS _ LOG GED _ IN _ BEFORE , Ġuser LoggedIn Before ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġget If User Has LoggedIn Before (): ĠBoolean Ġ= ĊĠĠĠĠĠĠĠ Ġprefs Utils . getBoolean ( Pref Keys . HAS _ LOG GED _ IN _ BEFORE , Ġfalse ) ĊĊĠĠĠ Ġfun ĠgetUser Profile ( from Just Profile : ĠBoolean Ġ= Ġfalse ): ĠProfile Response ? Ġ{ ĊĠĠĠĠĠĠĠ Ġreturn Ġif Ġ( from Just Profile Ġ&& Ġprefs Utils . does Contain ( Pref Keys . USER _ PROFILE _ SINGLE )) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġprefs Utils . get Pref As Object ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠPref Keys . USER _ PROFILE _ SINGLE , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠProfile Response :: class . java ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠ Ġ} Ġelse Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġprefs Utils . get Pref As Object ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠPref Keys . USER _ PROFILE , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠLogin SignUp Response :: class . java ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ). profile ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun ĠgetLast U Ser Email (): ĠString ? Ġ= Ġprefs Utils . getString ( Pref Keys . LAST _ USER _ EMAIL , Ġ"") ĊĊĠĠĠ Ġfun Ġshuffle Pract ice Questions ( shuffle Pract ice Questions : ĠBoolean ) Ġ{ ĊĠĠĠĠĠĠĠ Ġif Ġ( prefs Utils . does Contain ( Pref Keys . PR ACT ICE _ SH UFF LE _ QUEST IONS )) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġprefs Utils . remove Pref ( Pref Keys . PR ACT ICE _ SH UFF LE _ QUEST IONS ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġprefs Utils . put Boolean ( Pref Keys . PR ACT ICE _ SH UFF LE _ QUEST IONS , Ġshuffle Pract ice Questions ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġget If User W ants Pract ice Questions Sh uffled (): ĠBoolean Ġ= ĊĠĠĠĠĠĠĠ Ġprefs Utils . getBoolean ( Pref Keys . PR ACT ICE _ SH UFF LE _ QUEST IONS , Ġfalse ) ĊĊĠĠĠ Ġfun Ġshuffle Study Questions ( shuffle Study Questions : ĠBoolean ) Ġ{ ĊĠĠĠĠĠĠĠ Ġif Ġ( prefs Utils . does Contain ( Pref Keys . ST UD Y _ SH UFF LE _ QUEST IONS )) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġprefs Utils . remove Pref ( Pref Keys . ST UD Y _ SH UFF LE _ QUEST IONS ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġprefs Utils . put Boolean ( Pref Keys . ST UD Y _ SH UFF LE _ QUEST IONS , Ġshuffle Study Questions ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġget If User W ants Study Questions Sh uffled (): ĠBoolean Ġ= ĊĠĠĠĠĠĠĠ Ġprefs Utils . getBoolean ( Pref Keys . ST UD Y _ SH UFF LE _ QUEST IONS , Ġfalse ) ĊĊĠĠĠ Ġfun Ġshow Only Answers For Study Sessions ( show Only Answer : ĠBoolean ) Ġ{ ĊĠĠĠĠĠĠĠ Ġif Ġ( prefs Utils . does Contain ( Pref Keys . SHOW _ ONLY _ AN SW ERS _ FOR _ ST UD Y _ QUEST IONS )) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġprefs Utils . remove Pref ( Pref Keys . SHOW _ ONLY _ AN SW ERS _ FOR _ ST UD Y _ QUEST IONS ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġprefs Utils . put Boolean ( Pref Keys . SHOW _ ONLY _ AN SW ERS _ FOR _ ST UD Y _ QUEST IONS , Ġshow Only Answer ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġget Show Only Answers For Study Questions (): ĠBoolean Ġ= ĊĠĠĠĠĠĠĠ Ġprefs Utils . getBoolean ( Pref Keys . SHOW _ ONLY _ AN SW ERS _ FOR _ ST UD Y _ QUEST IONS , Ġfalse ) ĊĊĊĠĠĠ Ġfun Ġsave Current Session ( current Session Questions : ĠCurrent Session Questions ) Ġ{ ĊĠĠĠĠĠĠĠ Ġif Ġ( prefs Utils . does Contain ( Pref Keys . CURRENT _ QUEST IONS _ SESSION S )) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġprefs Utils . remove Pref ( Pref Keys . CURRENT _ QUEST IONS _ SESSION S ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġprefs Utils . put Object ( Pref Keys . CURRENT _ QUEST IONS _ SESSION S , Ġcurrent Session Questions ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun ĠgetCurrent Session (): ĠCurrent Session Questions ? Ġ= ĊĠĠĠĠĠĠĠ Ġprefs Utils . get Pref As Object ( ĊĠĠĠĠĠĠĠĠĠĠĠ ĠPref Keys . CURRENT _ QUEST IONS _ SESSION S , ĊĠĠĠĠĠĠĠĠĠĠĠ ĠCurrent Session Questions :: class . java ĊĠĠĠĠĠĠĠ Ġ) ĊĠĠĠ Ġfun Ġsave Current Study Session ( current Session Questions : ĠCurrent Session Questions ) Ġ{ ĊĠĠĠĠĠĠĠ Ġif Ġ( prefs Utils . does Contain ( Pref Keys . CURRENT _ ST UD Y _ QUEST IONS _ SESSION S )) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġprefs Utils . remove Pref ( Pref Keys . CURRENT _ ST UD Y _ QUEST IONS _ SESSION S ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġprefs Utils . put Object ( Pref Keys . CURRENT _ ST UD Y _ QUEST IONS _ SESSION S , Ġcurrent Session Questions ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun ĠgetCurrent Study Session (): ĠCurrent Session Questions ? Ġ= ĊĠĠĠĠĠĠĠ Ġprefs Utils . get Pref As Object ( ĊĠĠĠĠĠĠĠĠĠĠĠ ĠPref Keys . CURRENT _ ST UD Y _ QUEST IONS _ SESSION S , ĊĠĠĠĠĠĠĠĠĠĠĠ ĠCurrent Session Questions :: class . java ĊĠĠĠĠĠĠĠ Ġ) ĊĊĠĠĠ Ġfun Ġsave Current Session Details ( current Session Details : ĠCurrent Session Details ) Ġ{ ĊĠĠĠĠĠĠĠ Ġif Ġ( prefs Utils . does Contain ( Pref Keys . CURRENT _ QUEST IONS _ SESSION S _ DETAILS )) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġprefs Utils . remove Pref ( Pref Keys . CURRENT _ QUEST IONS _ SESSION S _ DETAILS ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġprefs Utils . put Object ( Pref Keys . CURRENT _ QUEST IONS _ SESSION S _ DETAILS , Ġcurrent Session Details ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun ĠgetCurrent Session Details (): ĠCurrent Session Details ? Ġ= ĊĠĠĠĠĠĠĠ Ġprefs Utils . get Pref As Object ( ĊĠĠĠĠĠĠĠĠĠĠĠ ĠPref Keys . CURRENT _ QUEST IONS _ SESSION S _ DETAILS , ĊĠĠĠĠĠĠĠĠĠĠĠ ĠCurrent Session Details :: class . java ĊĠĠĠĠĠĠĠ Ġ) ĊĊĠĠĠ Ġfun Ġsave Current Study Session Details ( current Session Details : ĠCurrent Session Details ) Ġ{ ĊĠĠĠĠĠĠĠ Ġif Ġ( prefs Utils . does Contain ( Pref Keys . CURRENT _ ST UD Y _ QUEST IONS _ SESSION S _ DETAILS )) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġprefs Utils . remove Pref ( Pref Keys . CURRENT _ ST UD Y _ QUEST IONS _ SESSION S _ DETAILS ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġprefs Utils . put Object ( Pref Keys . CURRENT _ ST UD Y _ QUEST IONS _ SESSION S _ DETAILS , Ġcurrent Session Details ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun ĠgetCurrent Study Session Details (): ĠCurrent Session Details ? Ġ= ĊĠĠĠĠĠĠĠ Ġprefs Utils . get Pref As Object ( ĊĠĠĠĠĠĠĠĠĠĠĠ ĠPref Keys . CURRENT _ ST UD Y _ QUEST IONS _ SESSION S _ DETAILS , ĊĠĠĠĠĠĠĠĠĠĠĠ ĠCurrent Session Details :: class . java ĊĠĠĠĠĠĠĠ Ġ) ĊĊĠĠĠ Ġfun Ġdelete Pref ( var arg Ġkeys : ĠString ) Ġ{ ĊĠĠĠĠĠĠĠ Ġfor Ġ( key Ġin Ġkeys ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġprefs Utils . remove Pref ( key ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġsave Current Questions For Review ( current Session Questions : ĠCurrent Session Questions ) Ġ{ ĊĠĠĠĠĠĠĠ Ġif Ġ( prefs Utils . does Contain ( Pref Keys . CURRENT _ RE VIEW _ QUEST IONS _ SESSION S )) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġprefs Utils . remove Pref ( Pref Keys . CURRENT _ RE VIEW _ QUEST IONS _ SESSION S ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġprefs Utils . put Object ( Pref Keys . CURRENT _ RE VIEW _ QUEST IONS _ SESSION S , Ġcurrent Session Questions ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun ĠgetCurrent Review Questions (): ĠCurrent Session Questions ? Ġ= ĊĠĠĠĠĠĠĠ Ġprefs Utils . get Pref As Object ( ĊĠĠĠĠĠĠĠĠĠĠĠ ĠPref Keys . CURRENT _ RE VIEW _ QUEST IONS _ SESSION S , ĊĠĠĠĠĠĠĠĠĠĠĠ ĠCurrent Session Questions :: class . java ĊĠĠĠĠĠĠĠ Ġ) ĊĊĠĠĠ Ġfun Ġsave Book marked Questions ( book Marked Questions : ĠBook Marked Questions ) Ġ{ ĊĠĠĠĠĠĠĠ Ġif Ġ( prefs Utils . does Contain ( Pref Keys . BOOK MARK ED _ QUEST IONS )) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġprefs Utils . remove Pref ( Pref Keys . BOOK MARK ED _ QUEST IONS ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġprefs Utils . put Object ( Pref Keys . BOOK MARK ED _ QUEST IONS , Ġbook Marked Questions ) ĊĠĠĠ Ġ} ĊĊĊĠĠĠ Ġfun Ġget Saved Book Marked (): ĠBook Marked Questions Ġ{ ĊĠĠĠĠĠĠĠ Ġreturn Ġif Ġ( prefs Utils . does Contain ( Pref Keys . BOOK MARK ED _ QUEST IONS )) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġprefs Utils . get Pref As Object ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠPref Keys . BOOK MARK ED _ QUEST IONS , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠBook Marked Questions :: class . java ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠ Ġ} Ġelse Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġbook Marked Questions Ġ= ĠBook Marked Questions ( ArrayList ()) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġsave Book marked Questions ( book Marked Questions ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġbook Marked Questions ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġsave Pract ice Questions ( practice Question Answers : ĠHashMap < String , ĠOption > ){ ĊĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġsave Question Type ( question Type : ĠString ){ ĊĠĠĠĠĠĠĠ Ġif Ġ( prefs Utils . does Contain ( Pref Keys . QUEST ION _ TYPE )) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġprefs Utils . remove Pref ( Pref Keys . QUEST ION _ TYPE ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġprefs Utils . putString ( Pref Keys . QUEST ION _ TYPE , Ġquestion Type ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġget Question Type (): String Ġ= Ġprefs Utils . getString ( Pref Keys . QUEST ION _ TYPE , Ġ"") Ġ?: Ġ"" Ċ }