Skip to content

Commit

Permalink
#6 mypage_fragment/설정 화면 : 3 작성한 리뷰 화면
Browse files Browse the repository at this point in the history
 - 내가 작성한 리뷰 틀 화면 구현
  • Loading branch information
likppi10 committed Aug 23, 2022
1 parent 33ca6d7 commit 7a687cd
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import androidx.lifecycle.repeatOnLifecycle
import com.ftw.hometerview.R
import com.ftw.hometerview.databinding.FragmentMyPageBinding
import com.ftw.hometerview.ui.updatenickname.UpdateNicknameActivity
import com.ftw.hometerview.ui.writtenreview.WrittenReviewsActivity
import dagger.hilt.android.AndroidEntryPoint
import kotlinx.coroutines.launch
import javax.inject.Inject
Expand Down Expand Up @@ -75,6 +76,9 @@ class MyPageFragment : Fragment() {
is MyPageViewModel.Event.onClickUpdateNickname -> {
updateNicknameActivity(event.nickname)
}
MyPageViewModel.Event.onClickWrittenReview -> {
writtenReviewActivity()
}
}
}
}
Expand Down Expand Up @@ -130,6 +134,10 @@ class MyPageFragment : Fragment() {
updateNicknameLauncher.launch(UpdateNicknameActivity.newIntent(requireContext(), nickname))
}

private fun writtenReviewActivity() {
startActivity(WrittenReviewsActivity.newIntent(requireContext()))
}

private fun setLauncher() {
updateNicknameLauncher =
registerForActivityResult(ActivityResultContracts.StartActivityForResult()) { result ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ class MyPageViewModel (
sealed class Event {
object None : Event()
class onClickUpdateNickname(val nickname: String) : Event()
object onClickWrittenReview : Event()
}

private val _user: MutableStateFlow<User> = MutableStateFlow(User.NONE)
Expand All @@ -42,4 +43,9 @@ class MyPageViewModel (
_event.value = Event.onClickUpdateNickname(user.value.nickName)
_event.value = Event.None
}

fun onClickWrittenReview() {
_event.value = Event.onClickWrittenReview
_event.value = Event.None
}
}

0 comments on commit 7a687cd

Please sign in to comment.