Skip to content

Commit 6af58e4

Browse files
committed
[BOOK-151] chore: code style check success
1 parent c4d6c8b commit 6af58e4

File tree

4 files changed

+9
-3
lines changed

4 files changed

+9
-3
lines changed

core/data/impl/src/main/kotlin/com/ninecraft/booket/core/data/impl/repository/DefaultBookRepository.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ internal class DefaultBookRepository @Inject constructor(
3131
dataSource.removeRecentSearch(query)
3232
}
3333

34-
3534
override suspend fun getBookDetail(itemId: String) = runSuspendCatching {
3635
service.getBookDetail(itemId).toModel()
3736
}

core/datastore/api/src/main/kotlin/com/ninecraft/booket/core/datastore/api/datasource/RecentSearchDataSource.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ interface RecentSearchDataSource {
77
suspend fun addRecentSearch(query: String)
88
suspend fun removeRecentSearch(query: String)
99
suspend fun clearRecentSearches()
10-
}
10+
}

core/datastore/impl/src/main/kotlin/com/ninecraft/booket/core/datastore/impl/datasource/DefaultRecentSearchDataSource.kt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import androidx.datastore.preferences.core.edit
66
import androidx.datastore.preferences.core.stringPreferencesKey
77
import com.ninecraft.booket.core.datastore.api.datasource.RecentSearchDataSource
88
import com.ninecraft.booket.core.datastore.impl.util.handleIOException
9+
import com.orhanobut.logger.Logger
910
import kotlinx.coroutines.flow.Flow
1011
import kotlinx.coroutines.flow.map
1112
import kotlinx.serialization.json.Json
@@ -14,18 +15,21 @@ import javax.inject.Inject
1415
class DefaultRecentSearchDataSource @Inject constructor(
1516
private val dataStore: DataStore<Preferences>,
1617
) : RecentSearchDataSource {
18+
@Suppress("TooGenericExceptionCaught")
1719
override val recentSearches: Flow<List<String>> = dataStore.data
1820
.handleIOException()
1921
.map { prefs ->
2022
prefs[RECENT_SEARCHES]?.let { jsonString ->
2123
try {
2224
Json.decodeFromString<List<String>>(jsonString)
2325
} catch (e: Exception) {
26+
Logger.e(e.toString())
2427
emptyList()
2528
}
2629
} ?: emptyList()
2730
}
2831

32+
@Suppress("TooGenericExceptionCaught")
2933
override suspend fun addRecentSearch(query: String) {
3034
if (query.isBlank()) return
3135

@@ -34,6 +38,7 @@ class DefaultRecentSearchDataSource @Inject constructor(
3438
try {
3539
Json.decodeFromString<List<String>>(jsonString).toMutableList()
3640
} catch (e: Exception) {
41+
Logger.e(e.toString())
3742
mutableListOf()
3843
}
3944
} ?: mutableListOf()
@@ -49,12 +54,14 @@ class DefaultRecentSearchDataSource @Inject constructor(
4954
}
5055
}
5156

57+
@Suppress("TooGenericExceptionCaught")
5258
override suspend fun removeRecentSearch(query: String) {
5359
dataStore.edit { prefs ->
5460
val currentSearches = prefs[RECENT_SEARCHES]?.let { jsonString ->
5561
try {
5662
Json.decodeFromString<List<String>>(jsonString).toMutableList()
5763
} catch (e: Exception) {
64+
Logger.e(e.toString())
5865
mutableListOf()
5966
}
6067
} ?: mutableListOf()

feature/search/src/main/kotlin/com/ninecraft/booket/feature/search/SearchScreen.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ internal fun SearchContent(
137137
},
138138
onRemoveIconClick = { keyword ->
139139
state.eventSink(SearchUiEvent.OnRemoveSearchRemoveClick(keyword))
140-
}
140+
},
141141
)
142142
HorizontalDivider(
143143
modifier = Modifier.fillMaxWidth(),

0 commit comments

Comments
 (0)