File tree Expand file tree Collapse file tree 1 file changed +2
-9
lines changed
data/src/main/kotlin/com/alish/boilerplate/data/base Expand file tree Collapse file tree 1 file changed +2
-9
lines changed Original file line number Diff line number Diff line change @@ -7,10 +7,9 @@ import androidx.paging.PagingConfig
7
7
import androidx.paging.PagingData
8
8
import com.alish.boilerplate.data.BuildConfig
9
9
import com.alish.boilerplate.data.utils.DataMapper
10
+ import com.alish.boilerplate.data.utils.fromJson
10
11
import com.alish.boilerplate.domain.utils.Either
11
12
import com.alish.boilerplate.domain.utils.NetworkError
12
- import com.squareup.moshi.Moshi
13
- import com.squareup.moshi.kotlin.reflect.KotlinJsonAdapterFactory
14
13
import kotlinx.coroutines.Dispatchers
15
14
import kotlinx.coroutines.flow.*
16
15
import okhttp3.MediaType.Companion.toMediaTypeOrNull
@@ -123,13 +122,7 @@ abstract class BaseRepository {
123
122
* @see Gson.fromJson
124
123
*/
125
124
private inline fun <reified T > ResponseBody?.toApiError (): T ? {
126
- return this ?.string()?.let {
127
- Moshi .Builder ()
128
- .add(KotlinJsonAdapterFactory ())
129
- .build()
130
- .adapter(T ::class .java)
131
- .fromJson(it)
132
- }
125
+ return this ?.string()?.let { fromJson<T >(it) }
133
126
}
134
127
135
128
/* *
You can’t perform that action at this time.
0 commit comments