Skip to content

Commit

Permalink
[Feat/#88] 자동로그인 상태 저장 로직 가
Browse files Browse the repository at this point in the history
  • Loading branch information
yeoncheong committed Jul 20, 2023
1 parent 13ab018 commit 9aa11f1
Showing 1 changed file with 14 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ import androidx.core.content.edit
import androidx.security.crypto.EncryptedSharedPreferences
import androidx.security.crypto.MasterKeys
import com.sopt.umbba_android.BuildConfig
import com.sopt.umbba_android.presentation.login.LoginActivity
import com.sopt.umbba_android.presentation.login.LoginActivity.Companion.DID_USER_CLEAR_INVITE_CODE
import com.sopt.umbba_android.presentation.login.LoginActivity.Companion.DID_USER_CLEAR_ONBOARD

const val FILE_NAME = "UMBBA"

Expand Down Expand Up @@ -46,11 +47,19 @@ object SharedPreferences {
return preferences.getString(key, null)
}
//온보딩 완료 상태 저장
fun setBoolean(key: String, value: Boolean) {
fun setOnboardingBoolean(key: String, value: Boolean) {
preferences.edit { putBoolean(key, value) }
}
//온보딩 완료했는지 가져오기 - 온보딩 완료 확인
fun getBoolean(key: String): Boolean {
fun getOnboardingBoolean(key: String): Boolean {
return preferences.getBoolean(key, false)
}

fun setInviteCodeBoolean(key: String, value: Boolean) {
preferences.edit { putBoolean(key, value) }
}

fun getInviteCodeBoolean(key: String): Boolean {
return preferences.getBoolean(key, false)
}

Expand All @@ -60,7 +69,8 @@ object SharedPreferences {

fun clearForLogout() {
clear()
setBoolean(LoginActivity.DID_USER_CLEAR_ONBOARD, true)
setOnboardingBoolean(DID_USER_CLEAR_ONBOARD, true)
setInviteCodeBoolean(DID_USER_CLEAR_INVITE_CODE, true)
}

fun clearForSignout(){
Expand Down

0 comments on commit 9aa11f1

Please sign in to comment.