Advertisement
Guest User

Untitled

a guest
Jun 20th, 2019
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. bannersDeletionSubject
  2. .subscribeOn(Schedulers.io())
  3. .observeOn(AndroidSchedulers.ui())
  4. .onErrorReturn { errorBanner }
  5. .filter { it.id != errorBanner.id }
  6. .subscribe(
  7. { banner ->
  8. val allSectionsWithBanners = ListingSectionRealm()
  9. .queryAll()
  10. .filter { section ->
  11. section.realmSectionItems.any { it.banner != null && it.banner?.id == banner.id }
  12. }
  13. .toList()
  14.  
  15. allSectionsWithBanners
  16. .map { sectionWithBanner ->
  17. sectionWithBanner.realmSectionItems.removeAll {
  18. it.banner != null && it.banner?.id == banner.id
  19. }
  20. }
  21.  
  22. allSectionsWithBanners.saveAll()
  23. },
  24. { }
  25. )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement