Skip to content

Commit

Permalink
[fix] remove delay in API call
Browse files Browse the repository at this point in the history
  • Loading branch information
rustamsafarovrs committed Jun 25, 2024
1 parent 33a4a2b commit 7b60db9
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
package tj.rsdevteam.inmuslim.data.repositories

import kotlinx.coroutines.delay
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.flow
import tj.rsdevteam.inmuslim.data.api.Api
import tj.rsdevteam.inmuslim.data.constants.Constants
import tj.rsdevteam.inmuslim.data.models.Region
import tj.rsdevteam.inmuslim.data.models.Resource
import tj.rsdevteam.inmuslim.data.preferences.Preferences
Expand Down Expand Up @@ -32,7 +30,6 @@ class RegionRepository
fun getRegions(): Flow<Resource<List<Region>>> = flow {
emit(Resource.InProgress())
val result = api.getRegions()
delay(Constants.MIDDLE_DELAY)
if (result.isSuccess && result.getOrNull()?.result == 0) {
emit(Resource.Success(result.getOrThrow().regions.map { it.toRegion() }))
} else {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
package tj.rsdevteam.inmuslim.data.repositories

import kotlinx.coroutines.delay
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.flow
import tj.rsdevteam.inmuslim.data.api.Api
import tj.rsdevteam.inmuslim.data.constants.Constants
import tj.rsdevteam.inmuslim.data.models.Resource
import tj.rsdevteam.inmuslim.data.models.Timing
import tj.rsdevteam.inmuslim.data.models.api.GetTimingBodyDTO
Expand All @@ -29,7 +27,6 @@ class TimingRepository
fun getTiming(): Flow<Resource<Timing>> = flow {
emit(Resource.InProgress())
val result = api.getTiming(GetTimingBodyDTO(regionId = preferences.getRegionId()))
delay(Constants.MIDDLE_DELAY)
if (result.isSuccess && result.getOrNull()?.result == 0) {
emit(Resource.Success(result.getOrThrow().timing.toTiming()))
} else {
Expand Down

0 comments on commit 7b60db9

Please sign in to comment.