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

[Feat/#70] 마이페이지 api 연동 #71

Open
wants to merge 24 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
0dbd2a9
[FEAT/#66] 회원가입 이용약관 xml 작성
seongh06 Sep 24, 2024
4ec0c33
[FEAT/#66] 서비스 이용약관 팝업창 xml 작성
seongh06 Sep 24, 2024
64a2115
[FEAT/#66] 개인정보 처리방침 팝업창 xml 작성
seongh06 Sep 24, 2024
605ffb7
[FEAT/#66] login부분 setOnSingleClickListner로 변경
seongh06 Sep 24, 2024
8dc4ec6
[FEAT/#66] mypage부분 setOnSingleClickListner로 변경
seongh06 Sep 24, 2024
0a2dac7
[FEAT/#66] Log를 Timber로 변환
seongh06 Sep 25, 2024
9fb8536
[FEAT/#66] 마이페이지 메인에 설정 버튼 추가
seongh06 Sep 29, 2024
a07bf5e
[FEAT/#66] 마이페이지 beta 글씨 추가
seongh06 Sep 29, 2024
f6b60e3
[FEAT/#66] 마이페이지 앱 정보 xml 제작
seongh06 Sep 29, 2024
c87ed7e
[FEAT/#66] 이용약관 view 연결
seongh06 Sep 29, 2024
75622f2
[FEAT/#66] 마이페이지 view 변경
seongh06 Sep 30, 2024
b141501
[FEAT/#66] 이용약관 view 제작
seongh06 Oct 2, 2024
32726b2
[FEAT/#66] 로그인 api 수정
seongh06 Oct 3, 2024
123e109
[FEAT/#66] 회원가입 약관 동의 선택 변경
seongh06 Oct 3, 2024
3c93ad5
[FEAT/#66] 오픈소스 라이선스 이동 구현
seongh06 Oct 3, 2024
e28f43b
[FEAT/#66] 액세스 토큰 재발급 로직 구현
seongh06 Oct 9, 2024
397736a
[FEAT/#66] 회원가입 오류 수정
seongh06 Oct 9, 2024
a21bbde
Merge branch 'FEAT/#66-로그인-및-마이페이지-수정-사항-반영' into FEAT/#70-마이페이지-api-연동
seongh06 Oct 12, 2024
9d52e38
[FEAT/#66] Log -> Timber로 변경
seongh06 Oct 12, 2024
206080e
[FEAT/#66] 프로필 수정 변경
seongh06 Oct 16, 2024
c738e92
[FEAT/#70] 닉네임 중복 확인 수정
seongh06 Oct 16, 2024
5fbc870
[FEAT/#70] 마이페이지 api 적용 (테스트 x)
seongh06 Oct 16, 2024
6bc6426
[FEAT/#70] 첫화면에서 뒤로가기 방지
seongh06 Oct 16, 2024
dd97c94
[FEAT/#70] myPage에서 community, viewingParty 안보이도록 처리
seongh06 Oct 16, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -142,4 +142,7 @@ dependencies {
implementation("com.google.android.gms:play-services-oss-licenses:17.1.0")

implementation ("com.jakewharton.timber:timber:5.0.1")

implementation ("com.auth0.android:jwtdecode:2.0.0")

}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import okhttp3.RequestBody
import umc.everyones.lck.data.dto.BaseResponse
import umc.everyones.lck.data.dto.request.mypage.CancelHostViewingPartyMypageRequestDto
import umc.everyones.lck.data.dto.request.mypage.CancelParticipateViewingPartyMypageRequestDto
import umc.everyones.lck.data.dto.request.mypage.UpdateProfilesRequestDto
import umc.everyones.lck.data.dto.request.mypage.UpdateTeamRequestDto
import umc.everyones.lck.data.dto.response.NonBaseResponse
import umc.everyones.lck.data.dto.response.mypage.CommentsMypageResponseDto
Expand Down Expand Up @@ -33,7 +34,7 @@ interface MypageDataSource {

suspend fun withdraw(): NonBaseResponse

suspend fun updateProfiles(profileImage: MultipartBody.Part?, updateProfileRequest: RequestBody): BaseResponse<UpdateProfilesResponseDto>
suspend fun updateProfiles(profileImage: MultipartBody.Part, request: UpdateProfilesRequestDto): BaseResponse<UpdateProfilesResponseDto>

suspend fun updateTeam(requestDto: UpdateTeamRequestDto ): BaseResponse<Boolean>
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ import okhttp3.RequestBody
import umc.everyones.lck.data.dto.BaseResponse
import umc.everyones.lck.data.dto.request.login.CommonLoginRequestDto
import umc.everyones.lck.data.dto.request.login.NicknameAuthUserRequestDto
import umc.everyones.lck.data.dto.response.login.CommonLoginResponseDto
import umc.everyones.lck.data.dto.request.login.RefreshAuthUserRequestDto
import umc.everyones.lck.data.dto.response.login.LoginResponseDto

interface LoginDataSource {
suspend fun signup(signupUserData: RequestBody, profileImage: MultipartBody.Part): BaseResponse<CommonLoginResponseDto>
suspend fun signup(signupUserData: RequestBody, profileImage: MultipartBody.Part): BaseResponse<LoginResponseDto>

suspend fun login(requestDto: CommonLoginRequestDto): BaseResponse<LoginResponseDto>

suspend fun refresh(requestDto: CommonLoginRequestDto): BaseResponse<CommonLoginResponseDto>
suspend fun refresh(requestDto: RefreshAuthUserRequestDto): BaseResponse<LoginResponseDto>

suspend fun nickname(request: NicknameAuthUserRequestDto): BaseResponse<Boolean>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
package umc.everyones.lck.data.datasourceImpl

import android.util.Log
import okhttp3.MultipartBody
import okhttp3.RequestBody
import umc.everyones.lck.data.datasource.login.LoginDataSource
import umc.everyones.lck.data.dto.BaseResponse
import umc.everyones.lck.data.dto.request.login.CommonLoginRequestDto
import umc.everyones.lck.data.dto.request.login.NicknameAuthUserRequestDto
import umc.everyones.lck.data.dto.response.login.CommonLoginResponseDto
import umc.everyones.lck.data.dto.request.login.RefreshAuthUserRequestDto
import umc.everyones.lck.data.dto.response.login.LoginResponseDto
import umc.everyones.lck.data.service.LoginService
import javax.inject.Inject
Expand All @@ -18,12 +17,12 @@ class LoginDataSourceImpl @Inject constructor(
override suspend fun signup(
signupUserData: RequestBody,
profileImage: MultipartBody.Part
): BaseResponse<CommonLoginResponseDto> =
): BaseResponse<LoginResponseDto> =
loginService.signup(signupUserData, profileImage)

override suspend fun login(requestDto: CommonLoginRequestDto):BaseResponse<LoginResponseDto> = loginService.login(requestDto)

override suspend fun refresh(requestDto: CommonLoginRequestDto):BaseResponse<CommonLoginResponseDto> = loginService.refresh(requestDto)
override suspend fun refresh(requestDto: RefreshAuthUserRequestDto):BaseResponse<LoginResponseDto> = loginService.refresh(requestDto)

override suspend fun nickname(requestDto: NicknameAuthUserRequestDto): BaseResponse<Boolean> = loginService.nickname(requestDto.nickName)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import umc.everyones.lck.data.datasource.MypageDataSource
import umc.everyones.lck.data.dto.BaseResponse
import umc.everyones.lck.data.dto.request.mypage.CancelHostViewingPartyMypageRequestDto
import umc.everyones.lck.data.dto.request.mypage.CancelParticipateViewingPartyMypageRequestDto
import umc.everyones.lck.data.dto.request.mypage.UpdateProfilesRequestDto
import umc.everyones.lck.data.dto.request.mypage.UpdateTeamRequestDto
import umc.everyones.lck.data.dto.response.NonBaseResponse
import umc.everyones.lck.data.dto.response.mypage.CommentsMypageResponseDto
Expand Down Expand Up @@ -47,8 +48,8 @@ class MypageDataSourceImpl @Inject constructor(
override suspend fun withdraw(): NonBaseResponse =
mypageService.withdraw()

override suspend fun updateProfiles(profileImage: MultipartBody.Part?, updateProfileRequest: RequestBody): BaseResponse<UpdateProfilesResponseDto> =
mypageService.updateProfiles(profileImage, updateProfileRequest)
override suspend fun updateProfiles(profileImage: MultipartBody.Part, updateProfileRequest: UpdateProfilesRequestDto): BaseResponse<UpdateProfilesResponseDto> =
mypageService.updateProfiles(profileImage, updateProfileRequest.updateProfileRequest)

override suspend fun updateTeam(requestDto: UpdateTeamRequestDto): BaseResponse<Boolean> =
mypageService.updateTeam(requestDto)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package umc.everyones.lck.data.dto.request.login

data class RefreshAuthUserRequestDto(
val kakaoUserId: String,
val refreshToken: String
)
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
package umc.everyones.lck.data.dto.request.mypage

import okhttp3.MultipartBody
import okhttp3.RequestBody
import umc.everyones.lck.data.UpdateProfileRequest

data class UpdateProfilesRequestDto(
val profileImage: MultipartBody.Part,
val updateProfileRequest: UpdateProfileRequestElementDto
val updateProfileRequest: RequestBody
) {
data class UpdateProfileRequestElementDto(
val nickname: String,
val isDefaultImage: Boolean
val nickname: String?,
val defaultImage: Boolean
)
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,4 @@ data class LoginResponseDto(
){
fun toLoginResponseDto() =
LoginResponseModel(accessToken, refreshToken, accessTokenExpirationTime, refreshTokenExpirationTime, nickName)
}

}
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package umc.everyones.lck.data.dto.response.mypage

import umc.everyones.lck.domain.model.response.mypage.UpdateProfilesModel
import umc.everyones.lck.domain.model.response.mypage.UpdateProfilesResponseModel

data class UpdateProfilesResponseDto(
val updatedProfileImageUrl: String,
val updatedProfileImageUrl: String,
val updatedNickname: String
){
fun toUpdateProfilesModel() =
UpdateProfilesModel(updatedProfileImageUrl, updatedNickname)
fun toUpdateProfilesResponseModel() =
UpdateProfilesResponseModel(updatedProfileImageUrl, updatedNickname)
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@ package umc.everyones.lck.data.repositoryImpl.login
import okhttp3.MultipartBody
import okhttp3.RequestBody
import umc.everyones.lck.data.datasource.login.LoginDataSource
import umc.everyones.lck.data.dto.BaseResponse
import umc.everyones.lck.domain.model.request.login.CommonLoginRequestModel
import umc.everyones.lck.domain.model.request.login.NicknameAuthUserRequestModel
import umc.everyones.lck.domain.model.response.login.CommonLoginResponseModel
import umc.everyones.lck.domain.model.request.login.RefreshAuthUserRequestModel
import umc.everyones.lck.domain.model.response.login.LoginResponseModel
import umc.everyones.lck.domain.repository.login.LoginRepository
import javax.inject.Inject
Expand All @@ -17,14 +16,14 @@ class LoginRepositoryImpl @Inject constructor(
override suspend fun signup(
signupUserData: RequestBody,
profileImage: MultipartBody.Part
): Result<CommonLoginResponseModel> =
runCatching { loginDataSource.signup(signupUserData, profileImage).data.toCommonLoginResponseDto() }
): Result<LoginResponseModel> =
runCatching { loginDataSource.signup(signupUserData, profileImage).data.toLoginResponseDto() }

override suspend fun login(request:CommonLoginRequestModel): Result<LoginResponseModel> =
runCatching { loginDataSource.login(request.toCommonLoginRequestDto()).data.toLoginResponseDto()}

override suspend fun refresh(request: CommonLoginRequestModel): Result<CommonLoginResponseModel> =
runCatching { loginDataSource.refresh(request.toCommonLoginRequestDto()).data.toCommonLoginResponseDto() }
override suspend fun refresh(request: RefreshAuthUserRequestModel): Result<LoginResponseModel> =
runCatching { loginDataSource.refresh(request.toRefreshAuthUserRequestDto()).data.toLoginResponseDto() }

override suspend fun nickname(request: NicknameAuthUserRequestModel): Result<Boolean> =
runCatching {loginDataSource.nickname(request.toNicknameAuthUserRequestDto()).data}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,16 @@ package umc.everyones.lck.data.repositoryImpl.mypage
import okhttp3.MultipartBody
import okhttp3.RequestBody
import umc.everyones.lck.data.datasource.MypageDataSource
import umc.everyones.lck.data.dto.request.mypage.CancelParticipateViewingPartyMypageRequestDto
import umc.everyones.lck.data.dto.request.mypage.UpdateProfilesRequestDto
import umc.everyones.lck.data.dto.response.NonBaseResponse
import umc.everyones.lck.domain.model.request.mypage.CancelHostViewingPartyMypageModel
import umc.everyones.lck.domain.model.request.mypage.CancelParticipateViewingPartyMypageModel
import umc.everyones.lck.domain.model.request.mypage.UpdateProfilesRequestModel
import umc.everyones.lck.domain.model.request.mypage.UpdateTeamModel
import umc.everyones.lck.domain.model.response.mypage.CommentsMypageModel
import umc.everyones.lck.domain.model.response.mypage.HostViewingPartyMypageModel
import umc.everyones.lck.domain.model.response.mypage.InquiryProfilesModel
import umc.everyones.lck.domain.model.response.mypage.ParticipateViewingPartyMypageModel
import umc.everyones.lck.domain.model.response.mypage.PostsMypageModel
import umc.everyones.lck.domain.model.response.mypage.UpdateProfilesModel
import umc.everyones.lck.domain.model.response.mypage.UpdateProfilesResponseModel
import umc.everyones.lck.domain.repository.MypageRepository
import javax.inject.Inject

Expand Down Expand Up @@ -47,8 +46,8 @@ class MypageRepositoryImpl @Inject constructor(
override suspend fun withdraw(): Result<NonBaseResponse> =
runCatching { mypageDataSource.withdraw() }

override suspend fun updateProfiles(profileImage: MultipartBody.Part?, updateProfileRequest: RequestBody): Result<UpdateProfilesModel> =
runCatching { mypageDataSource.updateProfiles(profileImage, updateProfileRequest).data.toUpdateProfilesModel() }
override suspend fun updateProfiles(profileImage: MultipartBody.Part, requestModel: UpdateProfilesRequestModel): Result<UpdateProfilesResponseModel> =
runCatching { mypageDataSource.updateProfiles(profileImage, requestModel.toUpdateProfilesRequestDto()).data.toUpdateProfilesResponseModel()}

override suspend fun updateTeam(request: UpdateTeamModel): Result<Boolean> =
runCatching { mypageDataSource.updateTeam(request.toUpdateTeamRequestDto()).data }
Expand Down
11 changes: 4 additions & 7 deletions app/src/main/java/umc/everyones/lck/data/service/LoginService.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,13 @@ import okhttp3.MultipartBody
import okhttp3.RequestBody
import retrofit2.http.Body
import retrofit2.http.GET
import retrofit2.http.Header
import retrofit2.http.Multipart
import retrofit2.http.POST
import retrofit2.http.Part
import retrofit2.http.Path
import retrofit2.http.Query
import umc.everyones.lck.data.dto.BaseResponse
import umc.everyones.lck.data.dto.request.login.CommonLoginRequestDto
import umc.everyones.lck.data.dto.request.login.NicknameAuthUserRequestDto
import umc.everyones.lck.data.dto.response.login.CommonLoginResponseDto
import umc.everyones.lck.data.dto.request.login.RefreshAuthUserRequestDto
import umc.everyones.lck.data.dto.response.login.LoginResponseDto

interface LoginService {
Expand All @@ -23,7 +20,7 @@ interface LoginService {
suspend fun signup(
@Part("signupUserData") signupUserData: RequestBody,
@Part profileImage: MultipartBody.Part
): BaseResponse<CommonLoginResponseDto>
): BaseResponse<LoginResponseDto>

@POST("/auth/login")
suspend fun login(
Expand All @@ -32,8 +29,8 @@ interface LoginService {

@POST("/auth/refresh")
suspend fun refresh(
@Body request: CommonLoginRequestDto
):BaseResponse<CommonLoginResponseDto>
@Body request: RefreshAuthUserRequestDto
):BaseResponse<LoginResponseDto>

@GET("auth/nickname")
suspend fun nickname(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import umc.everyones.lck.data.UpdateProfileRequest
import umc.everyones.lck.data.dto.BaseResponse
import umc.everyones.lck.data.dto.request.mypage.CancelHostViewingPartyMypageRequestDto
import umc.everyones.lck.data.dto.request.mypage.CancelParticipateViewingPartyMypageRequestDto
import umc.everyones.lck.data.dto.request.mypage.UpdateProfilesRequestDto
import umc.everyones.lck.data.dto.request.mypage.UpdateTeamRequestDto
import umc.everyones.lck.data.dto.response.NonBaseResponse
import umc.everyones.lck.data.dto.response.mypage.CommentsMypageResponseDto
Expand Down Expand Up @@ -73,12 +74,12 @@ interface MypageService {
@Multipart
@PATCH("my-pages/profiles")
suspend fun updateProfiles(
@Part profileImage: MultipartBody.Part?,
@Part("updateProfileRequest") updateProfileRequest: RequestBody
@Part profileImage: MultipartBody.Part,
@Part("updateProfileRequest") request: RequestBody
): BaseResponse<UpdateProfilesResponseDto>

@PATCH("my-pages/my-team")
suspend fun updateTeam(
@Body request: UpdateTeamRequestDto
): BaseResponse<Boolean>
}
}
57 changes: 32 additions & 25 deletions app/src/main/java/umc/everyones/lck/di/NetworkModule.kt
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ object NetworkModule {
const val NETWORK_EXCEPTION_OFFLINE_CASE = "network status is offline"
const val NETWORK_EXCEPTION_BODY_IS_NULL = "result.json body is null"

// @Provides : 모듈 클래스 내에 해당 객체 생성
@Provides
@Singleton
fun providesConverterFactory(): GsonConverterFactory {
Expand All @@ -47,23 +46,49 @@ object NetworkModule {
)
}

@Provides
@Singleton
fun providesRetrofit(
client: OkHttpClient,
gsonConverterFactory: GsonConverterFactory
): Retrofit {
return Retrofit.Builder()
.baseUrl(EveryonesLCKApplication.getString(R.string.base_url))
.addConverterFactory(gsonConverterFactory)
.client(client)
.build()
}

@Provides
@Singleton
fun providesOkHttpClient(
authInterceptor: AuthInterceptor
sharedPreferences: SharedPreferences,
gsonConverterFactory: GsonConverterFactory // GsonConverterFactory를 주입받습니다.
): OkHttpClient {
val interceptor = HttpLoggingInterceptor().apply {
val authInterceptor = AuthInterceptor(sharedPreferences) {
providesRetrofit(providesOkHttpClient(sharedPreferences, gsonConverterFactory), gsonConverterFactory)
}
val loggingInterceptor = HttpLoggingInterceptor().apply {
level = HttpLoggingInterceptor.Level.BODY
}

return OkHttpClient.Builder().apply {
addInterceptor(authInterceptor)
addInterceptor(interceptor)
addInterceptor(loggingInterceptor)
connectTimeout(5, TimeUnit.SECONDS)
readTimeout(5, TimeUnit.SECONDS)
writeTimeout(5, TimeUnit.SECONDS)
}.build()
}

@Provides
@Singleton
fun provideAuthInterceptor(
sharedPreferences: SharedPreferences
): AuthInterceptor {
return AuthInterceptor(sharedPreferences) { providesRetrofit(providesOkHttpClient(sharedPreferences, providesConverterFactory()), providesConverterFactory()) }
}

@Provides
@Singleton
@Named("NaverClient")
Expand All @@ -82,19 +107,6 @@ object NetworkModule {
.build()
}

@Provides
@Singleton
fun providesRetrofit(
client: OkHttpClient,
gsonConverterFactory: GsonConverterFactory
): Retrofit {
return Retrofit.Builder()
.baseUrl(EveryonesLCKApplication.getString(R.string.base_url))
.addConverterFactory(gsonConverterFactory)
.client(client)
.build()
}

@Provides
@Singleton
fun provideMypageService(
Expand All @@ -108,23 +120,18 @@ object NetworkModule {
@Named("naver")
fun providesNaverRetrofit(
@Named("NaverClient") client: OkHttpClient,
): Retrofit{
): Retrofit {
return Retrofit.Builder()
.client(client)
.baseUrl(EveryonesLCKApplication.getString(R.string. naver_url))
.baseUrl(EveryonesLCKApplication.getString(R.string.naver_url))
.addConverterFactory(ScalarsConverterFactory.create())
.addConverterFactory(GsonConverterFactory.create())
.build()
}

@Provides
@Singleton
fun provideAuthInterceptor(sharedPreferences: SharedPreferences): AuthInterceptor =
AuthInterceptor(sharedPreferences)

@Provides
@Singleton
fun providesLoginService(retrofit: Retrofit): LoginService {
return retrofit.create(LoginService::class.java)
}
}
}
Loading