Skip to content
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

Week4 #8

Merged
merged 30 commits into from
May 20, 2023
Merged

Week4 #8

merged 30 commits into from
May 20, 2023

Conversation

SeonHwan-Kim
Copy link
Collaborator

이슈

작업 내용

필수 과제

  • 진짜 회원가입/로그인

    • 모든 입력값을 받으면 회원가입 버튼 클릭 할 수 있도록 수정
    • 서버 통신하여 회원가입하기
    • 로그인 api 연동
    • 실패시..?
  • Home 화면 꾸미기

심화 과제

  • Search Fragment 꾸미기
    • 주어진 키워드 입력 후 검색 버튼 클릭 시 API 통신
    • 성공적으로 응답이 된 경우 검색 입력창 하단이 리스트로 바뀌어져 검색 결과 리스트 보여주기
    • 검색 결과가 비어있다면 Empty UI 로 구성

)

@Serializable
data class ResponseSignInDto(

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SignIn, SignUp Dto 보면 공통으로 json object 로 감싸지는 영역들이 있는데요,
(status, message, data)
이런 부분들은 추상화 시켜서 중복을 제거해보는건 어떨까요?

  • 적용해볼것
    • Generic 활용
  • 관련해 공부해보면 좋은 내용
    • 객체지향
    • Generic in kotlin

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

한번 공부해보고 수정해보겠습니다!

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

짱이다..

import retrofit2.http.GET

interface HomeUserService {
@GET("users?page=2")

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

page 가 static 하게 2로 박혀있는 이유가 있을까요?
실제 앱을 구현하게 될때는 동적으로 받게될텐데, 적용해봐도 도움될것같네요

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

아직 화면에서 page를 받아오는 부분을 구현하지 않아서 우선 page를 static하게 2로 넣어뒀습니다. 후에 page를 받아오는 view를 만들게 되면 동적으로 바꿀 수 있도록 수정하겠습니다!

interface KakaoSearchService {
@GET("v2/search/vclip")
fun kakaoSearchVideo(
@Header("Authorization") apiKey: String = BuildConfig.KAKAO_AUTH_HEADER,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

매 요청마다 Authorization header 를 추가해주어야할 수도있는데,
어떻게 하면 매번 추가하는 header 를 생략할 수 있을까요?
(추가로, 매번 이렇게 추가하는게 나쁜건 아니지만, 어떤 문제점이 발생할 수 있을까요? (귀찮음 빼고) )

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

interceptor를 활용해서 요청을 보내는 방법으로 해결할 수 있을 것 같습니다!
매번 추가하면 중복이 심하고 관리하기 번거롭다는 문제가 발생할 수 있는 것 같네요! 혹시 이 외에 다른 문제점도 있을까요?

import retrofit2.http.Body
import retrofit2.http.POST

// suspend 함수?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

coroutine 을 사용하면 suspend fun 을 활용하게 되겠네요~ 앱잼때 거의 쓰게되어서,, 공부 꼭 해보면 좋겠네요
(세미나에서 다루겠지만)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

넵!!



class LoginActivity : AppCompatActivity() {

private lateinit var binding: ActivityLoginBinding
private val signInService = ServicePool.signInService

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

object class 에서 끌고오는 signInService 는 필드로 받을 필요는 없어보입니다~
바로 로직에서 사용하면 될것같아요

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

넵!!!

} else {
showShortToast(getString(R.string.login_fail_login_msg))
}
signInService.signIn(

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
signInService.signIn(
ServicePool.signInService.signIn(RequestIsnInDto(et,,, ))

}
}

override fun onFailure(call: Call<ResponseSignInDto>, t: Throwable) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

onFailure 는 언제 발생하게 될까요

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

네트워크에 연결되지 않는 경우 onFailure가 발생하고 그 외의 에러(4xx, 5xx 등)은 onResponse에서 받아와 예외처리를 하는 것 같습니다!

@skylartosf
Copy link

성환이 최고...💝

@giovannijunseokim
Copy link

성환이 최고...💝

이름 모르는건 아니지 누나..?

@daehwan2da
Copy link

ㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋ ..

@SeonHwan-Kim SeonHwan-Kim merged commit bf60800 into develop May 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants