Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- bannersDeletionSubject
- .subscribeOn(Schedulers.io())
- .observeOn(AndroidSchedulers.ui())
- .onErrorReturn { errorBanner }
- .filter { it.id != errorBanner.id }
- .subscribe(
- { banner ->
- val allSectionsWithBanners = ListingSectionRealm()
- .queryAll()
- .filter { section ->
- section.realmSectionItems.any { it.banner != null && it.banner?.id == banner.id }
- }
- .toList()
- allSectionsWithBanners
- .map { sectionWithBanner ->
- sectionWithBanner.realmSectionItems.removeAll {
- it.banner != null && it.banner?.id == banner.id
- }
- }
- allSectionsWithBanners.saveAll()
- },
- { }
- )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement