-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#219 로그인/회원가입 뷰모델 로직 새로운 api에 맞게 수정, 가입 이메일 검증 로직 VerifyEmail.kt추가
- Loading branch information
Showing
19 changed files
with
131 additions
and
188 deletions.
There are no files selected for viewing
10 changes: 5 additions & 5 deletions
10
core/common/src/main/java/com/android/mediproject/core/common/util/RegexChecker.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,11 +1,11 @@ | ||
package com.android.mediproject.core.common.util | ||
|
||
private val emailReg: String by lazy { | ||
"^[_a-z0-9-]+(.[_a-z0-9-]+)*@(?:\\w+\\.)+\\w+$" | ||
} | ||
private const val EMAIL_REGX: String = "^[_a-z0-9-]+(.[_a-z0-9-]+)*@(?:\\w+\\.)+\\w+$" | ||
private const val PW_MIN_LENGTH = 4 | ||
private const val PW_MAX_LENGTH = 16 | ||
|
||
fun isEmailValid(email: CharSequence) = email.matches( | ||
Regex(emailReg) | ||
Regex(EMAIL_REGX), | ||
) | ||
|
||
fun isPasswordValid(password: CharSequence) = (password.length in 4..16) | ||
fun isPasswordValid(password: CharSequence) = (password.length in PW_MIN_LENGTH..PW_MAX_LENGTH) |
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
5 changes: 2 additions & 3 deletions
5
core/data/src/main/java/com/android/mediproject/core/data/sign/SignRepository.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
9 changes: 2 additions & 7 deletions
9
core/domain/src/main/java/com/android/mediproject/core/domain/GetTokenUseCase.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,22 +1,17 @@ | ||
package com.android.mediproject.core.domain | ||
|
||
import android.util.Log | ||
import com.android.mediproject.core.data.token.TokenRepository | ||
import com.android.mediproject.core.data.sign.TokenRepository | ||
import com.android.mediproject.core.model.token.CurrentTokens | ||
import com.android.mediproject.core.model.token.TokenState | ||
import kotlinx.coroutines.flow.Flow | ||
import kotlinx.coroutines.flow.channelFlow | ||
import kotlinx.coroutines.flow.collectLatest | ||
import javax.inject.Inject | ||
import javax.inject.Singleton | ||
|
||
@Singleton | ||
class GetTokenUseCase @Inject constructor(private val tokenRepository: TokenRepository) { | ||
|
||
operator fun invoke(): Flow<TokenState<CurrentTokens>> = channelFlow { | ||
tokenRepository.getCurrentTokens().collectLatest { | ||
Log.d("wap", "GetTokenUseCase$it") | ||
trySend(it) | ||
} | ||
trySend(TokenState.Empty) | ||
} | ||
} |
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
17 changes: 5 additions & 12 deletions
17
...model/requestparameters/LoginParameter.kt → ...project/core/model/sign/LoginParameter.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,33 +1,26 @@ | ||
package com.android.mediproject.core.model.requestparameters | ||
package com.android.mediproject.core.model.sign | ||
|
||
|
||
/** | ||
* 로그인을 위한 파라미터 클래스입니다. | ||
* | ||
* @property email 이메일 | ||
* @property password 비밀번호 | ||
* @property isSavedEmail 이메일 저장 여부 | ||
*/ | ||
data class LoginParameter( | ||
val email: CharArray, val password: CharArray, val isSavedEmail: Boolean | ||
val email: String, val password: ByteArray, val isSavedEmail: Boolean, | ||
) { | ||
override fun equals(other: Any?): Boolean { | ||
if (this === other) return true | ||
if (javaClass != other?.javaClass) return false | ||
|
||
other as LoginParameter | ||
|
||
if (!email.contentEquals(other.email)) return false | ||
if (email != other.email) return false | ||
if (!password.contentEquals(other.password)) return false | ||
if (isSavedEmail != other.isSavedEmail) return false | ||
|
||
return true | ||
} | ||
|
||
override fun hashCode(): Int { | ||
var result = email.contentHashCode() | ||
var result = email.hashCode() | ||
result = 31 * result + password.contentHashCode() | ||
result = 31 * result + isSavedEmail.hashCode() | ||
return result | ||
} | ||
|
||
} |
18 changes: 6 additions & 12 deletions
18
...odel/requestparameters/SignUpParameter.kt → ...roject/core/model/sign/SignUpParameter.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,33 +1,27 @@ | ||
package com.android.mediproject.core.model.requestparameters | ||
package com.android.mediproject.core.model.sign | ||
|
||
|
||
/** | ||
* 회원가입을 위한 파라미터 클래스입니다. | ||
* | ||
* @property email 이메일 | ||
* @property password 비밀번호 | ||
* @property nickName 닉네임 | ||
*/ | ||
data class SignUpParameter( | ||
val email: CharArray, val password: CharArray, val nickName: String | ||
val email: String, val password: ByteArray, val nickName: String, | ||
) { | ||
override fun equals(other: Any?): Boolean { | ||
if (this === other) return true | ||
if (javaClass != other?.javaClass) return false | ||
|
||
other as SignUpParameter | ||
|
||
if (!email.contentEquals(other.email)) return false | ||
if (email != other.email) return false | ||
if (!password.contentEquals(other.password)) return false | ||
if (nickName != other.nickName) return false | ||
|
||
return true | ||
} | ||
|
||
override fun hashCode(): Int { | ||
var result = email.contentHashCode() | ||
var result = email.hashCode() | ||
result = 31 * result + password.contentHashCode() | ||
result = 31 * result + nickName.hashCode() | ||
return result | ||
} | ||
|
||
} | ||
} |
22 changes: 0 additions & 22 deletions
22
core/model/src/main/java/com/android/mediproject/core/model/user/remote/UserResponse.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
4 changes: 2 additions & 2 deletions
4
...work/src/main/java/com/android/mediproject/core/network/datasource/sign/SignDataSource.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
Oops, something went wrong.