From eef203933534debf7763e7bd1d59cfa7e43ff3d9 Mon Sep 17 00:00:00 2001 From: kxxhyorim Date: Wed, 26 Apr 2023 02:16:52 +0900 Subject: [PATCH 01/17] =?UTF-8?q?[FEAT]=20Crashlytics=20plugin=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80=20(#837)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/build.gradle | 8 +++++--- build.gradle | 1 + 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 50b8d3bf9..f61657b9b 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -6,6 +6,7 @@ plugins { id 'androidx.navigation.safeargs.kotlin' id 'com.google.gms.google-services' id 'kotlin-android-extensions' + id 'com.google.firebase.crashlytics' } Properties properties = new Properties() @@ -136,10 +137,11 @@ dependencies { * bom 이외의 sdk에 버전 지정을 하지 않게 주의 * */ - implementation platform('com.google.firebase:firebase-bom:29.0.2') + implementation platform('com.google.firebase:firebase-bom:31.5.0') implementation 'com.google.firebase:firebase-analytics-ktx' - implementation 'com.google.firebase:firebase-messaging:23.0.0' - implementation 'com.google.firebase:firebase-messaging-ktx:23.0.0' + implementation 'com.google.firebase:firebase-messaging' + implementation 'com.google.firebase:firebase-messaging-ktx' + implementation 'com.google.firebase:firebase-crashlytics-ktx' // Jsoup implementation 'org.jsoup:jsoup:1.13.1' diff --git a/build.gradle b/build.gradle index e26d974c2..89ad0f1d4 100644 --- a/build.gradle +++ b/build.gradle @@ -10,6 +10,7 @@ buildscript { classpath "androidx.navigation:navigation-safe-args-gradle-plugin:2.4.2" classpath 'com.google.gms:google-services:4.3.10' classpath 'com.google.dagger:hilt-android-gradle-plugin:2.42' + classpath 'com.google.firebase:firebase-crashlytics-gradle:2.9.5' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files } From 61ea9d40da9a929b6c4e7df203b0be64c428ec70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E1=84=8B=E1=85=A1=E1=86=AB=E1=84=82=E1=85=A1=E1=84=8B?= =?UTF-8?q?=E1=85=A7=E1=86=BC?= Date: Sun, 30 Apr 2023 19:02:27 +0900 Subject: [PATCH 02/17] =?UTF-8?q?[FIX]=20=EB=8B=89=EB=84=A4=EC=9E=84=20?= =?UTF-8?q?=EC=83=9D=EC=84=B1=EC=8B=9C=20=EB=9D=84=EC=96=B4=EC=93=B0?= =?UTF-8?q?=EA=B8=B0=20=EB=90=98=EC=A7=80=20=EC=95=8A=EB=8F=84=EB=A1=9D=20?= =?UTF-8?q?=EC=84=A4=EC=A0=95=20(#842)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/org/sopt/havit/ui/sign/AddNickNameFragment.kt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/org/sopt/havit/ui/sign/AddNickNameFragment.kt b/app/src/main/java/org/sopt/havit/ui/sign/AddNickNameFragment.kt index f4cb9a459..35f753461 100644 --- a/app/src/main/java/org/sopt/havit/ui/sign/AddNickNameFragment.kt +++ b/app/src/main/java/org/sopt/havit/ui/sign/AddNickNameFragment.kt @@ -42,7 +42,10 @@ class AddNickNameFragment : private fun setTextWatcher() { binding.etNickname.addTextChangedListener { - signUpViewModel.setNickName(binding.etNickname.text.toString()) + signUpViewModel.setNickName( + binding.etNickname.text.toString().replace("\\s".toRegex(), "") + ) + binding.etNickname.setSelection(binding.etNickname.length()) } } From 753d2602246af315bfbae89d7f0c6a8269345911 Mon Sep 17 00:00:00 2001 From: kxxhyorim Date: Wed, 3 May 2023 16:11:38 +0900 Subject: [PATCH 03/17] =?UTF-8?q?[CHORE]=20gitignore=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .idea/.gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.idea/.gitignore b/.idea/.gitignore index 26d33521a..473fe9664 100644 --- a/.idea/.gitignore +++ b/.idea/.gitignore @@ -1,3 +1,4 @@ # Default ignored files /shelf/ /workspace.xml +/kotlinc.xml From de547bed7f5ac4c0be70cfcd8b9e71c208ddce57 Mon Sep 17 00:00:00 2001 From: kxxhyorim Date: Wed, 3 May 2023 19:43:53 +0900 Subject: [PATCH 04/17] =?UTF-8?q?[UI]=20BindingAdapter=20-=20imageUrl?= =?UTF-8?q?=EC=9D=98=20placeholder=20=20=EB=8D=94=EB=AF=B8=EC=9D=B4?= =?UTF-8?q?=EB=AF=B8=EC=A7=80=20=EB=B3=80=EA=B2=BD=20(#839)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/java/org/sopt/havit/util/BindingAdapter.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/org/sopt/havit/util/BindingAdapter.kt b/app/src/main/java/org/sopt/havit/util/BindingAdapter.kt index 855555b95..2221bdc6e 100644 --- a/app/src/main/java/org/sopt/havit/util/BindingAdapter.kt +++ b/app/src/main/java/org/sopt/havit/util/BindingAdapter.kt @@ -25,7 +25,7 @@ import org.sopt.havit.util.DpToPxUtil.px fun ImageView.loadImage(url: String?) { Glide.with(context) .load(url) - .placeholder(R.drawable.img_contents_dummy) + .placeholder(R.drawable.img_contents_dummy_3) .into(this) } From 907f150d7846653b2492e0d424f81aa711039b5e Mon Sep 17 00:00:00 2001 From: kxxhyorim Date: Wed, 3 May 2023 19:44:53 +0900 Subject: [PATCH 05/17] =?UTF-8?q?[UI]=20ContentsActivity=EC=9D=98=20?= =?UTF-8?q?=EC=95=84=EC=9D=B4=ED=85=9C=EB=93=A4=20scaleType=EC=A7=80?= =?UTF-8?q?=EC=A0=95=20(#839)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/res/layout/item_contents_grid.xml | 5 +++-- app/src/main/res/layout/item_contents_linear_max.xml | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/app/src/main/res/layout/item_contents_grid.xml b/app/src/main/res/layout/item_contents_grid.xml index 11d3e05df..4d2ad7ccb 100644 --- a/app/src/main/res/layout/item_contents_grid.xml +++ b/app/src/main/res/layout/item_contents_grid.xml @@ -35,7 +35,8 @@ android:id="@+id/iv_thumbnail" imageDefaultGrid="@{content.image}" android:layout_width="match_parent" - android:layout_height="109dp" /> + android:layout_height="109dp" + android:scaleType="centerCrop" /> + android:layout_height="184dp" + android:scaleType="centerCrop" /> Date: Wed, 3 May 2023 20:07:29 +0900 Subject: [PATCH 06/17] =?UTF-8?q?[UI]=20ContentsActivity=EC=9D=98=20?= =?UTF-8?q?=EC=95=84=EC=9D=B4=ED=85=9C=EC=9D=98=20placeholder=EC=97=90?= =?UTF-8?q?=EB=8F=84=20radius=20=EC=A7=80=EC=A0=95=20(#839)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/res/layout/item_contents_grid.xml | 3 ++- app/src/main/res/layout/item_contents_linear_max.xml | 3 ++- app/src/main/res/values/styles.xml | 6 ++++++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/app/src/main/res/layout/item_contents_grid.xml b/app/src/main/res/layout/item_contents_grid.xml index 4d2ad7ccb..f72d968fc 100644 --- a/app/src/main/res/layout/item_contents_grid.xml +++ b/app/src/main/res/layout/item_contents_grid.xml @@ -31,10 +31,11 @@ app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent"> - diff --git a/app/src/main/res/layout/item_contents_linear_max.xml b/app/src/main/res/layout/item_contents_linear_max.xml index c8bba3d8f..f2c5f772b 100644 --- a/app/src/main/res/layout/item_contents_linear_max.xml +++ b/app/src/main/res/layout/item_contents_linear_max.xml @@ -31,10 +31,11 @@ app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent"> - diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index 39e395ef3..c19d3453e 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -22,4 +22,10 @@ 6dp + + + \ No newline at end of file From 4be4991d054bacc84ece4477aff25d7f267d3956 Mon Sep 17 00:00:00 2001 From: kxxhyorim Date: Thu, 4 May 2023 00:47:27 +0900 Subject: [PATCH 07/17] =?UTF-8?q?[FIX]=20=ED=9A=8C=EC=9B=90=ED=83=88?= =?UTF-8?q?=ED=87=B4=20=EC=A4=91=EB=B3=B5=20=EC=9A=94=EC=B2=AD=20=EB=B0=A9?= =?UTF-8?q?=EC=A7=80=20(#840)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/org/sopt/havit/util/DialogOkUtil.kt | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/app/src/main/java/org/sopt/havit/util/DialogOkUtil.kt b/app/src/main/java/org/sopt/havit/util/DialogOkUtil.kt index ec0769d72..3f45e5170 100644 --- a/app/src/main/java/org/sopt/havit/util/DialogOkUtil.kt +++ b/app/src/main/java/org/sopt/havit/util/DialogOkUtil.kt @@ -69,20 +69,12 @@ class DialogOkUtil(private val dialogMode: Int, private val doAfterConfirm: () - } private fun clickListener() { - binding.ivClose.setOnSingleClickListener { - dismiss() - doAfterConfirm() - } - binding.btnConfirm.setOnSinglePostClickListener { - dismiss() - doAfterConfirm() - } + binding.ivClose.setOnSingleClickListener { dismiss() } + binding.btnConfirm.setOnSinglePostClickListener { dismiss() } } override fun onDestroyView() { - if (dialogMode == UNREGISTER) { - doAfterConfirm() - } + doAfterConfirm() super.onDestroyView() _binding = null } From 66fbb2b8a5c50705c971c01c4d5f76c688651838 Mon Sep 17 00:00:00 2001 From: kxxhyorim Date: Thu, 4 May 2023 11:58:47 +0900 Subject: [PATCH 08/17] =?UTF-8?q?[FIX]=20isCategoryNameAlreadyExist=20?= =?UTF-8?q?=ED=95=A8=EC=88=98=20stream=20=EC=82=AC=EC=9A=A9=20=EB=B6=80?= =?UTF-8?q?=EB=B6=84=20=EC=88=98=EC=A0=95=20(#841)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/org/sopt/havit/ui/share/AddCategoryViewModel.kt | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/app/src/main/java/org/sopt/havit/ui/share/AddCategoryViewModel.kt b/app/src/main/java/org/sopt/havit/ui/share/AddCategoryViewModel.kt index d7c1424ea..dd4eab6c2 100644 --- a/app/src/main/java/org/sopt/havit/ui/share/AddCategoryViewModel.kt +++ b/app/src/main/java/org/sopt/havit/ui/share/AddCategoryViewModel.kt @@ -44,9 +44,7 @@ class AddCategoryViewModel @Inject constructor( fun isCategoryNameAlreadyExist(currentTitle: String): Boolean { val list = existingCategoryList.value?.toList() ?: throw IllegalStateException() - return list.stream().anyMatch { anotherString: String? -> - currentTitle.equals(anotherString, ignoreCase = true) - } + return list.any { it.equals(currentTitle, ignoreCase = false) } } /** Category Title */ From 70250f1458d5f3cb33d67916dfd6db383265370f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E1=84=8B=E1=85=A1=E1=86=AB=E1=84=82=E1=85=A1=E1=84=8B?= =?UTF-8?q?=E1=85=A7=E1=86=BC?= Date: Fri, 5 May 2023 14:33:55 +0900 Subject: [PATCH 09/17] =?UTF-8?q?[FEAT]=20=EB=8B=89=EB=84=A4=EC=9E=84=20?= =?UTF-8?q?=EC=83=9D=EC=84=B1=EC=97=90=EC=84=9C=20=EB=9D=84=EC=96=B4?= =?UTF-8?q?=EC=93=B0=EA=B8=B0=20=ED=8F=AC=ED=95=A8=EC=8B=9C=20=EA=B2=BD?= =?UTF-8?q?=EA=B3=A0=20=ED=85=8D=EC=8A=A4=ED=8A=B8=EC=99=80=20=EC=99=84?= =?UTF-8?q?=EB=A3=8C=20=EB=B2=84=ED=8A=BC=20=EB=B9=84=ED=99=9C=EC=84=B1?= =?UTF-8?q?=ED=99=94=20(#842)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sopt/havit/ui/sign/AddNickNameFragment.kt | 12 +++-- .../sopt/havit/ui/sign/NickNameTextStatus.kt | 5 +++ .../org/sopt/havit/ui/sign/SignUpViewModel.kt | 6 ++- .../res/layout/fragment_add_nick_name.xml | 45 +++++++++++++++++-- app/src/main/res/values/strings.xml | 1 + 5 files changed, 62 insertions(+), 7 deletions(-) create mode 100644 app/src/main/java/org/sopt/havit/ui/sign/NickNameTextStatus.kt diff --git a/app/src/main/java/org/sopt/havit/ui/sign/AddNickNameFragment.kt b/app/src/main/java/org/sopt/havit/ui/sign/AddNickNameFragment.kt index 35f753461..39dacec59 100644 --- a/app/src/main/java/org/sopt/havit/ui/sign/AddNickNameFragment.kt +++ b/app/src/main/java/org/sopt/havit/ui/sign/AddNickNameFragment.kt @@ -42,15 +42,21 @@ class AddNickNameFragment : private fun setTextWatcher() { binding.etNickname.addTextChangedListener { - signUpViewModel.setNickName( - binding.etNickname.text.toString().replace("\\s".toRegex(), "") - ) + val hasSpace = binding.etNickname.text?.toString()?.contains("\\s".toRegex()) ?: false + if (hasSpace) { // 닉네임에 띄어쓰기 포함 + signUpViewModel.nickNameStatus.value = NickNameTextStatus.HAS_SPACING + } else if (binding.etNickname.text?.toString()?.isEmpty() == true) { // 닉네임이 공백일 때 + signUpViewModel.nickNameStatus.value = NickNameTextStatus.EMPTY + } else { // 정상 닉네임 입력할 때 + signUpViewModel.nickNameStatus.value = NickNameTextStatus.FILLED + } binding.etNickname.setSelection(binding.etNickname.length()) } } private fun setListener() { binding.btnNicknameNext.setOnClickListener { + signUpViewModel.setNickName(binding.etNickname.text.toString()) signUpViewModel.setMoveToNextOrBack(true) } binding.ivNicknameDeleteText.setOnClickListener { diff --git a/app/src/main/java/org/sopt/havit/ui/sign/NickNameTextStatus.kt b/app/src/main/java/org/sopt/havit/ui/sign/NickNameTextStatus.kt new file mode 100644 index 000000000..ff15ed518 --- /dev/null +++ b/app/src/main/java/org/sopt/havit/ui/sign/NickNameTextStatus.kt @@ -0,0 +1,5 @@ +package org.sopt.havit.ui.sign + +enum class NickNameTextStatus { + EMPTY, HAS_SPACING, FILLED +} diff --git a/app/src/main/java/org/sopt/havit/ui/sign/SignUpViewModel.kt b/app/src/main/java/org/sopt/havit/ui/sign/SignUpViewModel.kt index 5394cf251..25035c9e1 100644 --- a/app/src/main/java/org/sopt/havit/ui/sign/SignUpViewModel.kt +++ b/app/src/main/java/org/sopt/havit/ui/sign/SignUpViewModel.kt @@ -4,6 +4,7 @@ import android.util.Log import android.view.View import androidx.lifecycle.* import dagger.hilt.android.lifecycle.HiltViewModel +import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.launch import org.sopt.havit.R import org.sopt.havit.domain.entity.NetworkState @@ -23,6 +24,8 @@ class SignUpViewModel @Inject constructor( var nickName = MutableLiveData(authRepository.getUserNickName()) + val nickNameStatus = MutableStateFlow(NickNameTextStatus.EMPTY) + private var _fcmToken = MutableLiveData() private var _accessToken = MutableLiveData() @@ -122,9 +125,10 @@ class SignUpViewModel @Inject constructor( fun setClearNickName() { nickName.value = "" + nickNameStatus.value = NickNameTextStatus.EMPTY } fun setMoveToNextOrBack(move: Boolean) { _isMoveToNextOrBack.value = Event(move) } -} \ No newline at end of file +} diff --git a/app/src/main/res/layout/fragment_add_nick_name.xml b/app/src/main/res/layout/fragment_add_nick_name.xml index d866685a3..85145f67b 100644 --- a/app/src/main/res/layout/fragment_add_nick_name.xml +++ b/app/src/main/res/layout/fragment_add_nick_name.xml @@ -5,6 +5,12 @@ + + + + @@ -78,6 +84,39 @@ app:layout_constraintStart_toStartOf="@+id/et_nickname" app:layout_constraintTop_toBottomOf="@+id/et_nickname" /> + + + + + + + + - \ 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 202646482..b8c292389 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -278,4 +278,5 @@ 서비스 준비중입니다 메일을 전송할 수 없습니다 문제 발생 + 닉네임에 띄어쓰기는 사용할 수 없습니다. From 5af81558e5cc3c558356e1601bf3c6a227a149fe Mon Sep 17 00:00:00 2001 From: kxxhyorim Date: Sun, 7 May 2023 20:31:50 +0900 Subject: [PATCH 10/17] [CHORE] Add google play core Library (#849) --- app/build.gradle | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/build.gradle b/app/build.gradle index f61657b9b..8720763a9 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -156,4 +156,8 @@ dependencies { // 스켈레톤 shimmer implementation "com.facebook.shimmer:shimmer:0.5.0" + // google play core + implementation 'com.google.android.play:app-update:2.0.1' + implementation 'com.google.android.play:app-update-ktx:2.0.1' + } From 6c367b64a1496b458c0844724a654ccd7a580328 Mon Sep 17 00:00:00 2001 From: kxxhyorim Date: Mon, 8 May 2023 04:33:49 +0900 Subject: [PATCH 11/17] =?UTF-8?q?[UI]=20=EC=84=A4=EC=A0=95>=EB=B2=84?= =?UTF-8?q?=EC=A0=84=EC=A0=95=EB=B7=B0=20=EB=B7=B0=20=EC=9E=91=EC=97=85=20?= =?UTF-8?q?(#849)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/res/layout/activity_setting.xml | 62 +++++++++++++++++++- app/src/main/res/values/strings.xml | 3 + 2 files changed, 64 insertions(+), 1 deletion(-) diff --git a/app/src/main/res/layout/activity_setting.xml b/app/src/main/res/layout/activity_setting.xml index 0b53f7ec0..01d5fa8fb 100644 --- a/app/src/main/res/layout/activity_setting.xml +++ b/app/src/main/res/layout/activity_setting.xml @@ -328,12 +328,72 @@ app:layout_constraintEnd_toEndOf="@id/iv_edit" app:layout_constraintTop_toTopOf="@id/tv_customer_center" /> + + + + + + + + + + + + + + + app:layout_constraintTop_toBottomOf="@id/cl_version_info"> havitofficial29@gmail.com 버전 정보 로그아웃 + 최신 버전 + 업데이트 회원 탈퇴 나의 콘텐츠 저장 현황 @@ -278,4 +280,5 @@ 서비스 준비중입니다 메일을 전송할 수 없습니다 문제 발생 + 현재 버전  From b7ca8eb9869e26cb22c40b21cbb12dfb8f7ccc2b Mon Sep 17 00:00:00 2001 From: kxxhyorim Date: Mon, 8 May 2023 05:49:00 +0900 Subject: [PATCH 12/17] =?UTF-8?q?[ADD]=20VersionState=20Enum=20Class=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80=20(#849)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/org/sopt/havit/domain/entity/VersionState.kt | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 app/src/main/java/org/sopt/havit/domain/entity/VersionState.kt diff --git a/app/src/main/java/org/sopt/havit/domain/entity/VersionState.kt b/app/src/main/java/org/sopt/havit/domain/entity/VersionState.kt new file mode 100644 index 000000000..fbf2ae1d4 --- /dev/null +++ b/app/src/main/java/org/sopt/havit/domain/entity/VersionState.kt @@ -0,0 +1,10 @@ +package org.sopt.havit.domain.entity + +/** VersionState가 Unkown인 경우 + * 1. debug build로 실행할 경우 (Prod로 실행해주세요) + * 2. Play Store지원을 하지 않는 Emulator를 사용하고 있는 경우 + * */ +enum class VersionState { + Latest, Update, Unknown + +} \ No newline at end of file From 6ca9e96412e545e91cb489b70cbc4e4e888a8dd4 Mon Sep 17 00:00:00 2001 From: kxxhyorim Date: Mon, 8 May 2023 05:49:46 +0900 Subject: [PATCH 13/17] =?UTF-8?q?[FEAT]=20=EB=B2=84=EC=A0=84=EC=A0=95?= =?UTF-8?q?=EB=B3=B4=20=EA=B0=80=EC=A0=B8=EC=98=A4=EA=B8=B0=20=EA=B8=B0?= =?UTF-8?q?=EB=8A=A5=20=EA=B5=AC=ED=98=84=20=EC=99=84=EB=A3=8C=20(#841)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/build.gradle | 2 +- .../sopt/havit/ui/setting/SettingActivity.kt | 53 ++++++++++++++++--- .../ui/setting/viewmodel/SettingViewModel.kt | 47 ++++++++++------ app/src/main/res/values/strings.xml | 1 + 4 files changed, 80 insertions(+), 23 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 8720763a9..65631832a 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -20,7 +20,7 @@ android { applicationId "org.sopt.havit" minSdk 23 targetSdk 31 - versionCode 105 + versionCode 104 versionName "1.0.5" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" buildConfigField("String", "HAVIT_BASE_URL_DEV", properties["HAVIT_BASE_URL_DEV"]) diff --git a/app/src/main/java/org/sopt/havit/ui/setting/SettingActivity.kt b/app/src/main/java/org/sopt/havit/ui/setting/SettingActivity.kt index 000d5bcff..cfe063d45 100644 --- a/app/src/main/java/org/sopt/havit/ui/setting/SettingActivity.kt +++ b/app/src/main/java/org/sopt/havit/ui/setting/SettingActivity.kt @@ -5,16 +5,21 @@ import android.net.Uri import android.os.Bundle import android.util.Log import androidx.activity.viewModels +import androidx.core.content.ContextCompat import com.kakao.sdk.user.UserApiClient import dagger.hilt.android.AndroidEntryPoint -import org.sopt.havit.BuildConfig import org.sopt.havit.R import org.sopt.havit.databinding.ActivitySettingBinding +import org.sopt.havit.domain.entity.VersionState import org.sopt.havit.ui.base.BaseBindingActivity import org.sopt.havit.ui.home.ServiceGuideActivity import org.sopt.havit.ui.setting.viewmodel.SettingViewModel import org.sopt.havit.ui.sign.SplashWithSignActivity -import org.sopt.havit.util.* +import org.sopt.havit.util.CANNOT_SEND_MAIL_TYPE +import org.sopt.havit.util.DialogUtil +import org.sopt.havit.util.HavitSharedPreference +import org.sopt.havit.util.ToastUtil +import org.sopt.havit.util.setOnSingleClickListener import javax.inject.Inject @AndroidEntryPoint @@ -29,6 +34,8 @@ class SettingActivity : BaseBindingActivity(R.layout.act binding.vmSetting = settingViewModel setVersion() setClickListener() + getLatestVersion() + observeIsLatest() } override fun onResume() { @@ -37,10 +44,46 @@ class SettingActivity : BaseBindingActivity(R.layout.act } private fun setVersion() { - val version = BuildConfig.VERSION_NAME // build.gradle->defaultConfig에 있는 version_name - settingViewModel.setVersion(version) + settingViewModel.setCurrentVersion() } + private fun getLatestVersion() { + settingViewModel.getLatestVersion() + } + + private fun setVersionLatestState() { + with(binding.tvVersionStatus) { + setText(R.string.latest_version) + setTextColor(ContextCompat.getColor(this@SettingActivity, R.color.gray_3)) + } + } + + private fun setVersionUpdateState() { + with(binding.tvVersionStatus) { + setText(R.string.update) + setTextColor(ContextCompat.getColor(this@SettingActivity, R.color.havit_purple)) + } + } + + private fun setVersionUnknownState() { + with(binding.tvVersionStatus) { + setText(R.string.dash) + setTextColor(ContextCompat.getColor(this@SettingActivity, R.color.gray_3)) + } + } + + private fun observeIsLatest() { + settingViewModel.versionState.observe(this) { versionState -> + versionState ?: return@observe + when (versionState) { + VersionState.Latest -> setVersionLatestState() + VersionState.Update -> setVersionUpdateState() + VersionState.Unknown -> setVersionUnknownState() + } + } + } + + private fun setClickListener() { // 뒤로가기 binding.ivBack.setOnSingleClickListener { finish() } @@ -132,7 +175,5 @@ class SettingActivity : BaseBindingActivity(R.layout.act companion object { const val nickname = "nickname" - const val NOTICE_URL = - "https://skitter-sloth-be4.notion.site/What-is-Havit-3db94fcc0cdc4a38bddd87f790e0ac96" } } diff --git a/app/src/main/java/org/sopt/havit/ui/setting/viewmodel/SettingViewModel.kt b/app/src/main/java/org/sopt/havit/ui/setting/viewmodel/SettingViewModel.kt index fc9596e65..9ba3df749 100644 --- a/app/src/main/java/org/sopt/havit/ui/setting/viewmodel/SettingViewModel.kt +++ b/app/src/main/java/org/sopt/havit/ui/setting/viewmodel/SettingViewModel.kt @@ -1,47 +1,62 @@ package org.sopt.havit.ui.setting.viewmodel +import android.app.Application import android.content.ContentValues.TAG import android.util.Log +import androidx.lifecycle.AndroidViewModel import androidx.lifecycle.LiveData import androidx.lifecycle.MutableLiveData -import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope +import com.google.android.play.core.appupdate.AppUpdateManagerFactory +import com.google.android.play.core.install.model.UpdateAvailability import dagger.hilt.android.lifecycle.HiltViewModel import kotlinx.coroutines.launch +import org.sopt.havit.BuildConfig import org.sopt.havit.data.RetrofitObject import org.sopt.havit.data.remote.NewNicknameRequest import org.sopt.havit.data.remote.UserResponse import org.sopt.havit.domain.entity.Notice +import org.sopt.havit.domain.entity.VersionState import org.sopt.havit.domain.repository.AuthRepository import javax.inject.Inject @HiltViewModel class SettingViewModel @Inject constructor( - private val authRepository: AuthRepository -) : ViewModel() { -// private val token = MySharedPreference.getXAuthToken(context) - + private val authRepository: AuthRepository, + application: Application +) : AndroidViewModel(application) { private val token = authRepository.getAccessToken() private val _user = MutableLiveData() val user: LiveData = _user - private val _version = MutableLiveData() - val version: LiveData = _version - private val _isLatest = MutableLiveData() - val isLatest: LiveData = _isLatest + private val _currentVersion = MutableLiveData() + val currentVersion: LiveData = _currentVersion + private val _versionState = MutableLiveData(VersionState.Unknown) + val versionState: LiveData = _versionState // 환경설정_내정보수정 private val _nickname = MutableLiveData() val nickname: LiveData = _nickname // version 정보 가져옴 - fun setVersion(appVersion: String) { - _version.postValue(appVersion) - Log.d("TOKEN", "setting token : $token") - if (appVersion == "1.0") - _isLatest.postValue(true) - else - _isLatest.postValue(false) + fun setCurrentVersion() { + _currentVersion.postValue(BuildConfig.VERSION_NAME) + } + + fun getLatestVersion() { + val context = getApplication().applicationContext + val appUpdateManager = AppUpdateManagerFactory.create(context) + val appUpdateInfoTask = appUpdateManager.appUpdateInfo + appUpdateInfoTask.addOnSuccessListener { appUpdateInfo -> + if (appUpdateInfo.updateAvailability() == UpdateAvailability.UPDATE_AVAILABLE) { + _versionState.postValue(VersionState.Update) + } else { + _versionState.postValue(VersionState.Latest) + } + }.addOnFailureListener { exception -> + _versionState.postValue(VersionState.Unknown) + Log.e(TAG, "error getting update info(Play Store가 설치된 앱에서 사용해주세요)", exception) + } } // user data 가져옴 diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index a6cd2b04c..2f707fe3f 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -281,4 +281,5 @@ 메일을 전송할 수 없습니다 문제 발생 현재 버전  + - From a608d8a11ca4a3ffdace320a070158eb9bbfc51a Mon Sep 17 00:00:00 2001 From: kxxhyorim Date: Mon, 8 May 2023 06:47:56 +0900 Subject: [PATCH 14/17] =?UTF-8?q?[FEAT]=20=EC=97=85=EB=8D=B0=EC=9D=B4?= =?UTF-8?q?=ED=8A=B8=20=EA=B0=80=EB=8A=A5=ED=95=A0=20=EA=B2=BD=EC=9A=B0=20?= =?UTF-8?q?play=20store=EB=A1=9C=20=EC=97=B0=EA=B2=B0=20=EA=B8=B0=EB=8A=A5?= =?UTF-8?q?=20=EA=B5=AC=ED=98=84=20(#841)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/build.gradle | 2 +- .../sopt/havit/ui/setting/SettingActivity.kt | 23 +++++++++++++++++++ app/src/main/res/layout/activity_setting.xml | 15 +++++++----- 3 files changed, 33 insertions(+), 7 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 65631832a..8720763a9 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -20,7 +20,7 @@ android { applicationId "org.sopt.havit" minSdk 23 targetSdk 31 - versionCode 104 + versionCode 105 versionName "1.0.5" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" buildConfigField("String", "HAVIT_BASE_URL_DEV", properties["HAVIT_BASE_URL_DEV"]) diff --git a/app/src/main/java/org/sopt/havit/ui/setting/SettingActivity.kt b/app/src/main/java/org/sopt/havit/ui/setting/SettingActivity.kt index cfe063d45..cbc6ec79c 100644 --- a/app/src/main/java/org/sopt/havit/ui/setting/SettingActivity.kt +++ b/app/src/main/java/org/sopt/havit/ui/setting/SettingActivity.kt @@ -17,6 +17,7 @@ import org.sopt.havit.ui.setting.viewmodel.SettingViewModel import org.sopt.havit.ui.sign.SplashWithSignActivity import org.sopt.havit.util.CANNOT_SEND_MAIL_TYPE import org.sopt.havit.util.DialogUtil +import org.sopt.havit.util.ERROR_OCCUR_TYPE import org.sopt.havit.util.HavitSharedPreference import org.sopt.havit.util.ToastUtil import org.sopt.havit.util.setOnSingleClickListener @@ -36,6 +37,7 @@ class SettingActivity : BaseBindingActivity(R.layout.act setClickListener() getLatestVersion() observeIsLatest() + onClickUpdate() } override fun onResume() { @@ -51,6 +53,27 @@ class SettingActivity : BaseBindingActivity(R.layout.act settingViewModel.getLatestVersion() } + private fun onClickUpdate() { + binding.tvVersionStatus.setOnSingleClickListener { + if (settingViewModel.versionState.value == VersionState.Update) { + linkToPlayStore() + } + } + } + + private fun linkToPlayStore() { + try { + val intent = Intent(Intent.ACTION_VIEW).apply { + data = Uri.parse("market://details?id=$packageName") + setPackage("com.android.vending") + } + startActivity(intent) + } catch (e: Exception) { + ToastUtil(this).makeToast(ERROR_OCCUR_TYPE) + } + } + + private fun setVersionLatestState() { with(binding.tvVersionStatus) { setText(R.string.latest_version) diff --git a/app/src/main/res/layout/activity_setting.xml b/app/src/main/res/layout/activity_setting.xml index 01d5fa8fb..54912a869 100644 --- a/app/src/main/res/layout/activity_setting.xml +++ b/app/src/main/res/layout/activity_setting.xml @@ -354,23 +354,26 @@ android:id="@+id/tv_version_status" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_marginEnd="16dp" - android:text="" + android:paddingHorizontal="18dp" + android:paddingTop="4dp" + android:paddingBottom="30dp" android:textAppearance="@style/Text15Semibold" app:layout_constraintEnd_toEndOf="parent" - app:layout_constraintTop_toTopOf="@id/tv_version_info" - tools:text="최신 버전" /> + app:layout_constraintTop_toTopOf="parent" + tools:text="업데이트" + tools:textColor="@color/gray_3" /> Date: Mon, 8 May 2023 07:16:09 +0900 Subject: [PATCH 15/17] =?UTF-8?q?[CHORE]=20=ED=98=84=EC=9E=AC=20=EB=B2=84?= =?UTF-8?q?=EC=A0=84=20=EC=A0=95=EB=B3=B4=20=EC=9E=90=EB=A3=8C=ED=98=95=20?= =?UTF-8?q?LiveData=20=EB=8C=80=EC=8B=A0=20String=20=EC=82=AC=EC=9A=A9=20(?= =?UTF-8?q?#841)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/org/sopt/havit/ui/setting/SettingActivity.kt | 5 ----- .../sopt/havit/ui/setting/viewmodel/SettingViewModel.kt | 9 +-------- 2 files changed, 1 insertion(+), 13 deletions(-) diff --git a/app/src/main/java/org/sopt/havit/ui/setting/SettingActivity.kt b/app/src/main/java/org/sopt/havit/ui/setting/SettingActivity.kt index cbc6ec79c..8c07674c5 100644 --- a/app/src/main/java/org/sopt/havit/ui/setting/SettingActivity.kt +++ b/app/src/main/java/org/sopt/havit/ui/setting/SettingActivity.kt @@ -33,7 +33,6 @@ class SettingActivity : BaseBindingActivity(R.layout.act override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) binding.vmSetting = settingViewModel - setVersion() setClickListener() getLatestVersion() observeIsLatest() @@ -45,10 +44,6 @@ class SettingActivity : BaseBindingActivity(R.layout.act setData() } - private fun setVersion() { - settingViewModel.setCurrentVersion() - } - private fun getLatestVersion() { settingViewModel.getLatestVersion() } diff --git a/app/src/main/java/org/sopt/havit/ui/setting/viewmodel/SettingViewModel.kt b/app/src/main/java/org/sopt/havit/ui/setting/viewmodel/SettingViewModel.kt index 9ba3df749..b9e4737e9 100644 --- a/app/src/main/java/org/sopt/havit/ui/setting/viewmodel/SettingViewModel.kt +++ b/app/src/main/java/org/sopt/havit/ui/setting/viewmodel/SettingViewModel.kt @@ -26,11 +26,9 @@ class SettingViewModel @Inject constructor( application: Application ) : AndroidViewModel(application) { private val token = authRepository.getAccessToken() - private val _user = MutableLiveData() val user: LiveData = _user - private val _currentVersion = MutableLiveData() - val currentVersion: LiveData = _currentVersion + val currentVersion: String = BuildConfig.VERSION_NAME private val _versionState = MutableLiveData(VersionState.Unknown) val versionState: LiveData = _versionState @@ -38,11 +36,6 @@ class SettingViewModel @Inject constructor( private val _nickname = MutableLiveData() val nickname: LiveData = _nickname - // version 정보 가져옴 - fun setCurrentVersion() { - _currentVersion.postValue(BuildConfig.VERSION_NAME) - } - fun getLatestVersion() { val context = getApplication().applicationContext val appUpdateManager = AppUpdateManagerFactory.create(context) From 654889b05fbc0b8dbe2ff339d0bf50df8fad43b3 Mon Sep 17 00:00:00 2001 From: kxxhyorim Date: Mon, 8 May 2023 19:52:38 +0900 Subject: [PATCH 16/17] [CHORE] version code, name v1.0.5 -> v1.0.6 (#854) --- app/build.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 8720763a9..66f0bcf24 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -20,8 +20,8 @@ android { applicationId "org.sopt.havit" minSdk 23 targetSdk 31 - versionCode 105 - versionName "1.0.5" + versionCode 106 + versionName "1.0.6" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" buildConfigField("String", "HAVIT_BASE_URL_DEV", properties["HAVIT_BASE_URL_DEV"]) buildConfigField("String", "HAVIT_BASE_URL_PROD", properties["HAVIT_BASE_URL_PROD"]) From b773cb8bffecf53a7f2986ceb6538c7a33486680 Mon Sep 17 00:00:00 2001 From: kxxhyorim Date: Mon, 8 May 2023 20:08:49 +0900 Subject: [PATCH 17/17] =?UTF-8?q?[FIX]=20google=20sdk=20=EB=AC=B8=EC=A0=9C?= =?UTF-8?q?=EB=A1=9C=20NP=EB=B0=9C=EC=83=9D=20=EB=B2=84=EA=B7=B8=20?= =?UTF-8?q?=EC=88=98=EC=A0=95=20(#855)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/build.gradle | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/build.gradle b/app/build.gradle index 66f0bcf24..aa48e2728 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -160,4 +160,8 @@ dependencies { implementation 'com.google.android.play:app-update:2.0.1' implementation 'com.google.android.play:app-update-ktx:2.0.1' + // google play service + implementation 'com.google.android.gms:play-services-base:18.0.1' + implementation 'com.google.android.gms:play-services-tasks:18.0.1' + }