diff --git a/app/build.gradle.kts b/app/build.gradle.kts
index f01aa69a..a2175538 100644
--- a/app/build.gradle.kts
+++ b/app/build.gradle.kts
@@ -26,7 +26,7 @@ android {
applicationId = "org.sopt.pingle"
minSdk = 28
targetSdk = 34
- versionCode = 16
+ versionCode = 17
versionName = "2.0.0"
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 5f541aa1..88f6d7e6 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -82,7 +82,6 @@
android:exported="false"
android:screenOrientation="portrait"
tools:ignore="LockedOrientationActivity" />
-
+
("")
val newGroupEmail = MutableStateFlow("")
- val isNewGroupBtnCheckName = MutableStateFlow(false)
+ val isGroupNameDuplicatedCheck = MutableStateFlow(false)
val newGroupKeywordName = MutableStateFlow("")
val newGroupKeywordValue = MutableStateFlow("")
@@ -55,7 +55,7 @@ class NewGroupViewModel @Inject constructor(
currentPage,
newGroupName,
newGroupEmail,
- isNewGroupBtnCheckName,
+ isGroupNameDuplicatedCheck,
newGroupKeywordValue
).combineAll().map { values ->
val currentPage = values[0] as Int
@@ -78,8 +78,8 @@ class NewGroupViewModel @Inject constructor(
newGroupKeywordValue.value = keywordValue
}
- fun setIsNewGroupBtnCheckName(boolean: Boolean) {
- isNewGroupBtnCheckName.value = boolean
+ fun setIsGroupNameDuplicatedCheck(boolean: Boolean) {
+ isGroupNameDuplicatedCheck.value = boolean
}
fun isEmailValid() = EMAIL_PATTERN.matches(newGroupEmail.value)
diff --git a/app/src/main/java/org/sopt/pingle/presentation/ui/newgroup/newgroupinput/NewGroupInputFragment.kt b/app/src/main/java/org/sopt/pingle/presentation/ui/newgroup/newgroupinput/NewGroupInputFragment.kt
index 9a9fb21c..02e2c6b1 100644
--- a/app/src/main/java/org/sopt/pingle/presentation/ui/newgroup/newgroupinput/NewGroupInputFragment.kt
+++ b/app/src/main/java/org/sopt/pingle/presentation/ui/newgroup/newgroupinput/NewGroupInputFragment.kt
@@ -32,31 +32,39 @@ class NewGroupInputFragment :
collectData()
}
- override fun onResume() {
- super.onResume()
-
- binding.etNewGroupInputGroupName.btnEditTextCheck.isEnabled =
- newGroupViewModel.isNewGroupBtnCheckName.value
- }
-
private fun addListeners() {
- binding.etNewGroupInputGroupName.btnEditTextCheck.setOnClickListener { newGroupViewModel.getNewGroupCheckName() }
+ binding.etNewGroupInputGroupName.btnEditTextCheck.setOnClickListener {
+ with(newGroupViewModel) {
+ newGroupName.apply { value = value.trim() }
+ getNewGroupCheckName()
+ }
+ }
}
private fun collectData() {
- collectNewGroupTeamNameIsEnabled()
+ collectIsGroupNameDuplicatedCheck()
+ collectNewGroupName()
collectNewGroupCheckNameState()
}
- private fun collectNewGroupTeamNameIsEnabled() {
- newGroupViewModel.newGroupName.flowWithLifecycle(lifecycle).onEach { newGroupName ->
- binding.etNewGroupInputGroupName.btnEditTextCheck.isEnabled = newGroupName.isNotBlank()
- newGroupViewModel.setIsNewGroupBtnCheckName(false)
- }.launchIn(lifecycleScope)
+ private fun collectIsGroupNameDuplicatedCheck() {
+ newGroupViewModel.isGroupNameDuplicatedCheck.flowWithLifecycle(viewLifecycleOwner.lifecycle)
+ .onEach { isGroupNameDuplicatedCheck ->
+ binding.etNewGroupInputGroupName.btnEditTextCheck.isEnabled =
+ !isGroupNameDuplicatedCheck && newGroupViewModel.newGroupName.value.isNotBlank()
+ }.launchIn(viewLifecycleOwner.lifecycleScope)
+ }
+
+ private fun collectNewGroupName() {
+ newGroupViewModel.newGroupName.flowWithLifecycle(viewLifecycleOwner.lifecycle)
+ .distinctUntilChanged().onEach { newGroupName ->
+ binding.etNewGroupInputGroupName.btnEditTextCheck.isEnabled = newGroupName.isNotBlank()
+ newGroupViewModel.setIsGroupNameDuplicatedCheck(false)
+ }.launchIn(viewLifecycleOwner.lifecycleScope)
}
private fun collectNewGroupCheckNameState() {
- newGroupViewModel.newGroupCheckNameState.flowWithLifecycle(lifecycle)
+ newGroupViewModel.newGroupCheckNameState.flowWithLifecycle(viewLifecycleOwner.lifecycle)
.distinctUntilChanged()
.onEach { uiState ->
when (uiState) {
@@ -68,8 +76,7 @@ class NewGroupInputFragment :
SNACKBAR_BOTTOM_MARGIN,
SnackbarType.GUIDE
)
- binding.etNewGroupInputGroupName.btnEditTextCheck.isEnabled = false
- newGroupViewModel.setIsNewGroupBtnCheckName(true)
+ newGroupViewModel.setIsGroupNameDuplicatedCheck(true)
} else {
PingleSnackbar.makeSnackbar(
binding.root,
@@ -77,6 +84,7 @@ class NewGroupInputFragment :
SNACKBAR_BOTTOM_MARGIN,
SnackbarType.WARNING
)
+ newGroupViewModel.setIsGroupNameDuplicatedCheck(false)
}
AmplitudeUtils.trackEventWithProperty(
COMPLETE_DOUBLECHECK,
@@ -87,7 +95,7 @@ class NewGroupInputFragment :
else -> {}
}
- }.launchIn(lifecycleScope)
+ }.launchIn(viewLifecycleOwner.lifecycleScope)
}
companion object {
diff --git a/app/src/main/java/org/sopt/pingle/presentation/ui/newgroup/newgroupkeyword/NewGroupKeywordFragment.kt b/app/src/main/java/org/sopt/pingle/presentation/ui/newgroup/newgroupkeyword/NewGroupKeywordFragment.kt
index cf787485..2918bc8b 100644
--- a/app/src/main/java/org/sopt/pingle/presentation/ui/newgroup/newgroupkeyword/NewGroupKeywordFragment.kt
+++ b/app/src/main/java/org/sopt/pingle/presentation/ui/newgroup/newgroupkeyword/NewGroupKeywordFragment.kt
@@ -48,13 +48,12 @@ class NewGroupKeywordFragment :
}
private fun collectData() {
- newGroupViewModel.newGroupKeywordsState.flowWithLifecycle(lifecycle).onEach { uiState ->
+ newGroupViewModel.newGroupKeywordsState.flowWithLifecycle(viewLifecycleOwner.lifecycle).onEach { uiState ->
when (uiState) {
is UiState.Success -> setChipKeyword(uiState.data)
-
- else -> {}
+ else -> Unit
}
- }.launchIn(lifecycleScope)
+ }.launchIn(viewLifecycleOwner.lifecycleScope)
}
private fun setChipKeyword(keywords: List) {
diff --git a/app/src/main/res/layout/activity_new_group_announcement.xml b/app/src/main/res/layout/activity_new_group_announcement.xml
index cc70873d..975da111 100644
--- a/app/src/main/res/layout/activity_new_group_announcement.xml
+++ b/app/src/main/res/layout/activity_new_group_announcement.xml
@@ -31,13 +31,13 @@