Skip to content

Commit

Permalink
[Feature] History 패키지 변경 (#46)
Browse files Browse the repository at this point in the history
  • Loading branch information
ajou4095 authored Feb 5, 2024
1 parent 2e3b100 commit 85f0798
Show file tree
Hide file tree
Showing 41 changed files with 293 additions and 364 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package ac.dnd.bookkeeping.android.presentation.ui.main.home
import ac.dnd.bookkeeping.android.presentation.common.util.ErrorObserver
import ac.dnd.bookkeeping.android.presentation.common.view.CustomSnackBarHost
import ac.dnd.bookkeeping.android.presentation.ui.main.ApplicationState
import ac.dnd.bookkeeping.android.presentation.ui.main.home.bookkeeping.BookkeepingScreen
import ac.dnd.bookkeeping.android.presentation.ui.main.home.history.HistoryScreen
import ac.dnd.bookkeeping.android.presentation.ui.main.home.setting.SettingScreen
import androidx.compose.foundation.ExperimentalFoundationApi
import androidx.compose.foundation.layout.fillMaxSize
Expand Down Expand Up @@ -67,7 +67,7 @@ fun HomeScreen(
) { page ->
when (page) {
0 -> {
BookkeepingScreen(
HistoryScreen(
appState = appState
)
}
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package ac.dnd.bookkeeping.android.presentation.ui.main.home.event.common.group
package ac.dnd.bookkeeping.android.presentation.ui.main.home.common.group.add

sealed interface AddGroupEvent {
sealed interface AddGroup : AddGroupEvent {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package ac.dnd.bookkeeping.android.presentation.ui.main.home.event.common.group
package ac.dnd.bookkeeping.android.presentation.ui.main.home.common.group.add

sealed interface AddGroupIntent {
data class OnConfirm(val name: String) : AddGroupIntent
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package ac.dnd.bookkeeping.android.presentation.ui.main.home.event.common.group
package ac.dnd.bookkeeping.android.presentation.ui.main.home.common.group.add

import androidx.compose.runtime.Immutable

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package ac.dnd.bookkeeping.android.presentation.ui.main.home.event.common.group
package ac.dnd.bookkeeping.android.presentation.ui.main.home.common.group.add

import ac.dnd.bookkeeping.android.presentation.R
import ac.dnd.bookkeeping.android.presentation.common.theme.Gray200
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package ac.dnd.bookkeeping.android.presentation.ui.main.home.event.common.group
package ac.dnd.bookkeeping.android.presentation.ui.main.home.common.group.add

sealed interface AddGroupState {
data object Init : AddGroupState
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package ac.dnd.bookkeeping.android.presentation.ui.main.home.event.common.group
package ac.dnd.bookkeeping.android.presentation.ui.main.home.common.group.add

import ac.dnd.bookkeeping.android.domain.model.error.ServerException
import ac.dnd.bookkeeping.android.domain.usecase.feature.group.AddGroupUseCase
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package ac.dnd.bookkeeping.android.presentation.ui.main.home.common.relation.get

object GetRelationConstant {
const val ROUTE: String = "searchName"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package ac.dnd.bookkeeping.android.presentation.ui.main.home.common.relation.get

sealed interface GetRelationEvent
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package ac.dnd.bookkeeping.android.presentation.ui.main.home.common.relation.get

sealed interface GetRelationIntent
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package ac.dnd.bookkeeping.android.presentation.ui.main.home.event.common.relation
package ac.dnd.bookkeeping.android.presentation.ui.main.home.common.relation.get

import ac.dnd.bookkeeping.android.domain.model.feature.group.GroupWithRelation
import androidx.compose.runtime.Immutable

@Immutable
data class SearchRelationModel(
val state: SearchRelationState,
data class GetRelationModel(
val state: GetRelationState,
val groups: List<GroupWithRelation>
)
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package ac.dnd.bookkeeping.android.presentation.ui.main.home.event.common.relation
package ac.dnd.bookkeeping.android.presentation.ui.main.home.common.relation.get

import ac.dnd.bookkeeping.android.domain.model.feature.group.GroupWithRelation
import ac.dnd.bookkeeping.android.domain.model.feature.relation.RelationSimple
Expand Down Expand Up @@ -69,13 +69,13 @@ fun SearchRelationScreen(
appState: ApplicationState,
onDismissRequest: () -> Unit,
onResult: (RelationSimple) -> Unit,
viewModel: SearchRelationViewModel = hiltViewModel()
viewModel: GetRelationViewModel = hiltViewModel()
) {
val model: SearchRelationModel = Unit.let {
val model: GetRelationModel = Unit.let {
val state by viewModel.state.collectAsStateWithLifecycle()
val groups by viewModel.groups.collectAsStateWithLifecycle()

SearchRelationModel(
GetRelationModel(
state = state,
groups = groups
)
Expand All @@ -97,9 +97,9 @@ fun SearchRelationScreen(
@OptIn(ExperimentalMaterialApi::class)
private fun SearchRelationScreen(
appState: ApplicationState,
model: SearchRelationModel,
event: EventFlow<SearchRelationEvent>,
intent: (SearchRelationIntent) -> Unit,
model: GetRelationModel,
event: EventFlow<GetRelationEvent>,
intent: (GetRelationIntent) -> Unit,
handler: CoroutineExceptionHandler,
onDismissRequest: () -> Unit,
onResult: (RelationSimple) -> Unit,
Expand Down Expand Up @@ -356,7 +356,7 @@ private fun SearchRelationRelation(
fun SearchRelationScreenPreview() {
SearchRelationScreen(
appState = rememberApplicationState(),
model = SearchRelationModel(state = SearchRelationState.Init, groups = listOf()),
model = GetRelationModel(state = GetRelationState.Init, groups = listOf()),
event = MutableEventFlow(),
intent = {},
handler = CoroutineExceptionHandler { _, _ -> },
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package ac.dnd.bookkeeping.android.presentation.ui.main.home.common.relation.get

sealed interface GetRelationState {
data object Init : GetRelationState
data object Loading : GetRelationState
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package ac.dnd.bookkeeping.android.presentation.ui.main.home.event.common.relation
package ac.dnd.bookkeeping.android.presentation.ui.main.home.common.relation.get

import ac.dnd.bookkeeping.android.domain.model.error.ServerException
import ac.dnd.bookkeeping.android.domain.model.feature.group.GroupWithRelation
Expand All @@ -16,24 +16,24 @@ import kotlinx.coroutines.flow.asStateFlow
import javax.inject.Inject

@HiltViewModel
class SearchRelationViewModel @Inject constructor(
class GetRelationViewModel @Inject constructor(
private val savedStateHandle: SavedStateHandle,
private val getGroupListWithRelationUseCase: GetGroupListWithRelationUseCase
) : BaseViewModel() {

private val _state: MutableStateFlow<SearchRelationState> =
MutableStateFlow(SearchRelationState.Init)
val state: StateFlow<SearchRelationState> = _state.asStateFlow()
private val _state: MutableStateFlow<GetRelationState> =
MutableStateFlow(GetRelationState.Init)
val state: StateFlow<GetRelationState> = _state.asStateFlow()

private val _event: MutableEventFlow<SearchRelationEvent> = MutableEventFlow()
val event: EventFlow<SearchRelationEvent> = _event.asEventFlow()
private val _event: MutableEventFlow<GetRelationEvent> = MutableEventFlow()
val event: EventFlow<GetRelationEvent> = _event.asEventFlow()

private val _groups: MutableStateFlow<List<GroupWithRelation>> = MutableStateFlow(emptyList())
val groups: StateFlow<List<GroupWithRelation>> = _groups.asStateFlow()

init {
launch {
_state.value = SearchRelationState.Loading
_state.value = GetRelationState.Loading
getGroupListWithRelationUseCase()
.onSuccess {
_groups.value = it
Expand All @@ -51,7 +51,7 @@ class SearchRelationViewModel @Inject constructor(
}
}

fun onIntent(intent: SearchRelationIntent) {
fun onIntent(intent: GetRelationIntent) {

}
}

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
package ac.dnd.bookkeeping.android.presentation.ui.main.home.history

object HistoryConstant {
const val ROUTE = "/history"
const val ROUTE: String = "/history"
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
package ac.dnd.bookkeeping.android.presentation.ui.main.home.history.main
package ac.dnd.bookkeeping.android.presentation.ui.main.home.history

sealed interface HistoryMainEvent
sealed interface HistoryEvent
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
package ac.dnd.bookkeeping.android.presentation.ui.main.home.history.main
package ac.dnd.bookkeeping.android.presentation.ui.main.home.history

sealed interface HistoryMainIntent
sealed interface HistoryIntent
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package ac.dnd.bookkeeping.android.presentation.ui.main.home.history.main
package ac.dnd.bookkeeping.android.presentation.ui.main.home.history

import ac.dnd.bookkeeping.android.domain.model.legacy.HistoryInfoLegacy
import androidx.compose.runtime.Immutable

@Immutable
data class HistoryMainModel(
val state: HistoryMainState,
data class HistoryModel(
val state: HistoryState,
val historyInfo: HistoryInfoLegacy
)
Loading

0 comments on commit 85f0798

Please sign in to comment.