diff --git a/app/src/main/java/com/sopt/umbba_android/application/UmbbaApplication.kt b/app/src/main/java/com/sopt/umbba_android/application/UmbbaApplication.kt index e5bcad97..f9b8b05e 100644 --- a/app/src/main/java/com/sopt/umbba_android/application/UmbbaApplication.kt +++ b/app/src/main/java/com/sopt/umbba_android/application/UmbbaApplication.kt @@ -3,15 +3,18 @@ package com.sopt.umbba_android.application import android.app.Application import androidx.appcompat.app.AppCompatDelegate import com.kakao.sdk.common.KakaoSdk +import com.sopt.umbba_android.BuildConfig import com.sopt.umbba_android.BuildConfig.KAKAO_NATIVE_APP_KEY import com.sopt.umbba_android.data.local.SharedPreferences +import timber.log.Timber class UmbbaApplication: Application() { override fun onCreate() { super.onCreate() - AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO) initKakao() setupSharedPreferences() + stopDarkMode() + useTimber() } private fun initKakao() { @@ -21,4 +24,14 @@ class UmbbaApplication: Application() { private fun setupSharedPreferences() { SharedPreferences.init(this) } + + private fun stopDarkMode() { + AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO) + } + + private fun useTimber() { + if (BuildConfig.DEBUG) { + Timber.plant(Timber.DebugTree()) + } + } } \ No newline at end of file diff --git a/app/src/main/java/com/sopt/umbba_android/data/datasource/ExampleDateSource.kt b/app/src/main/java/com/sopt/umbba_android/data/datasource/ExampleDateSource.kt deleted file mode 100644 index 800a9a9b..00000000 --- a/app/src/main/java/com/sopt/umbba_android/data/datasource/ExampleDateSource.kt +++ /dev/null @@ -1,13 +0,0 @@ -package com.sopt.umbba_android.data.datasource - -import com.sopt.umbba_android.data.service.ExampleService -import com.sopt.umbba_android.data.model.request.ExampleRequestDto -import com.sopt.umbba_android.data.model.response.ExampleResponseDto -import com.sopt.umbba_android.data.model.response.wrapper.BaseResponse - -class ExampleDateSource( - private val exampleService: ExampleService -) { - suspend fun postExample(exampleRequestDto: ExampleRequestDto): BaseResponse = - exampleService.postExample(exampleRequestDto) -} \ No newline at end of file diff --git a/app/src/main/java/com/sopt/umbba_android/data/interceptor/AuthInterceptor.kt b/app/src/main/java/com/sopt/umbba_android/data/interceptor/AuthInterceptor.kt index 35cb9262..4adf1bba 100644 --- a/app/src/main/java/com/sopt/umbba_android/data/interceptor/AuthInterceptor.kt +++ b/app/src/main/java/com/sopt/umbba_android/data/interceptor/AuthInterceptor.kt @@ -13,21 +13,18 @@ class AuthInterceptor : Interceptor { val token = if (SharedPreferences.getString(USER_TOKEN).isNullOrBlank()) { SharedPreferences.getKakaoString(USER_KAKAO_TOKEN) - // 저장된 서버 액세스 토큰이 없다면 카카오 토큰 전송 -> 회원가입 } else { "Bearer ${SharedPreferences.getString(USER_TOKEN)}" - // 저장된 서버 액세스 토큰이 있다면 Bearer 붙여서 전송 -> 로그인 } val originalRequest = chain.request() - val headerRequest = originalRequest.newBuilder() // 헤더를 추가한 req + val headerRequest = originalRequest.newBuilder() .header( "Authorization", "$token" ) .build() - Log.e("yeonjin", "헤더 $token") return chain.proceed(headerRequest) } } \ No newline at end of file diff --git a/app/src/main/java/com/sopt/umbba_android/data/local/SharedPreferences.kt b/app/src/main/java/com/sopt/umbba_android/data/local/SharedPreferences.kt index de341621..1ff64006 100644 --- a/app/src/main/java/com/sopt/umbba_android/data/local/SharedPreferences.kt +++ b/app/src/main/java/com/sopt/umbba_android/data/local/SharedPreferences.kt @@ -38,19 +38,18 @@ object SharedPreferences { return preferences.getString(key, null) } - //토큰 저장 fun setString(key: String, value: String?) { preferences.edit { putString(key, value) } } - //토큰 가져오기 - 자동 로그인 확인 + fun getString(key: String): String? { return preferences.getString(key, null) } - //온보딩 완료 상태 저장 + fun setOnboardingBoolean(key: String, value: Boolean) { preferences.edit { putBoolean(key, value) } } - //온보딩 완료했는지 가져오기 - 온보딩 완료 확인 + fun getOnboardingBoolean(key: String): Boolean { return preferences.getBoolean(key, false) } diff --git a/app/src/main/java/com/sopt/umbba_android/data/model/request/ExampleRequestDto.kt b/app/src/main/java/com/sopt/umbba_android/data/model/request/ExampleRequestDto.kt deleted file mode 100644 index ddff9ab9..00000000 --- a/app/src/main/java/com/sopt/umbba_android/data/model/request/ExampleRequestDto.kt +++ /dev/null @@ -1,9 +0,0 @@ -package com.sopt.umbba_android.data.model.request - -import kotlinx.serialization.Serializable - -@Serializable -data class ExampleRequestDto( - val id: String, - val pw: String -) diff --git a/app/src/main/java/com/sopt/umbba_android/data/model/response/ExampleResponseDto.kt b/app/src/main/java/com/sopt/umbba_android/data/model/response/ExampleResponseDto.kt deleted file mode 100644 index ea6c8313..00000000 --- a/app/src/main/java/com/sopt/umbba_android/data/model/response/ExampleResponseDto.kt +++ /dev/null @@ -1,10 +0,0 @@ -package com.sopt.umbba_android.data.model.response - -import kotlinx.serialization.Serializable - -@Serializable -data class ExampleResponseDto( - val id: Int, - val title: String, - val content: String -) \ No newline at end of file diff --git a/app/src/main/java/com/sopt/umbba_android/data/model/response/wrapper/BaseResponse.kt b/app/src/main/java/com/sopt/umbba_android/data/model/response/wrapper/BaseResponse.kt deleted file mode 100644 index 3fe62f4e..00000000 --- a/app/src/main/java/com/sopt/umbba_android/data/model/response/wrapper/BaseResponse.kt +++ /dev/null @@ -1,10 +0,0 @@ -package com.sopt.umbba_android.data.model.response.wrapper - -import kotlinx.serialization.Serializable - -@Serializable -data class BaseResponse( - val status: Int, - val message: String, - val data: T? -) diff --git a/app/src/main/java/com/sopt/umbba_android/data/repository/ExampleRepositoryImpl.kt b/app/src/main/java/com/sopt/umbba_android/data/repository/ExampleRepositoryImpl.kt deleted file mode 100644 index 07d7fe20..00000000 --- a/app/src/main/java/com/sopt/umbba_android/data/repository/ExampleRepositoryImpl.kt +++ /dev/null @@ -1,14 +0,0 @@ -package com.sopt.umbba_android.data.repository - -import com.sopt.umbba_android.data.datasource.ExampleDateSource -import com.sopt.umbba_android.data.model.request.ExampleRequestDto -import com.sopt.umbba_android.data.model.response.ExampleResponseDto -import com.sopt.umbba_android.data.model.response.wrapper.BaseResponse -import com.sopt.umbba_android.domain.repository.ExampleRepository - -class ExampleRepositoryImpl( - private val exampleDateSource: ExampleDateSource -) : ExampleRepository { - override suspend fun postExample(exampleRequestDto: ExampleRequestDto): Result> = - kotlin.runCatching { exampleDateSource.postExample(exampleRequestDto) } -} \ No newline at end of file diff --git a/app/src/main/java/com/sopt/umbba_android/data/repository/HomeRepositoryImpl.kt b/app/src/main/java/com/sopt/umbba_android/data/repository/HomeRepositoryImpl.kt index 3604193c..b46a457d 100644 --- a/app/src/main/java/com/sopt/umbba_android/data/repository/HomeRepositoryImpl.kt +++ b/app/src/main/java/com/sopt/umbba_android/data/repository/HomeRepositoryImpl.kt @@ -11,7 +11,7 @@ class HomeRepositoryImpl(private val homeRemoteDataSource: HomeRemoteDataSource) runCatching { homeRemoteDataSource.getHomeData() }.onSuccess { - Timber.e("get home data 성공~") + Timber.d("get home data 성공") }.onFailure { Timber.e("get home data 실패") } @@ -20,7 +20,7 @@ class HomeRepositoryImpl(private val homeRemoteDataSource: HomeRemoteDataSource) runCatching { homeRemoteDataSource.getResponseCase() }.onSuccess { - Timber.e("get response case 성공~") + Timber.d("get response case 성공") }.onFailure { Timber.e("get response case 실패") } diff --git a/app/src/main/java/com/sopt/umbba_android/data/repository/ListRepositoryImpl.kt b/app/src/main/java/com/sopt/umbba_android/data/repository/ListRepositoryImpl.kt index d9496281..8bb7c14c 100644 --- a/app/src/main/java/com/sopt/umbba_android/data/repository/ListRepositoryImpl.kt +++ b/app/src/main/java/com/sopt/umbba_android/data/repository/ListRepositoryImpl.kt @@ -10,8 +10,8 @@ class ListRepositoryImpl(private val listRemoteDataSource: ListRemoteDataSource) runCatching { listRemoteDataSource.getListData(sectionId) }.onSuccess { - Timber.e("get list data 성공~") + Timber.d("get list data 성공") }.onFailure { - Timber.e("get list data 실패 크라잉 . . . ") + Timber.e("get list data 실패") } } \ No newline at end of file diff --git a/app/src/main/java/com/sopt/umbba_android/data/repository/LoginRepositoryImpl.kt b/app/src/main/java/com/sopt/umbba_android/data/repository/LoginRepositoryImpl.kt index 78141b0d..23854004 100644 --- a/app/src/main/java/com/sopt/umbba_android/data/repository/LoginRepositoryImpl.kt +++ b/app/src/main/java/com/sopt/umbba_android/data/repository/LoginRepositoryImpl.kt @@ -14,8 +14,8 @@ class LoginRepositoryImpl( runCatching { loginRemoteDataSource.postLogin(loginRequestDto) }.onSuccess { - Log.e("yeonjin", "Impl login 성공") + Timber.d("Impl login 성공") }.onFailure { - Log.e("yeonjin", "Impl login 실패") + Timber.e("Impl login 실패") } } \ No newline at end of file diff --git a/app/src/main/java/com/sopt/umbba_android/data/repository/OnboardingRepositoryImpl.kt b/app/src/main/java/com/sopt/umbba_android/data/repository/OnboardingRepositoryImpl.kt index bf2a6eb6..1f66549d 100644 --- a/app/src/main/java/com/sopt/umbba_android/data/repository/OnboardingRepositoryImpl.kt +++ b/app/src/main/java/com/sopt/umbba_android/data/repository/OnboardingRepositoryImpl.kt @@ -9,6 +9,7 @@ import com.sopt.umbba_android.data.model.response.InviteCodeResponseDto import com.sopt.umbba_android.data.model.response.ReceiveInfoResponseDto import com.sopt.umbba_android.data.model.response.SendInfoResponseDto import com.sopt.umbba_android.domain.repository.OnboardingRepository +import timber.log.Timber class OnboardingRepositoryImpl( private val onboardingRemoteDataSource: OnboardingRemoteDataSource @@ -17,26 +18,26 @@ class OnboardingRepositoryImpl( runCatching { onboardingRemoteDataSource.setFamily(inviteCodeRequestDto) }.onSuccess { - Log.e("yeonjin", "onboarding setFamily Impl 성공") + Timber.d("onboarding setFamily Impl 성공") }.onFailure { - Log.e("yeonjin", "onboarding setFamily Impl 실패") + Timber.e("onboarding setFamily Impl 실패") } override suspend fun setSendInfo(sendInfoRequestDto: SendInfoRequestDto): Result = runCatching { onboardingRemoteDataSource.setSendInfo(sendInfoRequestDto) }.onSuccess { - Log.e("yeonjin", "onboarding setSendInfo Impl 성공") + Timber.d("onboarding setSendInfo Impl 성공") }.onFailure { - Log.e("yeonjin", "onboarding setSendInfo Impl 성공") + Timber.e("onboarding setSendInfo Impl 성공") } override suspend fun setReceiveInfo(receiveInfoRequestDto: ReceiveInfoRequestDto): Result = runCatching { onboardingRemoteDataSource.setReceiveInfo(receiveInfoRequestDto) }.onSuccess { - Log.e("yeonjin", "onboarding setReceiveInfo Impl 성공") + Timber.d("onboarding setReceiveInfo Impl 성공") }.onFailure { - Log.e("yeonjin", "onboarding setReceiveInfo Impl 성공") + Timber.e("onboarding setReceiveInfo Impl 성공") } } \ No newline at end of file diff --git a/app/src/main/java/com/sopt/umbba_android/data/repository/QuestionAnswerRepositoryImpl.kt b/app/src/main/java/com/sopt/umbba_android/data/repository/QuestionAnswerRepositoryImpl.kt index f023fe38..b63cc336 100644 --- a/app/src/main/java/com/sopt/umbba_android/data/repository/QuestionAnswerRepositoryImpl.kt +++ b/app/src/main/java/com/sopt/umbba_android/data/repository/QuestionAnswerRepositoryImpl.kt @@ -14,26 +14,26 @@ class QuestionAnswerRepositoryImpl(private val questionAnswerRemoteDataSource: Q runCatching { questionAnswerRemoteDataSource.getQuestionAnswer() }.onSuccess { - Timber.e("문답 data get 성공") + Timber.d("문답 data get 성공") }.onFailure { - Timber.e("문답 data get 실패 크라잉. . . ") + Timber.e("문답 data get 실패") } override suspend fun getListQuestionAnswer(qnaId: Long): Result = runCatching { questionAnswerRemoteDataSource.getListQuestionAnswer(qnaId) }.onSuccess { - Timber.e("list qna data get 성공") + Timber.d("list qna data get 성공") }.onFailure { - Timber.e("list qna data get 시이일패") + Timber.e("list qna data get 실패") } override suspend fun postAnswer(answerRequestDto: AnswerRequestDto):Result = runCatching { questionAnswerRemoteDataSource.postAnswer(answerRequestDto) }.onSuccess { - Timber.e("답변 data post 성공") + Timber.d("답변 data post 성공") }.onFailure { - Timber.e("답변 data post 실패 크라잉. . . ") + Timber.e("답변 data post 실패") } } \ No newline at end of file diff --git a/app/src/main/java/com/sopt/umbba_android/data/repository/SettingRepositoryImpl.kt b/app/src/main/java/com/sopt/umbba_android/data/repository/SettingRepositoryImpl.kt index c21eb327..fcbd30c7 100644 --- a/app/src/main/java/com/sopt/umbba_android/data/repository/SettingRepositoryImpl.kt +++ b/app/src/main/java/com/sopt/umbba_android/data/repository/SettingRepositoryImpl.kt @@ -5,6 +5,7 @@ import com.sopt.umbba_android.data.datasource.SettingRemoteDataSource import com.sopt.umbba_android.data.model.response.LogOutResponseDto import com.sopt.umbba_android.data.model.response.SignOutResponseDto import com.sopt.umbba_android.domain.repository.SettingRepository +import timber.log.Timber class SettingRepositoryImpl(private val settingRemoteDataSource: SettingRemoteDataSource) : SettingRepository { @@ -12,17 +13,17 @@ class SettingRepositoryImpl(private val settingRemoteDataSource: SettingRemoteDa runCatching { settingRemoteDataSource.logout() }.onSuccess { - Log.e("hyeon","Impl 로그아웃 성공") + Timber.d("Impl 로그아웃 성공") }.onFailure { - Log.e("hyeon","Impl 로그아웃 실패") + Timber.e("Impl 로그아웃 실패") } override suspend fun signout(): Result = runCatching { settingRemoteDataSource.signout() }.onSuccess { - Log.e("hyeon","Impl 회원탈퇴 성공") + Timber.d("Impl 회원탈퇴 성공") }.onFailure { - Log.e("hyeon","Impl 회원탈퇴 실패") + Timber.e("Impl 회원탈퇴 실패") } } \ No newline at end of file diff --git a/app/src/main/java/com/sopt/umbba_android/data/service/ExampleService.kt b/app/src/main/java/com/sopt/umbba_android/data/service/ExampleService.kt deleted file mode 100644 index a0dd9ee8..00000000 --- a/app/src/main/java/com/sopt/umbba_android/data/service/ExampleService.kt +++ /dev/null @@ -1,15 +0,0 @@ -package com.sopt.umbba_android.data.service - -import com.sopt.umbba_android.data.model.request.ExampleRequestDto -import com.sopt.umbba_android.data.model.response.ExampleResponseDto -import com.sopt.umbba_android.data.model.response.wrapper.BaseResponse -import retrofit2.http.Body -import retrofit2.http.POST - -interface ExampleService { - // 예시 API - @POST("api/example") - suspend fun postExample( - @Body request: ExampleRequestDto - ): BaseResponse -} \ No newline at end of file diff --git a/app/src/main/java/com/sopt/umbba_android/domain/repository/ExampleRepository.kt b/app/src/main/java/com/sopt/umbba_android/domain/repository/ExampleRepository.kt deleted file mode 100644 index f69f36f7..00000000 --- a/app/src/main/java/com/sopt/umbba_android/domain/repository/ExampleRepository.kt +++ /dev/null @@ -1,9 +0,0 @@ -package com.sopt.umbba_android.domain.repository - -import com.sopt.umbba_android.data.model.request.ExampleRequestDto -import com.sopt.umbba_android.data.model.response.ExampleResponseDto -import com.sopt.umbba_android.data.model.response.wrapper.BaseResponse - -interface ExampleRepository { - suspend fun postExample(exampleRequestDto: ExampleRequestDto): Result> -} \ No newline at end of file diff --git a/app/src/main/java/com/sopt/umbba_android/presentation/home/HomeFragment.kt b/app/src/main/java/com/sopt/umbba_android/presentation/home/HomeFragment.kt index e0e44a18..4e28014c 100644 --- a/app/src/main/java/com/sopt/umbba_android/presentation/home/HomeFragment.kt +++ b/app/src/main/java/com/sopt/umbba_android/presentation/home/HomeFragment.kt @@ -2,7 +2,6 @@ package com.sopt.umbba_android.presentation.home import android.content.Intent import android.os.Bundle -import android.util.Log import android.view.View import androidx.fragment.app.viewModels import coil.load @@ -14,6 +13,7 @@ import com.sopt.umbba_android.presentation.qna.NoOpponentDialogFragment import com.sopt.umbba_android.presentation.qna.QuestionAnswerActivity import com.sopt.umbba_android.util.ViewModelFactory import com.sopt.umbba_android.util.binding.BindingFragment +import com.sopt.umbba_android.util.setOnSingleClickListener class HomeFragment : BindingFragment(R.layout.fragment_home) { private val viewModel: HomeViewModel by viewModels { ViewModelFactory(requireActivity()) } @@ -23,7 +23,7 @@ class HomeFragment : BindingFragment(R.layout.fragment_home observeData() } private fun setClickEvent(responseCaseDto: HomeCaseResponseDto.HomeCaseData) { - binding.btnAnswer.setOnClickListener { + binding.btnAnswer.setOnSingleClickListener { viewModel.getResponseCase() when (responseCaseDto.responseCase) { 1 -> startActivity(Intent(requireActivity(), QuestionAnswerActivity::class.java)) diff --git a/app/src/main/java/com/sopt/umbba_android/presentation/home/InviteCodeDialogFragment.kt b/app/src/main/java/com/sopt/umbba_android/presentation/home/InviteCodeDialogFragment.kt index acb06a3c..ebf7e149 100644 --- a/app/src/main/java/com/sopt/umbba_android/presentation/home/InviteCodeDialogFragment.kt +++ b/app/src/main/java/com/sopt/umbba_android/presentation/home/InviteCodeDialogFragment.kt @@ -2,7 +2,6 @@ package com.sopt.umbba_android.presentation.home import android.content.ClipData import android.content.ClipboardManager -import android.content.Context import android.content.Context.CLIPBOARD_SERVICE import android.graphics.Color import android.graphics.drawable.ColorDrawable @@ -13,7 +12,6 @@ import android.view.View import android.view.ViewGroup import android.view.WindowManager import android.widget.Toast -import androidx.core.content.ContextCompat.getSystemService import androidx.fragment.app.DialogFragment import com.google.android.material.snackbar.Snackbar import com.kakao.sdk.share.ShareClient @@ -23,6 +21,8 @@ import com.kakao.sdk.template.model.FeedTemplate import com.kakao.sdk.template.model.Link import com.sopt.umbba_android.R import com.sopt.umbba_android.databinding.FragmentInviteCodeDialogBinding +import com.sopt.umbba_android.util.setOnSingleClickListener +import timber.log.Timber class InviteCodeDialogFragment(private val inviteUserName: String, private val inviteCode: String) : DialogFragment() { @@ -47,7 +47,7 @@ class InviteCodeDialogFragment(private val inviteUserName: String, private val i } private fun closeDialog() { - binding.btnClose.setOnClickListener { + binding.btnClose.setOnSingleClickListener { dismiss() } } @@ -61,30 +61,30 @@ class InviteCodeDialogFragment(private val inviteUserName: String, private val i } private fun copyInviteCode() { - binding.clCopyInviteCode.setOnClickListener { + binding.clCopyInviteCode.setOnSingleClickListener { val clipboard: ClipboardManager = requireActivity().getSystemService(CLIPBOARD_SERVICE) as ClipboardManager val clip = ClipData.newPlainText("label", binding.tvInviteCode.text) clipboard.setPrimaryClip(clip) - Toast.makeText(requireActivity(), "초대 코드가 복사되었습니다", Toast.LENGTH_SHORT).show() + Snackbar.make(binding.root, R.string.copy_invite_code_snackbar, Toast.LENGTH_SHORT).show() } } private fun sendInviteCodeWithKakao(inviteUserName: String, inviteCode: String) { - binding.btnSendInvitation.setOnClickListener { + binding.btnSendInvitation.setOnSingleClickListener { val defaultFeed = FeedTemplate( content = Content( - title = "${inviteUserName}으로부터 초대가 왔어요.\n초대 코드 : $inviteCode", - description = "과거로 떠나 함께 추억을 나누고,\n공감대를 형성해보세요.", - imageUrl = "https://github.com/Team-Umbba/Umbba-iOS/assets/75068759/64ba7265-9148-4f06-8235-de5f4030e92f", + title = getString(R.string.kakao_title, inviteUserName, inviteCode), + description = getString(R.string.kakao_description), + imageUrl = getString(R.string.kakao_image_url), link = Link( - webUrl = "https://developers.kakao.com", - mobileWebUrl = "https://developers.kakao.com" + webUrl = getString(R.string.kakao_link), + mobileWebUrl = getString(R.string.kakao_link) ) ), buttons = listOf( Button( - "초대 받기", + getString(R.string.kakao_button), Link( androidExecutionParams = mapOf("key1" to "value1", "key2" to "value2"), iosExecutionParams = mapOf("key1" to "value1", "key2" to "value2") @@ -96,17 +96,17 @@ class InviteCodeDialogFragment(private val inviteUserName: String, private val i if (ShareClient.instance.isKakaoTalkSharingAvailable(requireContext())) { ShareClient.instance.shareDefault(requireContext(), defaultFeed) { sharingResult, error -> if (error != null) { - Log.e("yeonjin", "카카오톡 공유 실패", error) + Timber.e(error, "카카오톡 공유 실패") } else if (sharingResult != null) { - Log.e("yeonjin", "카카오톡 공유 성공 ${sharingResult.intent}") + Timber.d("카카오톡 공유 성공 " + sharingResult.intent) startActivity(sharingResult.intent) - Log.w("yeonjin", "Warning Msg: ${sharingResult.warningMsg}") - Log.w("yeonjin", "Argument Msg: ${sharingResult.argumentMsg}") + Timber.w("Warning Msg: " + sharingResult.warningMsg) + Timber.w("Argument Msg: " + sharingResult.argumentMsg) } } } else { - Snackbar.make(binding.root, "카카오톡을 설치해주세요.", Snackbar.LENGTH_SHORT).show() + Snackbar.make(binding.root, R.string.install_kakaotalk, Snackbar.LENGTH_SHORT).show() } } } diff --git a/app/src/main/java/com/sopt/umbba_android/presentation/home/viewmodel/HomeViewModel.kt b/app/src/main/java/com/sopt/umbba_android/presentation/home/viewmodel/HomeViewModel.kt index 778b7990..1f64e888 100644 --- a/app/src/main/java/com/sopt/umbba_android/presentation/home/viewmodel/HomeViewModel.kt +++ b/app/src/main/java/com/sopt/umbba_android/presentation/home/viewmodel/HomeViewModel.kt @@ -29,7 +29,7 @@ class HomeViewModel(private val homeRepositoryImpl: HomeRepositoryImpl) : ViewMo viewModelScope.launch { homeRepositoryImpl.getHomeData() .onSuccess { response -> - Timber.e("getHomeData 성공") + Timber.d("getHomeData 성공") _homeData.value = response.data _topicTitle.value = "#${response.data.index} ${response.data.topic}" }.onFailure { error -> @@ -43,7 +43,7 @@ class HomeViewModel(private val homeRepositoryImpl: HomeRepositoryImpl) : ViewMo homeRepositoryImpl.getResponseCase() .onSuccess { response -> _responseCaseData.value = response.data - Timber.e("getResponseCode 성공") + Timber.d("getResponseCode 성공") }.onFailure { error -> Timber.e("getResponseCode 실패 " + error.message) } diff --git a/app/src/main/java/com/sopt/umbba_android/presentation/invite/InviteActivity.kt b/app/src/main/java/com/sopt/umbba_android/presentation/invite/InviteActivity.kt index 2b40260b..04ea5a01 100644 --- a/app/src/main/java/com/sopt/umbba_android/presentation/invite/InviteActivity.kt +++ b/app/src/main/java/com/sopt/umbba_android/presentation/invite/InviteActivity.kt @@ -8,6 +8,8 @@ import com.sopt.umbba_android.databinding.ActivityInviteBinding import com.sopt.umbba_android.domain.entity.User import com.sopt.umbba_android.presentation.onboarding.CommunicationActivity import com.sopt.umbba_android.util.binding.BindingActivity +import com.sopt.umbba_android.util.setOnSingleClickListener +import timber.log.Timber class InviteActivity : BindingActivity(R.layout.activity_invite) { @@ -19,10 +21,8 @@ class InviteActivity : BindingActivity(R.layout.activity_ } private fun goCommunicationActivity() { - // 초대하는 측 - binding.btnStart.setOnClickListener { + binding.btnStart.setOnSingleClickListener { val userData = User(isReceiver = false) - Log.e("yeonjin", "invite parcelable : ${userData.isReceiver}") startActivity(Intent(this, CommunicationActivity::class.java).apply { putExtra("userData", userData) }) @@ -30,10 +30,8 @@ class InviteActivity : BindingActivity(R.layout.activity_ } private fun goInviteCodeActivity() { - // 초대받는 측 - binding.btnInputCode.setOnClickListener { + binding.btnInputCode.setOnSingleClickListener { val userData = User(isReceiver = true) - Log.e("yeonjin", "invite parcelable : ${userData.isReceiver}") startActivity(Intent(this, InviteCodeActivity::class.java).apply { putExtra("userData", userData) }) diff --git a/app/src/main/java/com/sopt/umbba_android/presentation/invite/InviteCodeActivity.kt b/app/src/main/java/com/sopt/umbba_android/presentation/invite/InviteCodeActivity.kt index 0aea1231..74ba27c4 100644 --- a/app/src/main/java/com/sopt/umbba_android/presentation/invite/InviteCodeActivity.kt +++ b/app/src/main/java/com/sopt/umbba_android/presentation/invite/InviteCodeActivity.kt @@ -18,6 +18,7 @@ import com.sopt.umbba_android.presentation.login.LoginActivity.Companion.DID_USE import com.sopt.umbba_android.presentation.onboarding.CommunicationActivity import com.sopt.umbba_android.util.ViewModelFactory import com.sopt.umbba_android.util.binding.BindingActivity +import com.sopt.umbba_android.util.setOnSingleClickListener import java.util.regex.Pattern class InviteCodeActivity : @@ -72,17 +73,15 @@ class InviteCodeActivity : } private fun setFamilyToInviteCode() { - binding.btnNext.setOnClickListener { + binding.btnNext.setOnSingleClickListener { val code = binding.etCode.text.toString() - Log.e("yeonjin", "초대코드 입력 : $code") viewModel.setFamily(code) viewModel.isCodeSuccess.observe(this) { if (it) { - Log.e("yeonjin", "관계 연결 성공") setInviteCodeBoolean(DID_USER_CLEAR_INVITE_CODE, true) goCommunicationActivity() } else { - Snackbar.make(binding.root, "유효하지 않은 초대코드 입니다.", Snackbar.LENGTH_SHORT).show() + Snackbar.make(binding.root, R.string.invalid_invite_code, Snackbar.LENGTH_SHORT).show() } } } @@ -94,7 +93,6 @@ class InviteCodeActivity : } else { intent.getParcelableExtra("userData") } - Log.e("yeonjin", "inviteCode parcelable : ${userData?.isReceiver}") startActivity(Intent(this, CommunicationActivity::class.java).apply { putExtra("userData", userData) }) diff --git a/app/src/main/java/com/sopt/umbba_android/presentation/invite/viewmodel/InviteCodeViewModel.kt b/app/src/main/java/com/sopt/umbba_android/presentation/invite/viewmodel/InviteCodeViewModel.kt index 3f67ddc0..f36edfc9 100644 --- a/app/src/main/java/com/sopt/umbba_android/presentation/invite/viewmodel/InviteCodeViewModel.kt +++ b/app/src/main/java/com/sopt/umbba_android/presentation/invite/viewmodel/InviteCodeViewModel.kt @@ -1,19 +1,16 @@ package com.sopt.umbba_android.presentation.invite.viewmodel -import android.util.Log import androidx.lifecycle.LiveData import androidx.lifecycle.MutableLiveData import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope import com.sopt.umbba_android.data.model.request.InviteCodeRequestDto -import com.sopt.umbba_android.data.model.response.LoginResponseDto -import com.sopt.umbba_android.data.repository.LoginRepositoryImpl import com.sopt.umbba_android.data.repository.OnboardingRepositoryImpl import kotlinx.coroutines.launch +import timber.log.Timber class InviteCodeViewModel(private val onboardingRepositoryImpl: OnboardingRepositoryImpl) : ViewModel() { val code = MutableLiveData() - val isCodeValidate = MutableLiveData() private val _isCodeSuccess: MutableLiveData = MutableLiveData() @@ -29,10 +26,10 @@ class InviteCodeViewModel(private val onboardingRepositoryImpl: OnboardingReposi onboardingRepositoryImpl.setFamily( InviteCodeRequestDto(inviteCode) ).onSuccess { - Log.e("yeonjin", "Set Family 성공") + Timber.d("Set Family 성공") _isCodeSuccess.value = true }.onFailure { error -> - Log.e("yeonjin", "Set Family 실패 " + error.message + error) + Timber.e("Set Family 실패 $error") _isCodeSuccess.value = false } } diff --git a/app/src/main/java/com/sopt/umbba_android/presentation/list/ListFragment.kt b/app/src/main/java/com/sopt/umbba_android/presentation/list/ListFragment.kt index 8eab0b03..fe0b1005 100644 --- a/app/src/main/java/com/sopt/umbba_android/presentation/list/ListFragment.kt +++ b/app/src/main/java/com/sopt/umbba_android/presentation/list/ListFragment.kt @@ -11,6 +11,7 @@ import com.sopt.umbba_android.presentation.list.viewmodel.ListViewModel import com.sopt.umbba_android.presentation.qna.QuestionAnswerActivity import com.sopt.umbba_android.util.ViewModelFactory import com.sopt.umbba_android.util.binding.BindingFragment +import com.sopt.umbba_android.util.setOnSingleClickListener class ListFragment : BindingFragment(R.layout.fragment_list) { private val viewModel: ListViewModel by viewModels { ViewModelFactory(requireActivity()) } @@ -40,27 +41,27 @@ class ListFragment : BindingFragment(R.layout.fragment_list private fun setChipClickEvent() { with(binding) { - chip1.setOnClickListener { + chip1.setOnSingleClickListener { viewModel.getListData(1) tvSection.text = chip1.text ivImage.load(R.drawable.bg_list_img1) } - chip2.setOnClickListener { + chip2.setOnSingleClickListener { viewModel.getListData(2) tvSection.text = chip2.text ivImage.load(R.drawable.bg_list_img2) } - chip3.setOnClickListener { + chip3.setOnSingleClickListener { viewModel.getListData(3) tvSection.text = chip3.text ivImage.load(R.drawable.bg_list_img3) } - chip4.setOnClickListener { + chip4.setOnSingleClickListener { viewModel.getListData(4) tvSection.text = chip4.text ivImage.load(R.drawable.bg_list_img4) } - chip5.setOnClickListener { + chip5.setOnSingleClickListener { viewModel.getListData(5) tvSection.text = chip5.text ivImage.load(R.drawable.bg_list_img5) diff --git a/app/src/main/java/com/sopt/umbba_android/presentation/list/ListQuestionAdapter.kt b/app/src/main/java/com/sopt/umbba_android/presentation/list/ListQuestionAdapter.kt index 61078fbb..64fc1eb6 100644 --- a/app/src/main/java/com/sopt/umbba_android/presentation/list/ListQuestionAdapter.kt +++ b/app/src/main/java/com/sopt/umbba_android/presentation/list/ListQuestionAdapter.kt @@ -1,14 +1,13 @@ package com.sopt.umbba_android.presentation.list -import android.util.Log import android.view.LayoutInflater import android.view.ViewGroup import androidx.recyclerview.widget.DiffUtil import androidx.recyclerview.widget.ListAdapter import androidx.recyclerview.widget.RecyclerView -import com.sopt.umbba_android.data.model.response.ExampleResponseDto import com.sopt.umbba_android.data.model.response.ListResponseDto import com.sopt.umbba_android.databinding.ItemQuestionListBinding +import com.sopt.umbba_android.util.setOnSingleClickListener import timber.log.Timber class ListQuestionAdapter(private val itemClick: (ListResponseDto.ListData) -> (Unit)) : @@ -32,9 +31,9 @@ class ListQuestionAdapter(private val itemClick: (ListResponseDto.ListData) -> ( with(binding) { tvIndex.text = data.index.toString() tvTopic.text = data.topic - root.setOnClickListener { + root.setOnSingleClickListener { itemClick(data) - Timber.e("아이템 클릭 이벤트 발생") + Timber.d("아이템 클릭 이벤트 발생") } } } diff --git a/app/src/main/java/com/sopt/umbba_android/presentation/list/viewmodel/ListViewModel.kt b/app/src/main/java/com/sopt/umbba_android/presentation/list/viewmodel/ListViewModel.kt index 11632c3b..d7bd655b 100644 --- a/app/src/main/java/com/sopt/umbba_android/presentation/list/viewmodel/ListViewModel.kt +++ b/app/src/main/java/com/sopt/umbba_android/presentation/list/viewmodel/ListViewModel.kt @@ -22,8 +22,9 @@ class ListViewModel(private val listRepositoryImpl: ListRepositoryImpl) : ViewMo viewModelScope.launch { listRepositoryImpl.getListData(sectionId).onSuccess { response -> _listResponse.value = response.data + Timber.d("getList 성공") }.onFailure { error -> - Timber.e("getList 실패 " + error.message) + Timber.e("getList 실패 $error") } } } diff --git a/app/src/main/java/com/sopt/umbba_android/presentation/login/AgreePrivacyUseActivity.kt b/app/src/main/java/com/sopt/umbba_android/presentation/login/AgreePrivacyUseActivity.kt index 2bc71b70..62033497 100644 --- a/app/src/main/java/com/sopt/umbba_android/presentation/login/AgreePrivacyUseActivity.kt +++ b/app/src/main/java/com/sopt/umbba_android/presentation/login/AgreePrivacyUseActivity.kt @@ -13,6 +13,7 @@ import com.sopt.umbba_android.R import com.sopt.umbba_android.databinding.ActivityAgreePrivacyUseBinding import com.sopt.umbba_android.presentation.invite.InviteActivity import com.sopt.umbba_android.util.binding.BindingActivity +import com.sopt.umbba_android.util.setOnSingleClickListener import java.util.regex.Pattern class AgreePrivacyUseActivity : BindingActivity(R.layout.activity_agree_privacy_use) { @@ -29,7 +30,7 @@ class AgreePrivacyUseActivity : BindingActivity( private fun clickAllAgreeButton() { with(binding) { - btnAllAgreeCheck.setOnClickListener { + btnAllAgreeCheck.setOnSingleClickListener { btnAllAgreeCheck.isSelected = !btnAllAgreeCheck.isSelected checkAllAgreeButton() } @@ -54,15 +55,15 @@ class AgreePrivacyUseActivity : BindingActivity( private fun clickCircleButton() { with(binding) { - btnUp14.setOnClickListener { + btnUp14.setOnSingleClickListener { btnUp14.isSelected = !btnUp14.isSelected checkAllCircleButton() } - btnAgreeTermsAndCondition.setOnClickListener { + btnAgreeTermsAndCondition.setOnSingleClickListener { btnAgreeTermsAndCondition.isSelected = !btnAgreeTermsAndCondition.isSelected checkAllCircleButton() } - btnAgreePrivacy.setOnClickListener { + btnAgreePrivacy.setOnSingleClickListener { btnAgreePrivacy.isSelected = !btnAgreePrivacy.isSelected checkAllCircleButton() } @@ -83,7 +84,7 @@ class AgreePrivacyUseActivity : BindingActivity( private fun setHyperLinkAndColorInTermsTextView() { with(binding) { - setHyperLinkToTextView("서비스 이용약관", tvAgreeTermsAndCondition, "https://www.notion.so/f1a14bf60ed4421f9b3761ef88906adb?pvs=4") + setHyperLinkToTextView(getString(R.string.terms_and_condition), tvAgreeTermsAndCondition, "https://harsh-step-7dd.notion.site/f1a14bf60ed4421f9b3761ef88906adb") setLinkTextColorToBlack(tvAgreeTermsAndCondition) setLinkBold(tvAgreeTermsAndCondition, 13) } @@ -91,7 +92,7 @@ class AgreePrivacyUseActivity : BindingActivity( private fun setHyperLinkAndColorInPrivacyTextView() { with(binding) { - setHyperLinkToTextView("개인정보 수집 및 이용", tvAgreePrivacy, "https://www.notion.so/99fe0f58825d4f87bd3b987fadc623b6?pvs=4") + setHyperLinkToTextView(getString(R.string.privacy), tvAgreePrivacy, "https://harsh-step-7dd.notion.site/99fe0f58825d4f87bd3b987fadc623b6?pvs=4") setLinkTextColorToBlack(tvAgreePrivacy) setLinkBold(tvAgreePrivacy, 17) } @@ -115,7 +116,7 @@ class AgreePrivacyUseActivity : BindingActivity( } private fun goInviteActivity() { - binding.btnNext.setOnClickListener { + binding.btnNext.setOnSingleClickListener { startActivity(Intent(this, InviteActivity::class.java)) } } diff --git a/app/src/main/java/com/sopt/umbba_android/presentation/login/LoginActivity.kt b/app/src/main/java/com/sopt/umbba_android/presentation/login/LoginActivity.kt index 5403a477..2fab2160 100644 --- a/app/src/main/java/com/sopt/umbba_android/presentation/login/LoginActivity.kt +++ b/app/src/main/java/com/sopt/umbba_android/presentation/login/LoginActivity.kt @@ -18,6 +18,8 @@ import com.sopt.umbba_android.presentation.login.viewmodel.LoginViewModel import com.sopt.umbba_android.presentation.onboarding.InputInfoActivity import com.sopt.umbba_android.util.ViewModelFactory import com.sopt.umbba_android.util.binding.BindingActivity +import com.sopt.umbba_android.util.setOnSingleClickListener +import timber.log.Timber class LoginActivity : BindingActivity(R.layout.activity_login) { @@ -35,36 +37,31 @@ class LoginActivity : BindingActivity(R.layout.activity_lo private fun loginWithKaKao() { val callback: (OAuthToken?, Throwable?) -> Unit = { token, error -> if (error != null) { - Log.e("yeonjin", "카카오계정으로 로그인 실패", error) + Timber.e(error, "카카오계정으로 로그인 실패") } else if (token != null) { - Log.e("yeonjin", "카카오계정으로 로그인 성공 ${token.accessToken}") + Timber.d("카카오계정으로 로그인 성공 " + token.accessToken) FirebaseMessaging.getInstance().token.addOnSuccessListener { fcmToken -> - Log.e("yeonjin", "FCM 토큰 : $fcmToken") SharedPreferences.apply { setKakaoString(USER_KAKAO_TOKEN, token.accessToken) - Log.e("yeonjin", "카카오계정 토큰 저장 : ${getKakaoString(USER_KAKAO_TOKEN)}") } viewModel.login(fcmToken = fcmToken) } } } - binding.btnKakaoLogin.setOnClickListener { + binding.btnKakaoLogin.setOnSingleClickListener { if (UserApiClient.instance.isKakaoTalkLoginAvailable(this)) { UserApiClient.instance.loginWithKakaoTalk(this) { token, error -> if (error != null) { - Log.e("yeonjin", "카카오톡으로 로그인 실패", error) + Timber.e(error, "카카오톡으로 로그인 실패") - // 사용자가 카카오톡 설치 후 디바이스 권한 요청 화면에서 로그인을 취소한 경우, - // 의도적인 로그인 취소로 보고 카카오계정으로 로그인 시도 없이 로그인 취소로 처리 (예: 뒤로 가기) if (error is ClientError && error.reason == ClientErrorCause.Cancelled) { return@loginWithKakaoTalk } - // 카카오톡에 연결된 카카오계정이 없는 경우, 카카오계정으로 로그인 시도 UserApiClient.instance.loginWithKakaoAccount(this, callback = callback) } else if (token != null) { - Log.e("yeonjin", "카카오톡으로 로그인 성공 ${token.accessToken}") + Timber.d("카카오톡으로 로그인 성공 " + token.accessToken) callback.invoke(token, error) } } @@ -74,11 +71,9 @@ class LoginActivity : BindingActivity(R.layout.activity_lo } } - // 유저 정보, 토큰 세팅 private fun setUserInfo(accessToken: String) { SharedPreferences.apply { setString(USER_TOKEN, accessToken) - Log.e("yeonjin", "서버 토큰 저장 완료 : $accessToken") UserApiClient.instance.me { user, error -> if (error == null && user != null) { setString(USER_NICKNAME, user.kakaoAccount?.profile?.nickname) @@ -88,15 +83,10 @@ class LoginActivity : BindingActivity(R.layout.activity_lo } } - // 자동로그인 private fun setAutoLogin() { - //액세스 토큰이 저장되어 있다면 - Log.e("yeonjin", "setAutoLogin") - Log.e("yeonjin", "sharedPreference : ${SharedPreferences.getString(USER_TOKEN)}") if (!SharedPreferences.getString(USER_TOKEN).isNullOrBlank()) { showOnboardForFirst() } else { - Log.e("yeonjin", "viewmodel gettokenresult") viewModel.getTokenResult.observe(this) { response -> setUserInfo(response.accessToken) if (SharedPreferences.getOnboardingBoolean(DID_USER_CLEAR_ONBOARD) @@ -111,16 +101,13 @@ class LoginActivity : BindingActivity(R.layout.activity_lo } private fun showOnboardForFirst() { - //온보딩을 한번이라도 하지 않았다면 - Log.e("yeonjin", "showOnboardForFirst") if (!SharedPreferences.getOnboardingBoolean(DID_USER_CLEAR_ONBOARD)) { - if (SharedPreferences.getInviteCodeBoolean(DID_USER_CLEAR_INVITE_CODE)) { //초대코드 연결 했다면 + if (SharedPreferences.getInviteCodeBoolean(DID_USER_CLEAR_INVITE_CODE)) { goInputInfoActivity() - } else { //초대코드도 연결 안했다면 + } else { goAgreePrivacyUseActivity() } } else { - //온보딩을 했다면 goMainActivity() } } diff --git a/app/src/main/java/com/sopt/umbba_android/presentation/login/viewmodel/LoginViewModel.kt b/app/src/main/java/com/sopt/umbba_android/presentation/login/viewmodel/LoginViewModel.kt index 5c8ed100..9155cece 100644 --- a/app/src/main/java/com/sopt/umbba_android/presentation/login/viewmodel/LoginViewModel.kt +++ b/app/src/main/java/com/sopt/umbba_android/presentation/login/viewmodel/LoginViewModel.kt @@ -10,6 +10,7 @@ import com.sopt.umbba_android.data.model.request.LoginRequestDto import com.sopt.umbba_android.data.model.response.LoginResponseDto import com.sopt.umbba_android.data.repository.LoginRepositoryImpl import kotlinx.coroutines.launch +import timber.log.Timber class LoginViewModel(private val loginRepositoryImpl: LoginRepositoryImpl) : ViewModel() { @@ -19,17 +20,16 @@ class LoginViewModel(private val loginRepositoryImpl: LoginRepositoryImpl) : Vie fun login(fcmToken: String) { viewModelScope.launch { - Log.e("yeonjin", "서버 연결 : fcmToken.$fcmToken") loginRepositoryImpl.postLogin( LoginRequestDto( "KAKAO", fcmToken ) ).onSuccess { response -> - Log.e("yeonjin", "login 성공") + Timber.d("login 성공") _getTokenResult.value = response.data.tokenDto }.onFailure { error -> - Log.e("yeonjin", "login 실패 " + error.message) + Timber.e("login 실패 $error") } } } diff --git a/app/src/main/java/com/sopt/umbba_android/presentation/onboarding/CommunicationActivity.kt b/app/src/main/java/com/sopt/umbba_android/presentation/onboarding/CommunicationActivity.kt index 917371c3..083dd518 100644 --- a/app/src/main/java/com/sopt/umbba_android/presentation/onboarding/CommunicationActivity.kt +++ b/app/src/main/java/com/sopt/umbba_android/presentation/onboarding/CommunicationActivity.kt @@ -8,6 +8,7 @@ import com.sopt.umbba_android.R import com.sopt.umbba_android.databinding.ActivityCommunicationBinding import com.sopt.umbba_android.domain.entity.User import com.sopt.umbba_android.util.binding.BindingActivity +import com.sopt.umbba_android.util.setOnSingleClickListener class CommunicationActivity : BindingActivity(R.layout.activity_communication) { override fun onCreate(savedInstanceState: Bundle?) { @@ -17,13 +18,12 @@ class CommunicationActivity : BindingActivity(R.la } private fun goInputInfoActivity() { - binding.btnStart.setOnClickListener { + binding.btnStart.setOnSingleClickListener { val userData = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) { intent.getParcelableExtra("userData", User::class.java) } else { intent.getParcelableExtra("userData") } - Log.e("yeonjin", "communication parcelable : ${userData?.isReceiver}") startActivity(Intent(this, InputInfoActivity::class.java).apply { putExtra("userData", userData) }) diff --git a/app/src/main/java/com/sopt/umbba_android/presentation/onboarding/InputInfoActivity.kt b/app/src/main/java/com/sopt/umbba_android/presentation/onboarding/InputInfoActivity.kt index 63b179c6..74e7d66c 100644 --- a/app/src/main/java/com/sopt/umbba_android/presentation/onboarding/InputInfoActivity.kt +++ b/app/src/main/java/com/sopt/umbba_android/presentation/onboarding/InputInfoActivity.kt @@ -14,6 +14,7 @@ import com.sopt.umbba_android.domain.entity.User import com.sopt.umbba_android.presentation.onboarding.quest.QuestActivity import com.sopt.umbba_android.presentation.onboarding.viewmodel.InputInfoViewModel import com.sopt.umbba_android.util.binding.BindingActivity +import com.sopt.umbba_android.util.setOnSingleClickListener import java.util.regex.Pattern class InputInfoActivity : BindingActivity(R.layout.activity_input_info), @@ -115,7 +116,7 @@ class InputInfoActivity : BindingActivity(R.layout.act } private fun goSelectFamilyActivity() { - binding.btnNext.setOnClickListener { + binding.btnNext.setOnSingleClickListener { val userData = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) { intent.getParcelableExtra("userData", User::class.java) } else { @@ -123,19 +124,11 @@ class InputInfoActivity : BindingActivity(R.layout.act } if (userData != null) { saveInfo(userData) - if (!userData.isReceiver) { //초대하는 사람 - Log.e( - "yeonjin", - "inputInfo parcelable : ${userData?.isReceiver} + ${userData?.name} + ${userData?.gender} + ${userData?.bornYear}" - ) + if (!userData.isReceiver) { startActivity(Intent(this, SelectFamilyActivity::class.java).apply { putExtra("userData", userData) }) - } else { //초대받는 사람 - Log.e( - "yeonjin", - "inputInfo parcelable : ${userData?.isReceiver} + ${userData?.name} + ${userData?.gender} + ${userData?.bornYear}" - ) + } else { startActivity(Intent(this, QuestActivity::class.java).apply { putExtra("userData", userData) }) diff --git a/app/src/main/java/com/sopt/umbba_android/presentation/onboarding/NotifyTimeActivity.kt b/app/src/main/java/com/sopt/umbba_android/presentation/onboarding/NotifyTimeActivity.kt index 4df7db60..c831207e 100644 --- a/app/src/main/java/com/sopt/umbba_android/presentation/onboarding/NotifyTimeActivity.kt +++ b/app/src/main/java/com/sopt/umbba_android/presentation/onboarding/NotifyTimeActivity.kt @@ -10,15 +10,12 @@ import android.provider.Settings import android.util.Log import android.view.View import androidx.activity.result.contract.ActivityResultContracts -import androidx.activity.viewModels import androidx.core.content.ContextCompat import com.google.android.material.snackbar.Snackbar import com.sopt.umbba_android.R import com.sopt.umbba_android.databinding.ActivityNotifyTimeBinding -import com.sopt.umbba_android.domain.entity.User -import com.sopt.umbba_android.presentation.onboarding.quest.QuestViewModel -import com.sopt.umbba_android.util.ViewModelFactory import com.sopt.umbba_android.util.binding.BindingActivity +import com.sopt.umbba_android.util.setOnSingleClickListener class NotifyTimeActivity : BindingActivity(R.layout.activity_notify_time), @@ -26,11 +23,9 @@ class NotifyTimeActivity : private val requestPermissionLauncher = registerForActivityResult(ActivityResultContracts.RequestPermission()) { isGranted: Boolean -> if (isGranted) { - // 알림권한 허용 o - Snackbar.make(binding.root, "알림 권한이 허용되었습니다.", Snackbar.LENGTH_SHORT).show() + Snackbar.make(binding.root, R.string.allow_notification, Snackbar.LENGTH_SHORT).show() } else { - // 알림권한 허용 x - Snackbar.make(binding.root, "알림 권한이 없습니다.", Snackbar.LENGTH_SHORT).show() + Snackbar.make(binding.root, R.string.not_allow_notification, Snackbar.LENGTH_SHORT).show() } } @@ -56,27 +51,26 @@ class NotifyTimeActivity : val minute = time.substring(3, 5) var hourText = "" when (hour) { - 1, 2, 3, 4, 5 -> hourText = "새벽" - 6, 7, 8, 9, 10, 11 -> hourText = "아침" - 12, 13, 14, 15, 16, 17 -> hourText = "낮" - 18, 19, 20 -> hourText = "저녁" - 21, 22, 23, 24 -> hourText = "밤" + 1, 2, 3, 4, 5 -> hourText = getString(R.string.dawn) + 6, 7, 8, 9, 10, 11 -> hourText = getString(R.string.morning) + 12, 13, 14, 15, 16, 17 -> hourText = getString(R.string.day) + 18, 19, 20 -> hourText = getString(R.string.evening) + 21, 22, 23, 24 -> hourText = getString(R.string.night) } if (hour >= 13) { hour %= 12 } if (minute == "00") { - binding.tvTitle.text = "매일 ${hourText} ${hour}시에\n교신을 보내줄게" + binding.tvTitle.text = getString(R.string.everyday_notification, hourText, hour) } else { - binding.tvTitle.text = "매일 ${hourText} ${hour}시 반에\n교신을 보내줄게" + binding.tvTitle.text = getString(R.string.everyday_notification_half, hourText, hour) } } private fun askNotificationPermission() { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) { if (ContextCompat.checkSelfPermission(this, Manifest.permission.POST_NOTIFICATIONS) == PackageManager.PERMISSION_GRANTED) { - Snackbar.make(binding.root, "알림 권한이 허용되어 있습니다.", Snackbar.LENGTH_SHORT).show() + Snackbar.make(binding.root, R.string.allowing_notification, Snackbar.LENGTH_SHORT).show() } else if (shouldShowRequestPermissionRationale(Manifest.permission.POST_NOTIFICATIONS)) { - // 왜 알림을 허용해야 하는지에 대한 설명 + 권한 거절 시 권한 설정 화면으로 이동 - Snackbar.make(binding.root, "알림 권한을 설정하면 답변 작성 요청 알림을 받아볼 수 있습니다.", Snackbar.LENGTH_SHORT).show() + Snackbar.make(binding.root, R.string.if_allow_notification, Snackbar.LENGTH_SHORT).show() val intent = Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS).setData(Uri.parse("package:"+ this.packageName)) startActivity(intent) this.finish() @@ -88,7 +82,7 @@ class NotifyTimeActivity : private fun goOnboardingFinishActivity() { with(binding) { - btnGoPast.setOnClickListener { + btnGoPast.setOnSingleClickListener { startActivity(Intent(this@NotifyTimeActivity, OnboardingFinishActivity::class.java)) } } diff --git a/app/src/main/java/com/sopt/umbba_android/presentation/onboarding/OnboardingFinishActivity.kt b/app/src/main/java/com/sopt/umbba_android/presentation/onboarding/OnboardingFinishActivity.kt index 9998c4ea..b133ca2e 100644 --- a/app/src/main/java/com/sopt/umbba_android/presentation/onboarding/OnboardingFinishActivity.kt +++ b/app/src/main/java/com/sopt/umbba_android/presentation/onboarding/OnboardingFinishActivity.kt @@ -10,6 +10,7 @@ import com.sopt.umbba_android.R import com.sopt.umbba_android.databinding.ActivityOnboardingFinishBinding import com.sopt.umbba_android.presentation.MainActivity import com.sopt.umbba_android.util.binding.BindingActivity +import com.sopt.umbba_android.util.setOnSingleClickListener class OnboardingFinishActivity : BindingActivity(R.layout.activity_onboarding_finish) { @@ -22,10 +23,10 @@ class OnboardingFinishActivity : } private fun goBack() { - binding.btnBack1.setOnClickListener { + binding.btnBack1.setOnSingleClickListener { finish() } - binding.btnBack2.setOnClickListener { + binding.btnBack2.setOnSingleClickListener { finish() } } @@ -48,12 +49,12 @@ class OnboardingFinishActivity : } private fun goMainActivity() { - binding.btnStart.setOnClickListener { + binding.btnStart.setOnSingleClickListener { startActivity( Intent( this, MainActivity::class.java - ).addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP) + ).addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK or Intent.FLAG_ACTIVITY_NEW_TASK) ) } } diff --git a/app/src/main/java/com/sopt/umbba_android/presentation/onboarding/SelectFamilyActivity.kt b/app/src/main/java/com/sopt/umbba_android/presentation/onboarding/SelectFamilyActivity.kt index 8c6df4f9..69013a7a 100644 --- a/app/src/main/java/com/sopt/umbba_android/presentation/onboarding/SelectFamilyActivity.kt +++ b/app/src/main/java/com/sopt/umbba_android/presentation/onboarding/SelectFamilyActivity.kt @@ -12,6 +12,7 @@ import com.sopt.umbba_android.domain.entity.User import com.sopt.umbba_android.presentation.onboarding.quest.QuestActivity import com.sopt.umbba_android.presentation.onboarding.viewmodel.SelectFamilyViewModel import com.sopt.umbba_android.util.binding.BindingActivity +import com.sopt.umbba_android.util.setOnSingleClickListener class SelectFamilyActivity : BindingActivity(R.layout.activity_select_family), @@ -85,7 +86,7 @@ class SelectFamilyActivity : } private fun goQuestActivity() { - binding.btnNext.setOnClickListener { + binding.btnNext.setOnSingleClickListener { val userData = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) { intent.getParcelableExtra("userData", User::class.java) } else { @@ -94,7 +95,6 @@ class SelectFamilyActivity : if (userData != null) { saveInfo(userData) } - Log.e("yeonjin", "selectFamily parcelable : ${userData?.isReceiver} + ${userData?.isInvitorChild} + ${userData?.relationInfo}") startActivity(Intent(this, QuestActivity::class.java).apply { putExtra("userData", userData) }) diff --git a/app/src/main/java/com/sopt/umbba_android/presentation/onboarding/SetTimeActivity.kt b/app/src/main/java/com/sopt/umbba_android/presentation/onboarding/SetTimeActivity.kt index 86d71959..74254293 100644 --- a/app/src/main/java/com/sopt/umbba_android/presentation/onboarding/SetTimeActivity.kt +++ b/app/src/main/java/com/sopt/umbba_android/presentation/onboarding/SetTimeActivity.kt @@ -22,6 +22,7 @@ import com.sopt.umbba_android.presentation.login.LoginActivity.Companion.DID_USE import com.sopt.umbba_android.presentation.onboarding.viewmodel.SetTimeViewModel import com.sopt.umbba_android.util.ViewModelFactory import com.sopt.umbba_android.util.binding.BindingActivity +import com.sopt.umbba_android.util.setOnSingleClickListener import com.sopt.umbba_android.util.setTimeInterval class SetTimeActivity : BindingActivity(R.layout.activity_set_time), @@ -34,11 +35,9 @@ class SetTimeActivity : BindingActivity(R.layout.activit private val requestPermissionLauncher = registerForActivityResult(ActivityResultContracts.RequestPermission()) { isGranted: Boolean -> if (isGranted) { - // 알림권한 허용 o - Snackbar.make(binding.root, "알림 권한이 허용되었습니다.", Snackbar.LENGTH_SHORT).show() + Snackbar.make(binding.root, R.string.allow_notification, Snackbar.LENGTH_SHORT).show() } else { - // 알림권한 허용 x - Snackbar.make(binding.root, "알림 권한이 없습니다.", Snackbar.LENGTH_SHORT).show() + Snackbar.make(binding.root, R.string.not_allow_notification, Snackbar.LENGTH_SHORT).show() } } @@ -73,12 +72,11 @@ class SetTimeActivity : BindingActivity(R.layout.activit Manifest.permission.POST_NOTIFICATIONS ) == PackageManager.PERMISSION_GRANTED ) { - Snackbar.make(binding.root, "알림 권한이 허용되어 있습니다.", Snackbar.LENGTH_SHORT).show() + Snackbar.make(binding.root, R.string.allowing_notification, Snackbar.LENGTH_SHORT).show() } else if (shouldShowRequestPermissionRationale(Manifest.permission.POST_NOTIFICATIONS)) { - // 왜 알림을 허용해야 하는지에 대한 설명 + 권한 거절 시 권한 설정 화면으로 이동 Snackbar.make( binding.root, - "알림 권한을 설정하면 답변 작성 요청 알림을 받아볼 수 있습니다.", + R.string.if_allow_notification, Snackbar.LENGTH_SHORT ).show() val intent = @@ -95,7 +93,7 @@ class SetTimeActivity : BindingActivity(R.layout.activit val hour = if (binding.tpTime.hour == 0) { "24" - } else if (binding.tpTime.hour >= 1 || binding.tpTime.hour <= 9){ + } else if (binding.tpTime.hour in 1..9){ "0${binding.tpTime.hour}" } else { binding.tpTime.hour @@ -116,16 +114,14 @@ class SetTimeActivity : BindingActivity(R.layout.activit } private fun goOnboardingFinishActivity() { - binding.btnNext.setOnClickListener { + binding.btnNext.setOnSingleClickListener { askNotificationPermission() val userData = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) { intent.getParcelableExtra("userData", User::class.java) } else { intent.getParcelableExtra("userData") } - Log.e("yeonjin", "setTime parcelables : $userData") setTime() - Log.e("yeonjin", "설정 시간 : $time") val questData = intent.getStringArrayExtra("questData") setQuestList(questData) viewModel.setSendInfo(userData, time, questList) @@ -135,7 +131,7 @@ class SetTimeActivity : BindingActivity(R.layout.activit setOnboardingBoolean(DID_USER_CLEAR_INVITE_CODE, true) startActivity(Intent(this, OnboardingFinishActivity::class.java)) } else { - Snackbar.make(binding.root, "정보 등록에 실패했습니다.", Snackbar.LENGTH_SHORT).show() + Snackbar.make(binding.root, R.string.fail_information_post, Snackbar.LENGTH_SHORT).show() } } } diff --git a/app/src/main/java/com/sopt/umbba_android/presentation/onboarding/quest/QuestActivity.kt b/app/src/main/java/com/sopt/umbba_android/presentation/onboarding/quest/QuestActivity.kt index 434643db..81f90b23 100644 --- a/app/src/main/java/com/sopt/umbba_android/presentation/onboarding/quest/QuestActivity.kt +++ b/app/src/main/java/com/sopt/umbba_android/presentation/onboarding/quest/QuestActivity.kt @@ -10,12 +10,18 @@ import com.sopt.umbba_android.R import androidx.fragment.app.Fragment import androidx.fragment.app.FragmentManager import androidx.fragment.app.commit +import com.sopt.umbba_android.data.local.SharedPreferences +import com.sopt.umbba_android.data.local.SharedPreferences.setOnboardingBoolean import com.sopt.umbba_android.databinding.ActivityQuestBinding import com.sopt.umbba_android.domain.entity.User +import com.sopt.umbba_android.presentation.login.LoginActivity +import com.sopt.umbba_android.presentation.login.LoginActivity.Companion.DID_USER_CLEAR_INVITE_CODE +import com.sopt.umbba_android.presentation.login.LoginActivity.Companion.DID_USER_CLEAR_ONBOARD import com.sopt.umbba_android.presentation.onboarding.NotifyTimeActivity import com.sopt.umbba_android.presentation.onboarding.SetTimeActivity import com.sopt.umbba_android.util.ViewModelFactory import com.sopt.umbba_android.util.binding.BindingActivity +import com.sopt.umbba_android.util.setOnSingleClickListener class QuestActivity : BindingActivity(R.layout.activity_quest), View.OnClickListener { @@ -56,11 +62,10 @@ class QuestActivity : BindingActivity(R.layout.activity_qu private fun setBeforeButtonClick(count: Int) { when (quest[count].toString()) { - "응" -> viewModel.isClickedYes.value = true - "아니" -> viewModel.isClickedNo.value = true - "애매해" -> viewModel.isClickedAmbiguous.value = true + getString(R.string.yes) -> viewModel.isClickedYes.value = true + getString(R.string.no) -> viewModel.isClickedNo.value = true + getString(R.string.ambiguous) -> viewModel.isClickedAmbiguous.value = true } - Log.d("viewmodel", "pop stack : ${count}번 : ${quest[count].toString()}") } private fun initFragment(fragment: Fragment) { @@ -84,11 +89,8 @@ class QuestActivity : BindingActivity(R.layout.activity_qu } private fun clickNextButton() { - binding.btnNext.setOnClickListener { - Log.d("viewmodel", "chipText : ${viewModel.clickedChipText.value.toString()}") - Log.d("viewmodel", "count : ${count}") + binding.btnNext.setOnSingleClickListener { quest[count] = viewModel.clickedChipText.value.toString() - Log.d("viewmodel", "배열 값 : ${quest[count]}") initChip() count += 1 when (count) { @@ -121,26 +123,24 @@ class QuestActivity : BindingActivity(R.layout.activity_qu } private fun goNextActivity() { - Log.e("yeonjin", "${quest[0]}${quest[1]}${quest[2]}${quest[3]}${quest[4]}") val userData = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) { intent.getParcelableExtra("userData", User::class.java) } else { intent.getParcelableExtra("userData") } if (userData != null && !userData.isReceiver) { - Log.e("yeonjin", "quest parcelable : ${userData?.isReceiver}") startActivity(Intent(this, SetTimeActivity::class.java).apply { putExtra("questData", quest) putExtra("userData", userData) }) } else { - Log.e("yeonjin", "quest parcelable : ${userData?.isReceiver}") setQuestList(quest) viewModel.setReceiveInfo(userData, questList) viewModel.isPostSuccess.observe(this) { if (it) { val time = viewModel.notifyTime.value - Log.e("yeonjin", "server 연결 : $time") + setOnboardingBoolean(DID_USER_CLEAR_ONBOARD, true) + setOnboardingBoolean(DID_USER_CLEAR_INVITE_CODE, true) startActivity(Intent(this, NotifyTimeActivity::class.java).apply { putExtra("time", time) }) diff --git a/app/src/main/java/com/sopt/umbba_android/presentation/onboarding/quest/QuestViewModel.kt b/app/src/main/java/com/sopt/umbba_android/presentation/onboarding/quest/QuestViewModel.kt index ad3b94ae..3ffda6f8 100644 --- a/app/src/main/java/com/sopt/umbba_android/presentation/onboarding/quest/QuestViewModel.kt +++ b/app/src/main/java/com/sopt/umbba_android/presentation/onboarding/quest/QuestViewModel.kt @@ -9,22 +9,20 @@ import com.sopt.umbba_android.data.model.request.ReceiveInfoRequestDto import com.sopt.umbba_android.data.repository.OnboardingRepositoryImpl import com.sopt.umbba_android.domain.entity.User import kotlinx.coroutines.launch +import timber.log.Timber class QuestViewModel(private val onboardingRepositoryImpl: OnboardingRepositoryImpl) : ViewModel() { val isClickedYes = MutableLiveData() val isClickedNo = MutableLiveData() val isClickedAmbiguous = MutableLiveData() - val isClickedComplete = MutableLiveData() - val clickedChipText = MutableLiveData() + val notifyTime = MutableLiveData() private val _isPostSuccess: MutableLiveData = MutableLiveData() val isPostSuccess: LiveData get() = _isPostSuccess - val notifyTime = MutableLiveData() - fun checkButtonComplete() { isClickedComplete.value = isClickedYes.value == true || isClickedNo.value == true || isClickedAmbiguous.value == true } @@ -37,13 +35,12 @@ class QuestViewModel(private val onboardingRepositoryImpl: OnboardingRepositoryI onboardingAnswerList = quest ) ).onSuccess { - Log.e("yeonjin", "setReceiveInfo 성공") - Log.e("yeonjin", "setReceiveInfo time : ${it.data.pushTime}") notifyTime.value = it.data.pushTime _isPostSuccess.value = true + Timber.d("setReceiveInfo 성공") }.onFailure { - Log.e("yeonjin", "setReceiveInfo 실패") _isPostSuccess.value = false + Timber.e("setReceiveInfo 실패") } } } diff --git a/app/src/main/java/com/sopt/umbba_android/presentation/onboarding/viewmodel/SetTimeViewModel.kt b/app/src/main/java/com/sopt/umbba_android/presentation/onboarding/viewmodel/SetTimeViewModel.kt index 8e80d219..ff26dda0 100644 --- a/app/src/main/java/com/sopt/umbba_android/presentation/onboarding/viewmodel/SetTimeViewModel.kt +++ b/app/src/main/java/com/sopt/umbba_android/presentation/onboarding/viewmodel/SetTimeViewModel.kt @@ -9,6 +9,7 @@ import com.sopt.umbba_android.data.model.request.SendInfoRequestDto import com.sopt.umbba_android.data.repository.OnboardingRepositoryImpl import com.sopt.umbba_android.domain.entity.User import kotlinx.coroutines.launch +import timber.log.Timber class SetTimeViewModel(private val onboardingRepositoryImpl: OnboardingRepositoryImpl): ViewModel() { @@ -27,12 +28,12 @@ class SetTimeViewModel(private val onboardingRepositoryImpl: OnboardingRepositor onboardingAnswerList = quest ) ).onSuccess { - Log.e("yeonjin", "setSendInfo 성공") _isPostSuccess.value = true + Timber.d("setSendInfo 성공") }.onFailure { error -> - Log.e("yeonjin", "setSendInfo 실패 " + error.message + error) _isPostSuccess.value = false + Timber.e("setSendInfo 실패 $error") } } } diff --git a/app/src/main/java/com/sopt/umbba_android/presentation/qna/AnswerActivity.kt b/app/src/main/java/com/sopt/umbba_android/presentation/qna/AnswerActivity.kt index 4c883836..105e8415 100644 --- a/app/src/main/java/com/sopt/umbba_android/presentation/qna/AnswerActivity.kt +++ b/app/src/main/java/com/sopt/umbba_android/presentation/qna/AnswerActivity.kt @@ -1,7 +1,6 @@ package com.sopt.umbba_android.presentation.qna import android.os.Bundle -import android.util.Log import android.view.View import androidx.activity.viewModels import com.sopt.umbba_android.R diff --git a/app/src/main/java/com/sopt/umbba_android/presentation/qna/BackAnswerDialogFragment.kt b/app/src/main/java/com/sopt/umbba_android/presentation/qna/BackAnswerDialogFragment.kt index aedebd30..7bd01d1e 100644 --- a/app/src/main/java/com/sopt/umbba_android/presentation/qna/BackAnswerDialogFragment.kt +++ b/app/src/main/java/com/sopt/umbba_android/presentation/qna/BackAnswerDialogFragment.kt @@ -9,7 +9,7 @@ import android.view.ViewGroup import android.view.WindowManager import androidx.fragment.app.DialogFragment import com.sopt.umbba_android.databinding.FragmentBackAnswerDialogBinding -import com.sopt.umbba_android.databinding.FragmentConfirmAnswerDialogBinding +import com.sopt.umbba_android.util.setOnSingleClickListener class BackAnswerDialogFragment : DialogFragment() { @@ -40,10 +40,10 @@ class BackAnswerDialogFragment : DialogFragment() { private fun setBtnClickEvent() { with(binding) { - btnCancel.setOnClickListener { + btnCancel.setOnSingleClickListener { dismiss() } - btnConfirm.setOnClickListener { + btnConfirm.setOnSingleClickListener { dismiss() requireActivity().finish() } diff --git a/app/src/main/java/com/sopt/umbba_android/presentation/qna/ConfirmAnswerDialogFragment.kt b/app/src/main/java/com/sopt/umbba_android/presentation/qna/ConfirmAnswerDialogFragment.kt index 52d63c41..96c0682b 100644 --- a/app/src/main/java/com/sopt/umbba_android/presentation/qna/ConfirmAnswerDialogFragment.kt +++ b/app/src/main/java/com/sopt/umbba_android/presentation/qna/ConfirmAnswerDialogFragment.kt @@ -3,20 +3,20 @@ package com.sopt.umbba_android.presentation.qna import android.graphics.Color import android.graphics.drawable.ColorDrawable import android.os.Bundle -import android.util.Log import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import android.view.WindowManager import android.widget.Toast -import androidx.core.os.bundleOf import androidx.fragment.app.DialogFragment import androidx.fragment.app.viewModels import com.google.android.material.snackbar.Snackbar +import com.sopt.umbba_android.R import com.sopt.umbba_android.data.model.request.AnswerRequestDto import com.sopt.umbba_android.databinding.FragmentConfirmAnswerDialogBinding import com.sopt.umbba_android.presentation.qna.viewmodel.ConfirmAnswerDialogFragmentViewModel import com.sopt.umbba_android.util.ViewModelFactory +import com.sopt.umbba_android.util.setOnSingleClickListener class ConfirmAnswerDialogFragment : DialogFragment() { @@ -60,11 +60,11 @@ class ConfirmAnswerDialogFragment : DialogFragment() { private fun setBtnClickEvent() { with(binding) { - btnBack.setOnClickListener { + btnBack.setOnSingleClickListener { dismiss() } - btnConfirm.setOnClickListener { - Snackbar.make(binding.root, "답변이 전송되었습니다.", Toast.LENGTH_SHORT).show() + btnConfirm.setOnSingleClickListener { + Snackbar.make(binding.root, R.string.post_answer, Toast.LENGTH_SHORT).show() viewModel.postAnswer(AnswerRequestDto(arguments?.getString("answer"))) } } diff --git a/app/src/main/java/com/sopt/umbba_android/presentation/qna/NoOpponentDialogFragment.kt b/app/src/main/java/com/sopt/umbba_android/presentation/qna/NoOpponentDialogFragment.kt index f40f801b..dca58930 100644 --- a/app/src/main/java/com/sopt/umbba_android/presentation/qna/NoOpponentDialogFragment.kt +++ b/app/src/main/java/com/sopt/umbba_android/presentation/qna/NoOpponentDialogFragment.kt @@ -9,6 +9,7 @@ import android.view.ViewGroup import android.view.WindowManager import androidx.fragment.app.DialogFragment import com.sopt.umbba_android.databinding.FragmentNoOpponentDialogBinding +import com.sopt.umbba_android.util.setOnSingleClickListener class NoOpponentDialogFragment : DialogFragment() { @@ -34,7 +35,7 @@ class NoOpponentDialogFragment : DialogFragment() { } private fun closeDialog() { - binding.btnClose.setOnClickListener { + binding.btnClose.setOnSingleClickListener { dismiss() } } diff --git a/app/src/main/java/com/sopt/umbba_android/presentation/qna/QuestionAnswerActivity.kt b/app/src/main/java/com/sopt/umbba_android/presentation/qna/QuestionAnswerActivity.kt index 0506764f..9c777b0b 100644 --- a/app/src/main/java/com/sopt/umbba_android/presentation/qna/QuestionAnswerActivity.kt +++ b/app/src/main/java/com/sopt/umbba_android/presentation/qna/QuestionAnswerActivity.kt @@ -3,7 +3,6 @@ package com.sopt.umbba_android.presentation.qna import android.content.Intent import android.graphics.BlurMaskFilter import android.os.Bundle -import android.util.Log import android.view.View import androidx.activity.viewModels import androidx.core.content.ContextCompat @@ -14,6 +13,7 @@ import com.sopt.umbba_android.databinding.ActivityQuestionAnswerBinding import com.sopt.umbba_android.presentation.qna.viewmodel.QuestionAnswerViewModel import com.sopt.umbba_android.util.ViewModelFactory import com.sopt.umbba_android.util.binding.BindingActivity +import com.sopt.umbba_android.util.setOnSingleClickListener import timber.log.Timber class QuestionAnswerActivity : @@ -35,7 +35,7 @@ class QuestionAnswerActivity : private fun observeQnaViewFlag() { val qnaId = intent.getLongExtra("questionId", -1) - Timber.e( "qnaId activity에서" + qnaId.toString()) + Timber.d("qnaId activity에서 $qnaId") if (qnaId == -1L) { viewModel.getQuestionAnswer() viewModel.isBeforeList.value = false @@ -49,7 +49,7 @@ class QuestionAnswerActivity : private fun setClickEvent(data: QuestionAnswerResponseDto.QnaData) { if (data.isMyAnswer == false) { - binding.btnAnswer.setOnClickListener { + binding.btnAnswer.setOnSingleClickListener { Intent(this@QuestionAnswerActivity, AnswerActivity::class.java).apply { putExtra("section", data.section) putExtra("topic", data.topic) @@ -118,8 +118,8 @@ class QuestionAnswerActivity : this@QuestionAnswerActivity, R.drawable.shape_pri500_btn_stroke_r50_rect ) - btnAnswer.text = "홈으로" - btnAnswer.setOnClickListener { + btnAnswer.text = getString(R.string.home) + btnAnswer.setOnSingleClickListener { finish() } } diff --git a/app/src/main/java/com/sopt/umbba_android/presentation/qna/viewmodel/AnswerViewModel.kt b/app/src/main/java/com/sopt/umbba_android/presentation/qna/viewmodel/AnswerViewModel.kt index 0ce797d0..4dd431f9 100644 --- a/app/src/main/java/com/sopt/umbba_android/presentation/qna/viewmodel/AnswerViewModel.kt +++ b/app/src/main/java/com/sopt/umbba_android/presentation/qna/viewmodel/AnswerViewModel.kt @@ -13,11 +13,9 @@ class AnswerViewModel : ViewModel() { var topic = MutableLiveData() fun setDataFromIntent(intent: Intent) { - Log.e("hyeon", "question 들어왔니?" + intent.getStringExtra("question")) question.value = intent.getStringExtra("question") topic.value = "#${intent.getIntExtra("index", -1)} ${intent.getStringExtra("topic")}" - Log.e("hyeon", "index의 값은?" + intent.getIntExtra("index", -1)) section.value = intent.getStringExtra("section") } diff --git a/app/src/main/java/com/sopt/umbba_android/presentation/qna/viewmodel/ConfirmAnswerDialogFragmentViewModel.kt b/app/src/main/java/com/sopt/umbba_android/presentation/qna/viewmodel/ConfirmAnswerDialogFragmentViewModel.kt index 5ed7efe9..6d134ff7 100644 --- a/app/src/main/java/com/sopt/umbba_android/presentation/qna/viewmodel/ConfirmAnswerDialogFragmentViewModel.kt +++ b/app/src/main/java/com/sopt/umbba_android/presentation/qna/viewmodel/ConfirmAnswerDialogFragmentViewModel.kt @@ -30,11 +30,11 @@ class ConfirmAnswerDialogFragmentViewModel(private val questionAnswerRepositoryI viewModelScope.launch { questionAnswerRepositoryImpl.postAnswer(answerRequestDto) .onSuccess { reseponse -> - Timber.e( "postAnswer 성공") responseStatus.value = reseponse.status + Timber.d( "postAnswer 성공") }.onFailure { error -> - Timber.e("postAnswer 실패 " + error.message) responseStatus.value = -1 + Timber.e("postAnswer 실패 $error") } } } diff --git a/app/src/main/java/com/sopt/umbba_android/presentation/qna/viewmodel/QuestionAnswerViewModel.kt b/app/src/main/java/com/sopt/umbba_android/presentation/qna/viewmodel/QuestionAnswerViewModel.kt index d2b8250e..16567d22 100644 --- a/app/src/main/java/com/sopt/umbba_android/presentation/qna/viewmodel/QuestionAnswerViewModel.kt +++ b/app/src/main/java/com/sopt/umbba_android/presentation/qna/viewmodel/QuestionAnswerViewModel.kt @@ -33,14 +33,14 @@ class QuestionAnswerViewModel(private val questionAnswerRepositoryImpl: Question viewModelScope.launch { questionAnswerRepositoryImpl.getQuestionAnswer() .onSuccess { response -> - Timber.e( "getQuestionAnswer 성공") _qnaResponse.value = response.data isMyAnswer.value = response.data.isMyAnswer isOpponentAnswer.value = response.data.isOpponentAnswer _topicTitle.value = "#${response.data.index} ${response.data.topic}" appbarSection.value = response.data.section.toString() + Timber.d( "getQuestionAnswer 성공") }.onFailure { error -> - Timber.e("getQuestionAnswer 실패 " + error.message) + Timber.e("getQuestionAnswer 실패 $error") } } } @@ -54,7 +54,7 @@ class QuestionAnswerViewModel(private val questionAnswerRepositoryImpl: Question _topicTitle.value = "#${response.data.index} ${response.data.topic}" Timber.e( "getListQuestionAnswer 성공") }.onFailure { error -> - Timber.e( "getListQuestionAnswer 실패" + error.message) + Timber.e("getListQuestionAnswer 실패 $error") } } } diff --git a/app/src/main/java/com/sopt/umbba_android/presentation/setting/DeleteAccountActivity.kt b/app/src/main/java/com/sopt/umbba_android/presentation/setting/DeleteAccountActivity.kt index 0733a9ed..3daa8d48 100644 --- a/app/src/main/java/com/sopt/umbba_android/presentation/setting/DeleteAccountActivity.kt +++ b/app/src/main/java/com/sopt/umbba_android/presentation/setting/DeleteAccountActivity.kt @@ -1,16 +1,14 @@ package com.sopt.umbba_android.presentation.setting -import android.content.Intent import android.os.Bundle -import android.util.Log import android.view.View import androidx.activity.viewModels import com.sopt.umbba_android.R import com.sopt.umbba_android.databinding.ActivityDeleteAccountBinding -import com.sopt.umbba_android.presentation.login.LoginActivity import com.sopt.umbba_android.presentation.setting.viewmodel.DeleteAccountViewModel import com.sopt.umbba_android.util.ViewModelFactory import com.sopt.umbba_android.util.binding.BindingActivity +import com.sopt.umbba_android.util.setOnSingleClickListener class DeleteAccountActivity : BindingActivity(R.layout.activity_delete_account), @@ -24,7 +22,7 @@ class DeleteAccountActivity : private fun setClickEvent() { with(binding) { - btnDeleteAccount.setOnClickListener { + btnDeleteAccount.setOnSingleClickListener { DeleteAccountDialogFragment().apply{ show(supportFragmentManager, "DeleteAccountDialog") } diff --git a/app/src/main/java/com/sopt/umbba_android/presentation/setting/DeleteAccountDialogFragment.kt b/app/src/main/java/com/sopt/umbba_android/presentation/setting/DeleteAccountDialogFragment.kt index 951a018e..71f4a8f6 100644 --- a/app/src/main/java/com/sopt/umbba_android/presentation/setting/DeleteAccountDialogFragment.kt +++ b/app/src/main/java/com/sopt/umbba_android/presentation/setting/DeleteAccountDialogFragment.kt @@ -4,21 +4,18 @@ import android.content.Intent import android.graphics.Color import android.graphics.drawable.ColorDrawable import android.os.Bundle -import android.util.Log import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import android.view.WindowManager -import androidx.activity.viewModels import androidx.fragment.app.DialogFragment import androidx.fragment.app.viewModels import com.sopt.umbba_android.data.local.SharedPreferences import com.sopt.umbba_android.databinding.FragemntDeleteAccountDialogBinding import com.sopt.umbba_android.presentation.login.LoginActivity import com.sopt.umbba_android.presentation.setting.viewmodel.DeleteAccountViewModel -import com.sopt.umbba_android.presentation.setting.viewmodel.ManageAccountViewModel import com.sopt.umbba_android.util.ViewModelFactory - +import com.sopt.umbba_android.util.setOnSingleClickListener class DeleteAccountDialogFragment : DialogFragment() { @@ -47,10 +44,10 @@ class DeleteAccountDialogFragment : DialogFragment() { private fun setBtnClickEvent() { with(binding) { - btnCancel.setOnClickListener { + btnCancel.setOnSingleClickListener { dismiss() } - btnConfirm.setOnClickListener { + btnConfirm.setOnSingleClickListener { viewModel.signout() } } diff --git a/app/src/main/java/com/sopt/umbba_android/presentation/setting/ManageAccountActivity.kt b/app/src/main/java/com/sopt/umbba_android/presentation/setting/ManageAccountActivity.kt index ba7e5edd..9b05522e 100644 --- a/app/src/main/java/com/sopt/umbba_android/presentation/setting/ManageAccountActivity.kt +++ b/app/src/main/java/com/sopt/umbba_android/presentation/setting/ManageAccountActivity.kt @@ -2,9 +2,7 @@ package com.sopt.umbba_android.presentation.setting import android.content.Intent import android.os.Bundle -import android.util.Log import android.view.View -import android.widget.Toast import androidx.activity.viewModels import com.sopt.umbba_android.R import com.sopt.umbba_android.data.local.SharedPreferences @@ -13,6 +11,7 @@ import com.sopt.umbba_android.presentation.login.LoginActivity import com.sopt.umbba_android.presentation.setting.viewmodel.ManageAccountViewModel import com.sopt.umbba_android.util.ViewModelFactory import com.sopt.umbba_android.util.binding.BindingActivity +import com.sopt.umbba_android.util.setOnSingleClickListener class ManageAccountActivity : BindingActivity(R.layout.activity_manage_account), @@ -44,10 +43,10 @@ class ManageAccountActivity : private fun setClickEvent() { with(binding) { - clLogout.setOnClickListener { + clLogout.setOnSingleClickListener { viewModel.logout() } - clDeleteAccount.setOnClickListener { + clDeleteAccount.setOnSingleClickListener { startActivity(Intent(this@ManageAccountActivity, DeleteAccountActivity::class.java)) } } diff --git a/app/src/main/java/com/sopt/umbba_android/presentation/setting/SettingFragment.kt b/app/src/main/java/com/sopt/umbba_android/presentation/setting/SettingFragment.kt index 1661fd1a..5bd877ed 100644 --- a/app/src/main/java/com/sopt/umbba_android/presentation/setting/SettingFragment.kt +++ b/app/src/main/java/com/sopt/umbba_android/presentation/setting/SettingFragment.kt @@ -17,6 +17,7 @@ import com.sopt.umbba_android.databinding.FragmentSettingBinding import com.sopt.umbba_android.presentation.onboarding.OnboardingFinishActivity import com.sopt.umbba_android.util.binding.BindingFragment import com.sopt.umbba_android.util.fcm.MyFirebaseMessagingService +import com.sopt.umbba_android.util.setOnSingleClickListener import timber.log.Timber class SettingFragment : BindingFragment(R.layout.fragment_setting) { @@ -30,7 +31,6 @@ class SettingFragment : BindingFragment(R.layout.fragmen private val notificationSettingsLauncher = registerForActivityResult(ActivityResultContracts.StartActivityForResult()) { result: ActivityResult -> - // 앱의 설정 화면으로 이동한 후 결과를 처리하는 로직 setSwitchNotification() } @@ -58,10 +58,10 @@ class SettingFragment : BindingFragment(R.layout.fragmen private fun setClickEvent() { with(binding) { - clManageAccount.setOnClickListener { + clManageAccount.setOnSingleClickListener { startActivity(Intent(requireActivity(), ManageAccountActivity::class.java)) } - clAboutUmbba.setOnClickListener { + clAboutUmbba.setOnSingleClickListener { startActivity( Intent( Intent.ACTION_VIEW, @@ -69,7 +69,7 @@ class SettingFragment : BindingFragment(R.layout.fragmen ) ) } - clTos.setOnClickListener { + clTos.setOnSingleClickListener { startActivity( Intent( Intent.ACTION_VIEW, @@ -77,12 +77,12 @@ class SettingFragment : BindingFragment(R.layout.fragmen ) ) } - clPrivacyNotice.setOnClickListener { + clPrivacyNotice.setOnSingleClickListener { startActivity( Intent( Intent.ACTION_VIEW, Uri.parse(getString(R.string.notion_privacy_notice)) - ) //공지사항 바꾸기 + ) ) } } diff --git a/app/src/main/java/com/sopt/umbba_android/presentation/setting/viewmodel/DeleteAccountViewModel.kt b/app/src/main/java/com/sopt/umbba_android/presentation/setting/viewmodel/DeleteAccountViewModel.kt index 6d6e0cd4..cdb30db2 100644 --- a/app/src/main/java/com/sopt/umbba_android/presentation/setting/viewmodel/DeleteAccountViewModel.kt +++ b/app/src/main/java/com/sopt/umbba_android/presentation/setting/viewmodel/DeleteAccountViewModel.kt @@ -21,11 +21,11 @@ class DeleteAccountViewModel(private val settingRepositoryImpl: SettingRepositor viewModelScope.launch { settingRepositoryImpl.signout() .onSuccess { response -> - Timber.e("viewModel 회원탈퇴 성공") responseStatus.value = response.status + Timber.d("viewModel 회원탈퇴 성공") }.onFailure { error -> - Timber.e("viewModel 회원탈퇴 실패 " + error.message) responseStatus.value = -1 + Timber.e("viewModel 회원탈퇴 실패 $error") } } } diff --git a/app/src/main/java/com/sopt/umbba_android/presentation/setting/viewmodel/ManageAccountViewModel.kt b/app/src/main/java/com/sopt/umbba_android/presentation/setting/viewmodel/ManageAccountViewModel.kt index 2d002689..65e9debe 100644 --- a/app/src/main/java/com/sopt/umbba_android/presentation/setting/viewmodel/ManageAccountViewModel.kt +++ b/app/src/main/java/com/sopt/umbba_android/presentation/setting/viewmodel/ManageAccountViewModel.kt @@ -16,11 +16,11 @@ class ManageAccountViewModel(private val settingRepositoryImpl: SettingRepositor viewModelScope.launch { settingRepositoryImpl.logout() .onSuccess { response -> - Timber.e("viewmodel logout 성공") responseStatus.value = response.status + Timber.d("viewmodel logout 성공") }.onFailure { error -> - Timber.e( "viewmodel logout 실패 " + error.message) responseStatus.value = -1 + Timber.e("viewmodel logout 실패 $error") } } return responseStatus.value diff --git a/app/src/main/java/com/sopt/umbba_android/presentation/BasicAppbarFragment.kt b/app/src/main/java/com/sopt/umbba_android/util/BasicAppbar.kt similarity index 58% rename from app/src/main/java/com/sopt/umbba_android/presentation/BasicAppbarFragment.kt rename to app/src/main/java/com/sopt/umbba_android/util/BasicAppbar.kt index aed1cc9c..1f65cbd4 100644 --- a/app/src/main/java/com/sopt/umbba_android/presentation/BasicAppbarFragment.kt +++ b/app/src/main/java/com/sopt/umbba_android/util/BasicAppbar.kt @@ -1,15 +1,12 @@ -package com.sopt.umbba_android.presentation +package com.sopt.umbba_android.util -import android.content.Context import android.os.Bundle -import android.util.AttributeSet import android.view.View -import android.view.View.OnClickListener import com.sopt.umbba_android.R import com.sopt.umbba_android.databinding.BasicAppbarBinding import com.sopt.umbba_android.util.binding.BindingFragment -class BasicAppbarFragment : BindingFragment(R.layout.basic_appbar) { +class BasicAppbar : BindingFragment(R.layout.basic_appbar) { override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) } diff --git a/app/src/main/java/com/sopt/umbba_android/util/ViewExtension.kt b/app/src/main/java/com/sopt/umbba_android/util/ViewExtension.kt new file mode 100644 index 00000000..e611da14 --- /dev/null +++ b/app/src/main/java/com/sopt/umbba_android/util/ViewExtension.kt @@ -0,0 +1,17 @@ +package com.sopt.umbba_android.util + +import android.view.View + +inline fun View.setOnSingleClickListener( + delay: Long = 500L, + crossinline block: (View) -> Unit +) { + var previousClickedTime = 0L + setOnClickListener { view -> + val clickedTime = System.currentTimeMillis() + if (clickedTime - previousClickedTime >= delay) { + block(view) + previousClickedTime = clickedTime + } + } +} \ No newline at end of file diff --git a/app/src/main/res/layout/activity_delete_account.xml b/app/src/main/res/layout/activity_delete_account.xml index c2862b42..fc68509a 100644 --- a/app/src/main/res/layout/activity_delete_account.xml +++ b/app/src/main/res/layout/activity_delete_account.xml @@ -95,6 +95,7 @@ android:text="@string/btn_delete_account" android:textAppearance="@style/AndroidBody1_1SemiBold16" android:textColor="@color/umbba_white" + android:stateListAnimator="@null" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" /> diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index c0fbd8b0..28f52b05 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -6,6 +6,7 @@ ex) ORWO-11yzwx 초대코드를 입력해줘 + 유효하지 않은 초대코드 입니다. 엄빠도 어렸다 @@ -27,6 +28,9 @@ ex) 홍길동 태어난 연도는 언제야? ex) 1988 + *형식이 올바르지 않습니다. + *7글자 이하로 작성해주세요. + *4글자로 작성해주세요. *올바른 초대코드 형식이 아닙니다. @@ -45,12 +49,24 @@ 매일 밤\n교신을 보내줄게 선택한 시간에 따라 푸시 알림을 보내드려요 + 정보 등록에 실패했습니다. 오늘부터 매일, 과거로 시간 여행을 떠날 거야 초대자가 선택한 시간에 따라 푸시 알림을 보내드려요 과거로 떠나기 매일 밤 11시에\n교신을 보내줄게 + 알림 권한이 허용되었습니다. + 알림 권한이 없습니다. + 알림 권한이 허용되어 있습니다. + 알림 권한을 설정하면 답변 작성 요청 알림을 받아볼 수 있습니다. + 새벽 + 아침 + + 저녁 + + 매일 %s %d시에\n교신을 보내줄게 + 매일 %s %d시 반에\n교신을 보내줄게 거의 다 왔어! 조금만 힘내줘! @@ -63,6 +79,9 @@ About 엄빠도 어렸다 이용약관 개인정보 처리방침 + https://brawny-guan-098.notion.site/7b3e5f70a471468f8acbe56a1a4f4ec9 + https://harsh-step-7dd.notion.site/f1a14bf60ed4421f9b3761ef88906adb + https://harsh-step-7dd.notion.site/99fe0f58825d4f87bd3b987fadc623b6?pvs=4 답변을 입력해 주세요 @@ -79,20 +98,34 @@ 질문 확인하기 하단 버튼을 눌러 답변을 입력하세요 상대방은 아직 답변하지 않았어요 + 홈으로 상대를 초대할 차례야\n상대방이 수락하면 문답이 시작돼 초대코드 복사 카카오톡으로 초대 보내기 + 초대 코드가 복사되었습니다. + 카카오톡을 설치해주세요. + %s으로부터 초대가 왔어요.\n초대코드 : %s + 과거로 떠나 함께 추억을 나누고,\n공감대를 형성해보세요. + https://github.com/Team–Umbba/Umbba–iOS/assets/75068759/64ba7265–9148–4f06–8235-de5f4030e92f + https://developers.kakao.com + 초대 받기 답변을 저장하시겠어요? 돌아가기 저장 + 답변이 전송되었습니다. 리스트 #%d + # 어린시절 + # 학창시절 + # 청춘시절 + # 연애시절 + # 우리가 만나고 답변 작성을 취소하시겠어요?\n작성 중인 답변은 저장되지 않아요 @@ -125,13 +158,19 @@ [필수] 서비스 이용약관에 동의합니다. [필수] 개인정보 수집 및 이용에 동의합니다. \'(주)이승준 컴퍼니\'(이하 \'회사\')가 운영하는 \'엄빠도 어렸다\'는 개인정보보호법 제30조 의거 이용자의 개인정보보호와 권익을 보호하고 관련된 고충 및 애로사항을 신속하게 처리하기 위해 아래의 개인정보처리방침을 제정·운영하고 있습니다. - + 서비스 이용약관 + 개인정보 수집 및 이용 + 전화 받기 오래된 공중전화에서 수신음이 들린다 #%d %s + 어린시절 + 학창시절 + 청춘시절 + 연애시절 @@ -143,24 +182,4 @@ 뭔가를 크게 포기해본 경험이 있어? 돌아가고 싶은 순간이 있어? - - # 어린시절 - # 학창시절 - # 청춘시절 - # 연애시절 - # 우리가 만나고 - - - 어린시절 - 학창시절 - 청춘시절 - 연애시절 - *형식이 올바르지 않습니다. - *7글자 이하로 작성해주세요. - *4글자로 작성해주세요. - https://brawny-guan-098.notion.site/7b3e5f70a471468f8acbe56a1a4f4ec9 - https://harsh-step-7dd.notion.site/f1a14bf60ed4421f9b3761ef88906adb - https://harsh-step-7dd.notion.site/99fe0f58825d4f87bd3b987fadc623b6?pvs=4 - - \ No newline at end of file