-
Notifications
You must be signed in to change notification settings - Fork 0
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
Week4 #8
Conversation
) | ||
|
||
@Serializable | ||
data class ResponseSignInDto( |
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.
SignIn, SignUp Dto 보면 공통으로 json object 로 감싸지는 영역들이 있는데요,
(status, message, data)
이런 부분들은 추상화 시켜서 중복을 제거해보는건 어떨까요?
- 적용해볼것
- Generic 활용
- 관련해 공부해보면 좋은 내용
- 객체지향
- Generic in kotlin
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 retrofit2.http.GET | ||
|
||
interface HomeUserService { | ||
@GET("users?page=2") |
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.
page 가 static 하게 2로 박혀있는 이유가 있을까요?
실제 앱을 구현하게 될때는 동적으로 받게될텐데, 적용해봐도 도움될것같네요
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.
아직 화면에서 page를 받아오는 부분을 구현하지 않아서 우선 page를 static하게 2로 넣어뒀습니다. 후에 page를 받아오는 view를 만들게 되면 동적으로 바꿀 수 있도록 수정하겠습니다!
interface KakaoSearchService { | ||
@GET("v2/search/vclip") | ||
fun kakaoSearchVideo( | ||
@Header("Authorization") apiKey: String = BuildConfig.KAKAO_AUTH_HEADER, |
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.
매 요청마다 Authorization header 를 추가해주어야할 수도있는데,
어떻게 하면 매번 추가하는 header 를 생략할 수 있을까요?
(추가로, 매번 이렇게 추가하는게 나쁜건 아니지만, 어떤 문제점이 발생할 수 있을까요? (귀찮음 빼고) )
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.
interceptor를 활용해서 요청을 보내는 방법으로 해결할 수 있을 것 같습니다!
매번 추가하면 중복이 심하고 관리하기 번거롭다는 문제가 발생할 수 있는 것 같네요! 혹시 이 외에 다른 문제점도 있을까요?
import retrofit2.http.Body | ||
import retrofit2.http.POST | ||
|
||
// suspend 함수? |
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.
coroutine 을 사용하면 suspend fun 을 활용하게 되겠네요~ 앱잼때 거의 쓰게되어서,, 공부 꼭 해보면 좋겠네요
(세미나에서 다루겠지만)
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 LoginActivity : AppCompatActivity() { | ||
|
||
private lateinit var binding: ActivityLoginBinding | ||
private val signInService = ServicePool.signInService |
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.
object class 에서 끌고오는 signInService 는 필드로 받을 필요는 없어보입니다~
바로 로직에서 사용하면 될것같아요
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.
넵!!!
} else { | ||
showShortToast(getString(R.string.login_fail_login_msg)) | ||
} | ||
signInService.signIn( |
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.
signInService.signIn( | |
ServicePool.signInService.signIn(RequestIsnInDto(et,,, )) |
} | ||
} | ||
|
||
override fun onFailure(call: Call<ResponseSignInDto>, t: Throwable) { |
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.
onFailure 는 언제 발생하게 될까요
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.
네트워크에 연결되지 않는 경우 onFailure가 발생하고 그 외의 에러(4xx, 5xx 등)은 onResponse에서 받아와 예외처리를 하는 것 같습니다!
성환이 최고...💝 |
이름 모르는건 아니지 누나..? |
ㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋ .. |
이슈
작업 내용
필수 과제
진짜 회원가입/로그인
Home 화면 꾸미기
심화 과제