-
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.
* Rebase develop * feat: basicTextField 중앙 정렬 적용 * feat: role에 대한 회원가입 화면 이동로직 추가 * feat: 최초 로그인 profile 수정 * refactor: ProfileEditor, NickNameEditor 공용함수화 * fix: 토큰 저장방식 수정 * feat: 최초로그인 구현 * fix: signUp 버튼 클릭시 이벤트 변경 * feat: role, id 로컬 저장 및 따라 자동로그인 로직 추가 * feat: 회원가입 성공시 권한 업그레이드
- Loading branch information
1 parent
b7087bb
commit 7ebc012
Showing
58 changed files
with
938 additions
and
307 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
11 changes: 11 additions & 0 deletions
11
core/data/src/main/kotlin/com/withpeace/withpeace/core/data/mapper/RoleMapper.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,11 @@ | ||
package com.withpeace.withpeace.core.data.mapper | ||
|
||
import com.withpeace.withpeace.core.domain.model.role.Role | ||
|
||
internal fun String.roleToDomain(): Role { | ||
return when (this) { | ||
"GUEST" -> Role.GUEST | ||
"USER" -> Role.USER | ||
else -> Role.UNKNOWN | ||
} | ||
} |
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
...Store/DefaultTokenPreferenceDataSource.kt → ...token/DefaultTokenPreferenceDataSource.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
...re/dataStore/TokenPreferenceDataSource.kt → ...aStore/token/TokenPreferenceDataSource.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
45 changes: 45 additions & 0 deletions
45
.../com/withpeace/withpeace/core/datastore/dataStore/user/DefaultUserPreferenceDataSource.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,45 @@ | ||
package com.withpeace.withpeace.core.datastore.dataStore.user | ||
|
||
import androidx.datastore.core.DataStore | ||
import androidx.datastore.preferences.core.Preferences | ||
import androidx.datastore.preferences.core.edit | ||
import androidx.datastore.preferences.core.longPreferencesKey | ||
import androidx.datastore.preferences.core.stringPreferencesKey | ||
import kotlinx.coroutines.flow.Flow | ||
import kotlinx.coroutines.flow.map | ||
import javax.inject.Inject | ||
import javax.inject.Named | ||
|
||
class DefaultUserPreferenceDataSource @Inject constructor( | ||
@Named("user") private val dataStore: DataStore<Preferences>, | ||
) : UserPreferenceDataSource { | ||
override val userId: Flow<Long?> = dataStore.data.map { preferences -> | ||
preferences[USER_ID] | ||
} | ||
override val userRole: Flow<String?> = dataStore.data.map { preferences -> | ||
preferences[USER_ROLE] | ||
} | ||
|
||
override suspend fun updateUserId(userId: Long) { | ||
dataStore.edit { preferences -> | ||
preferences[USER_ID] = userId | ||
} | ||
} | ||
|
||
override suspend fun updateUserRole(userRole: String) { | ||
dataStore.edit { preferences -> | ||
preferences[USER_ROLE] = userRole | ||
} | ||
} | ||
|
||
override suspend fun removeAll() { | ||
dataStore.edit { preferences -> | ||
preferences.clear() | ||
} | ||
} | ||
|
||
companion object { | ||
private val USER_ID = longPreferencesKey("USER_ID") | ||
private val USER_ROLE = stringPreferencesKey("USER_ROLE") | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
...in/java/com/withpeace/withpeace/core/datastore/dataStore/user/UserPreferenceDataSource.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.withpeace.withpeace.core.datastore.dataStore.user | ||
|
||
import kotlinx.coroutines.flow.Flow | ||
|
||
interface UserPreferenceDataSource { | ||
|
||
val userId: Flow<Long?> | ||
|
||
val userRole: Flow<String?> | ||
|
||
suspend fun updateUserId(userId: Long) | ||
|
||
suspend fun updateUserRole(userRole: String) | ||
suspend fun removeAll() | ||
} |
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
6 changes: 6 additions & 0 deletions
6
core/domain/src/main/java/com/withpeace/withpeace/core/domain/model/SignUpInfo.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.withpeace.withpeace.core.domain.model | ||
|
||
data class SignUpInfo( | ||
val nickname: String, | ||
val profileImage: String?, | ||
) |
5 changes: 5 additions & 0 deletions
5
core/domain/src/main/java/com/withpeace/withpeace/core/domain/model/role/Role.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,5 @@ | ||
package com.withpeace.withpeace.core.domain.model.role | ||
|
||
enum class Role { | ||
GUEST, USER, UNKNOWN | ||
} |
10 changes: 2 additions & 8 deletions
10
core/domain/src/main/java/com/withpeace/withpeace/core/domain/repository/TokenRepository.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,19 +1,13 @@ | ||
package com.withpeace.withpeace.core.domain.repository | ||
|
||
import com.withpeace.withpeace.core.domain.model.role.Role | ||
import kotlinx.coroutines.flow.Flow | ||
|
||
interface TokenRepository { | ||
|
||
suspend fun isLogin(): Boolean | ||
|
||
suspend fun signUp( | ||
email: String, | ||
nickname: String, | ||
onError: (String) -> Unit, | ||
): Flow<Unit> | ||
|
||
fun getTokenByGoogle( | ||
idToken: String, | ||
onError: (String) -> Unit, | ||
): Flow<Unit> | ||
): Flow<Role> | ||
} |
Oops, something went wrong.