package com.alexstyl.specialdates.events.peopleevents

import com.alexstyl.specialdates.events.namedays.NamedayDatabaseRefresher
import io.reactivex.Observable
import io.reactivex.Scheduler

open class PeopleEventsUpdater(private val peopleEventsStaticEventsRefresher: PeopleEventsStaticEventsRefresher,
                               private val namedayDatabaseRefresher: NamedayDatabaseRefresher,
                               private val viewRefresher: UpcomingEventsViewRefresher,
                               private val workScheduler: Scheduler,
                               private val resultScheduler: Scheduler) {

    open fun updateEvents() = Observable.fromCallable {
        peopleEventsStaticEventsRefresher.rebuildEvents()
        namedayDatabaseRefresher.refreshNamedaysIfEnabled()
    }
            .subscribeOn(workScheduler)
            .observeOn(resultScheduler)
            .map {
                viewRefresher.refreshViews()
            }!!
}

package com.alexstyl.specialdates.events.peopleevents

import com.alexstyl.specialdates.events.namedays.NamedayDatabaseRefresher
import io.reactivex.Observable
import io.reactivex.Scheduler

open class PeopleEventsUpdater(private val peopleEventsStaticEventsRefresher: PeopleEventsStaticEventsRefresher,
                               private val namedayDatabaseRefresher: NamedayDatabaseRefresher,
                               private val viewRefresher: UpcomingEventsViewRefresher,
                               private val peopleSettings: UpcomingEventsSettings,
                               private val workScheduler: Scheduler,
                               private val resultScheduler: Scheduler) {

    open fun updateEvents() = Observable.fromCallable {
        peopleEventsStaticEventsRefresher.rebuildEvents()
        namedayDatabaseRefresher.refreshNamedaysIfEnabled()
        peopleSettings.markEventsAsInitialised()
    }
            .subscribeOn(workScheduler)
            .observeOn(resultScheduler)
            .map {
                viewRefresher.refreshViews()
            }!!
}

Mark events as initialised after done
Mark events as initialised after done

alexstyl/Memento-Namedays,alexstyl/Memento-Calendar,auricgoldfinger/Memento-Namedays,alexstyl/Memento-Namedays,alexstyl/Memento-Calendar,auricgoldfinger/Memento-Namedays,alexstyl/Memento-Calendar