Skip to content

Commit

Permalink
feat : finishFragment 추가 #2
Browse files Browse the repository at this point in the history
  • Loading branch information
SeonHwan-Kim committed Apr 25, 2023
1 parent d1be925 commit 7bb9b2b
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ class MyPageFragment : Fragment() {
val sharedPreferences = this.requireActivity().getSharedPreferences(KEY_PREFS, 0)
sharedPreferences.edit().putBoolean(KEY_ISLOGIN, false).apply()
startActivity(intent)
finishFragment()
}
}

Expand All @@ -51,9 +52,14 @@ class MyPageFragment : Fragment() {
val sharedPreferences = this.requireActivity().getSharedPreferences(KEY_PREFS, 0)
sharedPreferences.edit().clear().apply()
startActivity(intent)
finishFragment()
}
}

private fun finishFragment(){
if(!this.requireActivity().isFinishing) this.requireActivity().finish()
}

companion object {
private const val KEY_PREFS = "userInfo"
private const val KEY_ISLOGIN = "isLogin"
Expand Down

0 comments on commit 7bb9b2b

Please sign in to comment.