Skip to content

Commit 79c9a3e

Browse files
committed
[CHORE/#268] SharedPreferences의 property setter를 개선합니다.
1 parent b9d1818 commit 79c9a3e

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

app/src/main/java/com/sopt/clody/data/local/datasourceimpl/FirstDraftLocalDataSourceImpl.kt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package com.sopt.clody.data.local.datasourceimpl
22

33
import android.content.SharedPreferences
4+
import androidx.core.content.edit
45
import com.sopt.clody.data.local.datasource.FirstDraftLocalDataSource
56
import com.sopt.clody.di.qualifier.FirstDraftPrefs
67
import javax.inject.Inject
@@ -10,11 +11,11 @@ class FirstDraftLocalDataSourceImpl @Inject constructor(
1011
) : FirstDraftLocalDataSource {
1112
override var isDraftUsed: Boolean
1213
get() = sharedPreferences.getBoolean(IS_DRAFT_USED, false)
13-
set(value) = sharedPreferences.edit().putBoolean(IS_DRAFT_USED, value).apply()
14+
set(value) = sharedPreferences.edit { putBoolean(IS_DRAFT_USED, value) }
1415

1516
override var isFirstUse: Boolean
1617
get() = sharedPreferences.getBoolean(IS_FIRST_USE, false)
17-
set(value) = sharedPreferences.edit().putBoolean(IS_FIRST_USE, value).apply()
18+
set(value) = sharedPreferences.edit { putBoolean(IS_FIRST_USE, value) }
1819

1920
companion object {
2021
private const val IS_DRAFT_USED = "IS_DRAFT_USED"

0 commit comments

Comments
 (0)