Skip to content

Conversation

@jihyun0v0
Copy link
Contributor

๐Ÿ“Œ๐˜๐˜ด๐˜ด๐˜ถ๐˜ฆ๐˜ด

๐Ÿ“Ž๐˜ž๐˜ฐ๐˜ณ๐˜ฌ ๐˜‹๐˜ฆ๐˜ด๐˜ค๐˜ณ๐˜ช๐˜ฑ๐˜ต๐˜ช๐˜ฐ๐˜ฏ

  • ์ƒˆ๋กœ์šด id, password ์กฐ๊ฑด ๋งŒ๋“ค๊ธฐ
  • edit text๋ฅผ textInputLayout์œผ๋กœ ๋งŒ๋“ค์–ด์„œ ์—๋Ÿฌ ๋ฉ”์„ธ์ง€ ์ ์šฉํ•  ์ˆ˜ ์žˆ๊ฒŒ ํ•˜๊ธฐ
  • data binding์„ ํ™œ์šฉํ•˜์—ฌ mvvmํŒจํ„ด ์—ฐ์Šตํ•˜๊ธฐ

๐Ÿ“ท๐˜š๐˜ค๐˜ณ๐˜ฆ๐˜ฆ๐˜ฏ๐˜ด๐˜ฉ๐˜ฐ๐˜ต

Recording_2023-11-28-23-36-33.mp4

๐Ÿ’ฌ๐˜›๐˜ฐ ๐˜™๐˜ฆ๐˜ท๐˜ช๐˜ฆ๐˜ธ๐˜ฆ๐˜ณ๐˜ด

์ด๋ฒˆ์ฃผ๋„ ์ž˜๋ถ€ํƒ๋“œ๋ฆฝ๋‹ˆ๋‹ค(๊พธ๋ฒ…)

@jihyun0v0 jihyun0v0 added the ํ•„์ˆ˜๊ณผ์ œ DOSOPT ํ•„์ˆ˜๊ณผ์ œ label Nov 28, 2023
@jihyun0v0 jihyun0v0 self-assigned this Nov 28, 2023
Copy link
Member

@Marchbreeze Marchbreeze left a 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)
Copy link
Member

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(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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 ๊ณ„์ธต์„ ์ฃผ์–ด์„œ ์ข…์†๋˜๋„๋ก ํ‘œํ˜„ํ•ด๋‘์—ˆ์–ด์š”! ๋ฌผ๋ก  ์ด๊ฒƒ์€ ์ทจํ–ฅ์ฐจ์ด์ž…๋‹ˆ๋‹ค ~~~

Comment on lines 16 to +20
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())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

๋ทฐ๋ชจ๋ธ์˜ ์šฉ๋„๋ฅผ ์ •ํ™•ํ•˜๊ฒŒ ์ดํ•ดํ•˜๊ณ  ๊ณ„์‹œ๋„ค์š”... ์ตœ๊ณ ์ตœ๊ณ 

Comment on lines +23 to +25
binding.viewModel = editMyPageViewModel
editMyPageViewModel.setProfile(myProfile)
editMyPageViewModel.initPage()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

์ €๋Š” ๋ชจ๋‘ ํ•จ์ˆ˜ํ™”๋ฅผ ์ง„ํ–‰ํ•ด๋‘ฌ์„œ onCreate() ์•ˆ์— ์ œ๊ฐ€ ์ง€์ •ํ•œ ํ•จ์ˆ˜๋“ค๋งŒ ์žˆ๋„๋ก ๊น”๋”ํ•˜๊ฒŒ ์ •๋ฆฌํ•ด๋‘๋Š” ํŽธ์ด์—์š”!

Comment on lines +14 to +16
Glide.with(binding.root)
.load(friendData.reqresData?.avatar)
.into(ivProfile)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

์š”์ฆ˜์€ Glide๋ณด๋‹ค Coil์ด ๋” ์„ฑ๋Šฅ์ด ์ข‹์•„ ํ™œ์šฉํ•˜๋Š” ์ถ”์„ธ์ž…๋‹ˆ๋‹ค~~ ์–ด๋ ต์ง€ ์•Š์œผ๋‹ˆ ํ•œ๋ฒˆ ์•Œ์•„๋ด๋ณด์„ธ์š” ใ…Žใ…Ž

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

๋ฐ”์ธ๋”ฉ ์–ด๋Œ‘ํ„ฐ๋ฅผ ์‚ฌ์šฉํ•ด๋ณด์ง€ ์•Š์•˜๋‹ค๋ฉด ๋ฐ”์ธ๋”ฉ์–ด๋Œ‘ํ„ฐ๋ฅผ ์‚ฌ์šฉํ•˜์…”์„œ xml๋กœ ์‚ฌ์šฉํ•˜์—ฌ ๋ฐ๋ฐ”๋ฅผ ํ™œ์šฉํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค (์ถ”์ฒœ์€์•„๋‹˜)

Comment on lines +20 to +22
private var _profileAdapter: ProfileAdapter? = null
val profileAdapter: ProfileAdapter
get() = requireNotNull(_profileAdapter) { "profileAdapter not initialized" }
Copy link
Member

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() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

์•ž์—์„œ ์ž˜ ๋‚˜๋ˆ„์–ด์ฃผ์…จ๋˜ ๊ฒƒ์ฒ˜๋Ÿผ, ์ด๋ถ€๋ถ„๋„ ๋ทฐ๋ชจ๋ธ๋กœ ์˜ฎ๊ฒจ๋ด…์‹œ๋‹ค ~!

Comment on lines +59 to +60
android:onTextChanged="@{() -> authViewModel.onIDTextChanged()}"
android:text="@={authViewModel._id}"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

์–ด์šฐ ์•ผ๋ฌด์ง€๋„ค์š”..

Copy link
Member

@chattymin chattymin left a 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}"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

true๋Š” false๋กœ, false๋Š” true๋กœ ๋ฐ”๊พธ๋Š” ์ฝ”๋“œ ๊ฐ™์€๋ฐ !๋กœ ๋ฐ”๊พธ๋Š”๊ฒŒ ๋” ๊ฐ€๋…์„ฑ์ด ์ข‹์„ ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค!!

Suggested change
app:errorEnabled="@{authViewModel.passwordConditionSatisfied == false? true: false}"
app:errorEnabled="@{!authViewModel.passwordConditionSatisfied}"

Comment on lines +18 to +26
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)
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ํ‚น์˜์ง„๋‹˜์ด ๊ฟ€ํŒ๊ณต์œ ์— ์˜ฌ๋ ค์ฃผ์‹  "๋ถˆํ•„์š”ํ•œ ๊ฐ์ฒด ์ƒ์„ฑ์˜ ํ”ผํ•ด: ์ •๊ทœํ‘œํ˜„์‹ ๊ฐ์ฒด ์ตœ์ ํ™”"๋ฅผ ๋ณด์‹œ๊ณ  ์ ์šฉํ•ด๋ณด๋Š” ๊ฒƒ๋„ ์ข‹์„ ๊ฒƒ ๊ฐ™๋„ค์š” :)

Comment on lines +244 to +245
android:enabled="@{authViewModel.loginConditionSatisfied}"
android:onClick="@{() -> authViewModel.signUp()}"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

๋ฐ์ดํ„ฐ ๋ฐ”์ธ๋”ฉ ํ™œ์šฉ ๋„ˆ๋ฌด ๋ฉ‹์ง‘๋‹ˆ๋‹ค!

Copy link

@stellar-halo stellar-halo left a 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 ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ์— ๋“ค์–ด์žˆ์Šต๋‹ˆ๋‹ค!

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

์ฃผ์„ ์ฒ˜๋ฆฌ๊ฐ€ ์ž˜๋ชป ๋œ ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค..?

Comment on lines +33 to +38
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 ?: ""

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

๋ฐ˜๋ณต๋˜๋Š” ์ž‘์—…์„ ํ•œ ๋ฒˆ์— ์ฒ˜๋ฆฌํ•  ์ˆ˜๋Š” ์—†์„๊นŒ์š”? ํ•œ ๋ฒˆ ๊ณ ๋ฏผํ•ด๋ณด์„ธ์š”!

signUpSuccess.value = false
}
}.onFailure {
// ์—๋Ÿฌ ์ฒ˜๋ฆฌ

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๊ธ€์ž๋ฅผ ์ž…๋ ฅํ•ด์ฃผ์„ธ์š”."

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

databinding์„ ์“ฐ๊ณ  ์žˆ์œผ๋‹ˆ xml์—์„œ๋„ ์ฒ˜๋ฆฌ๊ฐ€ ๊ฐ€๋Šฅํ•œ ์ฝ”๋“œ์ž…๋‹ˆ๋‹ค!

Copy link

@crownjoe crownjoe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

์ด๋ ‡๊ฒŒ ๋ฐ๋ฐ” ์ด์šฉํ•˜๋Š” ๊ฑฐ๊ตฐ์š”!!! ๋ฐฐ์›Œ๊ฐ‘๋‹ˆ๋‹ค ๐Ÿ‘๐Ÿ‘์ด๋ฒˆ ์ฃผ๋„ ์ˆ˜๊ณ ํ•˜์…จ์Šด๋‹ˆ๋‹ค!!

Comment on lines +28 to +31
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)
Copy link

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,
)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

