Skip to content

Commit

Permalink
RenewDateUtil 을 DateUtil로 네이밍 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
toastmeister1 committed Jan 14, 2024
1 parent 4826f3c commit 43852c0
Show file tree
Hide file tree
Showing 11 changed files with 16 additions and 19 deletions.
1 change: 0 additions & 1 deletion app/src/main/java/com/yapp/attendance/di/DataModule.kt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import com.yapp.domain.repository.RemoteConfigRepository
import com.yapp.domain.repository.SessionRepository
import com.yapp.domain.repository.TeamRepository
import com.yapp.domain.util.DateParser
import com.yapp.domain.util.RenewDateUtil
import dagger.Module
import dagger.Provides
import dagger.hilt.InstallIn
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ package com.yapp.domain.usecases

import com.yapp.domain.model.Session
import com.yapp.domain.repository.RemoteConfigRepository
import com.yapp.domain.util.RenewDateUtil
import com.yapp.domain.util.DateUtil
import javax.inject.Inject


class CheckQrAuthTimeUseCase @Inject constructor(
private val remoteConfigRepository: RemoteConfigRepository,
private val dateUtil: RenewDateUtil
private val dateUtil: DateUtil
) {

companion object {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import javax.inject.Inject

class GetUpcomingSessionUseCase @Inject constructor(
private val remoteConfigRepository: RemoteConfigRepository,
private val dateUtil: RenewDateUtil
private val dateUtil: DateUtil
) {

suspend operator fun invoke(): Result<Session?> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ import com.yapp.domain.model.Attendance
import com.yapp.domain.model.Session
import com.yapp.domain.repository.LocalRepository
import com.yapp.domain.repository.MemberRepository
import com.yapp.domain.util.RenewDateUtil
import com.yapp.domain.util.DateUtil
import javax.inject.Inject

class MarkAttendanceUseCase @Inject constructor(
private val localRepository: LocalRepository,
private val memberRepository: MemberRepository,
private val dateUtil: RenewDateUtil
private val dateUtil: DateUtil
) {

suspend operator fun invoke(checkedSession: Session): Result<Unit> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import javax.inject.Inject

typealias Minute = Long

class RenewDateUtil @Inject constructor() {
class DateUtil @Inject constructor() {

fun getCurrentTime(): LocalDateTime {
return LocalDateTime.now()
Expand Down
4 changes: 2 additions & 2 deletions domain/src/test/java/DateUtilTest.kt
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import com.yapp.domain.util.DateParser
import com.yapp.domain.util.RenewDateUtil
import com.yapp.domain.util.DateUtil
import io.kotest.core.spec.style.BehaviorSpec
import io.kotest.matchers.shouldBe

class DateUtilTest : BehaviorSpec({
val dateParser = DateParser()
val dateUtil = RenewDateUtil()
val dateUtil = DateUtil()

given("[세션시간]과 그로 부터 [30분 전 시간]이 주어진 경우") {
val currentTime = dateParser.parse(rawDate = "2024-01-04 14:00:00")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@ package com.yapp.presentation.ui.admin.main

import androidx.lifecycle.viewModelScope
import com.yapp.common.base.BaseViewModel
import com.yapp.domain.model.Session
import com.yapp.domain.model.collections.AttendanceList
import com.yapp.domain.usecases.GetSessionListUseCase
import com.yapp.domain.usecases.GetUpcomingSessionUseCase
import com.yapp.domain.util.RenewDateUtil
import com.yapp.domain.util.DateUtil
import com.yapp.presentation.ui.admin.main.AdminMainContract.AdminMainUiEvent
import com.yapp.presentation.ui.admin.main.AdminMainContract.AdminMainUiSideEffect
import com.yapp.presentation.ui.admin.main.AdminMainContract.AdminMainUiState
Expand All @@ -18,7 +17,7 @@ import javax.inject.Inject
class AdminMainViewModel @Inject constructor(
private val getSessionListUseCase: GetSessionListUseCase,
private val getUpcomingSessionUseCase: GetUpcomingSessionUseCase,
private val dateUtil: RenewDateUtil
private val dateUtil: DateUtil
) : BaseViewModel<AdminMainUiState, AdminMainUiSideEffect, AdminMainUiEvent>(
AdminMainUiState()
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ import com.yapp.common.yds.YDSProgressBar
import com.yapp.domain.model.Attendance
import com.yapp.domain.model.Session
import com.yapp.domain.model.types.NeedToAttendType
import com.yapp.domain.util.RenewDateUtil
import com.yapp.domain.util.DateUtil
import com.yapp.presentation.R
import com.yapp.presentation.util.attendance.checkSessionAttendance

Expand Down Expand Up @@ -337,7 +337,7 @@ private fun AttendUserSession(
attendanceInfo: Pair<Session, Attendance>,
navigateToSessionDetail: (Int) -> Unit
) {
val dateUtil = remember { RenewDateUtil() }
val dateUtil = remember { DateUtil() }
val session = attendanceInfo.first
val attendance = attendanceInfo.second

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package com.yapp.presentation.ui.member.score
import androidx.lifecycle.viewModelScope
import com.yapp.common.base.BaseViewModel
import com.yapp.domain.usecases.GetMemberAttendanceListUseCase
import com.yapp.domain.util.RenewDateUtil
import com.yapp.domain.util.DateUtil
import com.yapp.presentation.ui.member.score.MemberScoreContract.MemberScoreUiEvent
import com.yapp.presentation.ui.member.score.MemberScoreContract.MemberScoreUiSideEffect
import com.yapp.presentation.ui.member.score.MemberScoreContract.MemberScoreUiState
Expand All @@ -15,7 +15,7 @@ import javax.inject.Inject
@HiltViewModel
class MemberScoreViewModel @Inject constructor(
private val getMemberAttendanceListUseCase: GetMemberAttendanceListUseCase,
private val dateUtil: RenewDateUtil
private val dateUtil: DateUtil
) : BaseViewModel<MemberScoreUiState, MemberScoreUiSideEffect, MemberScoreUiEvent>(initialState = MemberScoreUiState()) {

init {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@ import com.yapp.common.yds.YDSAttendanceType
import com.yapp.common.yds.YDSEmptyScreen
import com.yapp.common.yds.YDSProgressBar
import com.yapp.domain.model.Session
import com.yapp.domain.util.RenewDateUtil
import com.yapp.domain.util.DateUtil
import com.yapp.presentation.util.attendance.checkSessionAttendance

@Composable
fun SessionDetail(
viewModel: SessionDetailViewModel = hiltViewModel(),
onClickBackButton: () -> Unit,
) {
val dateUtil = remember { RenewDateUtil() }
val dateUtil = remember { DateUtil() }
val uiState by viewModel.uiState.collectAsState()
val session: Session? = uiState.session?.first
val attendance = checkSessionAttendance(session!!, uiState.session!!.second, isPastSession = dateUtil.isPastDate(session.date))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ import com.yapp.common.theme.Light_Gray_200
import com.yapp.common.util.rememberKeyboardVisible
import com.yapp.common.yds.YDSAppBar
import com.yapp.domain.util.DateParser
import com.yapp.domain.util.RenewDateUtil
import com.yapp.presentation.R
import com.yapp.presentation.common.AttendanceBundle
import com.yapp.presentation.ui.member.signup.name.OnKeyboardNextButton
Expand Down

0 comments on commit 43852c0

Please sign in to comment.