package Ġcom . demo . common . di Ċ Ċ import Ġandroid . content . Context Ċ import Ġandroid . content . SharedPreferences Ċ import Ġcom . demo . common . serializer . Serializer Ċ import Ġcom . demo . common . serializer . Serializer Impl Ċ import Ġcom . demo . common . storage . Setting Storage Ċ import Ġcom . demo . common . storage . Storage Ċ import Ġdagger . Module Ċ import Ġdagger . Provides Ċ import Ġdagger . h ilt . Install In Ċ import Ġdagger . h ilt . android . qual ifiers . ApplicationContext Ċ import Ġdagger . h ilt . components . Singleton Component Ċ import Ġkotlinx . serialization . json . Json Ċ import Ġjavax . inject . Singleton Ċ Ċ @ Module Ċ @ Install In ( Singleton Component :: class ) Ċ class ĠCommon Module Ġ{ ĊĊĠĠĠ Ġ@ Provides ĊĠĠĠ Ġ@ Settings ĊĠĠĠ Ġfun Ġprovide Settings Shared Preference (@ ApplicationContext Ġapp Context : ĠContext ): ĠSharedPreferences Ġ= ĊĠĠĠĠĠĠĠ Ġapp Context . get SharedPreferences (" demo _ settings ", ĠContext . MODE _ PRIVATE ) ĊĊĠĠĠ Ġ@ Provides ĊĠĠĠ Ġ@ Singleton ĊĠĠĠ Ġfun Ġprovide Kotlin Serializer (): ĠJson Ġ= ĠJson Ġ{ ĊĠĠĠĠĠĠĠ Ġencode Defaults Ġ= Ġtrue Ġ// ĠMakes Ġsure Ġdefault Ġfield Ġvalues Ġare Ġencoded ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Provides ĊĠĠĠ Ġ@ Singleton ĊĠĠĠ Ġfun Ġprovide Serializer ( json : ĠJson ): ĠSerializer Ġ= ĠSerializer Impl ( json ) ĊĊĠĠĠ Ġ@ Provides ĊĠĠĠ Ġ@ Settings ĊĠĠĠ Ġ@ Singleton ĊĠĠĠ Ġfun Ġprovide Settings Storage ( serializer : ĠSerializer , Ġ@ Settings Ġshared Preferences : ĠSharedPreferences ): ĠStorage Ġ= ĠSetting Storage ( serializer , Ġshared Preferences ) Ċ }