Skip to content

Commit

Permalink
readme
Browse files Browse the repository at this point in the history
  • Loading branch information
sidsharma2002 authored Sep 11, 2022
1 parent 947cebd commit b1a1683
Showing 1 changed file with 53 additions and 0 deletions.
53 changes: 53 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# SpinWill

A modern and highly customisable library to implement spinwheel feature in your android app which comes packed with inbuilt local database support that allows you to periodically _fetch and cache_ the reward items 🎁.

### How to use:

create and save this injector instance (recommended to be application scoped)

`private val injector by lazy {
SpinWillInjector<SpinWillItem>()
}`

provide the following dependencies to the injector :
1. Application context
2. SpinWillRemoteDatabase
3. SpinWillLocalDatabase (requires SpinWillDbActions incase you are using default local db immpl)
4. SpinWillBitmapLoadUseCase

example :

NOTE : We are assuming SpinWillItem is the reward item model class.

```
injector.init(this, RemoteDatabaseImpl())
// provide localDatabase
injector.setLocalDatabase(
// predefined impl provided by the library
SpinWillLocalDbImpl(daoActions) // provide daoActions to the local db
)
// provide bitmap load usecase
injector.setBitmapLoadUseCase(
// predefined impl provided by the library
SpinWillBitmapLoadUseCaseImpl(
this.applicationContext,
// provide the ItemAdapter
object : WillItemAdapter<SpinWillItem> {
override fun getRewardImageUrl(item: SpinWillItem): String {
return item.rewardImage
}
override fun setRewardBitmap(item: SpinWillItem, bitmap: Bitmap) {
item.rewardBitmap = bitmap
}
})
)
}
```




0 comments on commit b1a1683

Please sign in to comment.