Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
84581c9
refactor: LaunchedEffect 재시작 -> snapshotFlow로 변경 | base 기능 함수명 변경
ThirFir Jun 26, 2025
7837e3b
chore: core-ui 모듈 생성 | FeatureConventionPlugin 생성
ThirFir Jun 26, 2025
8ec9e34
chore: 미사용 권한 요청 코드 제거
ThirFir Jun 26, 2025
dcda222
refactor: base 함수 일부 롤백(2개의 Flow 변수 -> 1개로 통합)
ThirFir Jun 26, 2025
94b602a
chore: core-model 모듈 생성 | domain, core-ui 모듈에 의존성 추가
ThirFir Jun 26, 2025
3e968f1
refactor: domain에서 core-model로 Model 이동
ThirFir Jun 26, 2025
a2a2d22
refactor: BaseViewModel, FlowExt, CompositionLocals core:ui 모듈로 이동
ThirFir Jun 26, 2025
ae451f4
refactor: compose utils core:ui 모듈로 이동
ThirFir Jun 26, 2025
e16199b
refactor: navigation 관련한 것 제외하고 feature:common -> core:ui로 모두 이동
ThirFir Jun 26, 2025
7548b4b
chore: core-navigation 모듈 생성
ThirFir Jun 26, 2025
e2abaa3
chore: navigation 모듈 build-logic 적용, feature,app모듈 navigation 의존
ThirFir Jun 26, 2025
d43871a
refactor: 각 feature의 Route를 모두 navigation 모듈로 이동
ThirFir Jun 26, 2025
c30768e
refactor: feature-common 하의 Nav Utils를 navigation모듈로 이동
ThirFir Jun 26, 2025
5591d19
chore: feature-common 삭제
ThirFir Jun 26, 2025
b14ff83
refactor: navigation 유틸 정리
ThirFir Jun 26, 2025
758825f
chore: 레거시 Amplitude 코드 제거
ThirFir Jun 26, 2025
798c977
chore: core:utils 모듈 제거
ThirFir Jun 26, 2025
5f33713
refactor: ads-impl을 feature -> provider로 상위 디렉토리 변경
ThirFir Jun 26, 2025
0932beb
chore: Delete unused import
ThirFir Jun 28, 2025
07e4a6a
chore: provider 모듈 패키지명 컨벤션 유지
ThirFir Jun 28, 2025
b3322bd
chore: core-ui 모듈 패키지명 컨벤션 유지
ThirFir Jun 28, 2025
2ff6503
chore: core-navigation 모듈 패키지명 컨벤션 유지
ThirFir Jun 28, 2025
7f9a72e
chore: core-model 모듈 패키지명 컨벤션 유지
ThirFir Jun 28, 2025
88f1cfc
chore: core-analytics 모듈 패키지명 컨벤션 유지
ThirFir Jun 28, 2025
88a41c7
chore: core-adsapi 모듈 패키지명 컨벤션 유지
ThirFir Jun 28, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ fun AreaVerificationScreenContainer(
modifier = modifier
)

viewModel.emitLiveLocation()
viewModel.useLiveLocation()
viewModel.collectSideEffect {
when (it) {
is AreaVerificationSideEffect.NavigateToAppLocationSettings -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import android.annotation.SuppressLint
import android.location.Location
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.snapshotFlow
import androidx.lifecycle.ViewModel
import com.acon.acon.domain.type.UserType
import com.acon.feature.common.compose.LocalLocation
Expand All @@ -12,6 +13,8 @@ import com.acon.feature.common.compose.LocalUserType
import com.acon.feature.common.coroutine.firstNotNull
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.asStateFlow
import kotlinx.coroutines.flow.filterNotNull
import kotlinx.coroutines.flow.onEach
import kotlinx.coroutines.suspendCancellableCoroutine
import org.orbitmvi.orbit.ContainerHost
import org.orbitmvi.orbit.annotation.OrbitDsl
Expand All @@ -20,7 +23,10 @@ import org.orbitmvi.orbit.annotation.OrbitDsl
abstract class BaseContainerHost<STATE : Any, SIDE_EFFECT : Any>() :
ContainerHost<STATE, SIDE_EFFECT>, ViewModel() {

private val liveLocation = MutableStateFlow<Location?>(null)
private val _liveLocation = MutableStateFlow<Location?>(null)
private val liveLocation = _liveLocation.filterNotNull().onEach {
onNewLocation(it)
}

private val _userType = MutableStateFlow(UserType.GUEST)
protected val userType = _userType.asStateFlow()
Expand All @@ -35,21 +41,24 @@ abstract class BaseContainerHost<STATE : Any, SIDE_EFFECT : Any>() :
}

@Composable
fun emitUserType() {
fun useUserType() {
val userType = LocalUserType.current

LaunchedEffect(userType) {
_userType.value = userType
LaunchedEffect(Unit) {
snapshotFlow { userType }.collect {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

여기를 snapshotFlow로 바꾸신 이유가 뭔지 설명해주실 수 있나요?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

자주 바뀔 수 있는 값인데, LaunchedEffect 키로 걸어주면 바뀔 때마다 코루틴이 재실행되므로 비효율적이라고 판단했기 때문입니다

_userType.value = userType
}
}
}

@Composable
fun emitLiveLocation() {
fun useLiveLocation() {
val newLocation = LocalLocation.current

LaunchedEffect(newLocation) {
liveLocation.emit(newLocation)
newLocation?.let { onNewLocation(it) }
LaunchedEffect(Unit) {
snapshotFlow { newLocation }.filterNotNull().collect {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

여기도 snapshotFlow로 바꾸신 이유가 뭔지 설명해주실 수 있나요?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

위와 동일합니다!!

_liveLocation.emit(it)
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ fun ProfileScreenContainer(
onNavigateToUploadScreen = onNavigateToUploadScreen
)

viewModel.emitUserType()
viewModel.useUserType()
viewModel.collectSideEffect {
when(it) {
is ProfileUiSideEffect.OnNavigateToSpotDetailScreen -> { onNavigateToSpotDetailScreen(it.spotId) }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ fun SignInScreenContainer(
onAnimationEnd = viewModel::signIn,
)

viewModel.emitUserType()
viewModel.useUserType()
viewModel.collectSideEffect { sideEffect ->
when(sideEffect) {
is SignInSideEffect.ShowToastMessage -> { context.showToast(R.string.sign_in_failed_toast) }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ fun SpotDetailScreenContainer(
)
}

viewModel.emitUserType()
viewModel.useUserType()
viewModel.collectSideEffect { sideEffect ->
when (sideEffect) {
is SpotDetailSideEffect.NavigateToBack -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ fun SpotListScreenContainer(
}

viewModel.requestLocationPermission()
viewModel.emitUserType()
viewModel.emitLiveLocation()
viewModel.useUserType()
viewModel.useLiveLocation()
viewModel.collectSideEffect {
when (it) {
is SpotListSideEffectV2.ShowToastMessage -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ fun UploadSearchScreenContainer(
modifier = modifier
)

viewModel.emitLiveLocation()
viewModel.useLiveLocation()
viewModel.collectSideEffect { sideEffect ->
when (sideEffect) {
is UploadSearchSideEffect.NavigateToReviewScreen -> onNavigateToReview(sideEffect.spot)
Expand Down