From a7c6e42055dacb49736d3496b22913e230e837ce Mon Sep 17 00:00:00 2001 From: leeeha Date: Wed, 24 Jan 2024 19:41:05 +0900 Subject: [PATCH 01/26] =?UTF-8?q?[chore]=20#238=20=EC=A0=88=EC=95=BD=20?= =?UTF-8?q?=ED=94=BC=EB=93=9C=20=EC=97=85=EB=A1=9C=EB=93=9C=20=EB=B7=B0?= =?UTF-8?q?=EC=97=90=EC=84=9C=20=ED=85=8D=EC=8A=A4=ED=8A=B8=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD=20=EC=82=AC=ED=95=AD=20=EB=B0=98=EC=98=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/res/values/strings.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 3720a7fd..28eaaf1b 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -63,13 +63,13 @@ 절약을 실천한\n모습을 보여주세요! 사진은 피드의 썸네일로 사용됩니다 :) 다음 - 절약 내용을\n작성해주세요! + 절약한 내용을\n작성해주세요! 적어주신 글을 썸네일과 함께 표시합니다 :) Ex) 버스 타고 가는 길을 운동 삼아 20분 일찍 일어나 걸어갔어요!\n (%d/36) 6자 이상 작성해주세요 (0/36) - 얼마나 절약했나요? + 얼마나\n절약했나요? 절약하신 금액을 작성해주세요! 0 From 4f5aee94c1e26c766a5ccac1536afbe8f48d2b13 Mon Sep 17 00:00:00 2001 From: leeeha Date: Wed, 24 Jan 2024 19:56:45 +0900 Subject: [PATCH 02/26] =?UTF-8?q?[mod]=20#238=20=EC=A0=88=EC=95=BD=20?= =?UTF-8?q?=EB=82=B4=EC=9A=A9=20=EA=B8=80=EC=9E=90=EC=88=98=20=EC=A0=9C?= =?UTF-8?q?=ED=95=9C=20100=EC=9C=BC=EB=A1=9C=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/feed/upload/UploadViewModel.kt | 2 +- app/src/main/res/layout/fragment_content.xml | 17 ++++++++--------- app/src/main/res/values/strings.xml | 4 ++-- 3 files changed, 11 insertions(+), 12 deletions(-) diff --git a/app/src/main/java/org/go/sopt/winey/presentation/main/feed/upload/UploadViewModel.kt b/app/src/main/java/org/go/sopt/winey/presentation/main/feed/upload/UploadViewModel.kt index b00ce039..d0f14789 100644 --- a/app/src/main/java/org/go/sopt/winey/presentation/main/feed/upload/UploadViewModel.kt +++ b/app/src/main/java/org/go/sopt/winey/presentation/main/feed/upload/UploadViewModel.kt @@ -165,7 +165,7 @@ class UploadViewModel @Inject constructor( companion object { /** Content */ private const val MIN_CONTENT_LENGTH = 6 - const val MAX_CONTENT_LENGTH = 36 + const val MAX_CONTENT_LENGTH = 100 /** Amount */ private const val MIN_AMOUNT = 1L diff --git a/app/src/main/res/layout/fragment_content.xml b/app/src/main/res/layout/fragment_content.xml index caf6f813..d33bcb97 100644 --- a/app/src/main/res/layout/fragment_content.xml +++ b/app/src/main/res/layout/fragment_content.xml @@ -87,7 +87,7 @@ style="?editTextStyle" setUploadContentBackground="@{vm.inputUiState}" android:layout_width="0dp" - android:layout_height="90dp" + android:layout_height="128dp" android:layout_marginHorizontal="20dp" android:layout_marginTop="24dp" android:gravity="top" @@ -95,7 +95,7 @@ android:importantForAutofill="no" android:inputType="text|textMultiLine" android:maxLength="@{vm.MAX_CONTENT_LENGTH}" - android:padding="18dp" + android:padding="14dp" android:scrollbars="vertical" android:text="@={vm._content}" android:textAppearance="@style/TextAppearance.WINEY.body_m_16" @@ -104,11 +104,11 @@ app:layout_constraintTop_toBottomOf="@id/tv_content_detail" /> 절약한 내용을\n작성해주세요! 적어주신 글을 썸네일과 함께 표시합니다 :) Ex) 버스 타고 가는 길을 운동 삼아 20분 일찍 일어나 걸어갔어요!\n - (%d/36) + (%d/100) 6자 이상 작성해주세요 - (0/36) + (0/100) 얼마나\n절약했나요? 절약하신 금액을 작성해주세요! From af530f5373cad6f23c05f399c4164ae72ef8b2ce Mon Sep 17 00:00:00 2001 From: leeeha Date: Thu, 25 Jan 2024 00:51:03 +0900 Subject: [PATCH 03/26] =?UTF-8?q?[mod]=20#238=20=EC=BD=94=EB=93=9C=20?= =?UTF-8?q?=ED=9D=90=EB=A6=84=20=EC=88=9C=EC=9C=BC=EB=A1=9C=20=ED=95=A8?= =?UTF-8?q?=EC=88=98=20=EC=A0=95=EC=9D=98=20=EC=88=9C=EC=84=9C=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/feed/WineyFeedFragment.kt | 377 ++++++++++-------- 1 file changed, 203 insertions(+), 174 deletions(-) diff --git a/app/src/main/java/org/go/sopt/winey/presentation/main/feed/WineyFeedFragment.kt b/app/src/main/java/org/go/sopt/winey/presentation/main/feed/WineyFeedFragment.kt index f4305899..859288d3 100644 --- a/app/src/main/java/org/go/sopt/winey/presentation/main/feed/WineyFeedFragment.kt +++ b/app/src/main/java/org/go/sopt/winey/presentation/main/feed/WineyFeedFragment.kt @@ -73,8 +73,10 @@ class WineyFeedFragment : override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) amplitudeUtils.logEvent("view_homefeed") + binding.vm = mainViewModel mainViewModel.getHasNewNoti() + initAdapter() addListener() addObserver() @@ -103,36 +105,13 @@ class WineyFeedFragment : initDeleteFeedStateObserver() } - private fun initGetDetailFeedStateObserver() { - viewModel.getDetailFeedState.flowWithLifecycle(viewLifeCycle) - .onEach { state -> - when (state) { - is UiState.Success -> { - val detailFeed = state.data ?: return@onEach - wineyFeedAdapter.updateItem(clickedFeedId, detailFeed) - clickedFeedId = -1 - } - - is UiState.Failure -> { - snackBar(binding.root) { state.msg } - } - - else -> {} - } - }.launchIn(viewLifeCycleScope) - } - - private fun removeRecyclerviewItemChangeAnimation() { - val animator = binding.rvWineyfeedPost.itemAnimator - if (animator is SimpleItemAnimator) { - animator.supportsChangeAnimations = false - } - } - + /** + * Adapter + * */ private fun initAdapter() { wineyFeedHeaderAdapter = WineyFeedHeaderAdapter( - onBannerClicked = { -> - initHeaderClickListener() + onBannerClicked = { + navigateToWineyInstagram() } ) wineyFeedLoadAdapter = WineyFeedLoadAdapter() @@ -155,6 +134,12 @@ class WineyFeedFragment : ) } + private fun navigateToWineyInstagram() { + val url = INSTAGRAM_URL + val intent = Intent(Intent.ACTION_VIEW, Uri.parse(url)) + startActivity(intent) + } + private fun saveClickedFeedId(feedId: Int) { Timber.d("CLICKED FEED ID: $feedId") clickedFeedId = feedId @@ -227,38 +212,73 @@ class WineyFeedFragment : private fun isMyFeed(currentUserId: Int?, writerId: Int) = currentUserId == writerId - private fun initDeleteFeedStateObserver() { - viewModel.deleteWineyFeedState.flowWithLifecycle(viewLifeCycle) - .onEach { state -> - when (state) { - is UiState.Success -> { - val response = state.data ?: return@onEach - deletePagingDataItem(response.feedId.toInt()) + /** + * Listener + * */ + private fun initFabClickListener() { + binding.fabWineyfeedUpload.setOnSingleClickListener { + amplitudeUtils.logEvent("click_write_contents") + showUploadDialog() + } + } - wineySnackbar( - binding.root, - true, - stringOf(R.string.snackbar_feed_delete_success) - ) - viewModel.initDeleteFeedState() - } + // todo: 절약, 과소비 피드 업로드 + private fun showUploadDialog() { + val dialog = WineyUploadDialogFragment.newInstance( + handleSaveButton = { - is UiState.Failure -> { - snackBar(binding.root) { state.msg } - } + }, + handleConsumeButton = { - else -> {} - } - }.launchIn(viewLifeCycleScope) + } + ) + activity?.supportFragmentManager?.let { dialog.show(it, TAG_UPLOAD_DIALOG) } } - private fun deletePagingDataItem(feedId: Int) { - viewLifeCycleScope.launch { - val newList = wineyFeedAdapter.deleteItem(feedId) - wineyFeedAdapter.submitData(PagingData.from(newList)) + private fun initNotificationButtonClickListener() { + binding.ivWineyfeedNotification.setOnClickListener { + mainViewModel.patchCheckAllNoti() + val intent = Intent(context, NotificationActivity::class.java) + startActivity(intent) + } + } + + private fun initSwipeRefreshListener() { + binding.layoutWineyfeedRefresh.setOnRefreshListener { + refreshWineyFeed() + binding.layoutWineyfeedRefresh.isRefreshing = false + } + } + + private fun refreshWineyFeed() { + wineyFeedHeaderAdapter.notifyItemChanged(0) + wineyFeedAdapter.refresh() + } + + private fun initPagingLoadStateListener() { + wineyFeedAdapter.addLoadStateListener { loadStates -> + when (loadStates.refresh) { + is LoadState.Loading -> { + Timber.d("LOADING") + binding.rvWineyfeedPost.isVisible = false + } + + is LoadState.NotLoading -> { + Timber.d("NOT LOADING") + binding.rvWineyfeedPost.isVisible = wineyFeedAdapter.itemCount > 0 + } + + is LoadState.Error -> { + snackBar(binding.root) { stringOf(R.string.error_winey_feed_loading) } + } + } } } + /** + * Observer + * */ + private fun initGetWineyFeedListStateObserver() { viewModel.getWineyFeedListState.flowWithLifecycle(viewLifeCycle) .onEach { state -> @@ -279,24 +299,23 @@ class WineyFeedFragment : }.launchIn(viewLifeCycleScope) } - private fun initPagingLoadStateListener() { - wineyFeedAdapter.addLoadStateListener { loadStates -> - when (loadStates.refresh) { - is LoadState.Loading -> { - Timber.d("LOADING") - binding.rvWineyfeedPost.isVisible = false - } + private fun initGetDetailFeedStateObserver() { + viewModel.getDetailFeedState.flowWithLifecycle(viewLifeCycle) + .onEach { state -> + when (state) { + is UiState.Success -> { + val detailFeed = state.data ?: return@onEach + wineyFeedAdapter.updateItem(clickedFeedId, detailFeed) + clickedFeedId = -1 + } - is LoadState.NotLoading -> { - Timber.d("NOT LOADING") - binding.rvWineyfeedPost.isVisible = wineyFeedAdapter.itemCount > 0 - } + is UiState.Failure -> { + snackBar(binding.root) { state.msg } + } - is LoadState.Error -> { - snackBar(binding.root) { stringOf(R.string.error_winey_feed_loading) } + else -> {} } - } - } + }.launchIn(viewLifeCycleScope) } private fun initPostLikeStateObserver() { @@ -321,23 +340,118 @@ class WineyFeedFragment : }.launchIn(viewLifeCycleScope) } - private fun initFabClickListener() { - binding.fabWineyfeedUpload.setOnSingleClickListener { - amplitudeUtils.logEvent("click_write_contents") - showUploadDialog() + private fun initDeleteFeedStateObserver() { + viewModel.deleteWineyFeedState.flowWithLifecycle(viewLifeCycle) + .onEach { state -> + when (state) { + is UiState.Success -> { + val response = state.data ?: return@onEach + deletePagingDataItem(response.feedId.toInt()) + + wineySnackbar( + binding.root, + true, + stringOf(R.string.snackbar_feed_delete_success) + ) + viewModel.initDeleteFeedState() + } + + is UiState.Failure -> { + snackBar(binding.root) { state.msg } + } + + else -> {} + } + }.launchIn(viewLifeCycleScope) + } + + private fun deletePagingDataItem(feedId: Int) { + viewLifeCycleScope.launch { + val newList = wineyFeedAdapter.deleteItem(feedId) + wineyFeedAdapter.submitData(PagingData.from(newList)) } } - private fun showUploadDialog() { - val dialog = WineyUploadDialogFragment.newInstance( - handleSaveButton = { - initGetUserStateObserver() - }, - handleConsumeButton = {} - ) - activity?.supportFragmentManager?.let { dialog.show(it, TAG_UPLOAD_DIALOG) } + /** + * Navigation + * */ + + private fun navigateToUpload() { + val intent = Intent(requireContext(), UploadActivity::class.java) + startActivity(intent) + } + + private fun navigateToDetail(wineyFeed: WineyFeed) { + Intent(requireContext(), DetailActivity::class.java).apply { + putExtra(KEY_FEED_ID, wineyFeed.feedId) + putExtra(KEY_FEED_WRITER_ID, wineyFeed.userId) + putExtra(KEY_PREV_SCREEN_NAME, VAL_WINEY_FEED_SCREEN) + startActivity(this) + } + } + + /** + * Other + * */ + private fun removeRecyclerviewItemChangeAnimation() { + val animator = binding.rvWineyfeedPost.itemAnimator + if (animator is SimpleItemAnimator) { + animator.supportsChangeAnimations = false + } + } + + /** + * Amplitude Event Tagging + * */ + private fun sendDialogClickEvent(isNavigate: Boolean) { + val eventProperties = JSONObject() + + try { + if (isNavigate) { + eventProperties.put("method", "yes") + } else { + eventProperties.put("method", "no") + } + } catch (e: JSONException) { + System.err.println("Invalid JSON") + e.printStackTrace() + } + + amplitudeUtils.logEvent("click_goalsetting", eventProperties) + } + + private fun sendWineyFeedEvent(type: EventType, feed: WineyFeed) { + val eventProperties = JSONObject() + + try { + eventProperties.put("article_id", feed.feedId) + .put("like_count", feed.likes) + .put("comment_count", feed.comments) + + if (type == TYPE_CLICK_LIKE) { + eventProperties.put("from", "feed") + } + } catch (e: JSONException) { + System.err.println("Invalid JSON") + e.printStackTrace() + } + + when (type) { + TYPE_CLICK_FEED_ITEM -> amplitudeUtils.logEvent( + "click_homefeed_contents", + eventProperties + ) + + TYPE_CLICK_LIKE -> + amplitudeUtils.logEvent("click_like", eventProperties) + + else -> {} + } } + /** + * 1차 릴리즈 당시, 절약 피드 업로드 기능 (더 이상 사용 X) + * */ private fun initGetUserStateObserver() { viewLifeCycleScope.launch { mainViewModel.getUserState.collect { state -> @@ -357,14 +471,6 @@ class WineyFeedFragment : } } - private fun initNotificationButtonClickListener() { - binding.ivWineyfeedNotification.setOnClickListener { - mainViewModel.patchCheckAllNoti() - val intent = Intent(context, NotificationActivity::class.java) - startActivity(intent) - } - } - private fun checkGoalSetting(data: User) { // 목표를 설정한 적 없거나, 기간 내 목표 달성에 실패한 경우 if (data.isOver) { @@ -373,18 +479,19 @@ class WineyFeedFragment : // 기간 내 목표 달성에 성공한 경우 else if (data.isAttained) { showCongratulationDialog() - } else { // 새 목표를 설정한 경우 + } else { + // 새 목표를 설정한 경우 navigateToUpload() } } - private fun showCongratulationDialog() { + private fun showDefaultGoalSettingDialog() { amplitudeUtils.logEvent("view_goalsetting_popup") val dialog = WineyDialogFragment.newInstance( WineyDialogLabel( - stringOf(R.string.wineyfeed_congratulation_dialog_title), - stringOf(R.string.wineyfeed_congratulation_dialog_subtitle), + stringOf(R.string.wineyfeed_goal_dialog_title), + stringOf(R.string.wineyfeed_goal_dialog_subtitle), stringOf(R.string.wineyfeed_goal_dialog_negative_button), stringOf(R.string.wineyfeed_goal_dialog_positive_button) ), @@ -397,16 +504,16 @@ class WineyFeedFragment : } ) - activity?.supportFragmentManager?.let { dialog.show(it, TAG_CONGRATULATION_DIALOG) } + activity?.supportFragmentManager?.let { dialog.show(it, TAG_DEFAULT_GOAL_SETTING_DIALOG) } } - private fun showDefaultGoalSettingDialog() { + private fun showCongratulationDialog() { amplitudeUtils.logEvent("view_goalsetting_popup") val dialog = WineyDialogFragment.newInstance( WineyDialogLabel( - stringOf(R.string.wineyfeed_goal_dialog_title), - stringOf(R.string.wineyfeed_goal_dialog_subtitle), + stringOf(R.string.wineyfeed_congratulation_dialog_title), + stringOf(R.string.wineyfeed_congratulation_dialog_subtitle), stringOf(R.string.wineyfeed_goal_dialog_negative_button), stringOf(R.string.wineyfeed_goal_dialog_positive_button) ), @@ -419,7 +526,7 @@ class WineyFeedFragment : } ) - activity?.supportFragmentManager?.let { dialog.show(it, TAG_DEFAULT_GOAL_SETTING_DIALOG) } + activity?.supportFragmentManager?.let { dialog.show(it, TAG_CONGRATULATION_DIALOG) } } private fun navigateToMyPageWithBundle() { @@ -439,84 +546,6 @@ class WineyFeedFragment : bottomNav.selectedItemId = R.id.menu_mypage } - private fun initSwipeRefreshListener() { - binding.layoutWineyfeedRefresh.setOnRefreshListener { - refreshWineyFeed() - binding.layoutWineyfeedRefresh.isRefreshing = false - } - } - - private fun refreshWineyFeed() { - wineyFeedHeaderAdapter.notifyItemChanged(0) - wineyFeedAdapter.refresh() - } - - private fun navigateToUpload() { - val intent = Intent(requireContext(), UploadActivity::class.java) - startActivity(intent) - } - - private fun navigateToDetail(wineyFeed: WineyFeed) { - Intent(requireContext(), DetailActivity::class.java).apply { - putExtra(KEY_FEED_ID, wineyFeed.feedId) - putExtra(KEY_FEED_WRITER_ID, wineyFeed.userId) - putExtra(KEY_PREV_SCREEN_NAME, VAL_WINEY_FEED_SCREEN) - startActivity(this) - } - } - - private fun initHeaderClickListener() { - val url = INSTAGRAM_URL - val intent = Intent(Intent.ACTION_VIEW, Uri.parse(url)) - startActivity(intent) - } - - private fun sendDialogClickEvent(isNavigate: Boolean) { - val eventProperties = JSONObject() - - try { - if (isNavigate) { - eventProperties.put("method", "yes") - } else { - eventProperties.put("method", "no") - } - } catch (e: JSONException) { - System.err.println("Invalid JSON") - e.printStackTrace() - } - - amplitudeUtils.logEvent("click_goalsetting", eventProperties) - } - - private fun sendWineyFeedEvent(type: EventType, feed: WineyFeed) { - val eventProperties = JSONObject() - - try { - eventProperties.put("article_id", feed.feedId) - .put("like_count", feed.likes) - .put("comment_count", feed.comments) - - if (type == TYPE_CLICK_LIKE) { - eventProperties.put("from", "feed") - } - } catch (e: JSONException) { - System.err.println("Invalid JSON") - e.printStackTrace() - } - - when (type) { - TYPE_CLICK_FEED_ITEM -> amplitudeUtils.logEvent( - "click_homefeed_contents", - eventProperties - ) - - TYPE_CLICK_LIKE -> - amplitudeUtils.logEvent("click_like", eventProperties) - - else -> {} - } - } - companion object { private const val MSG_WINEYFEED_ERROR = "ERROR" private const val TAG_DEFAULT_GOAL_SETTING_DIALOG = "DEFAULT_GOAL_SETTING_DIALOG" From 351357f44d14aed5ac8d7a83f487a8a4608e56df Mon Sep 17 00:00:00 2001 From: leeeha Date: Thu, 25 Jan 2024 01:05:14 +0900 Subject: [PATCH 04/26] =?UTF-8?q?[refactor]=20#238=20=EC=97=AC=EB=9F=AC=20?= =?UTF-8?q?=ED=99=94=EB=A9=B4=EC=97=90=EC=84=9C=20=EB=8F=99=EC=9D=BC?= =?UTF-8?q?=ED=95=98=EA=B2=8C=20=EC=93=B0=EC=9D=B4=EB=8A=94=20=ED=95=A8?= =?UTF-8?q?=EC=88=98=EB=8A=94=20=EC=BB=A4=EC=8A=A4=ED=85=80=20=ED=8C=9D?= =?UTF-8?q?=EC=97=85=EB=A9=94=EB=89=B4=20=ED=81=B4=EB=9E=98=EC=8A=A4?= =?UTF-8?q?=EC=9D=98=20=EB=A9=A4=EB=B2=84=20=ED=95=A8=EC=88=98=EB=A1=9C=20?= =?UTF-8?q?=EB=A7=8C=EB=93=A4=EA=B8=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../winey/presentation/main/feed/WineyFeedFragment.kt | 5 ----- .../presentation/main/feed/detail/DetailActivity.kt | 6 ------ .../presentation/main/mypage/myfeed/MyFeedFragment.kt | 11 ++++------- .../org/go/sopt/winey/util/view/WineyPopupMenu.kt | 7 +++++++ 4 files changed, 11 insertions(+), 18 deletions(-) diff --git a/app/src/main/java/org/go/sopt/winey/presentation/main/feed/WineyFeedFragment.kt b/app/src/main/java/org/go/sopt/winey/presentation/main/feed/WineyFeedFragment.kt index 859288d3..a4a46a9e 100644 --- a/app/src/main/java/org/go/sopt/winey/presentation/main/feed/WineyFeedFragment.kt +++ b/app/src/main/java/org/go/sopt/winey/presentation/main/feed/WineyFeedFragment.kt @@ -174,10 +174,6 @@ class WineyFeedFragment : } } - private fun WineyPopupMenu.showCustomPosition(anchorView: View) { - showAsDropDown(anchorView, -POPUP_MENU_POS_OFFSET, -POPUP_MENU_POS_OFFSET, Gravity.END) - } - private fun showFeedDeleteDialog(feed: WineyFeed) { val dialog = WineyDialogFragment.newInstance( WineyDialogLabel( @@ -553,7 +549,6 @@ class WineyFeedFragment : private const val TAG_FEED_DELETE_DIALOG = "FEED_DELETE_DIALOG" private const val TAG_FEED_REPORT_DIALOG = "FEED_REPORT_DIALOG" private const val TAG_UPLOAD_DIALOG = "UPLOAD_DIALOG" - private const val POPUP_MENU_POS_OFFSET = 65 private const val KEY_FROM_WINEY_FEED = "fromWineyFeed" private const val KEY_FEED_ID = "feedId" diff --git a/app/src/main/java/org/go/sopt/winey/presentation/main/feed/detail/DetailActivity.kt b/app/src/main/java/org/go/sopt/winey/presentation/main/feed/detail/DetailActivity.kt index 12ec2be3..d3557343 100644 --- a/app/src/main/java/org/go/sopt/winey/presentation/main/feed/detail/DetailActivity.kt +++ b/app/src/main/java/org/go/sopt/winey/presentation/main/feed/detail/DetailActivity.kt @@ -436,10 +436,6 @@ class DetailActivity : BindingActivity(R.layout.activity_ } } - private fun WineyPopupMenu.showCustomPosition(anchorView: View) { - showAsDropDown(anchorView, -POPUP_MENU_POS_OFFSET, -POPUP_MENU_POS_OFFSET, Gravity.END) - } - private fun sendEventToAmplitude(type: EventType, feed: DetailFeed) { val eventProperties = JSONObject() @@ -477,9 +473,7 @@ class DetailActivity : BindingActivity(R.layout.activity_ private const val TAG_COMMENT_DELETE_DIALOG = "COMMENT_DELETE_DIALOG" private const val TAG_REPORT_DIALOG = "REPORT_DIALOG" - private const val POPUP_MENU_POS_OFFSET = 65 private const val MSG_DETAIL_ERROR = "ERROR" - private const val ACTION_COMMENT_POST = "POST" private const val ACTION_COMMENT_DELETE = "DELETE" } diff --git a/app/src/main/java/org/go/sopt/winey/presentation/main/mypage/myfeed/MyFeedFragment.kt b/app/src/main/java/org/go/sopt/winey/presentation/main/mypage/myfeed/MyFeedFragment.kt index f2fdbf8d..67d35f21 100644 --- a/app/src/main/java/org/go/sopt/winey/presentation/main/mypage/myfeed/MyFeedFragment.kt +++ b/app/src/main/java/org/go/sopt/winey/presentation/main/mypage/myfeed/MyFeedFragment.kt @@ -121,17 +121,16 @@ class MyFeedFragment : BindingFragment(R.layout.fragment_ private fun showFeedDeletePopupMenu(anchorView: View, wineyFeed: WineyFeed) { val deleteTitle = listOf(stringOf(R.string.popup_delete_title)) - WineyPopupMenu(context = anchorView.context, titles = deleteTitle) { _, _, _ -> + WineyPopupMenu( + context = anchorView.context, + titles = deleteTitle + ) { _, _, _ -> showFeedDeleteDialog(wineyFeed) }.apply { showCustomPosition(anchorView) } } - private fun WineyPopupMenu.showCustomPosition(anchorView: View) { - showAsDropDown(anchorView, -POPUP_MENU_OFFSET, -POPUP_MENU_OFFSET, Gravity.END) - } - private fun showFeedDeleteDialog(feed: WineyFeed) { val dialog = WineyDialogFragment.newInstance( WineyDialogLabel( @@ -279,9 +278,7 @@ class MyFeedFragment : BindingFragment(R.layout.fragment_ private const val KEY_FEED_WRITER_ID = "feedWriterId" private const val KEY_PREV_SCREEN_NAME = "PREV_SCREEN_NAME" - private const val POPUP_MENU_OFFSET = 65 private const val MSG_MYFEED_ERROR = "ERROR" - private const val TAG_FEED_DELETE_DIALOG = "DELETE_DIALOG" private const val VAL_MY_FEED_SCREEN = "MyFeedFragment" } diff --git a/app/src/main/java/org/go/sopt/winey/util/view/WineyPopupMenu.kt b/app/src/main/java/org/go/sopt/winey/util/view/WineyPopupMenu.kt index 405a3412..2e3688d0 100644 --- a/app/src/main/java/org/go/sopt/winey/util/view/WineyPopupMenu.kt +++ b/app/src/main/java/org/go/sopt/winey/util/view/WineyPopupMenu.kt @@ -2,6 +2,7 @@ package org.go.sopt.winey.util.view import android.content.Context import android.util.TypedValue +import android.view.Gravity import android.view.LayoutInflater import android.view.View import android.view.ViewGroup @@ -9,6 +10,7 @@ import android.widget.PopupWindow import org.go.sopt.winey.R import org.go.sopt.winey.databinding.ItemWineyPopupBinding import org.go.sopt.winey.databinding.LayoutWineyPopupBinding +import org.go.sopt.winey.presentation.main.mypage.myfeed.MyFeedFragment import org.go.sopt.winey.util.context.drawableOf class WineyPopupMenu( @@ -58,7 +60,12 @@ class WineyPopupMenu( return TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, value, dm).toInt() } + fun showCustomPosition(anchorView: View) { + showAsDropDown(anchorView, -POPUP_MENU_OFFSET, -POPUP_MENU_OFFSET, Gravity.END) + } + companion object { private const val POPUP_MENU_WIDTH = 120f + private const val POPUP_MENU_OFFSET = 65 } } From e29fc831406823f25fa81213d8b2e289f53ce906 Mon Sep 17 00:00:00 2001 From: leeeha Date: Thu, 25 Jan 2024 22:16:20 +0900 Subject: [PATCH 05/26] =?UTF-8?q?[chore]=20#238=20=EA=B0=80=EB=8F=85?= =?UTF-8?q?=EC=84=B1=20=ED=96=A5=EC=83=81=EC=9D=84=20=EC=9C=84=ED=95=B4=20?= =?UTF-8?q?=EC=A3=BC=EC=84=9D=EC=9D=B4=20=EC=B0=A8=EC=A7=80=ED=95=98?= =?UTF-8?q?=EA=B3=A0=20=EC=9E=88=EB=8A=94=20=EB=B6=88=ED=95=84=EC=9A=94?= =?UTF-8?q?=ED=95=9C=20=EA=B3=B5=EB=B0=B1=20=EB=9D=BC=EC=9D=B8=20=EC=A0=9C?= =?UTF-8?q?=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/feed/WineyFeedFragment.kt | 30 +++++-------------- 1 file changed, 7 insertions(+), 23 deletions(-) diff --git a/app/src/main/java/org/go/sopt/winey/presentation/main/feed/WineyFeedFragment.kt b/app/src/main/java/org/go/sopt/winey/presentation/main/feed/WineyFeedFragment.kt index a4a46a9e..d87da2f7 100644 --- a/app/src/main/java/org/go/sopt/winey/presentation/main/feed/WineyFeedFragment.kt +++ b/app/src/main/java/org/go/sopt/winey/presentation/main/feed/WineyFeedFragment.kt @@ -105,9 +105,7 @@ class WineyFeedFragment : initDeleteFeedStateObserver() } - /** - * Adapter - * */ + /** Adapter */ private fun initAdapter() { wineyFeedHeaderAdapter = WineyFeedHeaderAdapter( onBannerClicked = { @@ -208,9 +206,7 @@ class WineyFeedFragment : private fun isMyFeed(currentUserId: Int?, writerId: Int) = currentUserId == writerId - /** - * Listener - * */ + /** Listener */ private fun initFabClickListener() { binding.fabWineyfeedUpload.setOnSingleClickListener { amplitudeUtils.logEvent("click_write_contents") @@ -271,10 +267,7 @@ class WineyFeedFragment : } } - /** - * Observer - * */ - + /** Observer */ private fun initGetWineyFeedListStateObserver() { viewModel.getWineyFeedListState.flowWithLifecycle(viewLifeCycle) .onEach { state -> @@ -368,10 +361,7 @@ class WineyFeedFragment : } } - /** - * Navigation - * */ - + /** Navigation */ private fun navigateToUpload() { val intent = Intent(requireContext(), UploadActivity::class.java) startActivity(intent) @@ -386,9 +376,7 @@ class WineyFeedFragment : } } - /** - * Other - * */ + /** Other */ private fun removeRecyclerviewItemChangeAnimation() { val animator = binding.rvWineyfeedPost.itemAnimator if (animator is SimpleItemAnimator) { @@ -396,9 +384,7 @@ class WineyFeedFragment : } } - /** - * Amplitude Event Tagging - * */ + /** Amplitude Event Tagging */ private fun sendDialogClickEvent(isNavigate: Boolean) { val eventProperties = JSONObject() @@ -445,9 +431,7 @@ class WineyFeedFragment : } } - /** - * 1차 릴리즈 당시, 절약 피드 업로드 기능 (더 이상 사용 X) - * */ + /** 1차 릴리즈 당시, 절약 피드 업로드 (더 이상 사용 X) */ private fun initGetUserStateObserver() { viewLifeCycleScope.launch { mainViewModel.getUserState.collect { state -> From cb819ac5ec6d80197a3532fd4b1d6bd73aba5232 Mon Sep 17 00:00:00 2001 From: leeeha Date: Thu, 25 Jan 2024 22:44:46 +0900 Subject: [PATCH 06/26] =?UTF-8?q?[mod]=20#238=20BundleExt,=20IntentExt=20?= =?UTF-8?q?=ED=8C=8C=EC=9D=BC=20=EB=82=B4=EC=9A=A9=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../org/go/sopt/winey/util/intent/BundleExt.kt | 16 ++++++++++++++++ .../org/go/sopt/winey/util/intent/IntentExt.kt | 7 +++++++ 2 files changed, 23 insertions(+) create mode 100644 app/src/main/java/org/go/sopt/winey/util/intent/BundleExt.kt diff --git a/app/src/main/java/org/go/sopt/winey/util/intent/BundleExt.kt b/app/src/main/java/org/go/sopt/winey/util/intent/BundleExt.kt new file mode 100644 index 00000000..81a78112 --- /dev/null +++ b/app/src/main/java/org/go/sopt/winey/util/intent/BundleExt.kt @@ -0,0 +1,16 @@ +package org.go.sopt.winey.util.intent + +import android.os.Build +import android.os.Bundle +import android.os.Parcelable +import java.io.Serializable + +inline fun Bundle.getCompatibleParcelable(key: String): T? = when { + Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU -> getParcelable(key, T::class.java) + else -> getParcelable(key) as? T +} + +inline fun Bundle.getCompatibleSerializable(key: String): T? = when { + Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU -> getSerializable(key, T::class.java) + else -> getSerializable(key) as? T +} diff --git a/app/src/main/java/org/go/sopt/winey/util/intent/IntentExt.kt b/app/src/main/java/org/go/sopt/winey/util/intent/IntentExt.kt index 7a573336..8db86fd9 100644 --- a/app/src/main/java/org/go/sopt/winey/util/intent/IntentExt.kt +++ b/app/src/main/java/org/go/sopt/winey/util/intent/IntentExt.kt @@ -4,8 +4,15 @@ import android.content.Intent import android.os.Build.VERSION.SDK_INT import android.os.Build.VERSION_CODES.TIRAMISU import android.os.Parcelable +import java.io.Serializable +/** Retrieve parcelable extra data from the intent and support app compatibility */ inline fun Intent.getCompatibleParcelableExtra(key: String): T? = when { SDK_INT >= TIRAMISU -> getParcelableExtra(key, T::class.java) else -> getParcelableExtra(key) as? T } + +inline fun Intent.getCompatibleSerializableExtra(key: String): T? = when { + SDK_INT >= TIRAMISU -> getSerializableExtra(key, T::class.java) + else -> getSerializableExtra(key) as? T +} From 9c424c77d421c67a965dbdd9286d5ab59574ec76 Mon Sep 17 00:00:00 2001 From: leeeha Date: Thu, 25 Jan 2024 22:45:05 +0900 Subject: [PATCH 07/26] =?UTF-8?q?[add]=20#238=20=EC=A0=88=EC=95=BD=20?= =?UTF-8?q?=ED=83=80=EC=9E=85=EC=9D=84=20=EA=B5=AC=EB=B6=84=ED=95=98?= =?UTF-8?q?=EB=8A=94=20=EC=9D=B4=EB=84=98=20=ED=81=B4=EB=9E=98=EC=8A=A4=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../go/sopt/winey/presentation/main/feed/WineyFeedType.kt | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 app/src/main/java/org/go/sopt/winey/presentation/main/feed/WineyFeedType.kt diff --git a/app/src/main/java/org/go/sopt/winey/presentation/main/feed/WineyFeedType.kt b/app/src/main/java/org/go/sopt/winey/presentation/main/feed/WineyFeedType.kt new file mode 100644 index 00000000..db6f8553 --- /dev/null +++ b/app/src/main/java/org/go/sopt/winey/presentation/main/feed/WineyFeedType.kt @@ -0,0 +1,6 @@ +package org.go.sopt.winey.presentation.main.feed + +enum class WineyFeedType { + SAVE, + CONSUME +} From b3a101962423bc16e8be4125e8c9ea09945623b8 Mon Sep 17 00:00:00 2001 From: leeeha Date: Thu, 25 Jan 2024 22:45:48 +0900 Subject: [PATCH 08/26] =?UTF-8?q?[mod]=20#238=20=ED=99=95=EC=9E=A5=20?= =?UTF-8?q?=ED=95=A8=EC=88=98=EA=B0=80=20=EC=A0=95=EC=9D=98=EB=90=9C=20?= =?UTF-8?q?=ED=8C=8C=EC=9D=BC=20=EC=9C=84=EC=B9=98=20=EB=B3=80=EA=B2=BD=20?= =?UTF-8?q?(ArgsExt=20->=20BundleExt)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/java/org/go/sopt/winey/util/intent/ArgsExt.kt | 5 ----- 1 file changed, 5 deletions(-) diff --git a/app/src/main/java/org/go/sopt/winey/util/intent/ArgsExt.kt b/app/src/main/java/org/go/sopt/winey/util/intent/ArgsExt.kt index cc9db089..6cbaed4d 100644 --- a/app/src/main/java/org/go/sopt/winey/util/intent/ArgsExt.kt +++ b/app/src/main/java/org/go/sopt/winey/util/intent/ArgsExt.kt @@ -25,8 +25,3 @@ fun stringArgs() = ReadOnlyProperty { thisRef, property -> fun

