mirror of
https://github.com/NiciDieNase/chaosflix
synced 2024-11-26 22:20:24 +00:00
wrap bookmark and progress import in try/catch
This commit is contained in:
parent
ca82d78f20
commit
5de27c4965
2 changed files with 15 additions and 6 deletions
|
@ -1,4 +1,5 @@
|
|||
# 0.7.0
|
||||
- [debug] im/export also for progess (not only bookmarks)
|
||||
|
||||
# 0.6.0
|
||||
- Fahrplan-Import
|
||||
|
|
|
@ -100,13 +100,21 @@ class PreferencesViewModel(
|
|||
if (favoritesJson == null && progressJson == null) {
|
||||
mutableLiveData.postValue(LiveEvent(State.Done, null, null))
|
||||
} else {
|
||||
favoritesJson?.let {
|
||||
val fromJson = gson.fromJson(it, Array<WatchlistItem>::class.java)
|
||||
fromJson.map { watchlistItemDao.saveItem(it) }
|
||||
try {
|
||||
favoritesJson?.let {
|
||||
val fromJson = gson.fromJson(it, Array<WatchlistItem>::class.java)
|
||||
fromJson.map { watchlistItemDao.saveItem(it) }
|
||||
}
|
||||
} catch (ex: Exception) {
|
||||
Log.e(TAG, "bookmark import failed", ex)
|
||||
}
|
||||
progressJson?.let {
|
||||
val fromJson = gson.fromJson(it, Array<PlaybackProgress>::class.java)
|
||||
fromJson.map { progressItemDao.saveProgress(it) }
|
||||
try {
|
||||
progressJson?.let {
|
||||
val fromJson = gson.fromJson(it, Array<PlaybackProgress>::class.java)
|
||||
fromJson.map { progressItemDao.saveProgress(it) }
|
||||
}
|
||||
} catch (ex: Exception) {
|
||||
Log.e(TAG, "progress import failed", ex)
|
||||
}
|
||||
mutableLiveData.postValue(LiveEvent(State.Done, error = null))
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue