-
Notifications
You must be signed in to change notification settings - Fork 0
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/week6 essential #11
base: develop
Are you sure you want to change the base?
Conversation
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.
ํ์๋๋ฌ์๋ค๊ฐ ๊ฐ๋๋ฐ๊ณ ๊ฐ๋๋ค ... ์ฝ๋ ํ๋ฆฌํฐ ๋๋ฌด ์ข๋ค์ !!!!
private const val REQURES_BASE_URL = BuildConfig.REQRES_BASE_URL | ||
|
||
interface FollowerService { | ||
@GET(REQURES_BASE_URL) |
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.
์ ๋ถ๋ถ์ AuthService์ ๋ค๋ฅด๊ฒ BASE_URL์ ๋ฃ์ ์ด์ ๊ฐ ๋ญ๊ฐ์? BASE_URL์ ์ด FollowerService๋ฅผ ์ฌ์ฉํ๋ ServicePool์์ ๋ฃ์ด์ฃผ๋ ๊ฒ์ผ๋ก ๋ณด์ด๋๋ฐ!
import kotlinx.serialization.Serializable | ||
|
||
@Serializable | ||
data class ResponseGetFollwerDto( |
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.
data class ResponseGetFollwerDto( | |
@Serializable | |
data class FollowerResponseDto( | |
@SerialName("page") | |
val page: Int, | |
@SerialName("per_page") | |
val perPage: Int, | |
@SerialName("total") | |
val total: Int, | |
@SerialName("total_pages") | |
val totalPages: Int, | |
@SerialName("data") | |
val data: List<User>, | |
@SerialName("support") | |
val support: Support, | |
) { | |
@Serializable | |
data class User( | |
@SerialName("id") | |
val id: Int, | |
@SerialName("email") | |
val email: String, | |
@SerialName("first_name") | |
val firstName: String, | |
@SerialName("last_name") | |
val lastName: String, | |
@SerialName("avatar") | |
val avatar: String | |
) | |
@Serializable | |
data class Support( | |
@SerialName("url") | |
val url: String, | |
@SerialName("text") | |
val text: String | |
) | |
} |
์ ๋ ์ด๋ฐ์์ผ๋ก data class ๊ณ์ธต์ ์ฃผ์ด์ ์ข ์๋๋๋ก ํํํด๋์์ด์! ๋ฌผ๋ก ์ด๊ฒ์ ์ทจํฅ์ฐจ์ด์ ๋๋ค ~~~
fun setNewProfile(): Profile { | ||
if (!(mbti.value.isNullOrEmpty())) profile.MBTI = mbti.value.toString() | ||
if (!(musicTitle.value.isNullOrEmpty())) profile.musicTitle = musicTitle.value.toString() | ||
if (!(musicArtist.value.isNullOrEmpty())) profile.musicArtist = musicArtist.value.toString() | ||
if (!(intro.value.isNullOrEmpty())) profile.intro = intro.value.toString() | ||
profile.setMusic() | ||
// logProfile(profile) | ||
if (!(mbti.value.isNullOrEmpty())) profile.setMbti(mbti.value.toString()) | ||
if (!(musicTitle.value.isNullOrEmpty()) && !(musicArtist.value.isNullOrEmpty())) | ||
profile.setMusic(musicTitle.value.toString(), musicArtist.value.toString()) | ||
if (!(intro.value.isNullOrEmpty())) profile.setIntro(intro.value.toString()) |
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.
๋ทฐ๋ชจ๋ธ์ ์ฉ๋๋ฅผ ์ ํํ๊ฒ ์ดํดํ๊ณ ๊ณ์๋ค์... ์ต๊ณ ์ต๊ณ
binding.viewModel = editMyPageViewModel | ||
editMyPageViewModel.setProfile(myProfile) | ||
editMyPageViewModel.initPage() |
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.
์ ๋ ๋ชจ๋ ํจ์ํ๋ฅผ ์งํํด๋ฌ์ onCreate() ์์ ์ ๊ฐ ์ง์ ํ ํจ์๋ค๋ง ์๋๋ก ๊น๋ํ๊ฒ ์ ๋ฆฌํด๋๋ ํธ์ด์์!
Glide.with(binding.root) | ||
.load(friendData.reqresData?.avatar) | ||
.into(ivProfile) |
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.
์์ฆ์ Glide๋ณด๋ค Coil์ด ๋ ์ฑ๋ฅ์ด ์ข์ ํ์ฉํ๋ ์ถ์ธ์ ๋๋ค~~ ์ด๋ ต์ง ์์ผ๋ ํ๋ฒ ์์๋ด๋ณด์ธ์ ใ ใ
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.
๋ฐ์ธ๋ฉ ์ด๋ํฐ๋ฅผ ์ฌ์ฉํด๋ณด์ง ์์๋ค๋ฉด ๋ฐ์ธ๋ฉ์ด๋ํฐ๋ฅผ ์ฌ์ฉํ์ ์ xml๋ก ์ฌ์ฉํ์ฌ ๋ฐ๋ฐ๋ฅผ ํ์ฉํ ์ ์์ต๋๋ค (์ถ์ฒ์์๋)
private var _profileAdapter: ProfileAdapter? = null | ||
val profileAdapter: ProfileAdapter | ||
get() = requireNotNull(_profileAdapter) { "profileAdapter not initialized" } |
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.
์๋ ๊ฒ ๋ฐฑํจํน์ ํ์ฉํ๋ค๋ฉด, _adapter๋ฅผ ํ๋ฉด์ด ์ข ๋ฃ๋ ๋ null๋ก ํด์ฌ์์ผ์ค์ผ ์๋ฏธ๋ฅผ ์ป์ ์ ์๊ฒ ์ฃ ?
getFollowerList() | ||
} | ||
|
||
private fun getFollowerList() { |
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.
์์์ ์ ๋๋์ด์ฃผ์ จ๋ ๊ฒ์ฒ๋ผ, ์ด๋ถ๋ถ๋ ๋ทฐ๋ชจ๋ธ๋ก ์ฎ๊ฒจ๋ด ์๋ค ~!
android:onTextChanged="@{() -> authViewModel.onIDTextChanged()}" | ||
android:text="@={authViewModel._id}" |
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.
๋งค์ฃผ ๊ฐํ๋ฅด๊ฒ ์ฑ์ฅํ์๋ค์ ใทใท
android:hint="@string/pw_hint" | ||
android:inputType="textPassword" | ||
android:text="@={viewModel.password}" | ||
app:errorEnabled="@{authViewModel.passwordConditionSatisfied == false? true: false}" |
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.
true๋ false๋ก, false๋ true๋ก ๋ฐ๊พธ๋ ์ฝ๋ ๊ฐ์๋ฐ !๋ก ๋ฐ๊พธ๋๊ฒ ๋ ๊ฐ๋ ์ฑ์ด ์ข์ ๊ฒ ๊ฐ์ต๋๋ค!!
app:errorEnabled="@{authViewModel.passwordConditionSatisfied == false? true: false}" | |
app:errorEnabled="@{!authViewModel.passwordConditionSatisfied}" |
fun isIdConditionSatisfied(str: String): Boolean { | ||
val englishAndNumRegex: Regex = Regex("^(?=.*[0-9])(?=.*[a-zA-Z]).{6,10}\$") | ||
return str.matches(englishAndNumRegex) | ||
} | ||
|
||
fun isPasswordConditionSatisfied(str: String): Boolean { | ||
val englishAndNumSpecialRegex: Regex = Regex("^(?=.*[0-9])(?=.*[a-zA-Z])(?=.*[!@#\$%^&*()-_=+]).{6,12}\$") | ||
return str.matches(englishAndNumSpecialRegex) | ||
} |
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.
ํน์์ง๋์ด ๊ฟํ๊ณต์ ์ ์ฌ๋ ค์ฃผ์ "๋ถํ์ํ ๊ฐ์ฒด ์์ฑ์ ํผํด: ์ ๊ทํํ์ ๊ฐ์ฒด ์ต์ ํ"๋ฅผ ๋ณด์๊ณ ์ ์ฉํด๋ณด๋ ๊ฒ๋ ์ข์ ๊ฒ ๊ฐ๋ค์ :)
android:enabled="@{authViewModel.loginConditionSatisfied}" | ||
android:onClick="@{() -> authViewModel.signUp()}" |
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.
์ฑ์ฅ ์๋๊ฐ ๋๋ฌด ๋นจ๋ผ์!! ๋ฉ์๋ค ~
@@ -0,0 +1,89 @@ | |||
package org.sopt.dosopttemplate.api// ๋ณด์๋ฉด ์๊ฒ ์ง๋ง LiveData๋ lifecycle ๋ผ์ด๋ธ๋ฌ๋ฆฌ์ ๋ค์ด์์ต๋๋ค! |
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.
์ฃผ์ ์ฒ๋ฆฌ๊ฐ ์๋ชป ๋ ๊ฒ ๊ฐ์ต๋๋ค..?
val _id: MutableLiveData<String> = MutableLiveData() | ||
val id: String get() = _id.value ?: "" | ||
val _password: MutableLiveData<String> = MutableLiveData() | ||
val password: String get() = _password.value ?: "" | ||
val _nickName: MutableLiveData<String> = MutableLiveData() | ||
val nickName: String get() = _nickName.value ?: "" |
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.
๋ฐ๋ณต๋๋ ์์ ์ ํ ๋ฒ์ ์ฒ๋ฆฌํ ์๋ ์์๊น์? ํ ๋ฒ ๊ณ ๋ฏผํด๋ณด์ธ์!
signUpSuccess.value = false | ||
} | ||
}.onFailure { | ||
// ์๋ฌ ์ฒ๋ฆฌ |
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.
๋ก๊ทธ ์ถ๋ ฅ๋ ํ๋์ ๋ฐฉ๋ฒ์ ๋๋ค!
private fun observeId() { | ||
authViewModel.idConditionSatisfied.observe(this) { | ||
if (it == false && authViewModel.id.isNotBlank()) { | ||
binding.tilId.error = "์๋ฌธ, ์ซ์๊ฐ ํฌํจ๋ 6~10๊ธ์๋ฅผ ์ ๋ ฅํด์ฃผ์ธ์." |
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.
databinding์ ์ฐ๊ณ ์์ผ๋ xml์์๋ ์ฒ๋ฆฌ๊ฐ ๊ฐ๋ฅํ ์ฝ๋์ ๋๋ค!
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.
์ด๋ ๊ฒ ๋ฐ๋ฐ ์ด์ฉํ๋ ๊ฑฐ๊ตฐ์!!! ๋ฐฐ์๊ฐ๋๋ค ๐๐์ด๋ฒ ์ฃผ๋ ์๊ณ ํ์ จ์ด๋๋ค!!
val isLoginButtonClicked: MutableLiveData<Boolean> = MutableLiveData(false) | ||
val idConditionSatisfied: MutableLiveData<Boolean> = MutableLiveData(false) | ||
val passwordConditionSatisfied: MutableLiveData<Boolean> = MutableLiveData(false) | ||
val loginConditionSatisfied: MutableLiveData<Boolean> = MutableLiveData(idConditionSatisfied.value?:false && passwordConditionSatisfied.value?:false) |
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.
์๋ ๊ฒ ๋ผ์ด๋ธ๋ฐ์ดํฐ ์์ํ๋ ๊ฑฐ๊ตฐ์!!
val lastName: String, | ||
@SerialName("avatar") | ||
val avatar: String, | ||
) |
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.
๊ณ ์ํ์ จ์ฉ๋๋ค
val isLoginButtonClicked: MutableLiveData<Boolean> = MutableLiveData(false) | ||
val idConditionSatisfied: MutableLiveData<Boolean> = MutableLiveData(false) | ||
val passwordConditionSatisfied: MutableLiveData<Boolean> = MutableLiveData(false) | ||
val loginConditionSatisfied: MutableLiveData<Boolean> = MutableLiveData(idConditionSatisfied.value?:false && passwordConditionSatisfied.value?:false) |
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.
์๋ก์ง๋ค ๋ฐ์ดํฐ ๋ฐ์ธ๋ฉ์ ํ์ฉํ์ ๋ค๋ฉด xml๋ก ์ด์ ํ๋ ๋ฐฉ๋ฒ๋ ์๋๋ฐ ๋ชจ๋ฅด์ จ๋ค๋ฉด ํ๋ฒ ์ฌ์ฉํด๋ณด๋ ๋ฐฉ๋ฒ๋ ์ข์ธ๊ฑฐ ๊ฐ์ต๋๋ค.
import retrofit2.Call | ||
import retrofit2.http.GET | ||
|
||
private const val REQURES_BASE_URL = BuildConfig.REQRES_BASE_URL |
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.
์๋ถ๋ถ ๋ ํธ๋กํ์ผ๋ก ์ด๋ํด๋ ์ข์๋ง
Glide.with(binding.root) | ||
.load(friendData.reqresData?.avatar) | ||
.into(ivProfile) |
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.
๋ฐ์ธ๋ฉ ์ด๋ํฐ๋ฅผ ์ฌ์ฉํด๋ณด์ง ์์๋ค๋ฉด ๋ฐ์ธ๋ฉ์ด๋ํฐ๋ฅผ ์ฌ์ฉํ์ ์ xml๋ก ์ฌ์ฉํ์ฌ ๋ฐ๋ฐ๋ฅผ ํ์ฉํ ์ ์์ต๋๋ค (์ถ์ฒ์์๋)
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.
๊ณ ์ํ์ต๋๋ค~!!
viewModelScope.launch { | ||
kotlin.runCatching { | ||
authService.signUp(RequestSignUpDto(id, nickName, password)) | ||
}.onSuccess { | ||
if (it.isSuccessful) { | ||
signUpResult.value = it.body() | ||
signUpSuccess.value = true | ||
} else { | ||
signUpSuccess.value = false | ||
} | ||
}.onFailure { | ||
// ์๋ฌ ์ฒ๋ฆฌ | ||
} | ||
} | ||
} |
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.
runCatching์ผ๋ก ์๋ฒ ์๋ต ํธ๋ค๋งํ์ค๊ฑฐ๋ผ๋ฉด ๋ฐํ๊ฐ์ด Response ๊ตฌ์กฐ๊ฐ ์๋ DTO ๊ตฌ์กฐ๋ก ๋ณ๊ฒฝํด์ผํ ๊ฒ ๊ฐ์ต๋๋ค~!!
@Parcelize | ||
data class subInfo( | ||
var music: Music?, | ||
var MBTI: String, | ||
var intro: String, | ||
) : Parcelable { | ||
fun getMusic(): String = music?.string ?: "no music" | ||
|
||
constructor(music: Music?) : this(music, "", "") | ||
} |
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.
๊ตณ์ด ๋ณด์กฐ ์์ฑ์ ์๋ง๋ค๊ณ default value๋ฅผ ์ฌ์ฉํ๋ฉด ๋ ๊ฒ ๊ฐ์ต๋๋น
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.
getMusic๋ defaultValue๋ฅผ ํ์ฉํ๋ค๋ฉด nullableํ์ง ์์๋ ๋๋ ํด๋น ํจ์์ ์ญ์ ๊ฐ ๊ฐ๋ฅํ๊ฒ ๋ค์!
Glide.with(binding.root) | ||
.load(friendData.reqresData?.avatar) | ||
.into(ivProfile) |
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.
onBind๋ ๊ต์ฅํ ๋ง์ด ํธ์ถ๋๊ณ ์๋ ํจ์์ ๋๋ค. Glide ๊ฐ์ฒด๋ฅผ ๊ทธ๋๋ง๋ค ์์ฑํ๊ฒ ๋ ํ ๋ฐ์! ์ด๊ฑธ ์ ํด๊ฒฐํด๋ณด์๋ฉด ์ข์ ๊ฒ ๊ฐ๋ค์ฉ
๐๐๐ด๐ด๐ถ๐ฆ๐ด
๐๐๐ฐ๐ณ๐ฌ ๐๐ฆ๐ด๐ค๐ณ๐ช๐ฑ๐ต๐ช๐ฐ๐ฏ
๐ท๐๐ค๐ณ๐ฆ๐ฆ๐ฏ๐ด๐ฉ๐ฐ๐ต
Recording_2023-11-28-23-36-33.mp4
๐ฌ๐๐ฐ ๐๐ฆ๐ท๐ช๐ฆ๐ธ๐ฆ๐ณ๐ด
์ด๋ฒ์ฃผ๋ ์๋ถํ๋๋ฆฝ๋๋ค(๊พธ๋ฒ )