parcelableArgs() = ReadOnlyProperty { thisRef, property -> thisRef.requireArguments().getParcelable(property.name) } - -inline fun Bundle.getCompatibleParcelableExtra(key: String): T? = when { - Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU -> getParcelable(key, T::class.java) - else -> getParcelable(key) as? T -} From 363d489a198bdf937c8b1413e2a3b1ca632fab5b Mon Sep 17 00:00:00 2001 From: leeeha Date: Thu, 25 Jan 2024 22:50:21 +0900 Subject: [PATCH 09/26] =?UTF-8?q?[feat]=20#238=20=EB=B2=88=EB=93=A4=20?= =?UTF-8?q?=EC=9D=B4=EC=9A=A9=ED=95=98=EC=97=AC=20=EC=9C=84=EB=8B=88?= =?UTF-8?q?=ED=94=BC=EB=93=9C=20=ED=94=84=EB=9E=98=EA=B7=B8=EB=A8=BC?= =?UTF-8?q?=ED=8A=B8=EC=97=90=EC=84=9C=20=EC=97=85=EB=A1=9C=EB=93=9C=20?= =?UTF-8?q?=EC=95=A1=ED=8B=B0=EB=B9=84=ED=8B=B0=EB=A1=9C=20=ED=94=BC?= =?UTF-8?q?=EB=93=9C=20=ED=83=80=EC=9E=85=20=EB=8D=B0=EC=9D=B4=ED=84=B0=20?= =?UTF-8?q?=EC=A0=84=EB=8B=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/feed/WineyFeedFragment.kt | 21 ++++++++++--------- .../main/feed/upload/UploadActivity.kt | 8 +++++++ 2 files changed, 19 insertions(+), 10 deletions(-) diff --git a/app/src/main/java/org/go/sopt/winey/presentation/main/feed/WineyFeedFragment.kt b/app/src/main/java/org/go/sopt/winey/presentation/main/feed/WineyFeedFragment.kt index d87da2f7..75e651ff 100644 --- a/app/src/main/java/org/go/sopt/winey/presentation/main/feed/WineyFeedFragment.kt +++ b/app/src/main/java/org/go/sopt/winey/presentation/main/feed/WineyFeedFragment.kt @@ -217,12 +217,8 @@ class WineyFeedFragment : // todo: 절약, 과소비 피드 업로드 private fun showUploadDialog() { val dialog = WineyUploadDialogFragment.newInstance( - handleSaveButton = { - - }, - handleConsumeButton = { - - } + handleSaveButton = { navigateToUpload(WineyFeedType.SAVE) }, + handleConsumeButton = { navigateToUpload(WineyFeedType.CONSUME) } ) activity?.supportFragmentManager?.let { dialog.show(it, TAG_UPLOAD_DIALOG) } } @@ -362,9 +358,11 @@ class WineyFeedFragment : } /** Navigation */ - private fun navigateToUpload() { - val intent = Intent(requireContext(), UploadActivity::class.java) - startActivity(intent) + private fun navigateToUpload(feedType: WineyFeedType) { + Intent(requireContext(), UploadActivity::class.java).apply { + putExtra(KEY_FEED_TYPE, feedType) + startActivity(this) + } } private fun navigateToDetail(wineyFeed: WineyFeed) { @@ -461,7 +459,7 @@ class WineyFeedFragment : showCongratulationDialog() } else { // 새 목표를 설정한 경우 - navigateToUpload() + //navigateToUpload() } } @@ -537,8 +535,11 @@ class WineyFeedFragment : private const val KEY_FROM_WINEY_FEED = "fromWineyFeed" private const val KEY_FEED_ID = "feedId" private const val KEY_FEED_WRITER_ID = "feedWriterId" + const val KEY_FEED_TYPE = "feedType" + private const val KEY_PREV_SCREEN_NAME = "PREV_SCREEN_NAME" private const val VAL_WINEY_FEED_SCREEN = "WineyFeedFragment" + private const val INSTAGRAM_URL = "https://instagram.com/winey__official?igshid=MzRlODBiNWFlZA==" } diff --git a/app/src/main/java/org/go/sopt/winey/presentation/main/feed/upload/UploadActivity.kt b/app/src/main/java/org/go/sopt/winey/presentation/main/feed/upload/UploadActivity.kt index 7e50e30c..792e80da 100644 --- a/app/src/main/java/org/go/sopt/winey/presentation/main/feed/upload/UploadActivity.kt +++ b/app/src/main/java/org/go/sopt/winey/presentation/main/feed/upload/UploadActivity.kt @@ -5,10 +5,18 @@ import androidx.fragment.app.commit import dagger.hilt.android.AndroidEntryPoint import org.go.sopt.winey.R import org.go.sopt.winey.databinding.ActivityUploadBinding +import org.go.sopt.winey.presentation.main.feed.WineyFeedFragment +import org.go.sopt.winey.presentation.main.feed.WineyFeedType import org.go.sopt.winey.util.binding.BindingActivity +import org.go.sopt.winey.util.intent.getCompatibleSerializable @AndroidEntryPoint class UploadActivity : BindingActivity(R.layout.activity_upload) { + private val feedType by lazy { + intent.extras?.getCompatibleSerializable(WineyFeedFragment.KEY_FEED_TYPE) + ?: WineyFeedType.SAVE + } + override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setUpDefaultFragment(savedInstanceState) From a390546b32ba0f9a4ea406898d619d148278d259 Mon Sep 17 00:00:00 2001 From: leeeha Date: Thu, 25 Jan 2024 22:58:38 +0900 Subject: [PATCH 10/26] =?UTF-8?q?[feat]=20#238=20=EC=97=85=EB=A1=9C?= =?UTF-8?q?=EB=93=9C=20=EC=95=A1=ED=8B=B0=EB=B9=84=ED=8B=B0=EC=97=90?= =?UTF-8?q?=EC=84=9C=20=ED=8F=AC=ED=86=A0=20=ED=94=84=EB=9E=98=EA=B7=B8?= =?UTF-8?q?=EB=A8=BC=ED=8A=B8=EB=A1=9C=20=EB=B2=88=EB=93=A4=20=EB=8D=B0?= =?UTF-8?q?=EC=9D=B4=ED=84=B0=20=EC=A0=84=EB=8B=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../winey/presentation/main/feed/upload/PhotoFragment.kt | 8 ++++++++ .../presentation/main/feed/upload/UploadActivity.kt | 9 ++++++++- .../go/sopt/winey/util/fragment/WineyDialogFragment.kt | 3 ++- 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/org/go/sopt/winey/presentation/main/feed/upload/PhotoFragment.kt b/app/src/main/java/org/go/sopt/winey/presentation/main/feed/upload/PhotoFragment.kt index 7ca7f51b..e75d0b01 100644 --- a/app/src/main/java/org/go/sopt/winey/presentation/main/feed/upload/PhotoFragment.kt +++ b/app/src/main/java/org/go/sopt/winey/presentation/main/feed/upload/PhotoFragment.kt @@ -9,18 +9,26 @@ import androidx.fragment.app.commit import dagger.hilt.android.AndroidEntryPoint import org.go.sopt.winey.R import org.go.sopt.winey.databinding.FragmentPhotoBinding +import org.go.sopt.winey.presentation.main.feed.WineyFeedFragment +import org.go.sopt.winey.presentation.main.feed.WineyFeedType import org.go.sopt.winey.presentation.model.WineyDialogLabel import org.go.sopt.winey.util.amplitude.AmplitudeUtils import org.go.sopt.winey.util.binding.BindingFragment import org.go.sopt.winey.util.fragment.WineyDialogFragment import org.go.sopt.winey.util.fragment.stringOf +import org.go.sopt.winey.util.intent.getCompatibleSerializable import org.json.JSONException import org.json.JSONObject +import timber.log.Timber import javax.inject.Inject @AndroidEntryPoint class PhotoFragment : BindingFragment(R.layout.fragment_photo) { private val uploadViewModel by activityViewModels() + private val feedType by lazy { + arguments?.getCompatibleSerializable(WineyFeedFragment.KEY_FEED_TYPE) + ?: WineyFeedType.SAVE + } @Inject lateinit var amplitudeUtils: AmplitudeUtils diff --git a/app/src/main/java/org/go/sopt/winey/presentation/main/feed/upload/UploadActivity.kt b/app/src/main/java/org/go/sopt/winey/presentation/main/feed/upload/UploadActivity.kt index 792e80da..37aa2952 100644 --- a/app/src/main/java/org/go/sopt/winey/presentation/main/feed/upload/UploadActivity.kt +++ b/app/src/main/java/org/go/sopt/winey/presentation/main/feed/upload/UploadActivity.kt @@ -25,7 +25,14 @@ class UploadActivity : BindingActivity(R.layout.activity_ private fun setUpDefaultFragment(savedInstanceState: Bundle?) { if (savedInstanceState == null) { supportFragmentManager.commit { - replace(R.id.fcv_upload, PhotoFragment()) + replace( + R.id.fcv_upload, + PhotoFragment().apply { + arguments = Bundle().apply { + putSerializable(WineyFeedFragment.KEY_FEED_TYPE, feedType) + } + } + ) } } } diff --git a/app/src/main/java/org/go/sopt/winey/util/fragment/WineyDialogFragment.kt b/app/src/main/java/org/go/sopt/winey/util/fragment/WineyDialogFragment.kt index 37dcd29d..9a2f3696 100644 --- a/app/src/main/java/org/go/sopt/winey/util/fragment/WineyDialogFragment.kt +++ b/app/src/main/java/org/go/sopt/winey/util/fragment/WineyDialogFragment.kt @@ -6,6 +6,7 @@ import org.go.sopt.winey.R import org.go.sopt.winey.databinding.FragmentAlertDialogBinding import org.go.sopt.winey.presentation.model.WineyDialogLabel import org.go.sopt.winey.util.binding.BindingDialogFragment +import org.go.sopt.winey.util.intent.getCompatibleParcelable import org.go.sopt.winey.util.intent.getCompatibleParcelableExtra class WineyDialogFragment : @@ -16,7 +17,7 @@ class WineyDialogFragment : override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) dialog?.setCanceledOnTouchOutside(false) - binding.data = arguments?.getCompatibleParcelableExtra(ARG) + binding.data = arguments?.getCompatibleParcelable(ARG) initNegativeButtonClickListener(handleNegative) initPositiveButtonClickListener(handlePositive) From 3636fae391eb6ad812cdc43c6c2a51fb67096018 Mon Sep 17 00:00:00 2001 From: leeeha Date: Fri, 26 Jan 2024 00:05:07 +0900 Subject: [PATCH 11/26] =?UTF-8?q?[feat]=20#238=20=EC=97=85=EB=A1=9C?= =?UTF-8?q?=EB=93=9C=20=ED=94=84=EB=9E=98=EA=B7=B8=EB=A8=BC=ED=8A=B8?= =?UTF-8?q?=EC=97=90=20=EC=A0=84=EB=8B=AC=EB=90=9C=20=EB=B7=B0=20=ED=83=80?= =?UTF-8?q?=EC=9E=85=EC=9D=84=20=EB=B7=B0=20=EB=AA=A8=EB=8D=B8=EC=97=90=20?= =?UTF-8?q?=EC=A0=80=EC=9E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/feed/upload/PhotoFragment.kt | 4 -- .../main/feed/upload/UploadActivity.kt | 4 ++ .../main/feed/upload/UploadViewModel.kt | 68 +++++++++++-------- 3 files changed, 45 insertions(+), 31 deletions(-) diff --git a/app/src/main/java/org/go/sopt/winey/presentation/main/feed/upload/PhotoFragment.kt b/app/src/main/java/org/go/sopt/winey/presentation/main/feed/upload/PhotoFragment.kt index e75d0b01..18190546 100644 --- a/app/src/main/java/org/go/sopt/winey/presentation/main/feed/upload/PhotoFragment.kt +++ b/app/src/main/java/org/go/sopt/winey/presentation/main/feed/upload/PhotoFragment.kt @@ -25,10 +25,6 @@ import javax.inject.Inject @AndroidEntryPoint class PhotoFragment : BindingFragment(R.layout.fragment_photo) { private val uploadViewModel by activityViewModels() - private val feedType by lazy { - arguments?.getCompatibleSerializable(WineyFeedFragment.KEY_FEED_TYPE) - ?: WineyFeedType.SAVE - } @Inject lateinit var amplitudeUtils: AmplitudeUtils diff --git a/app/src/main/java/org/go/sopt/winey/presentation/main/feed/upload/UploadActivity.kt b/app/src/main/java/org/go/sopt/winey/presentation/main/feed/upload/UploadActivity.kt index 37aa2952..b4f798cb 100644 --- a/app/src/main/java/org/go/sopt/winey/presentation/main/feed/upload/UploadActivity.kt +++ b/app/src/main/java/org/go/sopt/winey/presentation/main/feed/upload/UploadActivity.kt @@ -1,6 +1,7 @@ package org.go.sopt.winey.presentation.main.feed.upload import android.os.Bundle +import androidx.activity.viewModels import androidx.fragment.app.commit import dagger.hilt.android.AndroidEntryPoint import org.go.sopt.winey.R @@ -16,9 +17,12 @@ class UploadActivity : BindingActivity(R.layout.activity_ intent.extras?.getCompatibleSerializable(WineyFeedFragment.KEY_FEED_TYPE) ?: WineyFeedType.SAVE } + private val viewModel by viewModels() override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) + + viewModel.saveCurrentFeedType(feedType) setUpDefaultFragment(savedInstanceState) } diff --git a/app/src/main/java/org/go/sopt/winey/presentation/main/feed/upload/UploadViewModel.kt b/app/src/main/java/org/go/sopt/winey/presentation/main/feed/upload/UploadViewModel.kt index d0f14789..fccd6ee2 100644 --- a/app/src/main/java/org/go/sopt/winey/presentation/main/feed/upload/UploadViewModel.kt +++ b/app/src/main/java/org/go/sopt/winey/presentation/main/feed/upload/UploadViewModel.kt @@ -17,6 +17,7 @@ import okhttp3.RequestBody import okhttp3.RequestBody.Companion.toRequestBody import org.go.sopt.winey.data.model.remote.response.ResponsePostWineyFeedDto import org.go.sopt.winey.domain.repository.FeedRepository +import org.go.sopt.winey.presentation.main.feed.WineyFeedType import org.go.sopt.winey.util.code.ErrorCode import org.go.sopt.winey.util.multipart.UriToRequestBody import org.go.sopt.winey.util.view.InputUiState @@ -29,21 +30,16 @@ import javax.inject.Inject class UploadViewModel @Inject constructor( private val feedRepository: FeedRepository ) : ViewModel() { - /** Photo Fragment */ + /** todo: Common properties */ + lateinit var feedType: WineyFeedType + + /** Properties associated with PhotoFragment */ private val _isImageSelected = MutableStateFlow(false) val isImageSelected: StateFlow = _isImageSelected.asStateFlow() private val _imageUri = MutableStateFlow(null) val imageUri: StateFlow = _imageUri.asStateFlow() - fun activateNextButton() { - _isImageSelected.value = true - } - - fun updateImageUri(imageUri: Uri) { - _imageUri.value = imageUri - } - - /** Content Fragment */ + /** Properties associated with ContentFragment */ val _content = MutableStateFlow("") val content: String get() = _content.value @@ -61,6 +57,39 @@ class UploadViewModel @Inject constructor( started = SharingStarted.WhileSubscribed(PRODUCE_STOP_TIMEOUT) ) + /** Properties associated with AmountFragment */ + val _amount = MutableStateFlow("") + val amount: String get() = _amount.value + + val isValidAmount: StateFlow = _amount.map { validateAmount(it) } + .stateIn( + initialValue = false, + scope = viewModelScope, + started = SharingStarted.WhileSubscribed(PRODUCE_STOP_TIMEOUT) + ) + + /** Properties associated with Multipart */ + private var imageRequestBody: UriToRequestBody? = null + private val _postWineyFeedState = + MutableStateFlow>(UiState.Empty) + val postWineyFeedState: StateFlow> = + _postWineyFeedState.asStateFlow() + + /** todo: Common functions */ + fun saveCurrentFeedType(feedType: WineyFeedType) { + this.feedType = feedType + } + + /** Functions associated with Photo Fragment */ + fun activateNextButton() { + _isImageSelected.value = true + } + + fun updateImageUri(imageUri: Uri) { + _imageUri.value = imageUri + } + + /** Functions associated with Content Fragment */ private fun validateContent(state: InputUiState) = state == InputUiState.Success private fun checkInputUiState(content: String): InputUiState { @@ -74,16 +103,7 @@ class UploadViewModel @Inject constructor( private fun checkContentLength(content: String) = content.length in MIN_CONTENT_LENGTH..MAX_CONTENT_LENGTH - /** Amount Fragment */ - val _amount = MutableStateFlow("") - val amount: String get() = _amount.value - val isValidAmount: StateFlow = _amount.map { validateAmount(it) } - .stateIn( - initialValue = false, - scope = viewModelScope, - started = SharingStarted.WhileSubscribed(PRODUCE_STOP_TIMEOUT) - ) - + /** Functions associated with AmountFragment */ private fun validateAmount(amount: String): Boolean { if (amount.isBlank()) return false @@ -96,13 +116,7 @@ class UploadViewModel @Inject constructor( private fun checkAmountRange(amountNumber: Long) = amountNumber in MIN_AMOUNT..MAX_AMOUNT - /** Multipart */ - private var imageRequestBody: UriToRequestBody? = null - private val _postWineyFeedState = - MutableStateFlow>(UiState.Empty) - val postWineyFeedState: StateFlow> = - _postWineyFeedState.asStateFlow() - + /** Functions associated with Multipart */ fun updateRequestBody(requestBody: UriToRequestBody) { this.imageRequestBody = requestBody } From b4a80de084c4a217f299bb15fc0366c117db2e3f Mon Sep 17 00:00:00 2001 From: leeeha Date: Fri, 26 Jan 2024 00:07:10 +0900 Subject: [PATCH 12/26] =?UTF-8?q?[del]=20#238=20=EB=A9=94=EC=9D=B8=20?= =?UTF-8?q?=EC=95=A1=ED=8B=B0=EB=B9=84=ED=8B=B0=EC=97=90=EC=84=9C=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=86=8D=EC=84=B1=20=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/org/go/sopt/winey/presentation/main/MainActivity.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/org/go/sopt/winey/presentation/main/MainActivity.kt b/app/src/main/java/org/go/sopt/winey/presentation/main/MainActivity.kt index 74615f22..51f788bb 100644 --- a/app/src/main/java/org/go/sopt/winey/presentation/main/MainActivity.kt +++ b/app/src/main/java/org/go/sopt/winey/presentation/main/MainActivity.kt @@ -34,12 +34,13 @@ import org.go.sopt.winey.util.view.UiState @AndroidEntryPoint class MainActivity : BindingActivity(R.layout.activity_main) { private val mainViewModel by viewModels() + private val isUploadSuccess by lazy { intent.extras?.getBoolean(EXTRA_UPLOAD_KEY, false) } private val isDeleteSuccess by lazy { intent.extras?.getBoolean(EXTRA_DELETE_KEY, false) } - private val isReportSuccess by lazy { intent.extras?.getBoolean(EXTRA_REPORT_KEY, false) } private val prevScreenName by lazy { intent.extras?.getString(KEY_PREV_SCREEN, "") } private val notiType by lazy { intent.extras?.getString(KEY_NOTI_TYPE, "") } private val feedId by lazy { intent.extras?.getString(KEY_FEED_ID) } + private val notificationPermissionLauncher = registerForActivityResult(ActivityResultContracts.RequestPermission()) { isGranted -> if (!isGranted) { From a28a996f6c2b5ff3fa512cb698c7d4c0ee2ff49e Mon Sep 17 00:00:00 2001 From: leeeha Date: Fri, 26 Jan 2024 00:08:22 +0900 Subject: [PATCH 13/26] =?UTF-8?q?[chore]=20#238=20=EC=86=8D=EC=84=B1=20?= =?UTF-8?q?=EC=A0=95=EC=9D=98=20=EC=88=9C=EC=84=9C=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sopt/winey/presentation/main/feed/upload/UploadActivity.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/org/go/sopt/winey/presentation/main/feed/upload/UploadActivity.kt b/app/src/main/java/org/go/sopt/winey/presentation/main/feed/upload/UploadActivity.kt index b4f798cb..b001de3f 100644 --- a/app/src/main/java/org/go/sopt/winey/presentation/main/feed/upload/UploadActivity.kt +++ b/app/src/main/java/org/go/sopt/winey/presentation/main/feed/upload/UploadActivity.kt @@ -13,11 +13,12 @@ import org.go.sopt.winey.util.intent.getCompatibleSerializable @AndroidEntryPoint class UploadActivity : BindingActivity(R.layout.activity_upload) { + private val viewModel by viewModels() + private val feedType by lazy { intent.extras?.getCompatibleSerializable(WineyFeedFragment.KEY_FEED_TYPE) ?: WineyFeedType.SAVE } - private val viewModel by viewModels() override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) From c39a01cc3849cdc340dc68065d5f6cfd1e39dc5c Mon Sep 17 00:00:00 2001 From: leeeha Date: Fri, 26 Jan 2024 00:33:32 +0900 Subject: [PATCH 14/26] =?UTF-8?q?[feat]=20#238=20=EC=A0=88=EC=95=BD,=20?= =?UTF-8?q?=EA=B3=BC=EC=86=8C=EB=B9=84=20=ED=83=80=EC=9E=85=20=EA=B5=AC?= =?UTF-8?q?=EB=B6=84=ED=95=98=EC=97=AC=20PhotoFragment=20=ED=85=8D?= =?UTF-8?q?=EC=8A=A4=ED=8A=B8=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/feed/upload/UploadViewModel.kt | 4 +-- .../sopt/winey/util/binding/BindingAdapter.kt | 28 ++++++++++++++++++- app/src/main/res/layout/fragment_photo.xml | 4 +-- app/src/main/res/values/strings.xml | 7 +++-- 4 files changed, 36 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/org/go/sopt/winey/presentation/main/feed/upload/UploadViewModel.kt b/app/src/main/java/org/go/sopt/winey/presentation/main/feed/upload/UploadViewModel.kt index fccd6ee2..eecbac2a 100644 --- a/app/src/main/java/org/go/sopt/winey/presentation/main/feed/upload/UploadViewModel.kt +++ b/app/src/main/java/org/go/sopt/winey/presentation/main/feed/upload/UploadViewModel.kt @@ -80,7 +80,7 @@ class UploadViewModel @Inject constructor( this.feedType = feedType } - /** Functions associated with Photo Fragment */ + /** Functions associated with PhotoFragment */ fun activateNextButton() { _isImageSelected.value = true } @@ -89,7 +89,7 @@ class UploadViewModel @Inject constructor( _imageUri.value = imageUri } - /** Functions associated with Content Fragment */ + /** Functions associated with ContentFragment */ private fun validateContent(state: InputUiState) = state == InputUiState.Success private fun checkInputUiState(content: String): InputUiState { diff --git a/app/src/main/java/org/go/sopt/winey/util/binding/BindingAdapter.kt b/app/src/main/java/org/go/sopt/winey/util/binding/BindingAdapter.kt index fe8b6743..69aedde7 100644 --- a/app/src/main/java/org/go/sopt/winey/util/binding/BindingAdapter.kt +++ b/app/src/main/java/org/go/sopt/winey/util/binding/BindingAdapter.kt @@ -11,6 +11,7 @@ import coil.load import coil.transform.RoundedCornersTransformation import de.hdodenhof.circleimageview.CircleImageView import org.go.sopt.winey.R +import org.go.sopt.winey.presentation.main.feed.WineyFeedType import org.go.sopt.winey.presentation.nickname.NicknameActivity.Companion.VAL_MY_PAGE_SCREEN import org.go.sopt.winey.presentation.nickname.NicknameActivity.Companion.VAL_STORY_SCREEN import org.go.sopt.winey.util.code.ErrorCode.* @@ -51,6 +52,32 @@ fun ImageView.setImageUrl(imageUrl: String?) { } } +@BindingAdapter("switchUploadImageTitle") +fun TextView.switchUploadImageTitle(feedType: WineyFeedType) { + when (feedType) { + WineyFeedType.SAVE -> { + this.text = context.getString(R.string.upload_photo_title, "절약을 실천한") + } + + WineyFeedType.CONSUME -> { + this.text = context.getString(R.string.upload_photo_title, "과소비한") + } + } +} + +@BindingAdapter("switchUploadImageButtonText") +fun TextView.switchUploadImageButtonText(feedType: WineyFeedType) { + when (feedType) { + WineyFeedType.SAVE -> { + this.text = context.getString(R.string.upload_plus_text, "절약을") + } + + WineyFeedType.CONSUME -> { + this.text = context.getString(R.string.upload_plus_text, "과소비를") + } + } +} + @BindingAdapter("setUploadImageUri") fun ImageView.setUploadImageUri(imageUri: Uri?) { if (imageUri == null) { @@ -248,7 +275,6 @@ fun ImageView.setNotiType(notiType: String) { if (drawableResourceId != 0) { setImageResource(drawableResourceId) - } else { } } diff --git a/app/src/main/res/layout/fragment_photo.xml b/app/src/main/res/layout/fragment_photo.xml index 3b496bbe..38f536ed 100644 --- a/app/src/main/res/layout/fragment_photo.xml +++ b/app/src/main/res/layout/fragment_photo.xml @@ -61,10 +61,10 @@ diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 9668028e..5f0bd252 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -59,21 +59,24 @@ 확인 - 절약을 인증할 수 있는\n사진을 업로드 해 주세요. - 절약을 실천한\n모습을 보여주세요! + %s\n모습을 보여주세요! 사진은 피드의 썸네일로 사용됩니다 :) + %s 인증할 수 있는\n사진을 업로드 해 주세요. 다음 + 절약한 내용을\n작성해주세요! 적어주신 글을 썸네일과 함께 표시합니다 :) Ex) 버스 타고 가는 길을 운동 삼아 20분 일찍 일어나 걸어갔어요!\n (%d/100) 6자 이상 작성해주세요 (0/100) + 얼마나\n절약했나요? 절약하신 금액을 작성해주세요! 0 업로드 + %s 값을 지금 나가시면 작성하신 게 지워져요 절약 실천 게시물을 올리면 레벨업에 가까워져요\n그래도 나가시겠습니까? From 681526bd94e0dad4fc3138e51d879e0bf65ac4fa Mon Sep 17 00:00:00 2001 From: leeeha Date: Fri, 26 Jan 2024 00:43:52 +0900 Subject: [PATCH 15/26] =?UTF-8?q?[feat]=20#238=20=EC=A0=88=EC=95=BD,=20?= =?UTF-8?q?=EA=B3=BC=EC=86=8C=EB=B9=84=20=ED=83=80=EC=9E=85=20=EA=B5=AC?= =?UTF-8?q?=EB=B6=84=ED=95=98=EC=97=AC=20ContentFragment=20=ED=85=8D?= =?UTF-8?q?=EC=8A=A4=ED=8A=B8=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sopt/winey/util/binding/BindingAdapter.kt | 38 +++++++++++-------- app/src/main/res/layout/fragment_content.xml | 4 +- app/src/main/res/values/strings.xml | 5 ++- 3 files changed, 27 insertions(+), 20 deletions(-) diff --git a/app/src/main/java/org/go/sopt/winey/util/binding/BindingAdapter.kt b/app/src/main/java/org/go/sopt/winey/util/binding/BindingAdapter.kt index 69aedde7..0023613f 100644 --- a/app/src/main/java/org/go/sopt/winey/util/binding/BindingAdapter.kt +++ b/app/src/main/java/org/go/sopt/winey/util/binding/BindingAdapter.kt @@ -54,27 +54,17 @@ fun ImageView.setImageUrl(imageUrl: String?) { @BindingAdapter("switchUploadImageTitle") fun TextView.switchUploadImageTitle(feedType: WineyFeedType) { - when (feedType) { - WineyFeedType.SAVE -> { - this.text = context.getString(R.string.upload_photo_title, "절약을 실천한") - } - - WineyFeedType.CONSUME -> { - this.text = context.getString(R.string.upload_photo_title, "과소비한") - } + text = when (feedType) { + WineyFeedType.SAVE -> context.getString(R.string.upload_photo_title, "절약을 실천한") + WineyFeedType.CONSUME -> context.getString(R.string.upload_photo_title, "과소비한") } } @BindingAdapter("switchUploadImageButtonText") fun TextView.switchUploadImageButtonText(feedType: WineyFeedType) { - when (feedType) { - WineyFeedType.SAVE -> { - this.text = context.getString(R.string.upload_plus_text, "절약을") - } - - WineyFeedType.CONSUME -> { - this.text = context.getString(R.string.upload_plus_text, "과소비를") - } + text = when (feedType) { + WineyFeedType.SAVE -> context.getString(R.string.upload_plus_text, "절약을") + WineyFeedType.CONSUME -> context.getString(R.string.upload_plus_text, "과소비를") } } @@ -92,6 +82,22 @@ fun ImageView.setUploadImageUri(imageUri: Uri?) { } } +@BindingAdapter("switchUploadContentTitle") +fun TextView.switchUploadContentTitle(feedType: WineyFeedType) { + text = when (feedType) { + WineyFeedType.SAVE -> context.getString(R.string.upload_plus_text, "절약을") + WineyFeedType.CONSUME -> context.getString(R.string.upload_plus_text, "과소비를") + } +} + +@BindingAdapter("switchUploadContentHint") +fun EditText.switchUploadContentHint(feedType: WineyFeedType) { + hint = when (feedType) { + WineyFeedType.SAVE -> context.getString(R.string.upload_save_content_edittext_hint) + WineyFeedType.CONSUME -> context.getString(R.string.upload_consume_content_edittext_hint) + } +} + @BindingAdapter("setUploadContentBackground") fun EditText.setUploadContentBackground(inputUiState: InputUiState) { background = if (inputUiState is Empty || inputUiState is Success) { diff --git a/app/src/main/res/layout/fragment_content.xml b/app/src/main/res/layout/fragment_content.xml index d33bcb97..cd7a91b8 100644 --- a/app/src/main/res/layout/fragment_content.xml +++ b/app/src/main/res/layout/fragment_content.xml @@ -62,10 +62,10 @@ %s 인증할 수 있는\n사진을 업로드 해 주세요. 다음 - 절약한 내용을\n작성해주세요! + %s한 내용을\n작성해 주세요! 적어주신 글을 썸네일과 함께 표시합니다 :) - Ex) 버스 타고 가는 길을 운동 삼아 20분 일찍 일어나 걸어갔어요!\n + ex) 버스 타고 가는 길을 운동 삼아 20분 일찍 일어나 걸어갔어요! + ex) 술 먹다 막차를 놓쳐 결국 택시를 타고 집에 갔어요. (%d/100) 6자 이상 작성해주세요 (0/100) From 14ea9260694f458e5eb04695eb38e67e3bac68eb Mon Sep 17 00:00:00 2001 From: leeeha Date: Fri, 26 Jan 2024 00:49:56 +0900 Subject: [PATCH 16/26] =?UTF-8?q?[feat]=20#238=20=EC=A0=88=EC=95=BD,=20?= =?UTF-8?q?=EA=B3=BC=EC=86=8C=EB=B9=84=20=ED=83=80=EC=9E=85=20=EA=B5=AC?= =?UTF-8?q?=EB=B6=84=ED=95=98=EC=97=AC=20AmountFragment=20=ED=85=8D?= =?UTF-8?q?=EC=8A=A4=ED=8A=B8=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../go/sopt/winey/util/binding/BindingAdapter.kt | 16 ++++++++++++++++ app/src/main/res/layout/fragment_amount.xml | 8 ++++---- app/src/main/res/values/strings.xml | 4 ++-- 3 files changed, 22 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/org/go/sopt/winey/util/binding/BindingAdapter.kt b/app/src/main/java/org/go/sopt/winey/util/binding/BindingAdapter.kt index 0023613f..6dba7e8f 100644 --- a/app/src/main/java/org/go/sopt/winey/util/binding/BindingAdapter.kt +++ b/app/src/main/java/org/go/sopt/winey/util/binding/BindingAdapter.kt @@ -122,6 +122,22 @@ fun TextView.setUploadContentHelperText(inputUiState: InputUiState) { } } +@BindingAdapter("switchUploadAmountTitle") +fun TextView.switchUploadAmountTitle(feedType: WineyFeedType) { + text = when (feedType) { + WineyFeedType.SAVE -> context.getString(R.string.upload_amount_title, "절약") + WineyFeedType.CONSUME -> context.getString(R.string.upload_amount_title, "과소비") + } +} + +@BindingAdapter("switchUploadAmountDetailText") +fun TextView.switchUploadAmountDetailText(feedType: WineyFeedType) { + text = when (feedType) { + WineyFeedType.SAVE -> context.getString(R.string.upload_amount_detail, "절약하신") + WineyFeedType.CONSUME -> context.getString(R.string.upload_amount_detail, "과소비한") + } +} + @BindingAdapter("setNicknameBackground") fun EditText.setNicknameBackground(inputUiState: InputUiState) { background = when (inputUiState) { diff --git a/app/src/main/res/layout/fragment_amount.xml b/app/src/main/res/layout/fragment_amount.xml index f9cb771c..e2845649 100644 --- a/app/src/main/res/layout/fragment_amount.xml +++ b/app/src/main/res/layout/fragment_amount.xml @@ -61,10 +61,10 @@ 6자 이상 작성해주세요 (0/100) - 얼마나\n절약했나요? - 절약하신 금액을 작성해주세요! + 얼마나\n%s했나요? + %s 금액을 작성해주세요! 0 업로드 From f28c7cc516045b187230d7b548fd193659bd8763 Mon Sep 17 00:00:00 2001 From: leeeha Date: Fri, 26 Jan 2024 00:50:32 +0900 Subject: [PATCH 17/26] =?UTF-8?q?[del]=20#238=20todo=20=EC=A3=BC=EC=84=9D?= =?UTF-8?q?=20=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../winey/presentation/main/feed/upload/UploadViewModel.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/org/go/sopt/winey/presentation/main/feed/upload/UploadViewModel.kt b/app/src/main/java/org/go/sopt/winey/presentation/main/feed/upload/UploadViewModel.kt index eecbac2a..6812f7b3 100644 --- a/app/src/main/java/org/go/sopt/winey/presentation/main/feed/upload/UploadViewModel.kt +++ b/app/src/main/java/org/go/sopt/winey/presentation/main/feed/upload/UploadViewModel.kt @@ -30,7 +30,7 @@ import javax.inject.Inject class UploadViewModel @Inject constructor( private val feedRepository: FeedRepository ) : ViewModel() { - /** todo: Common properties */ + /** Common properties */ lateinit var feedType: WineyFeedType /** Properties associated with PhotoFragment */ @@ -75,7 +75,7 @@ class UploadViewModel @Inject constructor( val postWineyFeedState: StateFlow> = _postWineyFeedState.asStateFlow() - /** todo: Common functions */ + /** Common functions */ fun saveCurrentFeedType(feedType: WineyFeedType) { this.feedType = feedType } From c7c121fe43534f3c8640fd01cb8ef25b14516e27 Mon Sep 17 00:00:00 2001 From: leeeha Date: Fri, 26 Jan 2024 01:02:38 +0900 Subject: [PATCH 18/26] =?UTF-8?q?[mod]=20#238=20=ED=94=BC=EB=93=9C=20?= =?UTF-8?q?=EC=97=85=EB=A1=9C=EB=93=9C=20POST=20=EC=9A=94=EC=B2=AD=20?= =?UTF-8?q?=ED=95=A8=EC=88=98=EC=97=90=20feedType=20=EC=9D=B8=EC=9E=90=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80=ED=95=98=EA=B8=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/feed/upload/AmountFragment.kt | 7 +++- .../main/feed/upload/UploadViewModel.kt | 34 +++++++++++++------ 2 files changed, 29 insertions(+), 12 deletions(-) diff --git a/app/src/main/java/org/go/sopt/winey/presentation/main/feed/upload/AmountFragment.kt b/app/src/main/java/org/go/sopt/winey/presentation/main/feed/upload/AmountFragment.kt index 0d38bd17..fe667f8c 100644 --- a/app/src/main/java/org/go/sopt/winey/presentation/main/feed/upload/AmountFragment.kt +++ b/app/src/main/java/org/go/sopt/winey/presentation/main/feed/upload/AmountFragment.kt @@ -12,6 +12,7 @@ import kotlinx.coroutines.flow.launchIn import kotlinx.coroutines.flow.onEach import org.go.sopt.winey.R import org.go.sopt.winey.databinding.FragmentAmountBinding +import org.go.sopt.winey.presentation.main.feed.WineyFeedType import org.go.sopt.winey.presentation.main.feed.upload.loading.LoadingActivity import org.go.sopt.winey.util.binding.BindingFragment import org.go.sopt.winey.util.context.hideKeyboard @@ -50,7 +51,11 @@ class AmountFragment : BindingFragment(R.layout.fragment_ private fun initUploadButtonClickListener() { binding.btnAmountNext.setOnSingleClickListener { uploadViewModel.apply { - postWineyFeed(content, amount.removeComma()) + postWineyFeed( + content = content, + amount = amount.removeComma(), + feedType = feedType.name + ) } } } diff --git a/app/src/main/java/org/go/sopt/winey/presentation/main/feed/upload/UploadViewModel.kt b/app/src/main/java/org/go/sopt/winey/presentation/main/feed/upload/UploadViewModel.kt index 6812f7b3..b6bee9db 100644 --- a/app/src/main/java/org/go/sopt/winey/presentation/main/feed/upload/UploadViewModel.kt +++ b/app/src/main/java/org/go/sopt/winey/presentation/main/feed/upload/UploadViewModel.kt @@ -121,12 +121,17 @@ class UploadViewModel @Inject constructor( this.imageRequestBody = requestBody } - fun postWineyFeed(content: String, amount: String) { + fun postWineyFeed(content: String, amount: String, feedType: String) { if (!validateRequestBody()) return viewModelScope.launch { _postWineyFeedState.value = UiState.Loading - val (file, requestMap) = createRequestBody(content, amount) + + val (file, requestMap) = createRequestBody( + content = content, + amount = amount, + feedType = feedType + ) feedRepository.postWineyFeed(file, requestMap) .onSuccess { response -> @@ -145,24 +150,29 @@ class UploadViewModel @Inject constructor( } } - fun initPostWineyFeedState() { - _postWineyFeedState.value = UiState.Empty - } - private fun createRequestBody( content: String, - amount: String + amount: String, + feedType: String ): Pair> { val imageFormData = imageRequestBody?.toFormData() val contentBody = content.toPlainTextRequestBody() val amountBody = amount.toPlainTextRequestBody() + val feedTypeBody = feedType.toPlainTextRequestBody() + val plainTextRequestBodyMap = hashMapOf( - FEED_TITLE_KEY to contentBody, - FEED_MONEY_KEY to amountBody + KEY_FEED_TITLE to contentBody, + KEY_FEED_MONEY to amountBody, + KEY_FEED_TYPE to feedTypeBody ) + return Pair(imageFormData, plainTextRequestBodyMap) } + fun initPostWineyFeedState() { + _postWineyFeedState.value = UiState.Empty + } + private fun validateRequestBody(): Boolean { if (imageRequestBody == null) { _postWineyFeedState.value = UiState.Failure(REQUEST_BODY_ERR_MSG) @@ -187,8 +197,10 @@ class UploadViewModel @Inject constructor( const val MAX_AMOUNT_LENGTH = 9 /** Multipart */ - private const val FEED_TITLE_KEY = "feedTitle" - private const val FEED_MONEY_KEY = "feedMoney" + private const val KEY_FEED_TITLE = "feedTitle" + private const val KEY_FEED_MONEY = "feedMoney" + private const val KEY_FEED_TYPE = "feedType" + private const val REQUEST_BODY_ERR_MSG = "Image RequestBody is null" private const val COMMA = "," private const val CONTENT_TYPE = "text/plain" From 729e05106870ca97656bf09d5a78e282096a722d Mon Sep 17 00:00:00 2001 From: leeeha Date: Sat, 27 Jan 2024 18:53:48 +0900 Subject: [PATCH 19/26] =?UTF-8?q?[chore]=20#238=20=EA=B8=88=EC=95=A1=20?= =?UTF-8?q?=ED=85=8D=EC=8A=A4=ED=8A=B8=EC=9D=98=20=EB=B3=80=EA=B2=BD?= =?UTF-8?q?=EC=82=AC=ED=95=AD=EC=9D=84=20=ED=99=95=EC=9D=B8=ED=95=98?= =?UTF-8?q?=EB=8A=94=20=ED=95=A8=EC=88=98=20=EC=9D=B4=EB=A6=84=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../presentation/main/feed/upload/AmountFragment.kt | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/org/go/sopt/winey/presentation/main/feed/upload/AmountFragment.kt b/app/src/main/java/org/go/sopt/winey/presentation/main/feed/upload/AmountFragment.kt index fe667f8c..acf35691 100644 --- a/app/src/main/java/org/go/sopt/winey/presentation/main/feed/upload/AmountFragment.kt +++ b/app/src/main/java/org/go/sopt/winey/presentation/main/feed/upload/AmountFragment.kt @@ -12,7 +12,6 @@ import kotlinx.coroutines.flow.launchIn import kotlinx.coroutines.flow.onEach import org.go.sopt.winey.R import org.go.sopt.winey.databinding.FragmentAmountBinding -import org.go.sopt.winey.presentation.main.feed.WineyFeedType import org.go.sopt.winey.presentation.main.feed.upload.loading.LoadingActivity import org.go.sopt.winey.util.binding.BindingFragment import org.go.sopt.winey.util.context.hideKeyboard @@ -34,12 +33,13 @@ class AmountFragment : BindingFragment(R.layout.fragment_ binding.vm = uploadViewModel updateRequestBody() - initPostImageStateObserver() - initUploadButtonClickListener() + initUploadButtonClickListener() initRootLayoutClickListener() initBackButtonClickListener() - initEditTextWatcher() + initAmountTextChangedListener() + + initPostImageStateObserver() } private fun updateRequestBody() { @@ -87,6 +87,7 @@ class AmountFragment : BindingFragment(R.layout.fragment_ binding.btnAmountNext.isClickable = false } + // todo: 로딩 화면 없이 메인 액티비티로 넘어가도록 변경 private fun navigateLoadingScreen() { Intent(requireContext(), LoadingActivity::class.java).apply { putExtra(KEY_SAVE_AMOUNT, uploadViewModel.amount.removeComma()) @@ -103,7 +104,7 @@ class AmountFragment : BindingFragment(R.layout.fragment_ } } - private fun initEditTextWatcher() { + private fun initAmountTextChangedListener() { var temp = "" binding.etUploadAmount.addTextChangedListener(object : TextWatcher { override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) {} From a955c0614abfdb9f47ba39104c928304f6301f64 Mon Sep 17 00:00:00 2001 From: leeeha Date: Sat, 27 Jan 2024 18:54:11 +0900 Subject: [PATCH 20/26] =?UTF-8?q?[del]=20#238=20todo=20=EC=A3=BC=EC=84=9D?= =?UTF-8?q?=20=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../go/sopt/winey/presentation/main/feed/WineyFeedFragment.kt | 1 - 1 file changed, 1 deletion(-) diff --git a/app/src/main/java/org/go/sopt/winey/presentation/main/feed/WineyFeedFragment.kt b/app/src/main/java/org/go/sopt/winey/presentation/main/feed/WineyFeedFragment.kt index 75e651ff..a323def3 100644 --- a/app/src/main/java/org/go/sopt/winey/presentation/main/feed/WineyFeedFragment.kt +++ b/app/src/main/java/org/go/sopt/winey/presentation/main/feed/WineyFeedFragment.kt @@ -214,7 +214,6 @@ class WineyFeedFragment : } } - // todo: 절약, 과소비 피드 업로드 private fun showUploadDialog() { val dialog = WineyUploadDialogFragment.newInstance( handleSaveButton = { navigateToUpload(WineyFeedType.SAVE) }, From 72b5160bb3942ba128097518b2dcb67f53ff450d Mon Sep 17 00:00:00 2001 From: leeeha Date: Sat, 27 Jan 2024 18:56:33 +0900 Subject: [PATCH 21/26] =?UTF-8?q?[chore]=20#238=20=EB=B3=80=EC=88=98=20?= =?UTF-8?q?=EC=9D=B4=EB=A6=84=EC=97=90=EC=84=9C=20=EC=9E=90=EB=A3=8C?= =?UTF-8?q?=ED=98=95=EC=9D=84=20=EB=9C=BB=ED=95=98=EB=8A=94=20String=20?= =?UTF-8?q?=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../presentation/main/feed/upload/loading/LoadingActivity.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/org/go/sopt/winey/presentation/main/feed/upload/loading/LoadingActivity.kt b/app/src/main/java/org/go/sopt/winey/presentation/main/feed/upload/loading/LoadingActivity.kt index 9a5b8c2b..e58ce853 100644 --- a/app/src/main/java/org/go/sopt/winey/presentation/main/feed/upload/loading/LoadingActivity.kt +++ b/app/src/main/java/org/go/sopt/winey/presentation/main/feed/upload/loading/LoadingActivity.kt @@ -12,7 +12,7 @@ import org.go.sopt.winey.presentation.main.MainActivity import org.go.sopt.winey.util.binding.BindingActivity class LoadingActivity : BindingActivity(R.layout.activity_loading) { - private val amountString by lazy { intent.extras?.getString(KEY_SAVE_AMOUNT, "") } + private val amount by lazy { intent.extras?.getString(KEY_SAVE_AMOUNT, "") } private val amountRange by lazy { resources.getIntArray(R.array.save_amount_range) } private val itemCategories by lazy { resources.getStringArray(R.array.save_item_categories) } @@ -24,7 +24,7 @@ class LoadingActivity : BindingActivity(R.layout.activit private fun classifySaveItemCategory() { for (index in amountRange.indices) { - val amount = amountString?.toLong() ?: return + val amount = amount?.toLong() ?: return if (isLastAmountRange(index)) return if (amount >= amountRange[index] && amount < amountRange[index + 1]) { From 1c96244ca041415f2fce3c8c28f7900e876eb276 Mon Sep 17 00:00:00 2001 From: leeeha Date: Sat, 27 Jan 2024 19:19:38 +0900 Subject: [PATCH 22/26] =?UTF-8?q?[mod]=20#238=20=EC=97=85=EB=A1=9C?= =?UTF-8?q?=EB=93=9C=20=EB=B2=84=ED=8A=BC=20=EB=88=84=EB=A5=B4=EB=A9=B4=20?= =?UTF-8?q?=EB=A1=9C=ED=8B=B0=20=EC=95=A0=EB=8B=88=EB=A9=94=EC=9D=B4?= =?UTF-8?q?=EC=85=98=20=EC=97=86=EC=9D=B4=20=EB=B0=94=EB=A1=9C=20=EC=9C=84?= =?UTF-8?q?=EB=8B=88=ED=94=BC=EB=93=9C=EB=A1=9C=20=EC=9D=B4=EB=8F=99?= =?UTF-8?q?=ED=95=98=EB=8F=84=EB=A1=9D=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../winey/presentation/main/MainActivity.kt | 14 +++++----- .../main/feed/upload/AmountFragment.kt | 28 +++++++++++-------- 2 files changed, 23 insertions(+), 19 deletions(-) diff --git a/app/src/main/java/org/go/sopt/winey/presentation/main/MainActivity.kt b/app/src/main/java/org/go/sopt/winey/presentation/main/MainActivity.kt index 51f788bb..ab4ceca1 100644 --- a/app/src/main/java/org/go/sopt/winey/presentation/main/MainActivity.kt +++ b/app/src/main/java/org/go/sopt/winey/presentation/main/MainActivity.kt @@ -35,8 +35,9 @@ import org.go.sopt.winey.util.view.UiState class MainActivity : BindingActivity(R.layout.activity_main) { private val mainViewModel by viewModels() - private val isUploadSuccess by lazy { intent.extras?.getBoolean(EXTRA_UPLOAD_KEY, false) } - private val isDeleteSuccess by lazy { intent.extras?.getBoolean(EXTRA_DELETE_KEY, false) } + private val isUploadSuccess by lazy { intent.extras?.getBoolean(KEY_FEED_UPLOAD, false) } + private val isDeleteSuccess by lazy { intent.extras?.getBoolean(KEY_FEED_DELETE, false) } + private val prevScreenName by lazy { intent.extras?.getString(KEY_PREV_SCREEN, "") } private val notiType by lazy { intent.extras?.getString(KEY_NOTI_TYPE, "") } private val feedId by lazy { intent.extras?.getString(KEY_FEED_ID) } @@ -66,7 +67,7 @@ class MainActivity : BindingActivity(R.layout.activity_main syncBottomNavigationSelection() setupLogoutState() - showSuccessSnackBar() + showWineyFeedResultSnackBar() } private fun requestNotificationPermission() { @@ -109,7 +110,7 @@ class MainActivity : BindingActivity(R.layout.activity_main } } - private fun showSuccessSnackBar() { + private fun showWineyFeedResultSnackBar() { if (isUploadSuccess == true) { wineySnackbar(binding.root, true, stringOf(R.string.snackbar_upload_success)) } @@ -202,9 +203,8 @@ class MainActivity : BindingActivity(R.layout.activity_main } companion object { - private const val EXTRA_UPLOAD_KEY = "upload" - private const val EXTRA_DELETE_KEY = "delete" - private const val EXTRA_REPORT_KEY = "report" + private const val KEY_FEED_UPLOAD = "upload" + private const val KEY_FEED_DELETE = "delete" private const val KEY_FEED_ID = "feedId" private const val KEY_NOTI_TYPE = "notiType" diff --git a/app/src/main/java/org/go/sopt/winey/presentation/main/feed/upload/AmountFragment.kt b/app/src/main/java/org/go/sopt/winey/presentation/main/feed/upload/AmountFragment.kt index acf35691..5b47b8e6 100644 --- a/app/src/main/java/org/go/sopt/winey/presentation/main/feed/upload/AmountFragment.kt +++ b/app/src/main/java/org/go/sopt/winey/presentation/main/feed/upload/AmountFragment.kt @@ -12,7 +12,7 @@ import kotlinx.coroutines.flow.launchIn import kotlinx.coroutines.flow.onEach import org.go.sopt.winey.R import org.go.sopt.winey.databinding.FragmentAmountBinding -import org.go.sopt.winey.presentation.main.feed.upload.loading.LoadingActivity +import org.go.sopt.winey.presentation.main.MainActivity import org.go.sopt.winey.util.binding.BindingFragment import org.go.sopt.winey.util.context.hideKeyboard import org.go.sopt.winey.util.fragment.stringOf @@ -60,6 +60,8 @@ class AmountFragment : BindingFragment(R.layout.fragment_ } } + private fun String.removeComma() = replace(",", "") + private fun initPostImageStateObserver() { uploadViewModel.postWineyFeedState.flowWithLifecycle(viewLifeCycle) .onEach { state -> @@ -69,16 +71,20 @@ class AmountFragment : BindingFragment(R.layout.fragment_ } is UiState.Success -> { - navigateLoadingScreen() + navigateToMainScreen() } is UiState.Failure -> { - wineySnackbar(binding.root, false, stringOf(R.string.snackbar_upload_fail)) + wineySnackbar( + anchorView = binding.root, + isSuccess = false, + message = stringOf(R.string.snackbar_upload_fail) + ) + uploadViewModel.initPostWineyFeedState() } - is UiState.Empty -> { - } + else -> {} } }.launchIn(viewLifeCycleScope) } @@ -87,17 +93,15 @@ class AmountFragment : BindingFragment(R.layout.fragment_ binding.btnAmountNext.isClickable = false } - // todo: 로딩 화면 없이 메인 액티비티로 넘어가도록 변경 - private fun navigateLoadingScreen() { - Intent(requireContext(), LoadingActivity::class.java).apply { - putExtra(KEY_SAVE_AMOUNT, uploadViewModel.amount.removeComma()) + private fun navigateToMainScreen() { + val context = context ?: return + Intent(context, MainActivity::class.java).apply { addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK or Intent.FLAG_ACTIVITY_NEW_TASK) + putExtra(KEY_FEED_UPLOAD, true) startActivity(this) } } - private fun String.removeComma() = replace(",", "") - private fun initBackButtonClickListener() { binding.ivAmountBack.setOnClickListener { parentFragmentManager.popBackStack() @@ -141,6 +145,6 @@ class AmountFragment : BindingFragment(R.layout.fragment_ } companion object { - private const val KEY_SAVE_AMOUNT = "amount" + private const val KEY_FEED_UPLOAD = "upload" } } From d00c742d528d4e4566f528263dc92f1d9358a521 Mon Sep 17 00:00:00 2001 From: leeeha Date: Sat, 27 Jan 2024 19:31:57 +0900 Subject: [PATCH 23/26] =?UTF-8?q?[add]=20#238=20=EC=9C=84=EB=8B=88?= =?UTF-8?q?=ED=94=BC=EB=93=9C=20=EC=A1=B0=ED=9A=8C=20=EA=B4=80=EB=A0=A8=20?= =?UTF-8?q?todo=20=EC=A3=BC=EC=84=9D=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../go/sopt/winey/presentation/main/feed/WineyFeedViewModel.kt | 1 + 1 file changed, 1 insertion(+) diff --git a/app/src/main/java/org/go/sopt/winey/presentation/main/feed/WineyFeedViewModel.kt b/app/src/main/java/org/go/sopt/winey/presentation/main/feed/WineyFeedViewModel.kt index c16785bf..88f1c29c 100644 --- a/app/src/main/java/org/go/sopt/winey/presentation/main/feed/WineyFeedViewModel.kt +++ b/app/src/main/java/org/go/sopt/winey/presentation/main/feed/WineyFeedViewModel.kt @@ -48,6 +48,7 @@ class WineyFeedViewModel @Inject constructor( getWineyFeedList() } + // todo: 위니피드 조회 시, 절약 vs 과소비 타입에 따라 버튼 디자인 바뀌도록 변경 private fun getWineyFeedList() { viewModelScope.launch { _getWineyFeedListState.emit(UiState.Loading) From c4f600f60eaaefc2258f36d860bc021b9e3092bc Mon Sep 17 00:00:00 2001 From: leeeha Date: Sat, 27 Jan 2024 23:21:49 +0900 Subject: [PATCH 24/26] =?UTF-8?q?[del]=20#236=20=EC=82=AC=EC=9A=A9?= =?UTF-8?q?=ED=95=98=EC=A7=80=20=EC=95=8A=EB=8A=94=20=EC=9E=84=ED=8F=AC?= =?UTF-8?q?=ED=8A=B8=EB=AC=B8=20=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../go/sopt/winey/presentation/main/feed/WineyFeedFragment.kt | 1 - .../winey/presentation/main/feed/detail/DetailActivity.kt | 1 - .../sopt/winey/presentation/main/feed/upload/PhotoFragment.kt | 4 ---- .../winey/presentation/main/mypage/myfeed/MyFeedFragment.kt | 1 - .../org/go/sopt/winey/util/fragment/WineyDialogFragment.kt | 1 - app/src/main/java/org/go/sopt/winey/util/intent/ArgsExt.kt | 2 -- .../main/java/org/go/sopt/winey/util/view/WineyPopupMenu.kt | 1 - 7 files changed, 11 deletions(-) diff --git a/app/src/main/java/org/go/sopt/winey/presentation/main/feed/WineyFeedFragment.kt b/app/src/main/java/org/go/sopt/winey/presentation/main/feed/WineyFeedFragment.kt index a323def3..c8cf4e0a 100644 --- a/app/src/main/java/org/go/sopt/winey/presentation/main/feed/WineyFeedFragment.kt +++ b/app/src/main/java/org/go/sopt/winey/presentation/main/feed/WineyFeedFragment.kt @@ -3,7 +3,6 @@ package org.go.sopt.winey.presentation.main.feed import android.content.Intent import android.net.Uri import android.os.Bundle -import android.view.Gravity import android.view.View import androidx.core.view.isVisible import androidx.fragment.app.activityViewModels diff --git a/app/src/main/java/org/go/sopt/winey/presentation/main/feed/detail/DetailActivity.kt b/app/src/main/java/org/go/sopt/winey/presentation/main/feed/detail/DetailActivity.kt index d3557343..af9c38fd 100644 --- a/app/src/main/java/org/go/sopt/winey/presentation/main/feed/detail/DetailActivity.kt +++ b/app/src/main/java/org/go/sopt/winey/presentation/main/feed/detail/DetailActivity.kt @@ -3,7 +3,6 @@ package org.go.sopt.winey.presentation.main.feed.detail import android.content.Intent import android.graphics.Rect import android.os.Bundle -import android.view.Gravity import android.view.MotionEvent import android.view.View import android.widget.EditText diff --git a/app/src/main/java/org/go/sopt/winey/presentation/main/feed/upload/PhotoFragment.kt b/app/src/main/java/org/go/sopt/winey/presentation/main/feed/upload/PhotoFragment.kt index 18190546..7ca7f51b 100644 --- a/app/src/main/java/org/go/sopt/winey/presentation/main/feed/upload/PhotoFragment.kt +++ b/app/src/main/java/org/go/sopt/winey/presentation/main/feed/upload/PhotoFragment.kt @@ -9,17 +9,13 @@ import androidx.fragment.app.commit import dagger.hilt.android.AndroidEntryPoint import org.go.sopt.winey.R import org.go.sopt.winey.databinding.FragmentPhotoBinding -import org.go.sopt.winey.presentation.main.feed.WineyFeedFragment -import org.go.sopt.winey.presentation.main.feed.WineyFeedType import org.go.sopt.winey.presentation.model.WineyDialogLabel import org.go.sopt.winey.util.amplitude.AmplitudeUtils import org.go.sopt.winey.util.binding.BindingFragment import org.go.sopt.winey.util.fragment.WineyDialogFragment import org.go.sopt.winey.util.fragment.stringOf -import org.go.sopt.winey.util.intent.getCompatibleSerializable import org.json.JSONException import org.json.JSONObject -import timber.log.Timber import javax.inject.Inject @AndroidEntryPoint diff --git a/app/src/main/java/org/go/sopt/winey/presentation/main/mypage/myfeed/MyFeedFragment.kt b/app/src/main/java/org/go/sopt/winey/presentation/main/mypage/myfeed/MyFeedFragment.kt index 67d35f21..05131fac 100644 --- a/app/src/main/java/org/go/sopt/winey/presentation/main/mypage/myfeed/MyFeedFragment.kt +++ b/app/src/main/java/org/go/sopt/winey/presentation/main/mypage/myfeed/MyFeedFragment.kt @@ -2,7 +2,6 @@ package org.go.sopt.winey.presentation.main.mypage.myfeed import android.content.Intent import android.os.Bundle -import android.view.Gravity import android.view.View import androidx.core.view.isVisible import androidx.fragment.app.Fragment diff --git a/app/src/main/java/org/go/sopt/winey/util/fragment/WineyDialogFragment.kt b/app/src/main/java/org/go/sopt/winey/util/fragment/WineyDialogFragment.kt index 9a2f3696..f421ca19 100644 --- a/app/src/main/java/org/go/sopt/winey/util/fragment/WineyDialogFragment.kt +++ b/app/src/main/java/org/go/sopt/winey/util/fragment/WineyDialogFragment.kt @@ -7,7 +7,6 @@ import org.go.sopt.winey.databinding.FragmentAlertDialogBinding import org.go.sopt.winey.presentation.model.WineyDialogLabel import org.go.sopt.winey.util.binding.BindingDialogFragment import org.go.sopt.winey.util.intent.getCompatibleParcelable -import org.go.sopt.winey.util.intent.getCompatibleParcelableExtra class WineyDialogFragment : BindingDialogFragment(R.layout.fragment_alert_dialog) { diff --git a/app/src/main/java/org/go/sopt/winey/util/intent/ArgsExt.kt b/app/src/main/java/org/go/sopt/winey/util/intent/ArgsExt.kt index 6cbaed4d..54238498 100644 --- a/app/src/main/java/org/go/sopt/winey/util/intent/ArgsExt.kt +++ b/app/src/main/java/org/go/sopt/winey/util/intent/ArgsExt.kt @@ -1,7 +1,5 @@ package org.go.sopt.winey.util.intent -import android.os.Build -import android.os.Bundle import android.os.Parcelable import androidx.fragment.app.Fragment import kotlin.properties.ReadOnlyProperty diff --git a/app/src/main/java/org/go/sopt/winey/util/view/WineyPopupMenu.kt b/app/src/main/java/org/go/sopt/winey/util/view/WineyPopupMenu.kt index 2e3688d0..6e49f46d 100644 --- a/app/src/main/java/org/go/sopt/winey/util/view/WineyPopupMenu.kt +++ b/app/src/main/java/org/go/sopt/winey/util/view/WineyPopupMenu.kt @@ -10,7 +10,6 @@ import android.widget.PopupWindow import org.go.sopt.winey.R import org.go.sopt.winey.databinding.ItemWineyPopupBinding import org.go.sopt.winey.databinding.LayoutWineyPopupBinding -import org.go.sopt.winey.presentation.main.mypage.myfeed.MyFeedFragment import org.go.sopt.winey.util.context.drawableOf class WineyPopupMenu( From b2af512517a9056038c8f06b82944f5a5914b8b6 Mon Sep 17 00:00:00 2001 From: leeeha Date: Tue, 6 Feb 2024 16:53:23 +0900 Subject: [PATCH 25/26] =?UTF-8?q?[add]=20#238=20=EB=A8=B8=EC=A7=80?= =?UTF-8?q?=ED=95=98=EB=8B=A4=EA=B0=80=20=EB=B9=A0=EB=9C=A8=EB=A6=B0=20?= =?UTF-8?q?=EC=9E=84=ED=8F=AC=ED=8A=B8=EB=AC=B8=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/org/go/sopt/winey/presentation/main/MainActivity.kt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/src/main/java/org/go/sopt/winey/presentation/main/MainActivity.kt b/app/src/main/java/org/go/sopt/winey/presentation/main/MainActivity.kt index 2164de6c..35367e5d 100644 --- a/app/src/main/java/org/go/sopt/winey/presentation/main/MainActivity.kt +++ b/app/src/main/java/org/go/sopt/winey/presentation/main/MainActivity.kt @@ -5,6 +5,7 @@ import android.content.Intent import android.content.pm.PackageManager import android.os.Build import android.os.Bundle +import android.provider.Settings import androidx.activity.result.contract.ActivityResultContracts import androidx.activity.viewModels import androidx.core.content.ContextCompat @@ -30,6 +31,7 @@ import org.go.sopt.winey.util.context.snackBar import org.go.sopt.winey.util.context.stringOf import org.go.sopt.winey.util.context.wineySnackbar import org.go.sopt.winey.util.view.UiState +import org.go.sopt.winey.util.view.snackbar.SnackbarType @AndroidEntryPoint class MainActivity : BindingActivity(R.layout.activity_main) { From a2f440a5336925173e81e07c7c17d421379115f2 Mon Sep 17 00:00:00 2001 From: leeeha Date: Tue, 6 Feb 2024 16:55:55 +0900 Subject: [PATCH 26/26] =?UTF-8?q?[mod]=20#238=20=EC=97=85=EB=A1=9C?= =?UTF-8?q?=EB=93=9C=20=EC=8B=A4=ED=8C=A8=20=EC=8B=9C=20=EC=8A=A4=EB=82=B5?= =?UTF-8?q?=EB=B0=94=20=EB=9D=84=EC=9A=B0=EB=8A=94=20=EC=BD=94=EB=93=9C=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../winey/presentation/main/feed/upload/AmountFragment.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/org/go/sopt/winey/presentation/main/feed/upload/AmountFragment.kt b/app/src/main/java/org/go/sopt/winey/presentation/main/feed/upload/AmountFragment.kt index 5b47b8e6..9f7f340a 100644 --- a/app/src/main/java/org/go/sopt/winey/presentation/main/feed/upload/AmountFragment.kt +++ b/app/src/main/java/org/go/sopt/winey/presentation/main/feed/upload/AmountFragment.kt @@ -22,6 +22,7 @@ import org.go.sopt.winey.util.fragment.wineySnackbar import org.go.sopt.winey.util.multipart.UriToRequestBody import org.go.sopt.winey.util.view.UiState import org.go.sopt.winey.util.view.setOnSingleClickListener +import org.go.sopt.winey.util.view.snackbar.SnackbarType import java.text.DecimalFormat @AndroidEntryPoint @@ -77,10 +78,9 @@ class AmountFragment : BindingFragment(R.layout.fragment_ is UiState.Failure -> { wineySnackbar( anchorView = binding.root, - isSuccess = false, - message = stringOf(R.string.snackbar_upload_fail) + message = stringOf(R.string.snackbar_upload_fail), + type = SnackbarType.WineyFeedResult(isSuccess = false) ) - uploadViewModel.initPostWineyFeedState() }