Skip to content

Commit

Permalink
�[MERGE] : #160 -> main
Browse files Browse the repository at this point in the history
[FIX/#160] 2차 QA 수정사항 반영
  • Loading branch information
blueme0 authored Feb 15, 2024
2 parents 3856e73 + a8216ec commit 29573c4
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import com.teumteum.data.model.request.toDeviceToken
import com.teumteum.data.service.UserService
import com.teumteum.domain.TeumTeumDataStore
import com.teumteum.domain.entity.Message
import com.teumteum.domain.repository.UserRepository
import com.teumteum.teumteum.R
import com.teumteum.teumteum.presentation.splash.SplashActivity
import dagger.hilt.android.AndroidEntryPoint
Expand All @@ -29,6 +30,9 @@ class TeumMessagingService : FirebaseMessagingService() {
@Inject
lateinit var userService: UserService

@Inject
lateinit var userRepository: UserRepository

override fun onNewToken(token: String) {
super.onNewToken(token)

Expand Down Expand Up @@ -63,9 +67,12 @@ class TeumMessagingService : FirebaseMessagingService() {
}
if (alertMessage.type == END_MEETING) {
alertMessage.meetingId = message.data["meetingId"]?.toLong()
alertMessage.participants = message.data["participants"]?.toList()?.map { it.digitToInt() }
alertMessage.participants = message.data["participants"]?.split(",")?.map { it.toInt() }
val userId = userRepository.getUserInfo()?.id?.toInt()
if (alertMessage.participants?.contains(userId) == true)
sendNotificationAlarm(alertMessage)
}
if (alertMessage.title.isNotEmpty()) sendNotificationAlarm(alertMessage)
else if (alertMessage.title.isNotEmpty()) sendNotificationAlarm(alertMessage)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package com.teumteum.teumteum.presentation.signup.name

import android.os.Bundle
import android.text.Editable
import android.text.InputFilter
import android.text.TextWatcher
import android.view.View
import androidx.fragment.app.activityViewModels
Expand All @@ -26,6 +27,7 @@ class GetNameFragment

binding.vm = viewModel
binding.lifecycleOwner = this
binding.etName.filters = arrayOf(filterAlphaNumSpace)
setTextChangedListener()
checkValidinput()
}
Expand All @@ -44,18 +46,30 @@ class GetNameFragment
})
}

private var filterAlphaNumSpace = InputFilter { source, _, _, _, _, _ ->
val ps = Pattern.compile(REGEX_NAME_PATTERN_WRITING)
if (!ps.matcher(source).matches()) {
""
} else source
}

private fun checkValidinput() {
lifecycleScope.launch {
viewModel.userName.collect { userName ->
if (Pattern.matches(REGEX_NAME_PATTERN, userName) && userName.trim().length >= 2)
if (Pattern.matches(REGEX_NAME_PATTERN_SUBMIT, userName) && userName.trim().length >= 2) {
(activity as SignUpActivity).activateNextButton()
else
binding.tvCaption.visibility = View.INVISIBLE
}
else {
(activity as SignUpActivity).disableNextButton()
binding.tvCaption.visibility = View.VISIBLE
}
}
}
}

companion object {
private const val REGEX_NAME_PATTERN = "^([가-힣]*)\$"
private const val REGEX_NAME_PATTERN_SUBMIT = "^([가-힣]*)\$"
private const val REGEX_NAME_PATTERN_WRITING = "^[ㄱ-ㅣ가-힣]+$"
}
}
12 changes: 12 additions & 0 deletions app/src/main/res/layout/fragment_get_name.xml
Original file line number Diff line number Diff line change
Expand Up @@ -79,5 +79,17 @@
app:layout_constraintTop_toBottomOf="@id/tv_name"
/>

<TextView
android:id="@+id/tv_caption"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
app:layout_constraintStart_toStartOf="@id/et_name"
app:layout_constraintTop_toBottomOf="@id/et_name"
android:text="@string/signup_tv_name_caption"
android:textColor="@color/error_300"
android:textAppearance="@style/ta.caption.2"
/>

</androidx.constraintlayout.widget.ConstraintLayout>
</layout>
1 change: 1 addition & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
<string name="signup_tv_name_subtitle">틈틈은 신뢰 기반 커뮤니티로 실명으로\n대화하고 있어요</string>
<string name="signup_tv_name_input">이름</string>
<string name="signup_tv_name_hint">실명을 입력해주세요</string>
<string name="signup_tv_name_caption">형식이 올바르지 않아요.</string>
<string name="signup_tv_bday_title">생일이 언제인가요?</string>
<string name="signup_tv_bday_subtitle">또래와 함께하는 맞춤형 모임을 추천해 드려요</string>
<string name="signup_tv_bday_year">2000년</string>
Expand Down

0 comments on commit 29573c4

Please sign in to comment.