From f34af04aa60ae2e3fdc2e33135051fa6e4d72285 Mon Sep 17 00:00:00 2001 From: ootr47 Date: Mon, 11 Dec 2023 19:55:38 +0900 Subject: [PATCH 1/8] =?UTF-8?q?fix:=20=EB=A7=88=EC=9D=B4=ED=8E=98=EC=9D=B4?= =?UTF-8?q?=EC=A7=80=20=ED=85=8C=EB=A7=88=20=EB=8B=A4=EC=9D=B4=EC=96=BC?= =?UTF-8?q?=EB=A1=9C=EA=B7=B8=20=ED=94=84=EB=9E=98=EA=B7=B8=EB=A8=BC?= =?UTF-8?q?=ED=8A=B8=20=EB=8D=94=EB=B8=94=20=ED=81=B4=EB=A6=AD=20=EC=8B=9C?= =?UTF-8?q?=20=EC=95=B1=EC=9D=B4=20=EC=A2=85=EB=A3=8C=EB=90=98=EB=8A=94=20?= =?UTF-8?q?=EC=98=A4=EB=A5=98=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/priceguard/ui/additem/AddItemActivity.kt | 5 +---- .../ui/additem/link/RegisterItemLinkFragment.kt | 5 +---- .../app/priceguard/ui/home/mypage/MyPageFragment.kt | 3 ++- .../priceguard/ui/util/NavControllerExtensions.kt | 12 ++++++++++++ 4 files changed, 16 insertions(+), 9 deletions(-) create mode 100644 android/app/src/main/java/app/priceguard/ui/util/NavControllerExtensions.kt diff --git a/android/app/src/main/java/app/priceguard/ui/additem/AddItemActivity.kt b/android/app/src/main/java/app/priceguard/ui/additem/AddItemActivity.kt index 132accb..79762b4 100644 --- a/android/app/src/main/java/app/priceguard/ui/additem/AddItemActivity.kt +++ b/android/app/src/main/java/app/priceguard/ui/additem/AddItemActivity.kt @@ -9,6 +9,7 @@ import androidx.navigation.fragment.NavHostFragment import app.priceguard.R import app.priceguard.databinding.ActivityAddItemBinding import app.priceguard.ui.additem.link.RegisterItemLinkFragmentDirections +import app.priceguard.ui.util.safeNavigate import dagger.hilt.android.AndroidEntryPoint @AndroidEntryPoint @@ -48,8 +49,4 @@ class AddItemActivity : AppCompatActivity() { navController.safeNavigate(action) } } - - private fun NavController.safeNavigate(direction: NavDirections) { - currentDestination?.getAction(direction.actionId)?.run { navigate(direction) } - } } diff --git a/android/app/src/main/java/app/priceguard/ui/additem/link/RegisterItemLinkFragment.kt b/android/app/src/main/java/app/priceguard/ui/additem/link/RegisterItemLinkFragment.kt index 197c9f1..28e29e8 100644 --- a/android/app/src/main/java/app/priceguard/ui/additem/link/RegisterItemLinkFragment.kt +++ b/android/app/src/main/java/app/priceguard/ui/additem/link/RegisterItemLinkFragment.kt @@ -17,6 +17,7 @@ import app.priceguard.data.repository.token.TokenRepository import app.priceguard.databinding.FragmentRegisterItemLinkBinding import app.priceguard.ui.home.HomeActivity import app.priceguard.ui.util.lifecycle.repeatOnStarted +import app.priceguard.ui.util.safeNavigate import app.priceguard.ui.util.showDialogWithLogout import dagger.hilt.android.AndroidEntryPoint import javax.inject.Inject @@ -132,10 +133,6 @@ class RegisterItemLinkFragment : Fragment() { binding.tvRegisterItemError.text = message } - private fun NavController.safeNavigate(direction: NavDirections) { - currentDestination?.getAction(direction.actionId)?.run { navigate(direction) } - } - override fun onDestroyView() { super.onDestroyView() _binding = null diff --git a/android/app/src/main/java/app/priceguard/ui/home/mypage/MyPageFragment.kt b/android/app/src/main/java/app/priceguard/ui/home/mypage/MyPageFragment.kt index b0e5c76..0d68bc0 100644 --- a/android/app/src/main/java/app/priceguard/ui/home/mypage/MyPageFragment.kt +++ b/android/app/src/main/java/app/priceguard/ui/home/mypage/MyPageFragment.kt @@ -18,6 +18,7 @@ import app.priceguard.ui.intro.IntroActivity import app.priceguard.ui.util.ConfirmDialogFragment import app.priceguard.ui.util.lifecycle.repeatOnStarted import app.priceguard.ui.util.openNotificationSettings +import app.priceguard.ui.util.safeNavigate import com.google.android.gms.oss.licenses.OssLicensesMenuActivity import dagger.hilt.android.AndroidEntryPoint import javax.inject.Inject @@ -69,7 +70,7 @@ class MyPageFragment : Fragment(), ConfirmDialogFragment.OnDialogResultListener } Setting.THEME -> { - findNavController().navigate(R.id.action_myPageFragment_to_themeDialogFragment) + findNavController().safeNavigate(R.id.action_myPageFragment_to_themeDialogFragment) } Setting.LICENSE -> { diff --git a/android/app/src/main/java/app/priceguard/ui/util/NavControllerExtensions.kt b/android/app/src/main/java/app/priceguard/ui/util/NavControllerExtensions.kt new file mode 100644 index 0000000..7b45e79 --- /dev/null +++ b/android/app/src/main/java/app/priceguard/ui/util/NavControllerExtensions.kt @@ -0,0 +1,12 @@ +package app.priceguard.ui.util + +import androidx.navigation.NavController +import androidx.navigation.NavDirections + +fun NavController.safeNavigate(direction: NavDirections) { + currentDestination?.getAction(direction.actionId)?.run { navigate(direction) } +} + +fun NavController.safeNavigate(actionId: Int) { + currentDestination?.getAction(actionId)?.run { navigate(actionId) } +} From 9162e2e23d6d96e3b1af5a845ec58ad7cdd77f66 Mon Sep 17 00:00:00 2001 From: ootr47 Date: Mon, 11 Dec 2023 20:09:25 +0900 Subject: [PATCH 2/8] =?UTF-8?q?fix:=20=EB=8B=A4=EC=9D=B4=EC=96=BC=EB=A1=9C?= =?UTF-8?q?=EA=B7=B8=20=ED=94=84=EB=9E=98=EA=B7=B8=EB=A8=BC=ED=8A=B8=202?= =?UTF-8?q?=EB=B2=88=20=EC=83=9D=EC=84=B1=EB=90=98=EB=8A=94=20=EC=98=A4?= =?UTF-8?q?=EB=A5=98=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/priceguard/ui/detail/DetailActivity.kt | 5 ++++- .../ui/home/mypage/MyPageFragment.kt | 5 ++++- .../main/java/app/priceguard/ui/util/Dialog.kt | 18 +++++++++++++++--- 3 files changed, 23 insertions(+), 5 deletions(-) diff --git a/android/app/src/main/java/app/priceguard/ui/detail/DetailActivity.kt b/android/app/src/main/java/app/priceguard/ui/detail/DetailActivity.kt index 8a2dd22..9895d32 100644 --- a/android/app/src/main/java/app/priceguard/ui/detail/DetailActivity.kt +++ b/android/app/src/main/java/app/priceguard/ui/detail/DetailActivity.kt @@ -270,6 +270,9 @@ class DetailActivity : AppCompatActivity(), ConfirmDialogFragment.OnDialogResult } private fun showConfirmationDialogForResult() { + val tag = "confirm_dialog_fragment_from_activity" + if(supportFragmentManager.findFragmentByTag(tag) != null) return + val dialogFragment = ConfirmDialogFragment() val bundle = Bundle() bundle.putString("title", getString(R.string.stop_tracking_confirm)) @@ -277,7 +280,7 @@ class DetailActivity : AppCompatActivity(), ConfirmDialogFragment.OnDialogResult bundle.putString("actionString", DialogConfirmAction.CUSTOM.name) dialogFragment.arguments = bundle dialogFragment.setOnDialogResultListener(this) - dialogFragment.show(supportFragmentManager, "confirm_dialog_fragment_from_fragment") + dialogFragment.show(supportFragmentManager, tag) } private fun showToast(message: String) { diff --git a/android/app/src/main/java/app/priceguard/ui/home/mypage/MyPageFragment.kt b/android/app/src/main/java/app/priceguard/ui/home/mypage/MyPageFragment.kt index 0d68bc0..70ae68e 100644 --- a/android/app/src/main/java/app/priceguard/ui/home/mypage/MyPageFragment.kt +++ b/android/app/src/main/java/app/priceguard/ui/home/mypage/MyPageFragment.kt @@ -112,6 +112,9 @@ class MyPageFragment : Fragment(), ConfirmDialogFragment.OnDialogResultListener } private fun showConfirmationDialogForResult() { + val tag = "confirm_dialog_fragment_from_activity" + if(requireActivity().supportFragmentManager.findFragmentByTag(tag) != null) return + val dialogFragment = ConfirmDialogFragment() val bundle = Bundle() bundle.putString("title", getString(R.string.logout_confirm_title)) @@ -119,7 +122,7 @@ class MyPageFragment : Fragment(), ConfirmDialogFragment.OnDialogResultListener bundle.putString("actionString", DialogConfirmAction.CUSTOM.name) dialogFragment.arguments = bundle dialogFragment.setOnDialogResultListener(this) - dialogFragment.show(requireActivity().supportFragmentManager, "confirm_dialog_fragment_from_fragment") + dialogFragment.show(requireActivity().supportFragmentManager, tag) } private fun startIntroAndExitHome() { diff --git a/android/app/src/main/java/app/priceguard/ui/util/Dialog.kt b/android/app/src/main/java/app/priceguard/ui/util/Dialog.kt index c2bf0e9..359e1d7 100644 --- a/android/app/src/main/java/app/priceguard/ui/util/Dialog.kt +++ b/android/app/src/main/java/app/priceguard/ui/util/Dialog.kt @@ -11,13 +11,16 @@ fun AppCompatActivity.showConfirmDialog( message: String, action: DialogConfirmAction = DialogConfirmAction.NOTHING ) { + val tag = "confirm_dialog_fragment_from_activity" + if(supportFragmentManager.findFragmentByTag(tag) != null) return + val dialogFragment = ConfirmDialogFragment() val bundle = Bundle() bundle.putString("title", title) bundle.putString("message", message) bundle.putString("actionString", action.name) dialogFragment.arguments = bundle - dialogFragment.show(supportFragmentManager, "confirm_dialog_fragment_from_activity") + dialogFragment.show(supportFragmentManager, tag) } fun Fragment.showDialogWithAction( @@ -25,21 +28,30 @@ fun Fragment.showDialogWithAction( message: String, action: DialogConfirmAction = DialogConfirmAction.NOTHING ) { + val tag = "confirm_dialog_fragment_from_activity" + if(requireActivity().supportFragmentManager.findFragmentByTag(tag) != null) return + val dialogFragment = ConfirmDialogFragment() val bundle = Bundle() bundle.putString("title", title) bundle.putString("message", message) bundle.putString("actionString", action.name) dialogFragment.arguments = bundle - dialogFragment.show(requireActivity().supportFragmentManager, "confirm_dialog_fragment_from_fragment") + dialogFragment.show(requireActivity().supportFragmentManager, tag) } fun AppCompatActivity.showDialogWithLogout() { + val tag = "error_dialog_fragment_from_fragment" + if(supportFragmentManager.findFragmentByTag(tag) != null) return + val dialogFragment = ErrorDialogFragment() dialogFragment.show(supportFragmentManager, "error_dialog_fragment_from_activity") } fun Fragment.showDialogWithLogout() { + val tag = "error_dialog_fragment_from_fragment" + if(requireActivity().supportFragmentManager.findFragmentByTag(tag) != null) return + val dialogFragment = ErrorDialogFragment() - dialogFragment.show(requireActivity().supportFragmentManager, "error_dialog_fragment_from_fragment") + dialogFragment.show(requireActivity().supportFragmentManager, tag) } From a3fd26261b20ba4335d0bd4853bfcf3186642c42 Mon Sep 17 00:00:00 2001 From: ootr47 Date: Mon, 11 Dec 2023 20:38:00 +0900 Subject: [PATCH 3/8] =?UTF-8?q?fix:=20=EA=B3=B5=EC=9C=A0=ED=99=94=EB=A9=B4?= =?UTF-8?q?=202=EB=B2=88=20=EC=83=9D=EC=84=B1=EB=90=98=EB=8A=94=20?= =?UTF-8?q?=EC=98=A4=EB=A5=98=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/app/priceguard/ui/detail/DetailActivity.kt | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/android/app/src/main/java/app/priceguard/ui/detail/DetailActivity.kt b/android/app/src/main/java/app/priceguard/ui/detail/DetailActivity.kt index 9895d32..7f784e3 100644 --- a/android/app/src/main/java/app/priceguard/ui/detail/DetailActivity.kt +++ b/android/app/src/main/java/app/priceguard/ui/detail/DetailActivity.kt @@ -5,6 +5,7 @@ import android.net.Uri import android.os.Bundle import android.widget.Toast import androidx.activity.addCallback +import androidx.activity.result.contract.ActivityResultContracts import androidx.activity.viewModels import androidx.appcompat.app.AppCompatActivity import app.priceguard.R @@ -32,6 +33,11 @@ class DetailActivity : AppCompatActivity(), ConfirmDialogFragment.OnDialogResult private lateinit var binding: ActivityDetailBinding private val productDetailViewModel: ProductDetailViewModel by viewModels() + private val activityResultLauncher = + registerForActivityResult(ActivityResultContracts.StartActivityForResult()) { + binding.btnDetailShare.isEnabled = true + } + override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) binding = ActivityDetailBinding.inflate(layoutInflater) @@ -101,6 +107,7 @@ class DetailActivity : AppCompatActivity(), ConfirmDialogFragment.OnDialogResult } binding.btnDetailShare.setOnClickListener { + binding.btnDetailShare.isEnabled = false val shareLink = getString(R.string.share_link_template, productDetailViewModel.productCode) @@ -112,7 +119,7 @@ class DetailActivity : AppCompatActivity(), ConfirmDialogFragment.OnDialogResult } val shareIntent = Intent.createChooser(sendIntent, null) - startActivity(shareIntent) + activityResultLauncher.launch(shareIntent) } } @@ -271,7 +278,7 @@ class DetailActivity : AppCompatActivity(), ConfirmDialogFragment.OnDialogResult private fun showConfirmationDialogForResult() { val tag = "confirm_dialog_fragment_from_activity" - if(supportFragmentManager.findFragmentByTag(tag) != null) return + if (supportFragmentManager.findFragmentByTag(tag) != null) return val dialogFragment = ConfirmDialogFragment() val bundle = Bundle() From ce3d400e0679d6f77dff52c8db393c910f0ec4c2 Mon Sep 17 00:00:00 2001 From: ootr47 Date: Mon, 11 Dec 2023 20:38:26 +0900 Subject: [PATCH 4/8] =?UTF-8?q?refactor:=20=EB=A6=AC=ED=8F=AC=EB=A7=B7,=20?= =?UTF-8?q?=EC=82=AC=EC=9A=A9=ED=95=98=EC=A7=80=20=EC=95=8A=EB=8A=94=20?= =?UTF-8?q?=EC=BD=94=EB=93=9C=20=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/app/priceguard/ui/additem/AddItemActivity.kt | 2 -- .../ui/additem/link/RegisterItemLinkFragment.kt | 2 -- .../java/app/priceguard/ui/home/mypage/MyPageFragment.kt | 2 +- .../app/src/main/java/app/priceguard/ui/util/Dialog.kt | 8 ++++---- 4 files changed, 5 insertions(+), 9 deletions(-) diff --git a/android/app/src/main/java/app/priceguard/ui/additem/AddItemActivity.kt b/android/app/src/main/java/app/priceguard/ui/additem/AddItemActivity.kt index 79762b4..9120d89 100644 --- a/android/app/src/main/java/app/priceguard/ui/additem/AddItemActivity.kt +++ b/android/app/src/main/java/app/priceguard/ui/additem/AddItemActivity.kt @@ -3,8 +3,6 @@ package app.priceguard.ui.additem import android.content.Intent import android.os.Bundle import androidx.appcompat.app.AppCompatActivity -import androidx.navigation.NavController -import androidx.navigation.NavDirections import androidx.navigation.fragment.NavHostFragment import app.priceguard.R import app.priceguard.databinding.ActivityAddItemBinding diff --git a/android/app/src/main/java/app/priceguard/ui/additem/link/RegisterItemLinkFragment.kt b/android/app/src/main/java/app/priceguard/ui/additem/link/RegisterItemLinkFragment.kt index 28e29e8..25b033a 100644 --- a/android/app/src/main/java/app/priceguard/ui/additem/link/RegisterItemLinkFragment.kt +++ b/android/app/src/main/java/app/priceguard/ui/additem/link/RegisterItemLinkFragment.kt @@ -8,8 +8,6 @@ import android.view.ViewGroup import androidx.activity.addCallback import androidx.fragment.app.Fragment import androidx.fragment.app.viewModels -import androidx.navigation.NavController -import androidx.navigation.NavDirections import androidx.navigation.fragment.findNavController import app.priceguard.R import app.priceguard.data.repository.product.ProductErrorState diff --git a/android/app/src/main/java/app/priceguard/ui/home/mypage/MyPageFragment.kt b/android/app/src/main/java/app/priceguard/ui/home/mypage/MyPageFragment.kt index 70ae68e..77c0c7b 100644 --- a/android/app/src/main/java/app/priceguard/ui/home/mypage/MyPageFragment.kt +++ b/android/app/src/main/java/app/priceguard/ui/home/mypage/MyPageFragment.kt @@ -113,7 +113,7 @@ class MyPageFragment : Fragment(), ConfirmDialogFragment.OnDialogResultListener private fun showConfirmationDialogForResult() { val tag = "confirm_dialog_fragment_from_activity" - if(requireActivity().supportFragmentManager.findFragmentByTag(tag) != null) return + if (requireActivity().supportFragmentManager.findFragmentByTag(tag) != null) return val dialogFragment = ConfirmDialogFragment() val bundle = Bundle() diff --git a/android/app/src/main/java/app/priceguard/ui/util/Dialog.kt b/android/app/src/main/java/app/priceguard/ui/util/Dialog.kt index 359e1d7..f635091 100644 --- a/android/app/src/main/java/app/priceguard/ui/util/Dialog.kt +++ b/android/app/src/main/java/app/priceguard/ui/util/Dialog.kt @@ -12,7 +12,7 @@ fun AppCompatActivity.showConfirmDialog( action: DialogConfirmAction = DialogConfirmAction.NOTHING ) { val tag = "confirm_dialog_fragment_from_activity" - if(supportFragmentManager.findFragmentByTag(tag) != null) return + if (supportFragmentManager.findFragmentByTag(tag) != null) return val dialogFragment = ConfirmDialogFragment() val bundle = Bundle() @@ -29,7 +29,7 @@ fun Fragment.showDialogWithAction( action: DialogConfirmAction = DialogConfirmAction.NOTHING ) { val tag = "confirm_dialog_fragment_from_activity" - if(requireActivity().supportFragmentManager.findFragmentByTag(tag) != null) return + if (requireActivity().supportFragmentManager.findFragmentByTag(tag) != null) return val dialogFragment = ConfirmDialogFragment() val bundle = Bundle() @@ -42,7 +42,7 @@ fun Fragment.showDialogWithAction( fun AppCompatActivity.showDialogWithLogout() { val tag = "error_dialog_fragment_from_fragment" - if(supportFragmentManager.findFragmentByTag(tag) != null) return + if (supportFragmentManager.findFragmentByTag(tag) != null) return val dialogFragment = ErrorDialogFragment() dialogFragment.show(supportFragmentManager, "error_dialog_fragment_from_activity") @@ -50,7 +50,7 @@ fun AppCompatActivity.showDialogWithLogout() { fun Fragment.showDialogWithLogout() { val tag = "error_dialog_fragment_from_fragment" - if(requireActivity().supportFragmentManager.findFragmentByTag(tag) != null) return + if (requireActivity().supportFragmentManager.findFragmentByTag(tag) != null) return val dialogFragment = ErrorDialogFragment() dialogFragment.show(requireActivity().supportFragmentManager, tag) From f580ad901dd0e0ad177bc3af52ee9ff59f885223 Mon Sep 17 00:00:00 2001 From: ootr47 Date: Mon, 11 Dec 2023 21:20:58 +0900 Subject: [PATCH 5/8] =?UTF-8?q?fix:=20=EB=84=A4=ED=8A=B8=EC=9B=8C=ED=81=AC?= =?UTF-8?q?=20=EC=9A=94=EC=B2=AD=20=EB=B2=84=ED=8A=BC=202=EB=B2=88=20?= =?UTF-8?q?=EC=9D=B4=EC=83=81=20=EB=88=8C=EB=A6=AC=EB=8A=94=20=ED=98=84?= =?UTF-8?q?=EC=83=81=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ui/additem/setprice/SetTargetPriceViewModel.kt | 5 ++++- .../java/app/priceguard/ui/login/LoginActivity.kt | 11 +++++++++-- .../java/app/priceguard/ui/signup/SignupViewModel.kt | 2 ++ android/app/src/main/res/layout/activity_login.xml | 1 + .../src/main/res/layout/fragment_set_target_price.xml | 2 ++ 5 files changed, 18 insertions(+), 3 deletions(-) diff --git a/android/app/src/main/java/app/priceguard/ui/additem/setprice/SetTargetPriceViewModel.kt b/android/app/src/main/java/app/priceguard/ui/additem/setprice/SetTargetPriceViewModel.kt index 5120522..c40b3d0 100644 --- a/android/app/src/main/java/app/priceguard/ui/additem/setprice/SetTargetPriceViewModel.kt +++ b/android/app/src/main/java/app/priceguard/ui/additem/setprice/SetTargetPriceViewModel.kt @@ -21,7 +21,8 @@ class SetTargetPriceViewModel @Inject constructor(private val productRepository: val productCode: String = "", val targetPrice: Int = 0, val productName: String = "", - val productPrice: Int = 0 + val productPrice: Int = 0, + val isReady: Boolean = true ) sealed class SetTargetPriceEvent { @@ -39,6 +40,7 @@ class SetTargetPriceViewModel @Inject constructor(private val productRepository: fun addProduct() { viewModelScope.launch { + _state.value = state.value.copy(isReady = false) val response = productRepository.addProduct( _state.value.productCode, _state.value.targetPrice @@ -52,6 +54,7 @@ class SetTargetPriceViewModel @Inject constructor(private val productRepository: _event.emit(SetTargetPriceEvent.FailurePriceAdd(response.errorState)) } } + _state.value = state.value.copy(isReady = true) } } diff --git a/android/app/src/main/java/app/priceguard/ui/login/LoginActivity.kt b/android/app/src/main/java/app/priceguard/ui/login/LoginActivity.kt index 598a10f..fc08e1b 100644 --- a/android/app/src/main/java/app/priceguard/ui/login/LoginActivity.kt +++ b/android/app/src/main/java/app/priceguard/ui/login/LoginActivity.kt @@ -29,6 +29,7 @@ class LoginActivity : AppCompatActivity() { binding = ActivityLoginBinding.inflate(layoutInflater) with(binding) { viewModel = loginViewModel + lifecycleOwner = this@LoginActivity } circularProgressIndicator = getCircularProgressIndicatorDrawable(this@LoginActivity) initListener() @@ -84,11 +85,17 @@ class LoginActivity : AppCompatActivity() { } is LoginEvent.LoginFailure -> { - showConfirmDialog(getString(R.string.login_fail), getString(R.string.login_fail_message)) + showConfirmDialog( + getString(R.string.login_fail), + getString(R.string.login_fail_message) + ) } is LoginEvent.UndefinedError -> { - showConfirmDialog(getString(R.string.login_fail), getString(R.string.undefined_error)) + showConfirmDialog( + getString(R.string.login_fail), + getString(R.string.undefined_error) + ) } is LoginEvent.LoginInfoSaved -> { diff --git a/android/app/src/main/java/app/priceguard/ui/signup/SignupViewModel.kt b/android/app/src/main/java/app/priceguard/ui/signup/SignupViewModel.kt index b5e5d10..5afa6ee 100644 --- a/android/app/src/main/java/app/priceguard/ui/signup/SignupViewModel.kt +++ b/android/app/src/main/java/app/priceguard/ui/signup/SignupViewModel.kt @@ -65,6 +65,7 @@ class SignupViewModel @Inject constructor( } viewModelScope.launch { + _state.value = state.value.copy(isSignupReady = false) sendSignupEvent(SignupEvent.SignupStart) Log.d("ViewModel", "Event Start Sent") updateSignupStarted(true) @@ -106,6 +107,7 @@ class SignupViewModel @Inject constructor( ) } } + _state.value = state.value.copy(isSignupReady = true) updateSignupStarted(false) } } diff --git a/android/app/src/main/res/layout/activity_login.xml b/android/app/src/main/res/layout/activity_login.xml index f13864e..fe54ddc 100644 --- a/android/app/src/main/res/layout/activity_login.xml +++ b/android/app/src/main/res/layout/activity_login.xml @@ -110,6 +110,7 @@ android:layout_height="wrap_content" android:layout_marginTop="16dp" android:onClick="@{() -> viewModel.login()}" + android:enabled="@{!viewModel.state.loading}" android:text="@string/login" app:iconGravity="textStart" app:layout_constraintEnd_toStartOf="@+id/gl_vertical_end" diff --git a/android/app/src/main/res/layout/fragment_set_target_price.xml b/android/app/src/main/res/layout/fragment_set_target_price.xml index 05126f0..6162bc7 100644 --- a/android/app/src/main/res/layout/fragment_set_target_price.xml +++ b/android/app/src/main/res/layout/fragment_set_target_price.xml @@ -118,6 +118,7 @@ android:layout_height="wrap_content" android:layout_marginTop="32dp" android:layout_marginBottom="16dp" + android:enabled="@{viewModel.state.ready}" android:text="@string/back" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintStart_toEndOf="@id/gl_vertical_start" @@ -128,6 +129,7 @@ android:id="@+id/btn_confirm_item_next" android:layout_width="wrap_content" android:layout_height="wrap_content" + android:enabled="@{viewModel.state.ready}" android:text="@string/finish" app:layout_constraintBottom_toBottomOf="@id/btn_confirm_item_back" app:layout_constraintEnd_toStartOf="@id/gl_vertical_end" From 699fa87fe25ceb8cc6a6ddeb23ffa78d884f9ecc Mon Sep 17 00:00:00 2001 From: ootr47 Date: Mon, 11 Dec 2023 21:21:41 +0900 Subject: [PATCH 6/8] =?UTF-8?q?fix:=20=EC=83=81=ED=92=88=20=EC=A4=91?= =?UTF-8?q?=EB=B3=B5=20=EB=93=B1=EB=A1=9D=20=EC=8B=9C=20=EB=8F=99=EC=9E=91?= =?UTF-8?q?=20=EC=95=A1=EC=85=98=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../priceguard/ui/additem/setprice/SetTargetPriceFragment.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/android/app/src/main/java/app/priceguard/ui/additem/setprice/SetTargetPriceFragment.kt b/android/app/src/main/java/app/priceguard/ui/additem/setprice/SetTargetPriceFragment.kt index 18e51f2..3a3210d 100644 --- a/android/app/src/main/java/app/priceguard/ui/additem/setprice/SetTargetPriceFragment.kt +++ b/android/app/src/main/java/app/priceguard/ui/additem/setprice/SetTargetPriceFragment.kt @@ -183,7 +183,8 @@ class SetTargetPriceFragment : Fragment() { ProductErrorState.EXIST -> { showDialogWithAction( getString(R.string.error_add_product), - getString(R.string.exist_product) + getString(R.string.exist_product), + DialogConfirmAction.FINISH ) } From 8b4f98be8e4ed563ddf325d4254dbe2dc06733e5 Mon Sep 17 00:00:00 2001 From: ootr47 Date: Mon, 11 Dec 2023 22:18:45 +0900 Subject: [PATCH 7/8] =?UTF-8?q?fix:=20=EB=A1=9C=EA=B7=B8=EC=9D=B8,=20?= =?UTF-8?q?=ED=9A=8C=EC=9B=90=EA=B0=80=EC=9E=85=20=EB=B2=84=ED=8A=BC=20ena?= =?UTF-8?q?bled=20=EC=84=A4=EC=A0=95=20=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/app/priceguard/ui/signup/SignupViewModel.kt | 5 ++--- android/app/src/main/res/layout/activity_login.xml | 1 - android/app/src/main/res/layout/activity_signup.xml | 1 - android/app/src/main/res/layout/fragment_my_page.xml | 2 +- 4 files changed, 3 insertions(+), 6 deletions(-) diff --git a/android/app/src/main/java/app/priceguard/ui/signup/SignupViewModel.kt b/android/app/src/main/java/app/priceguard/ui/signup/SignupViewModel.kt index 5afa6ee..1ed9b68 100644 --- a/android/app/src/main/java/app/priceguard/ui/signup/SignupViewModel.kt +++ b/android/app/src/main/java/app/priceguard/ui/signup/SignupViewModel.kt @@ -65,10 +65,10 @@ class SignupViewModel @Inject constructor( } viewModelScope.launch { - _state.value = state.value.copy(isSignupReady = false) + updateSignupStarted(true) sendSignupEvent(SignupEvent.SignupStart) Log.d("ViewModel", "Event Start Sent") - updateSignupStarted(true) + val result = authRepository.signUp(_state.value.email, _state.value.name, _state.value.password) @@ -107,7 +107,6 @@ class SignupViewModel @Inject constructor( ) } } - _state.value = state.value.copy(isSignupReady = true) updateSignupStarted(false) } } diff --git a/android/app/src/main/res/layout/activity_login.xml b/android/app/src/main/res/layout/activity_login.xml index fe54ddc..f13864e 100644 --- a/android/app/src/main/res/layout/activity_login.xml +++ b/android/app/src/main/res/layout/activity_login.xml @@ -110,7 +110,6 @@ android:layout_height="wrap_content" android:layout_marginTop="16dp" android:onClick="@{() -> viewModel.login()}" - android:enabled="@{!viewModel.state.loading}" android:text="@string/login" app:iconGravity="textStart" app:layout_constraintEnd_toStartOf="@+id/gl_vertical_end" diff --git a/android/app/src/main/res/layout/activity_signup.xml b/android/app/src/main/res/layout/activity_signup.xml index 194ea2e..af80f5e 100644 --- a/android/app/src/main/res/layout/activity_signup.xml +++ b/android/app/src/main/res/layout/activity_signup.xml @@ -170,7 +170,6 @@ android:layout_width="0dp" android:layout_height="wrap_content" android:layout_marginTop="36dp" - android:enabled="@{vm.state.signupReady}" android:onClick="@{() -> vm.signup()}" android:text="@string/register" app:iconGravity="textStart" diff --git a/android/app/src/main/res/layout/fragment_my_page.xml b/android/app/src/main/res/layout/fragment_my_page.xml index cf89cc9..c50dc56 100644 --- a/android/app/src/main/res/layout/fragment_my_page.xml +++ b/android/app/src/main/res/layout/fragment_my_page.xml @@ -53,7 +53,7 @@ Date: Mon, 11 Dec 2023 22:25:29 +0900 Subject: [PATCH 8/8] =?UTF-8?q?fix:=20=EC=9E=98=EB=AA=BB=20=EC=A0=9C?= =?UTF-8?q?=EA=B1=B0=ED=95=9C=20=EB=B2=84=ED=8A=BC=20enabled=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80,=20=EC=82=AC=EC=9A=A9=ED=95=98=EC=A7=80=20=EC=95=8A?= =?UTF-8?q?=EB=8A=94=20=EC=BD=94=EB=93=9C=20=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/src/main/java/app/priceguard/ui/login/LoginActivity.kt | 1 - android/app/src/main/res/layout/activity_signup.xml | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/android/app/src/main/java/app/priceguard/ui/login/LoginActivity.kt b/android/app/src/main/java/app/priceguard/ui/login/LoginActivity.kt index fc08e1b..3a8e2e3 100644 --- a/android/app/src/main/java/app/priceguard/ui/login/LoginActivity.kt +++ b/android/app/src/main/java/app/priceguard/ui/login/LoginActivity.kt @@ -29,7 +29,6 @@ class LoginActivity : AppCompatActivity() { binding = ActivityLoginBinding.inflate(layoutInflater) with(binding) { viewModel = loginViewModel - lifecycleOwner = this@LoginActivity } circularProgressIndicator = getCircularProgressIndicatorDrawable(this@LoginActivity) initListener() diff --git a/android/app/src/main/res/layout/activity_signup.xml b/android/app/src/main/res/layout/activity_signup.xml index af80f5e..194ea2e 100644 --- a/android/app/src/main/res/layout/activity_signup.xml +++ b/android/app/src/main/res/layout/activity_signup.xml @@ -170,6 +170,7 @@ android:layout_width="0dp" android:layout_height="wrap_content" android:layout_marginTop="36dp" + android:enabled="@{vm.state.signupReady}" android:onClick="@{() -> vm.signup()}" android:text="@string/register" app:iconGravity="textStart"