Skip to content

Commit

Permalink
[Feature] ScheduleAdd 화면 구현 (#58)
Browse files Browse the repository at this point in the history
  • Loading branch information
ajou4095 authored Feb 7, 2024
1 parent 8210ef6 commit ed986c3
Show file tree
Hide file tree
Showing 20 changed files with 733 additions and 24 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package ac.dnd.bookkeeping.android.data.repository.feature.schedule

import ac.dnd.bookkeeping.android.domain.model.feature.schedule.AlarmRepeatType
import ac.dnd.bookkeeping.android.domain.model.feature.schedule.UnrecordedSchedule
import ac.dnd.bookkeeping.android.domain.model.feature.schedule.UnrecordedScheduleRelation
import ac.dnd.bookkeeping.android.domain.repository.ScheduleRepository
Expand All @@ -15,7 +16,7 @@ class MockScheduleRepository @Inject constructor() : ScheduleRepository {
relationId: Long,
day: LocalDate,
event: String,
repeatType: String,
repeatType: AlarmRepeatType,
repeatFinish: LocalDate,
alarm: LocalDateTime,
time: LocalTime,
Expand All @@ -32,7 +33,7 @@ class MockScheduleRepository @Inject constructor() : ScheduleRepository {
relationId: Long,
day: LocalDate,
event: String,
repeatType: String,
repeatType: AlarmRepeatType,
repeatFinish: LocalDate,
alarm: LocalDateTime,
time: LocalTime,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import ac.dnd.bookkeeping.android.data.remote.local.SharedPreferencesManager
import ac.dnd.bookkeeping.android.data.remote.network.api.ScheduleApi
import ac.dnd.bookkeeping.android.data.remote.network.util.toDomain
import ac.dnd.bookkeeping.android.domain.model.feature.group.Group
import ac.dnd.bookkeeping.android.domain.model.feature.schedule.AlarmRepeatType
import ac.dnd.bookkeeping.android.domain.model.feature.schedule.UnrecordedSchedule
import ac.dnd.bookkeeping.android.domain.repository.GroupRepository
import ac.dnd.bookkeeping.android.domain.repository.ScheduleRepository
Expand All @@ -20,7 +21,7 @@ class RealScheduleRepository @Inject constructor(
relationId: Long,
day: LocalDate,
event: String,
repeatType: String,
repeatType: AlarmRepeatType,
repeatFinish: LocalDate,
alarm: LocalDateTime,
time: LocalTime,
Expand All @@ -32,7 +33,7 @@ class RealScheduleRepository @Inject constructor(
relationId = relationId,
day = day,
event = event,
repeatType = repeatType,
repeatType = repeatType.value,
repeatFinish = repeatFinish,
alarm = alarm,
time = time,
Expand All @@ -47,7 +48,7 @@ class RealScheduleRepository @Inject constructor(
relationId: Long,
day: LocalDate,
event: String,
repeatType: String,
repeatType: AlarmRepeatType,
repeatFinish: LocalDate,
alarm: LocalDateTime,
time: LocalTime,
Expand All @@ -60,7 +61,7 @@ class RealScheduleRepository @Inject constructor(
relationId = relationId,
day = day,
event = event,
repeatType = repeatType,
repeatType = repeatType.value,
repeatFinish = repeatFinish,
alarm = alarm,
time = time,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package ac.dnd.bookkeeping.android.domain.model.feature.schedule

sealed class AlarmRepeatType(val value: String) {
data object Month : AlarmRepeatType("month")
data object Year : AlarmRepeatType("year")
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package ac.dnd.bookkeeping.android.domain.repository

import ac.dnd.bookkeeping.android.domain.model.feature.schedule.AlarmRepeatType
import ac.dnd.bookkeeping.android.domain.model.feature.schedule.UnrecordedSchedule
import kotlinx.datetime.LocalDate
import kotlinx.datetime.LocalDateTime
Expand All @@ -11,7 +12,7 @@ interface ScheduleRepository {
relationId: Long,
day: LocalDate,
event: String,
repeatType: String,
repeatType: AlarmRepeatType,
repeatFinish: LocalDate,
alarm: LocalDateTime,
time: LocalTime,
Expand All @@ -25,7 +26,7 @@ interface ScheduleRepository {
relationId: Long,
day: LocalDate,
event: String,
repeatType: String,
repeatType: AlarmRepeatType,
repeatFinish: LocalDate,
alarm: LocalDateTime,
time: LocalTime,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package ac.dnd.bookkeeping.android.domain.usecase.feature.schedule

import ac.dnd.bookkeeping.android.domain.model.feature.schedule.AlarmRepeatType
import ac.dnd.bookkeeping.android.domain.repository.ScheduleRepository
import kotlinx.datetime.LocalDate
import kotlinx.datetime.LocalDateTime
Expand All @@ -13,7 +14,7 @@ class AddScheduleUseCase @Inject constructor(
relationId: Long,
day: LocalDate,
event: String,
repeatType: String,
repeatType: AlarmRepeatType,
repeatFinish: LocalDate,
alarm: LocalDateTime,
time: LocalTime,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package ac.dnd.bookkeeping.android.domain.usecase.feature.schedule

import ac.dnd.bookkeeping.android.domain.model.feature.schedule.AlarmRepeatType
import ac.dnd.bookkeeping.android.domain.repository.ScheduleRepository
import kotlinx.datetime.LocalDate
import kotlinx.datetime.LocalDateTime
Expand All @@ -14,7 +15,7 @@ class EditScheduleUseCase @Inject constructor(
relationId: Long,
day: LocalDate,
event: String,
repeatType: String,
repeatType: AlarmRepeatType,
repeatFinish: LocalDate,
alarm: LocalDateTime,
time: LocalTime,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ package ac.dnd.bookkeeping.android.presentation.ui.main.home

import ac.dnd.bookkeeping.android.presentation.common.util.ErrorObserver
import ac.dnd.bookkeeping.android.presentation.ui.main.ApplicationState
import ac.dnd.bookkeeping.android.presentation.ui.main.home.schedule.add.scheduleDestination
import androidx.compose.runtime.getValue
import androidx.compose.runtime.remember
import androidx.hilt.navigation.compose.hiltViewModel
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import androidx.navigation.NavGraphBuilder
Expand Down Expand Up @@ -35,4 +35,6 @@ fun NavGraphBuilder.homeDestination(
handler = viewModel.handler
)
}

scheduleDestination(appState)
}
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,12 @@ fun HomeScreen(
icon = R.drawable.ic_launcher
),
MainBottomBarItem(
route = ScheduleConstant.ROUTE,
route = StatisticsConstant.ROUTE,
name = "통계",
icon = R.drawable.ic_launcher
),
MainBottomBarItem(
route = StatisticsConstant.ROUTE,
route = ScheduleConstant.ROUTE,
name = "일정",
icon = R.drawable.ic_launcher
),
Expand Down Expand Up @@ -123,11 +123,13 @@ fun HomeScreen(
appState = appState
)
}

ScheduleConstant.ROUTE -> {
ScheduleScreen(
appState = appState
)
}

StatisticsConstant.ROUTE -> {
StatisticsScreen(
appState = appState
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -350,8 +350,7 @@ private fun SearchRelationRelation(
}
}

// TODO : Preview 안보임.
@Preview
@Preview(apiLevel = 33)
@Composable
fun SearchRelationScreenPreview() {
SearchRelationScreen(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,20 @@ import ac.dnd.bookkeeping.android.presentation.common.util.coroutine.event.Event
import ac.dnd.bookkeeping.android.presentation.common.util.coroutine.event.MutableEventFlow
import ac.dnd.bookkeeping.android.presentation.common.util.coroutine.event.eventObserve
import ac.dnd.bookkeeping.android.presentation.ui.main.ApplicationState
import ac.dnd.bookkeeping.android.presentation.ui.main.home.schedule.add.ScheduleAddConstant
import ac.dnd.bookkeeping.android.presentation.ui.main.rememberApplicationState
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.padding
import androidx.compose.material.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.rememberCoroutineScope
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import androidx.hilt.navigation.compose.hiltViewModel
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import kotlinx.coroutines.CoroutineExceptionHandler
Expand Down Expand Up @@ -50,8 +58,21 @@ private fun ScheduleScreen(
) {
val scope = rememberCoroutineScope()

Box {
fun navigateToScheduleAdd() {
appState.navController.navigate(ScheduleAddConstant.ROUTE)
}

Box {
Text(
text = "ScheduleAdd",
fontSize = 20.sp,
color = Color.Black,
modifier = Modifier
.padding(vertical = 10.dp)
.clickable {
navigateToScheduleAdd()
}
)
}

LaunchedEffectWithLifecycle(event, handler) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ fun NavGraphBuilder.scheduleAddDestination(
composable(
route = ScheduleAddConstant.ROUTE
) {
// TODO : 수정 argument 추가
val viewModel: ScheduleAddViewModel = hiltViewModel()

val model: ScheduleAddModel = let {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
package ac.dnd.bookkeeping.android.presentation.ui.main.home.schedule.add

sealed interface ScheduleAddIntent
sealed interface ScheduleAddIntent {
data object OnConfirm : ScheduleAddIntent
}
Loading

0 comments on commit ed986c3

Please sign in to comment.