package Ġcom . example . my application . di . module Ċ Ċ import Ġandroid . content . Context Ċ import Ġandroid . content . SharedPreferences Ċ import Ġcom . example . my application . data . persistent . Local KeyValue Storage Ċ import Ġcom . squareup . mos hi . M oshi Ċ 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 Ġjavax . inject . Singleton Ċ Ċ @ Module Ċ @ Install In ( Singleton Component :: class ) Ċ object ĠPers istency Module Ġ{ ĊĊĠĠĠ Ġ@ Provides ĊĠĠĠ Ġ@ Singleton ĊĠĠĠ Ġfun Ġprovide SharedPreferences (@ ApplicationContext Ġcontext : ĠContext ): ĠSharedPreferences Ġ= ĊĠĠĠĠĠĠĠ Ġcontext . get SharedPreferences ( ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ" our _ awesome _ app _ local _ key _ value _ storage ", ĊĠĠĠĠĠĠĠĠĠĠĠ ĠContext . MODE _ PRIVATE ĊĠĠĠĠĠĠĠ Ġ) ĊĊĠĠĠ Ġ@ Provides ĊĠĠĠ Ġ@ Singleton ĊĠĠĠ Ġfun Ġprovide Local KeyValue Storage ( pref : ĠSharedPreferences , Ġm oshi : ĠM oshi ): ĠLocal KeyValue Storage Ġ= ĊĠĠĠĠĠĠĠ ĠLocal KeyValue Storage ( pref , Ġm oshi ) Ċ }