Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ///// METHOD IN PRESENTER 1
- private fun mapCarsToFavorites(wishList: List<GetWishResponse>) {
- carsRepository.mapCarsToFavorites(wishList, { wishItem, favorite ->
- wishItem.id == favorite.id
- }, { wishItem, _ ->
- wishItem.is_favorite = true
- wishItem
- }).subscribeOn(backgroundScheduler)
- .observeOn(mainScheduler)
- .subscribe(
- { finalMappedWish ->
- (view as? LaunchSearchActivityView)?.openSearchDetailsActivity(
- ArrayList(finalMappedWish)
- )
- (view as? SearchHistoryFragmentView)?.openSearchDetailsActivity(
- ArrayList(finalMappedWish)
- )
- },
- { error ->
- Utils.logToCrashlytics(
- this.javaClass.simpleName,
- "Error getting Car Static Trims ${error.message}"
- )
- }
- )
- }
- /////// METHOD IN PRESENTER 2
- private fun mapCarsToFavorites(mappedDeals: List<HotDealsResponse>) {
- carsRepository.mapCarsToFavorites(mappedDeals, { hotDeal, favorite ->
- hotDeal.id == favorite.id
- }, { hotDeal, _ ->
- hotDeal.favorite = true
- hotDeal
- }).subscribeOn(backgroundScheduler)
- .observeOn(mainScheduler)
- .subscribe(
- { finalMappedDeal ->
- view.displayHotDeals(ArrayList(finalMappedDeal))
- },
- { error ->
- Utils.logToCrashlytics(
- this.javaClass.simpleName,
- "Error getting Car Static Trims ${error.message}"
- )
- }
- )
- }
- When method of first presenter is called at least once, method 2 of presenter 2 starts jumping to it whenever its time to call its own similar method, and the code in both runs
Add Comment
Please, Sign In to add comment