Skip to content

Commit b463eb0

Browse files
authored
Merge pull request #252 from TeamPINGLE/hotfix-new-group
[hotfix] 신규단체개설뷰 이슈 해결
2 parents 2fc735f + a9551dd commit b463eb0

File tree

6 files changed

+42
-31
lines changed

6 files changed

+42
-31
lines changed

app/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ android {
2626
applicationId = "org.sopt.pingle"
2727
minSdk = 28
2828
targetSdk = 34
29-
versionCode = 16
29+
versionCode = 17
3030
versionName = "2.0.0"
3131

3232
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"

app/src/main/AndroidManifest.xml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,6 @@
8282
android:exported="false"
8383
android:screenOrientation="portrait"
8484
tools:ignore="LockedOrientationActivity" />
85-
8685
<activity
8786
android:name=".presentation.ui.newgroup.NewGroupActivity"
8887
android:exported="false"
@@ -98,6 +97,11 @@
9897
android:exported="false"
9998
android:screenOrientation="portrait"
10099
tools:ignore="LockedOrientationActivity" />
100+
<activity
101+
android:name=".presentation.ui.newgroup.newgroupinfo.NewGroupInfoActivity"
102+
android:exported="false"
103+
android:screenOrientation="portrait"
104+
tools:ignore="LockedOrientationActivity" />
101105
<activity
102106
android:name=".presentation.ui.onboarding.onboarding.OnboardingActivity"
103107
android:exported="false"

app/src/main/java/org/sopt/pingle/presentation/ui/newgroup/NewGroupViewModel.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,15 +47,15 @@ class NewGroupViewModel @Inject constructor(
4747

4848
val newGroupName = MutableStateFlow<String>("")
4949
val newGroupEmail = MutableStateFlow<String>("")
50-
val isNewGroupBtnCheckName = MutableStateFlow<Boolean>(false)
50+
val isGroupNameDuplicatedCheck = MutableStateFlow<Boolean>(false)
5151
val newGroupKeywordName = MutableStateFlow<String>("")
5252
val newGroupKeywordValue = MutableStateFlow<String>("")
5353

5454
val isNewGroupBtnEnabled: StateFlow<Boolean> = listOf(
5555
currentPage,
5656
newGroupName,
5757
newGroupEmail,
58-
isNewGroupBtnCheckName,
58+
isGroupNameDuplicatedCheck,
5959
newGroupKeywordValue
6060
).combineAll().map { values ->
6161
val currentPage = values[0] as Int
@@ -78,8 +78,8 @@ class NewGroupViewModel @Inject constructor(
7878
newGroupKeywordValue.value = keywordValue
7979
}
8080

81-
fun setIsNewGroupBtnCheckName(boolean: Boolean) {
82-
isNewGroupBtnCheckName.value = boolean
81+
fun setIsGroupNameDuplicatedCheck(boolean: Boolean) {
82+
isGroupNameDuplicatedCheck.value = boolean
8383
}
8484

8585
fun isEmailValid() = EMAIL_PATTERN.matches(newGroupEmail.value)

app/src/main/java/org/sopt/pingle/presentation/ui/newgroup/newgroupinput/NewGroupInputFragment.kt

Lines changed: 26 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -32,31 +32,39 @@ class NewGroupInputFragment :
3232
collectData()
3333
}
3434

35-
override fun onResume() {
36-
super.onResume()
37-
38-
binding.etNewGroupInputGroupName.btnEditTextCheck.isEnabled =
39-
newGroupViewModel.isNewGroupBtnCheckName.value
40-
}
41-
4235
private fun addListeners() {
43-
binding.etNewGroupInputGroupName.btnEditTextCheck.setOnClickListener { newGroupViewModel.getNewGroupCheckName() }
36+
binding.etNewGroupInputGroupName.btnEditTextCheck.setOnClickListener {
37+
with(newGroupViewModel) {
38+
newGroupName.apply { value = value.trim() }
39+
getNewGroupCheckName()
40+
}
41+
}
4442
}
4543

4644
private fun collectData() {
47-
collectNewGroupTeamNameIsEnabled()
45+
collectIsGroupNameDuplicatedCheck()
46+
collectNewGroupName()
4847
collectNewGroupCheckNameState()
4948
}
5049

51-
private fun collectNewGroupTeamNameIsEnabled() {
52-
newGroupViewModel.newGroupName.flowWithLifecycle(lifecycle).onEach { newGroupName ->
53-
binding.etNewGroupInputGroupName.btnEditTextCheck.isEnabled = newGroupName.isNotBlank()
54-
newGroupViewModel.setIsNewGroupBtnCheckName(false)
55-
}.launchIn(lifecycleScope)
50+
private fun collectIsGroupNameDuplicatedCheck() {
51+
newGroupViewModel.isGroupNameDuplicatedCheck.flowWithLifecycle(viewLifecycleOwner.lifecycle)
52+
.onEach { isGroupNameDuplicatedCheck ->
53+
binding.etNewGroupInputGroupName.btnEditTextCheck.isEnabled =
54+
!isGroupNameDuplicatedCheck && newGroupViewModel.newGroupName.value.isNotBlank()
55+
}.launchIn(viewLifecycleOwner.lifecycleScope)
56+
}
57+
58+
private fun collectNewGroupName() {
59+
newGroupViewModel.newGroupName.flowWithLifecycle(viewLifecycleOwner.lifecycle)
60+
.distinctUntilChanged().onEach { newGroupName ->
61+
binding.etNewGroupInputGroupName.btnEditTextCheck.isEnabled = newGroupName.isNotBlank()
62+
newGroupViewModel.setIsGroupNameDuplicatedCheck(false)
63+
}.launchIn(viewLifecycleOwner.lifecycleScope)
5664
}
5765

5866
private fun collectNewGroupCheckNameState() {
59-
newGroupViewModel.newGroupCheckNameState.flowWithLifecycle(lifecycle)
67+
newGroupViewModel.newGroupCheckNameState.flowWithLifecycle(viewLifecycleOwner.lifecycle)
6068
.distinctUntilChanged()
6169
.onEach { uiState ->
6270
when (uiState) {
@@ -68,15 +76,15 @@ class NewGroupInputFragment :
6876
SNACKBAR_BOTTOM_MARGIN,
6977
SnackbarType.GUIDE
7078
)
71-
binding.etNewGroupInputGroupName.btnEditTextCheck.isEnabled = false
72-
newGroupViewModel.setIsNewGroupBtnCheckName(true)
79+
newGroupViewModel.setIsGroupNameDuplicatedCheck(true)
7380
} else {
7481
PingleSnackbar.makeSnackbar(
7582
binding.root,
7683
stringOf(R.string.new_group_input_snackbar_warning),
7784
SNACKBAR_BOTTOM_MARGIN,
7885
SnackbarType.WARNING
7986
)
87+
newGroupViewModel.setIsGroupNameDuplicatedCheck(false)
8088
}
8189
AmplitudeUtils.trackEventWithProperty(
8290
COMPLETE_DOUBLECHECK,
@@ -87,7 +95,7 @@ class NewGroupInputFragment :
8795

8896
else -> {}
8997
}
90-
}.launchIn(lifecycleScope)
98+
}.launchIn(viewLifecycleOwner.lifecycleScope)
9199
}
92100

93101
companion object {

app/src/main/java/org/sopt/pingle/presentation/ui/newgroup/newgroupkeyword/NewGroupKeywordFragment.kt

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,12 @@ class NewGroupKeywordFragment :
4848
}
4949

5050
private fun collectData() {
51-
newGroupViewModel.newGroupKeywordsState.flowWithLifecycle(lifecycle).onEach { uiState ->
51+
newGroupViewModel.newGroupKeywordsState.flowWithLifecycle(viewLifecycleOwner.lifecycle).onEach { uiState ->
5252
when (uiState) {
5353
is UiState.Success -> setChipKeyword(uiState.data)
54-
55-
else -> {}
54+
else -> Unit
5655
}
57-
}.launchIn(lifecycleScope)
56+
}.launchIn(viewLifecycleOwner.lifecycleScope)
5857
}
5958

6059
private fun setChipKeyword(keywords: List<NewGroupKeywordEntity>) {

app/src/main/res/layout/activity_new_group_announcement.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,13 @@
3131

3232
<TextView
3333
android:id="@+id/tv_new_group_announcement_group_name"
34-
android:layout_width="match_parent"
35-
android:layout_height="0dp"
34+
android:layout_width="0dp"
35+
android:layout_height="wrap_content"
3636
android:layout_marginTop="16dp"
3737
android:textAppearance="@style/TextAppearance.Pingle.Body.Med.16"
3838
android:textColor="@color/g_03"
39-
app:layout_constraintStart_toEndOf="@id/gl_start"
4039
app:layout_constraintEnd_toEndOf="parent"
40+
app:layout_constraintStart_toEndOf="@id/gl_start"
4141
app:layout_constraintTop_toBottomOf="@id/tv_new_group_announcement_title"
4242
tools:text="@string/new_group_announcement_group_name" />
4343

0 commit comments

Comments
 (0)