-
Notifications
You must be signed in to change notification settings - Fork 2
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] 핀 목록 (좌표 필터링x) API 연동 #95
Conversation
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.
1차 코리 ㅋㅋ. 추가할게염 고생핑
import org.sopt.pingle.util.base.BaseResponse | ||
|
||
interface MapRemoteDataSource { | ||
suspend fun getPinListWithoutFiltering(teamId: Long, category: String?): BaseResponse<List<ResponsePinListDto>> |
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.
아 애초에 여기서부터 List로 선언을 해줘야 하는 군여,, Service에서만 선언하니까 오류가 난거였티비..~
import org.sopt.pingle.data.service.MapService | ||
import org.sopt.pingle.util.base.BaseResponse | ||
|
||
class MapRemoteDataSourceImpl @Inject constructor( |
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.
@Inject 어노테이션은 디펜던시에 힐트 설정 안 하면 못 쓰는 앤가요?
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.
네 인젝션은 힐트에서 사용하는 어노테이션이기때문에 힐트를 사용할 때만 가능한 것으로 알고있습니다
teamId: Long, | ||
category: String? | ||
): BaseResponse<List<ResponsePinListDto>> = | ||
mapService.getPinListWithoutFiltering(teamId = teamId, category = category) |
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.
데이터소스에서 함수 추상화하고 데이터소스Impl에서 서비스에 접근해서 통신한 값들 불러오는 함수를 호출하는 거까지 이해 완...
갑자기 궁금한게 생겼는데 서비스는 왜 인터페이스인걸가요? 얘네는 오버라이드 해야되는 함수를 구현하는 것도 아닌데.. 흠냐
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.
구현해야할 코드가 없고 서버통신에서 필요한 부분이 어노테이션과 매개변수에 있어서 그런게 아닐까요..?!
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.
2차 코리 끝 ㅎ.ㅎ
@Query(CATEGORY) category: String? | ||
): BaseResponse<List<ResponsePinListDto>> | ||
|
||
companion object { |
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.
이건 URI에서 중복되는 부분들 일부러 다 상수화한건가요? 이렇게 해야 하는 이유는 무엇인가여? 몇 개 없을 때 상수화하는게 가독성에 조을까요? 그냥 나중에 규모가 커졌을 때를 대비해서 미리 상수화하는건가여
|
||
@Binds | ||
@Singleton | ||
abstract fun bindsMapRemoteDataSource(mapRemoteDataSourceImpl: MapRemoteDataSourceImpl): MapRemoteDataSource |
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.
이 부분이 제일 이해가 안되는데................................. 힐트 부분인건가요? 대충 뭘 많이 모아둔.. 데이터소스를 모아둔 부분인 건 알겠는데요.........
@@ -16,4 +18,9 @@ object ServiceModule { | |||
@Singleton | |||
fun providesDummyService(@Pingle retrofit: Retrofit): DummyService = | |||
retrofit.create(DummyService::class.java) | |||
|
|||
@Provides |
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.
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.
혼자 공부완ㅋㅅㅋ
import org.sopt.pingle.domain.repository.DummyRepository | ||
import org.sopt.pingle.domain.repository.MapRepository | ||
|
||
@Module | ||
@InstallIn(SingletonComponent::class) | ||
abstract class RepositoryModule { | ||
@Binds | ||
@Singleton |
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.
@singleton 객체의 인스턴스가 1개만 생성되는 싱글톤 패턴을 구현하기 위해 존재하는 어노테이션인가요? 이 어노테이션의 의미가 궁금합니다링구
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.
다은언니와 공부완
`~
class GetPinListWithoutFilteringUseCase( | ||
private val mapRepository: MapRepository | ||
) { | ||
suspend operator fun invoke(teamId: Long, category: String?): Flow<List<PinEntity>> = |
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.
왜 함수 이름 선언 안 해주고 invoke를 쓰는 건가염? invoke의 이점이 무엇인지 궁금합니둥
|
||
@AndroidEntryPoint |
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.
@androidentrypoint 는 프로젝트의 각 Android 클래스에 관한 개별 Hilt 구성요소를 생성합니다....... 대충 뇌빼고 따라 쳐야 하는 부분 그냥 규칙.. 머 그런거겠죠
mapViewModel.category.flowWithLifecycle(lifecycle).onEach { | ||
// TODO 서버 통신 구현 시 삭제 예정 | ||
showToast(it?.name ?: "null") | ||
mapViewModel.category.flowWithLifecycle(lifecycle).onEach { category -> |
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.
좋다.. 이 코드.. 쇽샥 가능하겠군요..
companion object { | ||
const val VERSION = "v1" | ||
const val TEAMS = "teams" | ||
const val PINS = "pins" | ||
const val TEAM_ID = "teamId" | ||
const val CATEGORY = "category" | ||
} |
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.
이 부분 상수화를 모든 Service 파일마다 해야하는건가요!?
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.
더 궁금한점이 나중에 url이 바뀔 가능성과 가독성을 위한거라면 상수화한 파일만 따로만들어서 서버통신 부분에서 공통되게 사용해야하는게 맞는 방법이라고 생각이 들어요!
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.
많이 보고 배웠습니다요~
import org.sopt.pingle.data.service.MapService | ||
import org.sopt.pingle.util.base.BaseResponse | ||
|
||
class MapRemoteDataSourceImpl @Inject constructor( |
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.
네 인젝션은 힐트에서 사용하는 어노테이션이기때문에 힐트를 사용할 때만 가능한 것으로 알고있습니다
teamId: Long, | ||
category: String? | ||
): BaseResponse<List<ResponsePinListDto>> = | ||
mapService.getPinListWithoutFiltering(teamId = teamId, category = category) |
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.
구현해야할 코드가 없고 서버통신에서 필요한 부분이 어노테이션과 매개변수에 있어서 그런게 아닐까요..?!
).data.map { pin -> | ||
pin.toPinEntity() | ||
} |
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.
이런식으로 하는거 몰랐었는데 코드짜면서 막힐 때 보고 배웠습니닷!
companion object { | ||
const val VERSION = "v1" | ||
const val TEAMS = "teams" | ||
const val PINS = "pins" | ||
const val TEAM_ID = "teamId" | ||
const val CATEGORY = "category" | ||
} |
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.
더 궁금한점이 나중에 url이 바뀔 가능성과 가독성을 위한거라면 상수화한 파일만 따로만들어서 서버통신 부분에서 공통되게 사용해야하는게 맞는 방법이라고 생각이 들어요!
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.
우헤헹 멋찌다
Related issue 🛠
Work Description ✏️
Screenshot 📸
Screen_recording_20240110_212511.mp4
Uncompleted Tasks 😅
To Reviewers 📢
더미 파일 보고 이해하기 힘들면 이 PR 보고 서버 통신 진행하세요 ~
서울, 독도, 제주도에 핀 하나씩 찍힘 ㅋㅋ