package Ġcom . inner circle software . trim io . settings Ċ Ċ import Ġcom . f 2 pr ate ek . rx . preferences 2 . Preference Ċ import Ġcom . f 2 pr ate ek . rx . preferences 2 . Rx SharedPreferences Ċ import Ġcom . inner circle software . trim io . trim . Partition Ċ import Ġcom . inner circle software . trim io . trim . periodic . Frequency Ċ import Ġcom . inner circle software . trim io . trim . to Partition Ċ import Ġio . reactivex . Back pressure Strategy Ċ import Ġio . reactivex . Comp letable Ċ import Ġio . reactivex . Flow able Ċ import Ġjavax . inject . Inject Ċ Ċ interface ĠPreference Manager Ġ{ ĊĊĠĠĠ Ġfun Ġset Periodic Trim Frequency ( frequency : ĠFrequency ): ĠComp letable ĊĊĠĠĠ Ġfun Ġget Periodic Trim Frequency (): ĠFlow able < Frequency > ĊĊĠĠĠ Ġfun ĠsetSelected Partitions ( partitions : ĠList < Partition >): ĠComp letable ĊĊĠĠĠ Ġfun Ġget Selected Partitions (): ĠFlow able < List < Partition >> Ċ Ċ } Ċ Ċ class ĠPreference ManagerImpl Ġ@ Inject Ġconstructor ( private Ġval Ġpreferences : ĠRx SharedPreferences ) Ġ: ĠPreference Manager Ġ{ ĊĊĠĠĠ Ġprivate Ġval Ġtrim Frequency : ĠPreference < Frequency > ĊĠĠĠĠĠĠĠ Ġget () Ġ= Ġpreferences . get Enum ( PERIOD IC _ TRIM _ FREQ UENCY _ KEY , ĠPER IOD IC _ TRIM _ FREQ UENCY _ DEFAULT , ĠFrequency :: class . java ) ĊĊĠĠĠ Ġprivate Ġval Ġselected Partitions : ĠPreference < Set < String >> ĊĠĠĠĠĠĠĠ Ġget () Ġ= Ġpreferences . getString Set ( ĊĠĠĠĠĠĠĠĠĠĠĠ ĠPER IOD IC _ TRIM _ PARTITION S _ KEY , ĊĠĠĠĠĠĠĠĠĠĠĠ ĠPER IOD IC _ TRIM _ PARTITION S _ DEFAULT . map Ġ{ Ġit . directory Ġ}. toSet () ĊĠĠĠĠĠĠĠ Ġ) ĊĊĠĠĠ Ġoverride Ġfun Ġget Periodic Trim Frequency (): ĠFlow able < Frequency > Ġ{ ĊĠĠĠĠĠĠĠ Ġreturn Ġtrim Frequency . as Observable (). to Flow able ( Back pressure Strategy . LATE ST ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġset Periodic Trim Frequency ( frequency : ĠFrequency ): ĠComp letable Ġ{ ĊĠĠĠĠĠĠĠ Ġreturn ĠComp letable . from Action Ġ{ Ġtrim Frequency . set ( frequency ) Ġ} ĊĠĠĠ Ġ} ĊĊĊĠĠĠ Ġoverride Ġfun Ġget Selected Partitions (): ĠFlow able < List < Partition >> Ġ{ ĊĠĠĠĠĠĠĠ Ġreturn Ġselected Partitions . as Observable (). to Flow able ( Back pressure Strategy . LATE ST ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. map Ġ{ Ġit . toList (). map Ġ{ Ġpartition String Ġ-> Ġpartition String . to Partition () !! Ġ} Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun ĠsetSelected Partitions ( partitions : ĠList < Partition >): ĠComp letable Ġ{ ĊĠĠĠĠĠĠĠ Ġreturn ĠComp letable . from Action Ġ{ Ġselected Partitions . set ( partitions . map Ġ{ Ġit . directory Ġ}. toSet ()) Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġcompanion Ġobject Ġ{ ĊĊĠĠĠĠĠĠĠ Ġconst Ġval ĠPER IOD IC _ TRIM _ FREQ UENCY _ KEY Ġ= Ġ" PERIOD IC _ TRIM _ FREQ UENCY _ KEY " ĊĠĠĠĠĠĠĠ Ġval ĠPER IOD IC _ TRIM _ FREQ UENCY _ DEFAULT Ġ= ĠFrequency . WEEK LY ĊĊĠĠĠĠĠĠĠ Ġconst Ġval ĠPER IOD IC _ TRIM _ PARTITION S _ KEY Ġ= Ġ" PERIOD IC _ TRIM _ PARTITION S _ KEY " ĊĠĠĠĠĠĠĠ Ġval ĠPER IOD IC _ TRIM _ PARTITION S _ DEFAULT Ġ= Ġset Of ( Partition . Cache , ĠPartition . Data ) ĊĠĠĠ Ġ} Ċ } Ċ