更新
This commit is contained in:
@@ -1,5 +1,10 @@
|
||||
package com.aiosman.riderpro.utils
|
||||
|
||||
import android.content.Context
|
||||
import coil.ImageLoader
|
||||
import coil.request.CachePolicy
|
||||
import com.aiosman.riderpro.data.api.getUnsafeOkHttpClient
|
||||
|
||||
object Utils {
|
||||
fun generateRandomString(length: Int): String {
|
||||
val allowedChars = ('A'..'Z') + ('a'..'z') + ('0'..'9')
|
||||
@@ -7,4 +12,15 @@ object Utils {
|
||||
.map { allowedChars.random() }
|
||||
.joinToString("")
|
||||
}
|
||||
fun getImageLoader(context: Context): ImageLoader {
|
||||
val okHttpClient = getUnsafeOkHttpClient()
|
||||
return ImageLoader.Builder(context)
|
||||
.okHttpClient(okHttpClient)
|
||||
.diskCachePolicy(CachePolicy.ENABLED)
|
||||
.memoryCachePolicy(CachePolicy.ENABLED)
|
||||
.components {
|
||||
|
||||
}
|
||||
.build()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user