Fix an error on a misconstruct author data.
This commit is contained in:
parent
4c98949bb6
commit
a26fa26400
2 changed files with 18 additions and 1 deletions
|
|
@ -1,6 +1,10 @@
|
||||||
package com.pixelized.biblib.network.factory
|
package com.pixelized.biblib.network.factory
|
||||||
|
|
||||||
import com.pixelized.biblib.model.book.*
|
import com.pixelized.biblib.model.book.Author
|
||||||
|
import com.pixelized.biblib.model.book.Book
|
||||||
|
import com.pixelized.biblib.model.book.Genre
|
||||||
|
import com.pixelized.biblib.model.book.Language
|
||||||
|
import com.pixelized.biblib.model.book.Series
|
||||||
import com.pixelized.biblib.network.data.response.BookDetailResponse
|
import com.pixelized.biblib.network.data.response.BookDetailResponse
|
||||||
import com.pixelized.biblib.network.data.response.BookListResponse
|
import com.pixelized.biblib.network.data.response.BookListResponse
|
||||||
import com.pixelized.biblib.utils.exception.missingField
|
import com.pixelized.biblib.utils.exception.missingField
|
||||||
|
|
@ -45,6 +49,17 @@ class BookFactory(
|
||||||
authorName.joinToString { it },
|
authorName.joinToString { it },
|
||||||
authorSort.joinToString { it })
|
authorSort.joinToString { it })
|
||||||
)
|
)
|
||||||
|
} else if (authorIdSize == authorSortSize) {
|
||||||
|
val contactedAuthorNames = authorSort.map { sortItem ->
|
||||||
|
authorName.filter { name -> sortItem.contains(name) }
|
||||||
|
}
|
||||||
|
(authorId.indices).map { index ->
|
||||||
|
Author(
|
||||||
|
authorId[index],
|
||||||
|
contactedAuthorNames[index].joinToString { it },
|
||||||
|
authorSort[index]
|
||||||
|
)
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
null
|
null
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
package com.pixelized.biblib.ui.screen.home
|
package com.pixelized.biblib.ui.screen.home
|
||||||
|
|
||||||
import android.app.Application
|
import android.app.Application
|
||||||
|
import android.util.Log
|
||||||
import androidx.compose.runtime.State
|
import androidx.compose.runtime.State
|
||||||
import androidx.compose.runtime.derivedStateOf
|
import androidx.compose.runtime.derivedStateOf
|
||||||
import androidx.compose.runtime.mutableStateOf
|
import androidx.compose.runtime.mutableStateOf
|
||||||
|
|
@ -94,6 +95,7 @@ class BookSearchViewModel @Inject constructor(
|
||||||
bookRepository.update()
|
bookRepository.update()
|
||||||
searchSource?.invalidate()
|
searchSource?.invalidate()
|
||||||
} catch (exception: Exception) {
|
} catch (exception: Exception) {
|
||||||
|
Log.e("BookSearchViewModel", exception.message, exception)
|
||||||
_error.emit(
|
_error.emit(
|
||||||
HomeScreenErrorUio.LibraryUpdate(
|
HomeScreenErrorUio.LibraryUpdate(
|
||||||
message = R.string.error_book_update_message,
|
message = R.string.error_book_update_message,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue