Guest User

Untitled

a guest
Dec 13th, 2017
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. @Provides
  2. @Singleton
  3. @JvmStatic
  4. internal fun provideHuntPersister(application: Application): Persister<BufferedSource, BarCode> =
  5. FileSystemPersisterFactory.create(application.cacheDir,
  6. { barCode: BarCode -> barCode.type + "/" + barCode.key })
  7.  
  8.  
  9. @Provides
  10. @Singleton
  11. @JvmStatic
  12. internal fun provideHuntStore(api: HuntAPI, moshi: Moshi,
  13. persister: Persister<BufferedSource, BarCode>):
  14. Store<Hunt, BarCode> = StoreBuilder.parsedWithKey<Barcode, BufferedSource, Data>()
  15. .fetcher {api.getData(it.key) }
  16. .parsers(MoshiParserFactory.createSourceParser<Data>(moshi, Data::class.java))
  17. .persister(persister)
  18. .open()
Add Comment
Please, Sign In to add comment