Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import androidx.core.content.FileProvider
import com.orhanobut.logger.Logger
import java.io.File

@Suppress("TooGenericExceptionCaught")
fun Context.externalShareForBitmap(bitmap: ImageBitmap) {
try {
val file = File(bitmap.saveToDisk(this))
Expand All @@ -31,7 +30,6 @@ fun Context.externalShareForBitmap(bitmap: ImageBitmap) {
}
}

@Suppress("TooGenericExceptionCaught")
fun Context.saveImageToGallery(bitmap: ImageBitmap) {
try {
val fileName = "reed_record_${System.currentTimeMillis()}.png"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ fun postErrorDialog(
ErrorEventHelper.sendError(event = ErrorEvent.ShowDialog(spec))
}

@Suppress("TooGenericExceptionCaught")
private fun HttpException.parseErrorMessage(): String? {
return try {
val errorBody = response()?.errorBody()?.string()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import kotlin.contracts.ExperimentalContracts
*/

@OptIn(ExperimentalContracts::class)
@Suppress("WRONG_INVOCATION_KIND", "TooGenericExceptionCaught")
@Suppress("WRONG_INVOCATION_KIND")
inline fun <T> runSuspendCatching(block: () -> T): Result<T> {
// 계약(contract): 컴파일러에게 'block' 람다의 실행 시점과 횟수를 명시적으로 알림
// 'callsInPlace'와 'EXACTLY_ONCE'는 'block'이 이 함수 내에서 즉시, 그리고 정확히 한 번만 실행됨을 보장
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ internal fun RecordRegisterResponse.toModel(): RecordRegisterModel {
pageNumber = pageNumber,
quote = quote,
emotionTags = emotionTags,
review = review,
review = review ?: "",
createdAt = createdAt,
updatedAt = updatedAt,
)
Expand All @@ -215,7 +215,7 @@ internal fun ReadingRecord.toModel(): ReadingRecordModel {
userBookId = userBookId,
pageNumber = pageNumber,
quote = quote,
review = review,
review = review ?: "",
emotionTags = emotionTags,
createdAt = createdAt,
updatedAt = updatedAt,
Expand All @@ -232,7 +232,7 @@ internal fun RecordDetailResponse.toModel(): RecordDetailModel {
userBookId = userBookId,
pageNumber = pageNumber,
quote = quote,
review = review,
review = review ?: "",
emotionTags = emotionTags,
createdAt = createdAt.toFormattedDate(),
updatedAt = updatedAt.toFormattedDate(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import javax.inject.Inject
class DefaultBookRecentSearchDataSource @Inject constructor(
@BookRecentSearchDataStore private val dataStore: DataStore<Preferences>,
) : BookRecentSearchDataSource {
@Suppress("TooGenericExceptionCaught")
override val recentSearches: Flow<List<String>> = dataStore.data
.handleIOException()
.map { prefs ->
Expand All @@ -34,7 +33,6 @@ class DefaultBookRecentSearchDataSource @Inject constructor(
} ?: emptyList()
}

@Suppress("TooGenericExceptionCaught")
override suspend fun addRecentSearch(query: String) {
if (query.isBlank()) return

Expand Down Expand Up @@ -66,7 +64,6 @@ class DefaultBookRecentSearchDataSource @Inject constructor(
}
}

@Suppress("TooGenericExceptionCaught")
override suspend fun deleteRecentSearch(query: String) {
dataStore.edit { prefs ->
val currentSearches = prefs[BOOK_RECENT_SEARCHES]?.let { jsonString ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import javax.inject.Inject
class DefaultLibraryRecentSearchDataSource @Inject constructor(
@LibraryRecentSearchDataStore private val dataStore: DataStore<Preferences>,
) : LibraryRecentSearchDataSource {
@Suppress("TooGenericExceptionCaught")
override val recentSearches: Flow<List<String>> = dataStore.data
.handleIOException()
.map { prefs ->
Expand All @@ -34,7 +33,6 @@ class DefaultLibraryRecentSearchDataSource @Inject constructor(
} ?: emptyList()
}

@Suppress("TooGenericExceptionCaught")
override suspend fun addRecentSearch(query: String) {
if (query.isBlank()) return

Expand Down Expand Up @@ -66,7 +64,6 @@ class DefaultLibraryRecentSearchDataSource @Inject constructor(
}
}

@Suppress("TooGenericExceptionCaught")
override suspend fun deleteRecentSearch(query: String) {
dataStore.edit { prefs ->
val currentSearches = prefs[LIBRARY_RECENT_SEARCHES]?.let { jsonString ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import okhttp3.Route
import javax.inject.Inject
import javax.inject.Provider

@Suppress("TooGenericExceptionCaught")
class TokenAuthenticator @Inject constructor(
private val tokenDataSource: TokenDataSource,
private val serviceProvider: Provider<ReedService>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ data class ReadingRecord(
@SerialName("quote")
val quote: String,
@SerialName("review")
val review: String = "",
val review: String?,
@SerialName("emotionTags")
val emotionTags: List<String> = emptyList(),
@SerialName("createdAt")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ data class RecordDetailResponse(
@SerialName("quote")
val quote: String,
@SerialName("review")
val review: String,
val review: String?,
@SerialName("emotionTags")
val emotionTags: List<String>,
@SerialName("createdAt")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ data class RecordRegisterResponse(
@SerialName("emotionTags")
val emotionTags: List<String>,
@SerialName("review")
val review: String,
val review: String?,
@SerialName("createdAt")
val createdAt: String,
@SerialName("updatedAt")
Expand Down
4 changes: 4 additions & 0 deletions detekt-config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@ style:
MaxLineLength:
active: false

exceptions:
TooGenericExceptionCaught:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

속이 다 시원하네요

active: false

naming:
TopLevelPropertyNaming:
constantPattern: '[A-Z][A-Za-z0-9_]*'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ class BookDetailPresenter @AssistedInject constructor(
var isBookDeleteDialogVisible by rememberRetained { mutableStateOf(false) }
var sideEffect by rememberRetained { mutableStateOf<BookDetailSideEffect?>(null) }

@Suppress("TooGenericExceptionCaught")
fun initialLoad() {
uiState = UiState.Loading

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ class RecordEditPresenter @AssistedInject constructor(
derivedStateOf {
recordPageState.text.isNotEmpty() &&
recordQuoteState.text.isNotEmpty() &&
recordImpressionState.text.isNotEmpty() &&
!isPageError &&
hasChanges
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ fun EmotionStep(
.padding(horizontal = ReedTheme.spacing.spacing5)
.padding(bottom = ReedTheme.spacing.spacing4),
enabled = state.isNextButtonEnabled,
text = stringResource(R.string.record_next_button),
text = stringResource(R.string.record_next_button_text),
multipleEventsCutterEnabled = false,
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ fun ImpressionStep(
vertical = ReedTheme.spacing.spacing4,
),
enabled = state.isNextButtonEnabled,
text = stringResource(R.string.record_next_button),
text = stringResource(R.string.record_finish_button_text),
multipleEventsCutterEnabled = true,
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ internal fun QuoteStep(
vertical = ReedTheme.spacing.spacing4,
),
enabled = state.isNextButtonEnabled,
text = stringResource(R.string.record_next_button),
text = stringResource(R.string.record_next_button_text),
multipleEventsCutterEnabled = false,
)
}
Expand Down
3 changes: 2 additions & 1 deletion feature/record/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
<string name="permission_dialog_title">카메라 권한이 필요해요</string>
<string name="permission_dialog_description">문장 인식을 위해 설정에서 권한을 허용해주세요.</string>
<string name="permission_dialog_move_to_settings">설정으로 이동하기</string>
<string name="record_next_button">다음</string>
<string name="record_next_button_text">다음</string>
<string name="record_finish_button_text">기록 완료</string>
<string name="quote_step_title">기록하고 싶은 페이지와\n문장을 등록해보세요</string>
<string name="quote_step_page_label">책 페이지</string>
<string name="quote_step_sentence_label">문장 기록</string>
Expand Down
Loading