Skip to content

Commit

Permalink
Merge pull request #269 from TeamDon-tBe/feature/#268-version-code-sn…
Browse files Browse the repository at this point in the history
…ackbar

[Feature/#268] : 스낵바 로딩 중일 때, 버전 코드 변경
  • Loading branch information
sohyun127 authored May 29, 2024
2 parents a133135 + cda5aab commit 4f68eaf
Show file tree
Hide file tree
Showing 8 changed files with 75 additions and 67 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,28 @@ internal fun Project.configureAndroidCommonPlugin() {

extensions.getByType<BaseExtension>().apply {
defaultConfig {
val dontbeBaseUrl = properties["dontbe.base.url"] as? String ?: ""
val kakaoApiKey = properties["kakao.api.key"] as? String ?: ""
val amplitudeApiKey = properties["amplitude.api.key"] as? String ?: ""

manifestPlaceholders["dontbeBaseUrl"] = properties["dontbe.base.url"] as String
manifestPlaceholders["kakaoApiKey"] = properties["kakao.api.key"] as String

buildConfigField("String", "DONTBE_BASE_URL", "\"${dontbeBaseUrl}\"")
buildConfigField("String", "KAKAO_APP_KEY", "\"${kakaoApiKey}\"")
buildConfigField("String", "AMPLITUDE_API_KEY", "\"${amplitudeApiKey}\"")
}

buildTypes {
getByName("debug") {
val dontbeDevBaseUrl = properties["dontbe.dev.base.url"] as? String ?: ""
buildConfigField("String", "DONTBE_BASE_URL", "\"${dontbeDevBaseUrl}\"")
manifestPlaceholders["dontbeBaseUrl"] = properties["dontbe.dev.base.url"] as String
}
getByName("release") {
val dontbeRelBaseUrl = properties["dontbe.rel.base.url"] as? String ?: ""
buildConfigField("String", "DONTBE_BASE_URL", "\"${dontbeRelBaseUrl}\"")
manifestPlaceholders["dontbeBaseUrl"] = properties["dontbe.rel.base.url"] as String
}
}

buildFeatures.apply {
viewBinding = true
buildConfig = true
Expand All @@ -47,4 +58,4 @@ internal fun Project.configureAndroidCommonPlugin() {
"implementation"(libs.findLibrary("material").get())
"implementation"(libs.findLibrary("timber").get())
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ class HomeViewModel
uriString: String?
) {
viewModelScope.launch {
_postCommentPosting.emit(UiState.Loading)
homeRepository.postCommentPosting(contentId, commentText, uriString)
.onSuccess {
if (it) _postCommentPosting.emit(UiState.Success(it))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,8 @@ class HomeDetailFragment :
}
}

else -> Unit
is UiState.Loading -> UploadingSnackBar.make(binding.root).show()
is UiState.Empty -> Unit
}
}.launchIn(viewLifeCycleScope)
}
Expand All @@ -314,7 +315,6 @@ class HomeDetailFragment :
requireContext().hideKeyboard(binding.root)
(requireActivity() as MainActivity).findViewById<View>(R.id.bnv_main).visibility =
View.VISIBLE
UploadingSnackBar.make(binding.root).show()
}

private fun observeDeleteComment() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,15 +160,12 @@ class PostingFragment : BindingFragment<FragmentPostingBinding>(R.layout.fragmen
private fun initObservePost() {
postingViewModel.postPosting.flowWithLifecycle(viewLifeCycle).onEach {
when (it) {
is UiState.Loading -> Unit
is UiState.Success -> {
navigateToMainActivity()
context?.let { it ->
UploadingSnackBar.make(binding.root)
.show(it.pxToDp(16), 0, it.pxToDp(16), it.pxToDp(80))
}
is UiState.Loading -> context?.let { it ->
UploadingSnackBar.make(binding.root)
.show(it.pxToDp(16), 0, it.pxToDp(16), it.pxToDp(80))
}

is UiState.Success -> navigateToMainActivity()
is UiState.Empty -> Unit
is UiState.Failure -> {
LinkCountErrorSnackBar.make(binding.root).apply {
Expand Down Expand Up @@ -279,9 +276,9 @@ class PostingFragment : BindingFragment<FragmentPostingBinding>(R.layout.fragmen
trackEvent(CLICK_POST_UPLOAD)
postingViewModel.posting(
binding.etPostingContent.text.toString() + (
binding.etPostingLink.text.takeIf { it.isNotEmpty() }
?.let { "\n$it" }.orEmpty()
),
binding.etPostingLink.text.takeIf { it.isNotEmpty() }
?.let { "\n$it" }.orEmpty()
),
postingViewModel.photoUri.value
)
}
Expand Down Expand Up @@ -413,7 +410,6 @@ class PostingFragment : BindingFragment<FragmentPostingBinding>(R.layout.fragmen
}
}


private fun observePhotoUri() {
postingViewModel.photoUri.flowWithLifecycle(viewLifeCycle).onEach { getUri ->
getUri?.let { uri ->
Expand Down
32 changes: 16 additions & 16 deletions feature/src/main/res/layout/item_home_comment.xml
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,22 @@
app:layout_constraintStart_toStartOf="@id/iv_comment_profile"
app:layout_constraintTop_toBottomOf="@id/iv_comment_profile" />

<com.google.android.material.imageview.ShapeableImageView
android:id="@+id/iv_home_feed_img"
setEmptyImageUrl="@{comment.commentImageUrl}"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginTop="8dp"
android:scaleType="centerCrop"
android:visibility="visible"
app:layout_constraintBottom_toTopOf="@id/btn_comment_heart"
app:layout_constraintDimensionRatio="270:330"
app:layout_constraintEnd_toEndOf="@id/tv_comment_content"
app:layout_constraintStart_toStartOf="@id/tv_comment_content"
app:layout_constraintTop_toBottomOf="@id/tv_comment_content"
app:shapeAppearance="@style/ShapeAppearanceOverlay.App.CornerRadius4"
tools:background="@color/primary" />

<View
android:id="@+id/view_comment_transparent_bg"
android:layout_width="0dp"
Expand Down Expand Up @@ -187,22 +203,6 @@
app:layout_constraintStart_toEndOf="@id/btn_comment_heart"
app:layout_constraintTop_toTopOf="@id/btn_comment_heart"
tools:text="544" />

<com.google.android.material.imageview.ShapeableImageView
android:id="@+id/iv_home_feed_img"
setEmptyImageUrl="@{comment.commentImageUrl}"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginTop="8dp"
android:scaleType="centerCrop"
android:visibility="visible"
app:layout_constraintBottom_toTopOf="@id/btn_comment_heart"
app:layout_constraintDimensionRatio="270:330"
app:layout_constraintEnd_toEndOf="@id/tv_comment_content"
app:layout_constraintStart_toStartOf="@id/tv_comment_content"
app:layout_constraintTop_toBottomOf="@id/tv_comment_content"
app:shapeAppearance="@style/ShapeAppearanceOverlay.App.CornerRadius4"
tools:background="@color/primary" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>
32 changes: 16 additions & 16 deletions feature/src/main/res/layout/item_home_feed.xml
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,22 @@
app:layout_constraintStart_toStartOf="@id/iv_home_profile"
app:layout_constraintTop_toBottomOf="@id/iv_home_profile" />

<com.google.android.material.imageview.ShapeableImageView
android:id="@+id/iv_home_feed_img"
setEmptyImageUrl="@{feed.contentImageUrl}"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginTop="8dp"
android:scaleType="centerCrop"
android:visibility="visible"
app:layout_constraintBottom_toTopOf="@id/btn_home_heart"
app:layout_constraintDimensionRatio="270:330"
app:layout_constraintEnd_toEndOf="@id/tv_home_feed_content"
app:layout_constraintStart_toStartOf="@id/tv_home_feed_content"
app:layout_constraintTop_toBottomOf="@id/tv_home_feed_content"
app:shapeAppearance="@style/ShapeAppearanceOverlay.App.CornerRadius4"
tools:background="@color/primary" />

<View
android:id="@+id/view_home_transparent_bg"
android:layout_width="0dp"
Expand Down Expand Up @@ -180,21 +196,5 @@
app:layout_constraintStart_toEndOf="@id/btn_home_heart"
app:layout_constraintTop_toTopOf="@id/btn_home_heart"
tools:text="541" />

<com.google.android.material.imageview.ShapeableImageView
android:id="@+id/iv_home_feed_img"
setEmptyImageUrl="@{feed.contentImageUrl}"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginTop="8dp"
android:scaleType="centerCrop"
android:visibility="visible"
app:layout_constraintBottom_toTopOf="@id/btn_home_heart"
app:layout_constraintDimensionRatio="270:330"
app:layout_constraintEnd_toEndOf="@id/tv_home_feed_content"
app:layout_constraintStart_toStartOf="@id/tv_home_feed_content"
app:layout_constraintTop_toBottomOf="@id/tv_home_feed_content"
app:shapeAppearance="@style/ShapeAppearanceOverlay.App.CornerRadius4"
tools:background="@color/primary" />
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>
32 changes: 16 additions & 16 deletions feature/src/main/res/layout/item_my_page_comment.xml
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,22 @@
tools:text="돈비를 사용하면 진짜 돈비를 맞을 수 있나요?
저 돈비 맞고 싶어요 돈벼락이 최고입니다. 그나저나 돈비 정말 흥미로운 서비스인 것 같아요 어떻게 이런 기획을 ? 대박 ㄷ ㄷ ㄷ돈비를 사용하면 진짜 돈비를 맞을 수 있나요?" />

<com.google.android.material.imageview.ShapeableImageView
android:id="@+id/iv_home_feed_img"
setEmptyImageUrl="@{feed.commentImageUrl}"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginTop="8dp"
android:scaleType="centerCrop"
android:visibility="visible"
app:layout_constraintBottom_toTopOf="@id/iv_comment_ghost_fill_green"
app:layout_constraintDimensionRatio="270:330"
app:layout_constraintEnd_toEndOf="@id/tv_comment_content"
app:layout_constraintStart_toStartOf="@id/tv_comment_content"
app:layout_constraintTop_toBottomOf="@id/tv_comment_content"
app:shapeAppearance="@style/ShapeAppearanceOverlay.App.CornerRadius4"
tools:background="@color/primary" />

<View
android:id="@+id/view_home_transparent_bg"
android:layout_width="0dp"
Expand Down Expand Up @@ -151,21 +167,5 @@
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="@id/btn_comment_heart"
tools:text="54" />

<com.google.android.material.imageview.ShapeableImageView
android:id="@+id/iv_home_feed_img"
setEmptyImageUrl="@{feed.commentImageUrl}"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginTop="8dp"
android:scaleType="centerCrop"
android:visibility="visible"
app:layout_constraintBottom_toTopOf="@id/iv_comment_ghost_fill_green"
app:layout_constraintDimensionRatio="270:330"
app:layout_constraintEnd_toEndOf="@id/tv_comment_content"
app:layout_constraintStart_toStartOf="@id/tv_comment_content"
app:layout_constraintTop_toBottomOf="@id/tv_comment_content"
app:shapeAppearance="@style/ShapeAppearanceOverlay.App.CornerRadius4"
tools:background="@color/primary" />
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>
4 changes: 2 additions & 2 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
compileSdk = "34"
minSdk = "28"
targetSdk = "34"
appVersion = "1.1.0"
versionCode = "7"
appVersion = "1.2.0"
versionCode = "8"

# kotlin
kotlin = "1.9.10"
Expand Down

0 comments on commit 4f68eaf

Please sign in to comment.