diff --git a/build-logic/src/main/kotlin/com/ninecraft/booket/convention/ApplicationConstants.kt b/build-logic/src/main/kotlin/com/ninecraft/booket/convention/ApplicationConstants.kt index 9119622b..7dd72860 100644 --- a/build-logic/src/main/kotlin/com/ninecraft/booket/convention/ApplicationConstants.kt +++ b/build-logic/src/main/kotlin/com/ninecraft/booket/convention/ApplicationConstants.kt @@ -6,7 +6,7 @@ internal object ApplicationConstants { const val MIN_SDK = 28 const val TARGET_SDK = 35 const val COMPILE_SDK = 35 - const val VERSION_CODE = 1 + const val VERSION_CODE = 3 const val VERSION_NAME = "1.0.0" const val JAVA_VERSION_INT = 17 val javaVersion = JavaVersion.VERSION_17 diff --git a/core/data/impl/src/main/kotlin/com/ninecraft/booket/core/data/impl/mapper/ResponseToModel.kt b/core/data/impl/src/main/kotlin/com/ninecraft/booket/core/data/impl/mapper/ResponseToModel.kt index fc8702a7..1d61416c 100644 --- a/core/data/impl/src/main/kotlin/com/ninecraft/booket/core/data/impl/mapper/ResponseToModel.kt +++ b/core/data/impl/src/main/kotlin/com/ninecraft/booket/core/data/impl/mapper/ResponseToModel.kt @@ -54,7 +54,6 @@ internal fun BookSearchResponse.toModel(): BookSearchModel { return BookSearchModel( version = version, title = title, - link = link, pubDate = pubDate, totalResults = totalResults, startIndex = startIndex, @@ -62,6 +61,7 @@ internal fun BookSearchResponse.toModel(): BookSearchModel { query = query, searchCategoryId = searchCategoryId, searchCategoryName = searchCategoryName, + lastPage = lastPage, books = books.map { it.toModel() }, ) } @@ -73,7 +73,9 @@ internal fun BookSummary.toModel(): BookSummaryModel { author = author, publisher = publisher, coverImageUrl = coverImageUrl, + link = link, userBookStatus = userBookStatus, + key = "$title-$isbn13", ) } diff --git a/core/model/src/main/kotlin/com/ninecraft/booket/core/model/BookSearchModel.kt b/core/model/src/main/kotlin/com/ninecraft/booket/core/model/BookSearchModel.kt index ec3761fa..cc592841 100644 --- a/core/model/src/main/kotlin/com/ninecraft/booket/core/model/BookSearchModel.kt +++ b/core/model/src/main/kotlin/com/ninecraft/booket/core/model/BookSearchModel.kt @@ -6,7 +6,6 @@ import androidx.compose.runtime.Stable data class BookSearchModel( val version: String = "", val title: String = "", - val link: String = "", val pubDate: String = "", val totalResults: Int = 0, val startIndex: Int = 0, @@ -14,6 +13,7 @@ data class BookSearchModel( val query: String = "", val searchCategoryId: Int = 0, val searchCategoryName: String = "", + val lastPage: Boolean = false, val books: List = emptyList(), ) @@ -24,5 +24,7 @@ data class BookSummaryModel( val author: String = "", val publisher: String = "", val coverImageUrl: String = "", + val link: String = "", val userBookStatus: String = "", + val key: String = "", ) diff --git a/core/network/src/main/kotlin/com/ninecraft/booket/core/network/response/BookSearchResponse.kt b/core/network/src/main/kotlin/com/ninecraft/booket/core/network/response/BookSearchResponse.kt index be1cb8bf..ae2b8067 100644 --- a/core/network/src/main/kotlin/com/ninecraft/booket/core/network/response/BookSearchResponse.kt +++ b/core/network/src/main/kotlin/com/ninecraft/booket/core/network/response/BookSearchResponse.kt @@ -9,8 +9,6 @@ data class BookSearchResponse( val version: String, @SerialName("title") val title: String, - @SerialName("link") - val link: String, @SerialName("pubDate") val pubDate: String, @SerialName("totalResults") @@ -25,6 +23,8 @@ data class BookSearchResponse( val searchCategoryId: Int, @SerialName("searchCategoryName") val searchCategoryName: String, + @SerialName("lastPage") + val lastPage: Boolean, @SerialName("books") val books: List, ) @@ -41,6 +41,8 @@ data class BookSummary( val publisher: String, @SerialName("coverImageUrl") val coverImageUrl: String, + @SerialName("link") + val link: String, @SerialName("userBookStatus") val userBookStatus: String, ) diff --git a/feature/search/src/main/kotlin/com/ninecraft/booket/feature/search/book/BookSearchPresenter.kt b/feature/search/src/main/kotlin/com/ninecraft/booket/feature/search/book/BookSearchPresenter.kt index e5516b38..62efcce8 100644 --- a/feature/search/src/main/kotlin/com/ninecraft/booket/feature/search/book/BookSearchPresenter.kt +++ b/feature/search/src/main/kotlin/com/ninecraft/booket/feature/search/book/BookSearchPresenter.kt @@ -40,7 +40,6 @@ class BookSearchPresenter @AssistedInject constructor( private val repository: BookRepository, ) : Presenter { companion object { - private const val PAGE_SIZE = 20 private const val START_INDEX = 1 } @@ -80,7 +79,7 @@ class BookSearchPresenter @AssistedInject constructor( } currentStartIndex = startIndex - isLastPage = result.books.size < PAGE_SIZE + isLastPage = result.lastPage if (startIndex == START_INDEX) { uiState = UiState.Success @@ -185,7 +184,12 @@ class BookSearchPresenter @AssistedInject constructor( is BookSearchUiEvent.OnBookClick -> { selectedBookIsbn = event.isbn13 - isBookRegisterBottomSheetVisible = true + + if (selectedBookIsbn.isEmpty()) { + sideEffect = BookSearchSideEffect.ShowToast("isbn이 없는 도서는 등록할 수 없습니다") + } else { + isBookRegisterBottomSheetVisible = true + } } is BookSearchUiEvent.OnBookRegisterBottomSheetDismiss -> { diff --git a/feature/search/src/main/kotlin/com/ninecraft/booket/feature/search/book/BookSearchUi.kt b/feature/search/src/main/kotlin/com/ninecraft/booket/feature/search/book/BookSearchUi.kt index 436e7b7d..28b8ea15 100644 --- a/feature/search/src/main/kotlin/com/ninecraft/booket/feature/search/book/BookSearchUi.kt +++ b/feature/search/src/main/kotlin/com/ninecraft/booket/feature/search/book/BookSearchUi.kt @@ -222,7 +222,7 @@ internal fun SearchContent( ) { items( count = state.books.size, - key = { index -> state.books[index].isbn13 }, + key = { index -> state.books[index].key }, ) { index -> Column { BookItem(