-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #27 from Nexters/feature/fix-qa-mvp
로그인 수정사항 변경, 프로필 수정 구현
- Loading branch information
Showing
33 changed files
with
454 additions
and
202 deletions.
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
3 changes: 3 additions & 0 deletions
3
...e/src/main/java/com/goalpanzi/mission_mate/core/datastore/datasource/DefaultDataSource.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 |
---|---|---|
@@ -1,7 +1,10 @@ | ||
package com.goalpanzi.mission_mate.core.datastore.datasource | ||
|
||
import com.luckyoct.core.model.UserProfile | ||
import kotlinx.coroutines.flow.Flow | ||
|
||
interface DefaultDataSource { | ||
fun clearUserData() : Flow<Unit> | ||
fun setUserProfile(data: UserProfile) : Flow<Unit> | ||
fun getUserProfile() : Flow<UserProfile?> | ||
} |
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
2 changes: 1 addition & 1 deletion
2
.../domain/src/main/java/com/goalpanzi/mission_mate/core/domain/repository/AuthRepository.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
3 changes: 2 additions & 1 deletion
3
...main/src/main/java/com/goalpanzi/mission_mate/core/domain/repository/ProfileRepository.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 |
---|---|---|
@@ -1,8 +1,9 @@ | ||
package com.goalpanzi.mission_mate.core.domain.repository | ||
|
||
import com.goalpanzi.mission_mate.core.network.ResultHandler | ||
import com.luckyoct.core.model.CharacterType | ||
import com.luckyoct.core.model.base.NetworkResult | ||
|
||
interface ProfileRepository: ResultHandler { | ||
suspend fun saveProfile(nickname: String, index: Int): NetworkResult<Unit> | ||
suspend fun saveProfile(nickname: String, type: CharacterType): NetworkResult<Unit> | ||
} |
15 changes: 13 additions & 2 deletions
15
core/domain/src/main/java/com/goalpanzi/mission_mate/core/domain/usecase/LoginUseCase.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
15 changes: 13 additions & 2 deletions
15
core/domain/src/main/java/com/goalpanzi/mission_mate/core/domain/usecase/ProfileUseCase.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 |
---|---|---|
@@ -1,10 +1,21 @@ | ||
package com.goalpanzi.mission_mate.core.domain.usecase | ||
|
||
import com.goalpanzi.mission_mate.core.datastore.datasource.DefaultDataSource | ||
import com.goalpanzi.mission_mate.core.domain.repository.ProfileRepository | ||
import com.luckyoct.core.model.CharacterType | ||
import com.luckyoct.core.model.UserProfile | ||
import com.luckyoct.core.model.base.NetworkResult | ||
import kotlinx.coroutines.flow.first | ||
import javax.inject.Inject | ||
|
||
class ProfileUseCase @Inject constructor( | ||
private val profileRepository: ProfileRepository | ||
private val profileRepository: ProfileRepository, | ||
private val defaultDataSource: DefaultDataSource | ||
) { | ||
suspend fun saveProfile(nickname: String, index: Int) = profileRepository.saveProfile(nickname, index) | ||
suspend fun saveProfile(nickname: String, type: CharacterType) = profileRepository.saveProfile(nickname, type).also { | ||
if (it is NetworkResult.Success) { | ||
defaultDataSource.setUserProfile(UserProfile(nickname, type)).first() | ||
} | ||
} | ||
suspend fun getProfile(): UserProfile? = defaultDataSource.getUserProfile().first() | ||
} |
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
24 changes: 24 additions & 0 deletions
24
core/model/src/main/java/com/luckyoct/core/model/CharacterType.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.luckyoct.core.model | ||
|
||
import kotlinx.serialization.SerialName | ||
|
||
enum class CharacterType { | ||
|
||
@SerialName("RABBIT") | ||
RABBIT, | ||
|
||
@SerialName("CAT") | ||
CAT, | ||
|
||
@SerialName("DOG") | ||
DOG, | ||
|
||
@SerialName("PANDA") | ||
PANDA, | ||
|
||
@SerialName("BEAR") | ||
BEAR, | ||
|
||
@SerialName("BIRD") | ||
BIRD | ||
} |
6 changes: 6 additions & 0 deletions
6
core/model/src/main/java/com/luckyoct/core/model/UserProfile.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,6 @@ | ||
package com.luckyoct.core.model | ||
|
||
data class UserProfile( | ||
val nickname: String, | ||
val characterType: CharacterType | ||
) |
9 changes: 3 additions & 6 deletions
9
core/model/src/main/java/com/luckyoct/core/model/request/SaveProfileRequest.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 |
---|---|---|
@@ -1,20 +1,17 @@ | ||
package com.luckyoct.core.model.request | ||
|
||
import com.luckyoct.core.model.CharacterType | ||
import kotlinx.serialization.Serializable | ||
|
||
enum class CharacterType { | ||
RABBIT, CAT, DOG, PANDA, BEAR, BIRD | ||
} | ||
|
||
@Serializable | ||
data class SaveProfileRequest( | ||
val nickname: String, | ||
val characterType: String, | ||
) { | ||
companion object { | ||
fun createRequest(nickname: String, index: Int) = SaveProfileRequest( | ||
fun createRequest(nickname: String, type: CharacterType) = SaveProfileRequest( | ||
nickname = nickname, | ||
characterType = CharacterType.entries[index].name.uppercase() | ||
characterType = type.name.uppercase() | ||
) | ||
} | ||
} |
5 changes: 4 additions & 1 deletion
5
...va/com/luckyoct/core/model/GoogleLogin.kt → ...ckyoct/core/model/response/GoogleLogin.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 |
---|---|---|
@@ -1,10 +1,13 @@ | ||
package com.luckyoct.core.model | ||
package com.luckyoct.core.model.response | ||
|
||
import com.luckyoct.core.model.CharacterType | ||
import kotlinx.serialization.Serializable | ||
|
||
@Serializable | ||
data class GoogleLogin( | ||
val accessToken: String, | ||
val refreshToken: String, | ||
val nickname: String?, | ||
val characterType: CharacterType?, | ||
val isProfileSet: Boolean | ||
) |
2 changes: 1 addition & 1 deletion
2
core/model/src/main/java/com/luckyoct/core/model/response/MissionBoardMembersResponse.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
2 changes: 1 addition & 1 deletion
2
core/model/src/main/java/com/luckyoct/core/model/response/MissionVerificationResponse.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
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
2 changes: 1 addition & 1 deletion
2
core/network/src/main/java/com/goalpanzi/mission_mate/core/network/service/LoginService.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
2 changes: 1 addition & 1 deletion
2
feature/board/src/main/java/com/goalpanzi/mission_mate/feature/board/model/Character.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
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
Oops, something went wrong.