From 819d64b7a3ed84dd9cb0db424d01073a32e2d349 Mon Sep 17 00:00:00 2001 From: blueme0 Date: Thu, 15 Feb 2024 21:23:24 +0900 Subject: [PATCH 1/2] =?UTF-8?q?[fix/#160]=20=ED=9A=8C=EC=9B=90=EA=B0=80?= =?UTF-8?q?=EC=9E=85=20=EC=9D=B4=EB=A6=84=20input=20error=20case=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../signup/name/GetNameFragment.kt | 20 ++++++++++++++++--- app/src/main/res/layout/fragment_get_name.xml | 12 +++++++++++ app/src/main/res/values/strings.xml | 1 + 3 files changed, 30 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/com/teumteum/teumteum/presentation/signup/name/GetNameFragment.kt b/app/src/main/java/com/teumteum/teumteum/presentation/signup/name/GetNameFragment.kt index 8dec9030..5fb7c245 100644 --- a/app/src/main/java/com/teumteum/teumteum/presentation/signup/name/GetNameFragment.kt +++ b/app/src/main/java/com/teumteum/teumteum/presentation/signup/name/GetNameFragment.kt @@ -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 @@ -26,6 +27,7 @@ class GetNameFragment binding.vm = viewModel binding.lifecycleOwner = this + binding.etName.filters = arrayOf(filterAlphaNumSpace) setTextChangedListener() checkValidinput() } @@ -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 = "^[ㄱ-ㅣ가-힣]+$" } } \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_get_name.xml b/app/src/main/res/layout/fragment_get_name.xml index 314620b8..0eb0b8f3 100644 --- a/app/src/main/res/layout/fragment_get_name.xml +++ b/app/src/main/res/layout/fragment_get_name.xml @@ -79,5 +79,17 @@ app:layout_constraintTop_toBottomOf="@id/tv_name" /> + + \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 3947a0ae..ac95967c 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -57,6 +57,7 @@ 틈틈은 신뢰 기반 커뮤니티로 실명으로\n대화하고 있어요 이름 실명을 입력해주세요 + 형식이 올바르지 않아요. 생일이 언제인가요? 또래와 함께하는 맞춤형 모임을 추천해 드려요 2000년 From a8216ec028bee9933731e594d3d6b7f0f2a3582e Mon Sep 17 00:00:00 2001 From: blueme0 Date: Thu, 15 Feb 2024 22:38:08 +0900 Subject: [PATCH 2/2] =?UTF-8?q?[fix/#160]=20=EC=95=8C=EB=A6=BC=20=EC=88=98?= =?UTF-8?q?=EC=8B=A0=20=EC=BD=94=EB=93=9C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../teumteum/teumteum/config/TeumMessagingService.kt | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/teumteum/teumteum/config/TeumMessagingService.kt b/app/src/main/java/com/teumteum/teumteum/config/TeumMessagingService.kt index d22a921d..e32ea452 100644 --- a/app/src/main/java/com/teumteum/teumteum/config/TeumMessagingService.kt +++ b/app/src/main/java/com/teumteum/teumteum/config/TeumMessagingService.kt @@ -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 @@ -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) @@ -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) } } }