์ด๋ ‡๊ฒŒ ํ•œ ๋ฒˆ์— ์“ฐ๋‹ˆ๊นŒ ๋” ๊น”๋”ํ•œ ๊ฒƒ ๊ฐ™์•„์š”!

Copy link

@lsakee lsakee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

๊ณ ์ƒํ•˜์…จ์ˆฉ๋‹ˆ๋‹ค

Comment on lines +28 to +31
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)
Copy link

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
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

์š”๋ถ€๋ถ„ ๋ ˆํŠธ๋กœํ•์œผ๋กœ ์ด๋™ํ•ด๋„ ์ข‹์„๋ง

Comment on lines +14 to +16
Glide.with(binding.root)
.load(friendData.reqresData?.avatar)
.into(ivProfile)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

๋ฐ”์ธ๋”ฉ ์–ด๋Œ‘ํ„ฐ๋ฅผ ์‚ฌ์šฉํ•ด๋ณด์ง€ ์•Š์•˜๋‹ค๋ฉด ๋ฐ”์ธ๋”ฉ์–ด๋Œ‘ํ„ฐ๋ฅผ ์‚ฌ์šฉํ•˜์…”์„œ xml๋กœ ์‚ฌ์šฉํ•˜์—ฌ ๋ฐ๋ฐ”๋ฅผ ํ™œ์šฉํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค (์ถ”์ฒœ์€์•„๋‹˜)

Copy link
Member

@kez-lab kez-lab left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

๊ณ ์ƒํ–ˆ์Šต๋‹ˆ๋‹ค~!!

Comment on lines +58 to +72
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 {
// ์—๋Ÿฌ ์ฒ˜๋ฆฌ
}
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

runCatching์œผ๋กœ ์„œ๋ฒ„ ์‘๋‹ต ํ•ธ๋“ค๋งํ•˜์‹ค๊ฑฐ๋ผ๋ฉด ๋ฐ˜ํ™˜๊ฐ’์ด Response ๊ตฌ์กฐ๊ฐ€ ์•„๋‹Œ DTO ๊ตฌ์กฐ๋กœ ๋ณ€๊ฒฝํ•ด์•ผํ•  ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค~!!

Comment on lines +16 to +25
@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, "", "")
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

๊ตณ์ด ๋ณด์กฐ ์ƒ์„ฑ์ž ์•ˆ๋งŒ๋“ค๊ณ  default value๋ฅผ ์‚ฌ์šฉํ•˜๋ฉด ๋  ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹น

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getMusic๋„ defaultValue๋ฅผ ํ™œ์šฉํ•œ๋‹ค๋ฉด nullableํ•˜์ง€ ์•Š์•„๋„ ๋˜๋‹ˆ ํ•ด๋‹น ํ•จ์ˆ˜์˜ ์‚ญ์ œ๊ฐ€ ๊ฐ€๋Šฅํ•˜๊ฒ ๋„ค์š”!

Comment on lines +14 to +16
Glide.with(binding.root)
.load(friendData.reqresData?.avatar)
.into(ivProfile)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

onBind๋Š” ๊ต‰์žฅํžˆ ๋งŽ์ด ํ˜ธ์ถœ๋˜๊ณ  ์žˆ๋Š” ํ•จ์ˆ˜์ž…๋‹ˆ๋‹ค. Glide ๊ฐ์ฒด๋ฅผ ๊ทธ๋•Œ๋งˆ๋‹ค ์ƒ์„ฑํ•˜๊ฒŒ ๋ ํ…๋ฐ์š”! ์ด๊ฑธ ์ž˜ ํ•ด๊ฒฐํ•ด๋ณด์‹œ๋ฉด ์ข‹์„ ๊ฒƒ ๊ฐ™๋„ค์šฉ

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ํ•„์ˆ˜๊ณผ์ œ DOSOPT ํ•„์ˆ˜๊ณผ์ œ

Projects

None yet

Development

Successfully merging this pull request may close these issues.

week6 ํ•„์ˆ˜๊ณผ์ œ

8 participants