-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: 약속 목록 조회 api 연결 #279
Changes from all commits
96b084a
30eb602
bc6f832
90a7a76
fdb2e28
1e04bd2
1403f40
97547e9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package com.woowacourse.ody.data.remote.core.entity.meeting.mapper | ||
|
||
import com.woowacourse.ody.data.remote.core.entity.meeting.response.MeetingCatalogResponse | ||
import com.woowacourse.ody.data.remote.core.entity.meeting.response.MeetingCatalogsResponse | ||
import com.woowacourse.ody.domain.model.MeetingCatalog | ||
import java.time.LocalDate | ||
import java.time.LocalTime | ||
|
||
fun MeetingCatalogResponse.toMeetingCatalog(): MeetingCatalog { | ||
val date = LocalDate.parse(date) | ||
val time = LocalTime.parse(time) | ||
val dateTime = date.atTime(time) | ||
return MeetingCatalog( | ||
durationMinutes = durationMinutes, | ||
id = id, | ||
mateCount = mateCount, | ||
name = name, | ||
originAddress = originAddress, | ||
targetAddress = targetAddress, | ||
datetime = dateTime, | ||
) | ||
} | ||
|
||
fun MeetingCatalogsResponse.toMeetingCatalogs(): List<MeetingCatalog> = meetingCatalogs.map { it.toMeetingCatalog() } | ||
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package com.woowacourse.ody.data.remote.core.entity.meeting.response | ||
|
||
import com.squareup.moshi.Json | ||
import com.squareup.moshi.JsonClass | ||
|
||
@JsonClass(generateAdapter = true) | ||
data class MeetingCatalogResponse( | ||
@Json(name = "date") | ||
val date: String, | ||
@Json(name = "durationMinutes") | ||
val durationMinutes: Int, | ||
@Json(name = "id") | ||
val id: Long, | ||
@Json(name = "mateCount") | ||
val mateCount: Int, | ||
@Json(name = "name") | ||
val name: String, | ||
@Json(name = "originAddress") | ||
val originAddress: String, | ||
@Json(name = "targetAddress") | ||
val targetAddress: String, | ||
@Json(name = "time") | ||
val time: String, | ||
) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package com.woowacourse.ody.data.remote.core.entity.meeting.response | ||
|
||
import com.squareup.moshi.Json | ||
import com.squareup.moshi.JsonClass | ||
|
||
@JsonClass(generateAdapter = true) | ||
data class MeetingCatalogsResponse( | ||
@Json(name = "meetings") | ||
val meetingCatalogs: List<MeetingCatalogResponse>, | ||
) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package com.woowacourse.ody.domain.model | ||
|
||
import java.time.LocalDateTime | ||
|
||
data class MeetingCatalog( | ||
val durationMinutes: Int, | ||
val id: Long, | ||
val mateCount: Int, | ||
val name: String, | ||
val originAddress: String, | ||
val targetAddress: String, | ||
val datetime: LocalDateTime, | ||
) |
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
package com.woowacourse.ody.presentation.creation | ||
|
||
sealed interface MeetingCreationNavigateAction { | ||
data object NavigateToIntro : MeetingCreationNavigateAction | ||
data object NavigateToHome : MeetingCreationNavigateAction | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 궁금한게 있는데.. 모임 개설 후에 바로 모임 리스트로 이동하는 경우가 있나요?? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 아 사용하고 있는 쪽 쫓아가보니까, back 버튼 눌렀을 때 아예 새로운 홈 화면을 시작해주네요. 기존 구현이 이런 방식이었네요.. ㄷㄷ There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. "모임 개설 -> 모임 참여 -> 모임방" 이 맞죠. |
||
|
||
data object NavigateToCreationComplete : MeetingCreationNavigateAction | ||
} |
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 음.. 통일시에 헷갈려서 일부러 변경한 사양이긴 했는데, 저도 Meetings~처럼 명확한 게 좋다고 생각합니다. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. �저는 MeetingsActivity가 직관적이라 더 취향이긴 합니다.. Catalog는 어떤 의미로 넣으셨는지도 궁금해요~! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 그럽시다! |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package com.woowacourse.ody.presentation.intro | ||
package com.woowacourse.ody.presentation.home | ||
|
||
import android.Manifest | ||
import android.app.AlertDialog | ||
|
@@ -8,18 +8,36 @@ import android.content.Intent | |
import android.content.pm.PackageManager | ||
import android.os.Build | ||
import android.os.Bundle | ||
import android.view.View | ||
import androidx.activity.viewModels | ||
import androidx.annotation.RequiresApi | ||
import androidx.core.app.ActivityCompat | ||
import androidx.core.content.ContextCompat | ||
import com.woowacourse.ody.R | ||
import com.woowacourse.ody.databinding.ActivityIntroBinding | ||
import com.woowacourse.ody.databinding.ActivityHomeBinding | ||
import com.woowacourse.ody.presentation.common.binding.BindingActivity | ||
import com.woowacourse.ody.presentation.creation.MeetingCreationActivity | ||
import com.woowacourse.ody.presentation.home.adapter.MeetingCatalogsAdapter | ||
import com.woowacourse.ody.presentation.home.listener.HomeListener | ||
import com.woowacourse.ody.presentation.invitecode.InviteCodeActivity | ||
|
||
class IntroActivity : BindingActivity<ActivityIntroBinding>(R.layout.activity_intro) { | ||
private val viewModel: IntroViewModel by viewModels() | ||
import com.woowacourse.ody.presentation.room.log.NotificationLogActivity | ||
|
||
class HomeActivity : | ||
BindingActivity<ActivityHomeBinding>( | ||
R.layout.activity_home, | ||
), | ||
HomeListener { | ||
private val viewModel by viewModels<HomeViewModel> { | ||
HomeViewModelFactory( | ||
application.meetingRepository, | ||
) | ||
} | ||
private val adapter by lazy { | ||
MeetingCatalogsAdapter( | ||
viewModel, | ||
this, | ||
) | ||
Comment on lines
+36
to
+39
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Adapter에 viewModel을 전달하기 보다, Listener interface로 추상화해서 그 Listener만 전달하면 어떨까요? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 리스너로 고쳐주었습니다. |
||
} | ||
|
||
@RequiresApi(Build.VERSION_CODES.TIRAMISU) | ||
override fun onCreate(savedInstanceState: Bundle?) { | ||
|
@@ -29,30 +47,46 @@ class IntroActivity : BindingActivity<ActivityIntroBinding>(R.layout.activity_in | |
requestPermissions() | ||
} | ||
|
||
override fun onResume() { | ||
super.onResume() | ||
viewModel.fetchMeetingCatalogs() | ||
} | ||
|
||
override fun initializeBinding() { | ||
binding.listener = viewModel | ||
binding.rvMeetingList.adapter = adapter | ||
binding.listener = this | ||
} | ||
|
||
private fun initializeObserve() { | ||
viewModel.navigateAction.observe(this) { navigateAction -> | ||
when (navigateAction) { | ||
is IntroNavigateAction.NavigateToMeetingInfo -> | ||
navigateToMeetingInfoActivity() | ||
|
||
is IntroNavigateAction.NavigateToInviteCode -> | ||
navigateToInviteCodeActivity() | ||
} | ||
viewModel.meetingCatalogs.observe(this) { | ||
adapter.submitList(it) | ||
} | ||
viewModel.isMeetingCatalogsEmpty.observe(this) { | ||
binding.isCatalogsEmpty = it | ||
} | ||
} | ||
|
||
private fun navigateToMeetingInfoActivity() { | ||
startActivity(MeetingCreationActivity.getIntent(this)) | ||
override fun onFab() { | ||
binding.cvMenuView.visibility = if (binding.fabHomeNavigator.isSelected) View.GONE else View.VISIBLE | ||
binding.fabHomeNavigator.isSelected = !binding.fabHomeNavigator.isSelected | ||
} | ||
|
||
private fun navigateToInviteCodeActivity() { | ||
override fun onJoinMeeting() { | ||
startActivity(InviteCodeActivity.getIntent(this)) | ||
} | ||
|
||
override fun onCreateMeeting() { | ||
startActivity(MeetingCreationActivity.getIntent(this)) | ||
} | ||
|
||
override fun navigateToMeetingRoom(meetingId: Long) { | ||
startActivity(NotificationLogActivity.getIntent(this, meetingId)) | ||
} | ||
|
||
override fun guideItemDisabled() { | ||
showSnackBar(R.string.intro_notification_permission_required) | ||
} | ||
|
||
@RequiresApi(Build.VERSION_CODES.TIRAMISU) | ||
private fun requestPermissions() { | ||
if (ContextCompat.checkSelfPermission( | ||
|
@@ -148,6 +182,6 @@ class IntroActivity : BindingActivity<ActivityIntroBinding>(R.layout.activity_in | |
private const val PERMISSIONS_REQUEST_CODE = 1 | ||
private const val PERMISSION_REQUEST_CODE = 2 | ||
|
||
fun getIntent(context: Context): Intent = Intent(context, IntroActivity::class.java) | ||
fun getIntent(context: Context): Intent = Intent(context, HomeActivity::class.java) | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이 함수가 안 쓰이고 있는 것 같은데, DefaultMeetingRepository에서 사용하면 될 것 같네요