Skip to content

Commit

Permalink
feat: 의견 제안 클릭 이벤트 적용
Browse files Browse the repository at this point in the history
  • Loading branch information
Heonbyeong committed Aug 16, 2024
1 parent 0889066 commit 9f9d5ee
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.moneymong.moneymong.feature.agency.search

import android.content.Intent
import android.net.Uri
import androidx.compose.foundation.Image
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Arrangement
Expand All @@ -18,6 +20,7 @@ import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.dp
Expand Down Expand Up @@ -55,6 +58,7 @@ fun AgencySearchScreen(
navigateAgencyJoin: (agencyId: Long) -> Unit
) {
val state by viewModel.collectAsState()
val context = LocalContext.current
val pagingItems = viewModel.agencies.collectAsLazyPagingItems()

viewModel.collectSideEffect {
Expand All @@ -66,6 +70,11 @@ fun AgencySearchScreen(
is AgencySearchSideEffect.NavigateToAgencyJoin -> {
navigateAgencyJoin(it.agencyId)
}

is AgencySearchSideEffect.FollowAsk -> {
val intent = Intent(Intent.ACTION_VIEW, Uri.parse("https://asked.kr/moneymong"))
context.startActivity(intent)
}
}
}

Expand Down Expand Up @@ -100,6 +109,7 @@ fun AgencySearchScreen(
viewModel.navigateToJoin(agencyId)
}
},
onClickFeedbackItem = viewModel::onClickAskFeedback,
isLoading = state.isLoading,
isError = state.isError,
errorMessage = state.errorMessage,
Expand Down Expand Up @@ -133,6 +143,7 @@ private fun AgencySearchContentView(
modifier: Modifier = Modifier,
pagingItems: LazyPagingItems<Agency>,
onClickItem: (agencyId: Long) -> Unit,
onClickFeedbackItem: () -> Unit,
isLoading: Boolean,
isError: Boolean,
errorMessage: String,
Expand All @@ -157,18 +168,18 @@ private fun AgencySearchContentView(
},
)
} else {
if (pagingItems.itemCount != 0) {
if (pagingItems.itemCount == 0) {
ContentViewWithoutAgencies(
modifier = modifier,
pagingItems = pagingItems,
onClickFeedbackItem = {}
onClickFeedbackItem = onClickFeedbackItem
)
} else {
ContentViewWithAgencies(
modifier = modifier,
pagingItems = pagingItems,
onClickItem = onClickItem,
onClickFeedbackItem = {}
onClickFeedbackItem = onClickFeedbackItem
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ import com.moneymong.moneymong.common.base.SideEffect
sealed interface AgencySearchSideEffect : SideEffect {
data class NavigateToRegister(val isUniversityStudent: Boolean) : AgencySearchSideEffect
data class NavigateToAgencyJoin(val agencyId: Long) : AgencySearchSideEffect
data object FollowAsk : AgencySearchSideEffect
}
Original file line number Diff line number Diff line change
Expand Up @@ -87,4 +87,6 @@ class AgencySearchViewModel @Inject constructor(
state.copy(visibleWarningDialog = visible)
}
}

fun onClickAskFeedback() = eventEmit(AgencySearchSideEffect.FollowAsk)
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.moneymong.moneymong.feature.mymong.main

import android.content.Intent
import android.net.Uri
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Spacer
Expand Down Expand Up @@ -37,6 +39,7 @@ fun MyMongScreen(
navigateToLogin: () -> Unit,
) {
val state by viewModel.collectAsState()
val context = LocalContext.current

viewModel.collectSideEffect {
when (it) {
Expand All @@ -57,6 +60,8 @@ fun MyMongScreen(
}

is MyMongSideEffect.FollowKakaoChannel -> {
val intent = Intent(Intent.ACTION_VIEW, Uri.parse("https://pf.kakao.com/_zDsyG"))
context.startActivity(intent)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import com.moneymong.moneymong.design_system.component.button.MDSButton
Expand Down Expand Up @@ -48,7 +49,7 @@ fun MyMongFeedbackView(
Column {
Text(
text = "머니몽에게 자유롭게\n문의 해보세요!",
style = Body4,
style = Body4.copy(fontWeight = FontWeight.Bold),
color = Gray08
)
Spacer(modifier = Modifier.height(8.dp))
Expand Down

0 comments on commit 9f9d5ee

Please sign in to comment.