otakusenpai
10/19/2018, 7:55 AModay
10/19/2018, 7:55 AMoverride fun fetchAndSaveFavorites(): Observable<List<WishResponse>> =
carsService.getFavorites().map { favorites ->
database.favoritesDao().wipeTable()
database.favoritesDao().insert(favorites)
favorites
}
insert now accepts List<FavoriteCars> not List<WishResponse> anymore, but the data required to make a FavoriteCar is inside each WishResponseelizarov
10/19/2018, 7:55 AMlaunch {
delay(60000)
// do something after 1 minute
}
otakusenpai
10/19/2018, 7:57 AMotakusenpai
10/19/2018, 7:57 AMelizarov
10/19/2018, 7:59 AMlaunch {
while(true) {
delay(60000)
// do something _every_ minute
}
}
SUPERCILEX
10/19/2018, 8:00 AMwhile(true)
is bad. Should be while(isActive)
so you don't shoot yourself in the foot later cancelling stuffSUPERCILEX
10/19/2018, 8:01 AMdelay
actually handle that for you?elizarov
10/19/2018, 8:01 AMdelay
is cancellable. You can do while(isActive)
but you don’t have to.SUPERCILEX
10/19/2018, 8:02 AM