-
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/#41] sharedpreferences + SignIn + SignUp 분기 처리 및 연결 #53
Merged
+549
−268
Merged
Changes from all commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
b7b6367
[CHORE/#41] sharedpreferences 구현
chattymin f141fd8
[CHORE/#41] sharedpreferences 구현
chattymin 3903dbe
[FIX/#41] app Key 변경 -> kakao login error fix
chattymin 309dffd
Merge branch 'develop' into feat/#41-sharedpreferences
chattymin 3cd3b8e
[FIX/#41] 쉐어드프리퍼런스 구현
chattymin e65a140
[FIX/#41] kakao login 흐름 구현 -> 회원가입 이동
chattymin 3b0df13
[FIX/#41] error code 상수화
chattymin d53253b
[FIX/#41] SignUp 기초 flow 세팅
chattymin 4a1af06
[FIX/#41] 서버통신 에러코드 익스텐션 생성 및 적용
chattymin 386b29e
[FIX/#41] 서버통신 에러코드 익스텐션 간략화
chattymin a1d8787
[FIX/#41] 구조 리펙토링
chattymin 6dae170
[FEAT/#41] SignUp Api 구현
chattymin 17170fc
[FEAT/#41] SignUp Api 구현 및 분기처리
chattymin fc88ef2
[FEAT/#41] sharedpreferences 기능 연결
chattymin 19b6622
[FEAT/#41] signup 분기처리
chattymin 15919b8
[FEAT/#41] SignIn 분기처리
chattymin f0152ac
[CHORE/#41] 미사용 import 및 객체 삭제
chattymin 837d0b2
[FEAT/#41] SignIn model 생성 및 적용
chattymin cb6ebb9
[CHORE/#41] SignIn으로 네이밍 통일
chattymin a49e3d8
[CHORE/#41] 변수명 수정
chattymin 098cb9c
[CHORE/#41] 줄바꿈
chattymin a1a2f0e
Merge branch 'develop' into feat/#41-sharedpreferences
chattymin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package com.going.going.di | ||
|
||
import android.content.Context | ||
import android.content.SharedPreferences | ||
import com.going.data.local.GoingDataStoreImpl | ||
import com.going.data.local.GoingDataStore | ||
import dagger.Module | ||
import dagger.Provides | ||
import dagger.hilt.InstallIn | ||
import dagger.hilt.android.qualifiers.ApplicationContext | ||
import dagger.hilt.components.SingletonComponent | ||
import javax.inject.Singleton | ||
|
||
@Module | ||
@InstallIn(SingletonComponent::class) | ||
object DataStoreModule { | ||
|
||
@Provides | ||
@Singleton | ||
fun provideSharedPreferences(@ApplicationContext context: Context): SharedPreferences = | ||
context.getSharedPreferences(context.packageName, Context.MODE_PRIVATE) | ||
|
||
@Provides | ||
@Singleton | ||
fun provideGoingDataStore(dataStoreImpl: GoingDataStoreImpl): GoingDataStore = | ||
dataStoreImpl | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
data/src/main/java/com/going/data/datasource/AuthDataSource.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package com.going.data.datasource | ||
|
||
import com.going.data.dto.BaseResponse | ||
import com.going.data.dto.request.SignInRequestDto | ||
import com.going.data.dto.request.SignUpRequestDto | ||
import com.going.data.dto.response.AuthResponseDto | ||
|
||
interface AuthDataSource { | ||
suspend fun postSignIn( | ||
Authorization: String, | ||
platform: SignInRequestDto, | ||
): BaseResponse<AuthResponseDto> | ||
|
||
suspend fun postSignUp( | ||
Authorization: String, | ||
data: SignUpRequestDto, | ||
): BaseResponse<AuthResponseDto> | ||
} |
12 changes: 0 additions & 12 deletions
12
data/src/main/java/com/going/data/datasource/LoginDataSource.kt
This file was deleted.
Oops, something went wrong.
24 changes: 24 additions & 0 deletions
24
data/src/main/java/com/going/data/datasourceImpl/AuthDataSourceImpl.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package com.going.data.datasourceImpl | ||
|
||
import com.going.data.datasource.AuthDataSource | ||
import com.going.data.dto.BaseResponse | ||
import com.going.data.dto.request.SignInRequestDto | ||
import com.going.data.dto.request.SignUpRequestDto | ||
import com.going.data.dto.response.AuthResponseDto | ||
import com.going.data.service.AuthService | ||
import javax.inject.Inject | ||
|
||
class AuthDataSourceImpl @Inject constructor( | ||
private val authService: AuthService, | ||
) : AuthDataSource { | ||
override suspend fun postSignIn( | ||
Authorization: String, | ||
platform: SignInRequestDto, | ||
): BaseResponse<AuthResponseDto> = | ||
authService.postSignin(Authorization, platform) | ||
|
||
override suspend fun postSignUp( | ||
Authorization: String, | ||
data: SignUpRequestDto, | ||
): BaseResponse<AuthResponseDto> = authService.postSignUp(Authorization, data) | ||
} |
18 changes: 0 additions & 18 deletions
18
data/src/main/java/com/going/data/datasourceImpl/LoginDataSourceImpl.kt
This file was deleted.
Oops, something went wrong.
10 changes: 0 additions & 10 deletions
10
data/src/main/java/com/going/data/dto/request/RequestLoginDto.kt
This file was deleted.
Oops, something went wrong.
15 changes: 15 additions & 0 deletions
15
data/src/main/java/com/going/data/dto/request/SignInRequestDto.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package com.going.data.dto.request | ||
|
||
import com.going.domain.entity.request.RequestSignInModel | ||
import com.going.domain.entity.request.RequestSignUpModel | ||
import kotlinx.serialization.SerialName | ||
import kotlinx.serialization.Serializable | ||
|
||
@Serializable | ||
data class SignInRequestDto( | ||
@SerialName("platform") | ||
val platform: String | ||
) | ||
|
||
fun RequestSignInModel.toSignInRequestDto(): SignInRequestDto = | ||
SignInRequestDto(platform) |
18 changes: 18 additions & 0 deletions
18
data/src/main/java/com/going/data/dto/request/SignUpRequestDto.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package com.going.data.dto.request | ||
|
||
import com.going.domain.entity.request.RequestSignUpModel | ||
import kotlinx.serialization.SerialName | ||
import kotlinx.serialization.Serializable | ||
|
||
@Serializable | ||
data class SignUpRequestDto( | ||
@SerialName("name") | ||
val name: String, | ||
@SerialName("intro") | ||
val intro: String, | ||
@SerialName("platform") | ||
val platform: String, | ||
) | ||
|
||
fun RequestSignUpModel.toSignUpRequestDto(): SignUpRequestDto = | ||
SignUpRequestDto(name, intro, platform) |
16 changes: 16 additions & 0 deletions
16
data/src/main/java/com/going/data/dto/response/AuthResponseDto.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package com.going.data.dto.response | ||
|
||
import com.going.domain.entity.response.AuthTokenModel | ||
import kotlinx.serialization.SerialName | ||
import kotlinx.serialization.Serializable | ||
|
||
@Serializable | ||
data class AuthResponseDto( | ||
@SerialName("accessToken") | ||
val accessToken: String, | ||
@SerialName("refreshToken") | ||
val refreshToken: String, | ||
) { | ||
fun toAuthTokenModel() = | ||
AuthTokenModel(accessToken = accessToken, refreshToken = refreshToken) | ||
} |
37 changes: 0 additions & 37 deletions
37
data/src/main/java/com/going/data/dto/response/LoginResponseDto.kt
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package com.going.data.local | ||
|
||
interface GoingDataStore { | ||
var accessToken: String | ||
var refreshToken: String | ||
} |
22 changes: 22 additions & 0 deletions
22
data/src/main/java/com/going/data/local/GoingDataStoreImpl.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package com.going.data.local | ||
|
||
import android.content.SharedPreferences | ||
import androidx.core.content.edit | ||
import javax.inject.Inject | ||
|
||
class GoingDataStoreImpl @Inject constructor( | ||
private val dataStore: SharedPreferences, | ||
) : GoingDataStore { | ||
override var accessToken: String | ||
get() = dataStore.getString(ACCESS_TOKEN, "") ?: "" | ||
set(value) = dataStore.edit { putString(ACCESS_TOKEN, value) } | ||
|
||
override var refreshToken: String | ||
get() = dataStore.getString(REFRESH_TOKEN, "") ?: "" | ||
set(value) = dataStore.edit { putString(REFRESH_TOKEN, value) } | ||
|
||
companion object { | ||
private const val ACCESS_TOKEN = "ACCESS_TOKEN" | ||
private const val REFRESH_TOKEN = "REFRESH_TOKEN" | ||
} | ||
} |
36 changes: 36 additions & 0 deletions
36
data/src/main/java/com/going/data/repositoryImpl/AuthRepositoryImpl.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package com.going.data.repositoryImpl | ||
|
||
import com.going.data.datasource.AuthDataSource | ||
import com.going.data.dto.request.toSignInRequestDto | ||
import com.going.data.dto.request.toSignUpRequestDto | ||
import com.going.domain.entity.request.RequestSignInModel | ||
import com.going.domain.entity.request.RequestSignUpModel | ||
import com.going.domain.entity.response.AuthTokenModel | ||
import com.going.domain.repository.AuthRepository | ||
import javax.inject.Inject | ||
|
||
class AuthRepositoryImpl @Inject constructor( | ||
private val authDataSource: AuthDataSource, | ||
) : AuthRepository { | ||
override suspend fun postSignIn( | ||
Authorization: String, | ||
requestSignIpModel: RequestSignInModel, | ||
): Result<AuthTokenModel> = | ||
runCatching { | ||
authDataSource.postSignIn( | ||
Authorization, | ||
requestSignIpModel.toSignInRequestDto(), | ||
).data.toAuthTokenModel() | ||
} | ||
|
||
override suspend fun postSignUp( | ||
Authorization: String, | ||
requestSignUpModel: RequestSignUpModel, | ||
): Result<AuthTokenModel> = | ||
runCatching { | ||
authDataSource.postSignUp( | ||
Authorization, | ||
requestSignUpModel.toSignUpRequestDto(), | ||
).data.toAuthTokenModel() | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
김상호 그는 신이야!!! 김상호 그는 신이야!!! 김상호 그는 신이야!!! 김상호 그는 신이야!!! 김상호 그는 신이야!!! 김상호 그는 신이야!!! 김상호 그는 신이야!!! 김상호 그는 신이야!!! 김상호 그는 신이야!!! 김상호 그는 신이야!!! 김상호 그는 신이야!!! 김상호 그는 신이야!!!