Skip to content

Commit

Permalink
🎨 Style: 함수, 변수명 오타 수정
Browse files Browse the repository at this point in the history
- Friend 데이터 클래스의 userId
- ScheduleRepository에서의 getGuestInvitationLink

Related to: #347
  • Loading branch information
nahy-512 committed Jan 8, 2025
1 parent 4d7f297 commit f0b101a
Show file tree
Hide file tree
Showing 10 changed files with 41 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ class ScheduleRepositoryImpl @Inject constructor(
).isSuccess
}

override suspend fun getGuestInvitaionLink(moimScheduleId: Long): String {
override suspend fun getGuestInvitationLink(moimScheduleId: Long): String {
return remoteScheduleDataSource.getGuestInvitationLink(moimScheduleId).result
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import com.mongmong.namo.presentation.utils.converter.ScheduleDateConverter
object FriendMapper {
fun FriendDTO.toModel(): Friend {
return Friend(
userid = this.memberId,
userId = this.memberId,
profileUrl = this.profileImage,
nickname = this.nickname,
name = this.nickname,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import org.joda.time.LocalDateTime
import java.io.Serializable

data class Friend(
val userid: Long,
val userId: Long,
val profileUrl: String?,
val nickname: String,
val tag: String,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ interface ScheduleRepository {
memberIdsToInvite: List<Long>
): Boolean

suspend fun getGuestInvitaionLink(
suspend fun getGuestInvitationLink(
moimScheduleId: Long
): String
}
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ class CalendarViewModel @Inject constructor (
viewModelScope.launch {
// 범위로 일정 목록 조회
_friendScheduleList.value = friendRepository.getFriendCalendar(
userId = friend.userid,
userId = friend.userId,
startDate = _monthDateList.first(), // 캘린더에 표시되는 첫번쨰 날짜
endDate = _monthDateList.last() // 캘린더에 표시되는 마지막 날짜
)
Expand All @@ -87,7 +87,7 @@ class CalendarViewModel @Inject constructor (
/** 친구 카테고리 조회 */
fun getFriendCategories() {
viewModelScope.launch {
friendCategoryList = friendRepository.getFriendCategoryList(friend.userid)
friendCategoryList = friendRepository.getFriendCategoryList(friend.userId)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class FriendFragment : BaseFragment<FragmentFriendBinding>(R.layout.fragment_fri
friendAdapter.setItemClickListener(object : FriendRVAdapter.MyItemClickListener {
override fun onFavoriteButtonClick(position: Int) {
// 즐겨찾기 상태 변경
viewModel.toggleFriendFavoriteState(viewModel.friendList.value!![position].userid)
viewModel.toggleFriendFavoriteState(viewModel.friendList.value!![position].userId)
}

override fun onItemClick(position: Int) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class FriendInfoDialog(

// 즐겨찾기 버튼 클릭
binding.friendInfoFavoriteIv.setOnClickListener {
viewModel.toggleFriendFavoriteState(friendInfo!!.userid)
viewModel.toggleFriendFavoriteState(friendInfo!!.userId)
binding.isFavorite = !binding.isFavorite!! // 즐겨찾기 여부 전환
}

Expand All @@ -77,7 +77,7 @@ class FriendInfoDialog(

// 친구 리스트 - 삭제 버튼 클릭
binding.friendInfoDeleteBtn.setOnClickListener {
viewModel.deleteFriend(friendInfo!!.userid)
viewModel.deleteFriend(friendInfo!!.userId)
}

// 친구 요청 - 수락 버튼 클릭
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,30 +4,43 @@ import android.app.Activity
import android.content.Intent
import android.util.Log
import androidx.activity.result.contract.ActivityResultContracts
import androidx.core.content.ContextCompat
import androidx.fragment.app.viewModels
import androidx.recyclerview.widget.LinearLayoutManager
import com.mongmong.namo.R
import com.mongmong.namo.databinding.FragmentMoimBinding
import com.mongmong.namo.domain.model.Moim
import com.mongmong.namo.presentation.config.BaseFragment
import com.mongmong.namo.presentation.ui.common.ConfirmDialog
import com.mongmong.namo.presentation.ui.common.ConfirmDialog.ConfirmDialogInterface
import com.mongmong.namo.presentation.ui.community.moim.diary.MoimDiaryDetailActivity
import com.mongmong.namo.presentation.ui.community.moim.adapter.MoimRVAdapter
import com.mongmong.namo.presentation.ui.community.moim.schedule.FriendInviteActivity
import com.mongmong.namo.presentation.ui.community.moim.schedule.MoimScheduleActivity
import dagger.hilt.android.AndroidEntryPoint

@AndroidEntryPoint
class MoimFragment : BaseFragment<FragmentMoimBinding>(R.layout.fragment_moim) {
class MoimFragment : BaseFragment<FragmentMoimBinding>(R.layout.fragment_moim),
ConfirmDialogInterface {

private val viewModel: MoimViewModel by viewModels()

private var moimAdapter = MoimRVAdapter()

private val getResultText = registerForActivityResult(
ActivityResultContracts.StartActivityForResult()
) {result ->
) { result ->
Log.d("MoimFragment", "ActivityResult received")
if (result.resultCode == Activity.RESULT_OK) {
val edited = result.data?.getBooleanExtra(MOIM_EDIT_KEY, false)
if (edited == true) viewModel.getMoim() // 변경 사항이 있다면 업데이트
Log.d("MoimFragment", "Result OK")
val isEdited = result.data?.getBooleanExtra(MOIM_EDIT_KEY, false)
if (isEdited == true) viewModel.getMoim() // 변경 사항이 있다면 업데이트

val createdMoimTitle = result.data?.getStringExtra(MOIM_CREATE_KEY)
Log.d("MoimFragment", "isEdited: $isEdited, createdMoimTitle: $createdMoimTitle")
if (createdMoimTitle != null) showCustomDialog(getString(R.string.dialog_moim_friend_invite_title, createdMoimTitle), R.string.dialog_moim_friend_invite_content, R.string.continuously, 0)
} else {
Log.d("MoimFragment", "Result not OK: ${result.resultCode}")
}
}

Expand Down Expand Up @@ -70,6 +83,13 @@ class MoimFragment : BaseFragment<FragmentMoimBinding>(R.layout.fragment_moim) {
})
}

private fun showCustomDialog(title: String, content: Int, buttonText: Int, id: Int) {
Log.d("MoimFragment", "showCustomDialog()")
val dialog = ConfirmDialog(this, title, getString(content), getString(buttonText), id)
dialog.isCancelable = false
activity?.let { dialog.show(it.supportFragmentManager, "ConfirmDialog") }
}

private fun initObserve() {
viewModel.moimPreviewList.observe(viewLifecycleOwner) {
if (it.isNotEmpty()) {
Expand All @@ -79,7 +99,13 @@ class MoimFragment : BaseFragment<FragmentMoimBinding>(R.layout.fragment_moim) {
}
}

override fun onClickYesButton(id: Int) {
// 친구 초대 화면으로 이동
startActivity(Intent(requireActivity(), FriendInviteActivity::class.java))
}

companion object {
const val MOIM_EDIT_KEY = "moim_edit_key"
const val MOIM_CREATE_KEY = "moim_create_key"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class FriendInviteViewModel @Inject constructor(
Log.d("FriendInviteVM", "moimScheduleId: $moimScheduleId")
if (moimScheduleId == 0L) return
viewModelScope.launch {
_isSuccess.value = repository.inviteMoimParticipant(moimScheduleId, _friendToInviteList.value!!.map { friend -> friend.userid })
_isSuccess.value = repository.inviteMoimParticipant(moimScheduleId, _friendToInviteList.value!!.map { friend -> friend.userId })
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ class MoimScheduleViewModel @Inject constructor(

private fun getGuestInvitationLink() {
viewModelScope.launch {
guestInvitationLink = repository.getGuestInvitaionLink(_moimSchedule.value!!.moimId)
guestInvitationLink = repository.getGuestInvitationLink(_moimSchedule.value!!.moimId)
}
}

Expand Down

0 comments on commit f0b101a

Please sign in to comment.