eurofurence / ef-app_android

Eurofurence App (Android version)
MIT License
13 stars 5 forks source link

Don't clear favorites, remove non-existing GUIDs on update #239

Closed lukashaertel closed 6 years ago

lukashaertel commented 6 years ago

Clearing the database should not remove the favorites, as this is likely to be a fix tried by many people if something in the app goes wrong, and favorites should not be lost then. Instead, after an update of all data in the UIS, favorites that are pointing to no longer existing events should be filtered out, i.e.,

events
  .map { it.id }
  .toSet()
  .let {
    eventIds -> faves = faves.filter { it in eventIds }
  }