Skip to content

Commit

Permalink
Issues #287 refactor: 변경된 사항 대응
Browse files Browse the repository at this point in the history
  • Loading branch information
audxo112 committed Feb 6, 2023
1 parent 0aafd95 commit 4c1989a
Show file tree
Hide file tree
Showing 23 changed files with 228 additions and 123 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.lighthouse.datasource.gifticon

import com.lighthouse.core.exts.isExpired
import com.lighthouse.core.exts.today
import com.lighthouse.database.dao.GifticonDao
import com.lighthouse.database.entity.GifticonEntity
import com.lighthouse.database.entity.GifticonWithCrop
Expand All @@ -9,8 +11,6 @@ import com.lighthouse.domain.model.Brand
import com.lighthouse.domain.model.Gifticon
import com.lighthouse.domain.model.SortBy
import com.lighthouse.domain.model.UsageHistory
import com.lighthouse.domain.util.isExpired
import com.lighthouse.domain.util.today
import com.lighthouse.mapper.toDomain
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.map
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.lighthouse.domain.usecase

import com.lighthouse.core.exts.currentTime
import com.lighthouse.domain.model.UsageHistory
import com.lighthouse.domain.repository.GifticonRepository
import com.lighthouse.domain.util.currentTime
import kotlinx.coroutines.flow.first
import javax.inject.Inject

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.lighthouse.domain.usecase

import com.lighthouse.core.exts.currentTime
import com.lighthouse.domain.model.UsageHistory
import com.lighthouse.domain.repository.GifticonRepository
import com.lighthouse.domain.util.currentTime
import kotlinx.coroutines.flow.first
import javax.inject.Inject

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import androidx.work.ExistingPeriodicWorkPolicy
import androidx.work.PeriodicWorkRequest
import androidx.work.PeriodicWorkRequestBuilder
import androidx.work.WorkManager
import com.lighthouse.core.utils.time.TimeCalculator.calculateAfterDateDiffHour
import com.lighthouse.presentation.ui.widget.BeepWidgetWorker
import com.lighthouse.presentation.util.TimeCalculator.calculateAfterDateDiffHour
import dagger.hilt.android.qualifiers.ApplicationContext
import java.util.concurrent.TimeUnit

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import androidx.work.WorkerParameters
import com.lighthouse.domain.model.DbResult
import com.lighthouse.domain.model.Gifticon
import com.lighthouse.domain.usecase.GetGifticonsUseCase
import com.lighthouse.presentation.util.TimeCalculator
import com.lighthouse.core.utils.time.TimeCalculator
import dagger.assisted.Assisted
import dagger.assisted.AssistedInject

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ import android.view.View
import android.widget.TextView
import androidx.core.content.ContextCompat
import androidx.databinding.BindingAdapter
import com.lighthouse.core.exts.toDayOfMonth
import com.lighthouse.core.exts.toMonth
import com.lighthouse.core.exts.toYear
import com.lighthouse.core.utils.time.TimeCalculator
import com.lighthouse.presentation.R
import com.lighthouse.presentation.extension.toDayOfMonth
import com.lighthouse.presentation.extension.toMonth
import com.lighthouse.presentation.extension.toYear
import com.lighthouse.presentation.util.TimeCalculator
import com.lighthouse.presentation.util.resource.UIText
import java.text.DecimalFormat
import java.util.Date
Expand Down Expand Up @@ -145,6 +145,7 @@ fun setDday(view: TextView, date: Date) {
view.context.getString(R.string.all_d_day),
dDay
)

dDay < TimeCalculator.MIN_DAY -> view.context.getString(R.string.all_d_day_expired)
else -> view.context.getString(R.string.all_d_day_more_than_year)
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
package com.lighthouse.presentation.mapper

import android.net.Uri
import com.lighthouse.core.exts.toFormatString
import com.lighthouse.domain.model.GalleryImage
import com.lighthouse.presentation.extension.toString
import com.lighthouse.presentation.model.GalleryUIModel

fun GalleryImage.toPresentation(index: Int = -1): GalleryUIModel.Gallery = GalleryUIModel.Gallery(
id = id,
uri = Uri.parse(contentUri),
selectedOrder = index,
createdDate = date.toString("yyyy-MM-dd")
createdDate = date.toFormatString("yyyy-MM-dd")
)
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.lighthouse.presentation.mapper

import android.graphics.RectF
import com.lighthouse.core.exts.toDate
import com.lighthouse.domain.model.GalleryImage
import com.lighthouse.presentation.extension.toDate
import com.lighthouse.presentation.model.AddGifticonUIModel
import com.lighthouse.presentation.model.CroppedImage
import com.lighthouse.presentation.model.GalleryUIModel
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.lighthouse.presentation.mapper

import androidx.core.graphics.toRect
import com.lighthouse.core.exts.toDigit
import com.lighthouse.domain.model.GifticonForUpdate
import com.lighthouse.presentation.extension.toDigit
import com.lighthouse.presentation.model.ModifyGifticonUIModel

fun ModifyGifticonUIModel.toDomain(): GifticonForUpdate {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
package com.lighthouse.presentation.model

import android.content.Context
import com.lighthouse.core.exts.toConcurrency
import com.lighthouse.presentation.R
import com.lighthouse.presentation.extension.toConcurrency

enum class CashAmountPreset(val amount: Int?) {
ONE(1000), TWO(5000), THREE(10000), TOTAL(null);

fun toString(context: Context): String {
return amount?.toConcurrency(context)
return amount?.toConcurrency()
?: context.resources.getString(R.string.use_gifticon_dialog_chip_total_amount)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import androidx.compose.ui.text.input.OffsetMapping
import androidx.compose.ui.text.input.TransformedText
import androidx.compose.ui.text.input.VisualTransformation
import androidx.compose.ui.tooling.preview.Preview
import com.lighthouse.core.exts.toConcurrency
import com.lighthouse.presentation.R
import com.lighthouse.presentation.extension.toNumberFormat
import com.lighthouse.presentation.ui.common.compose.ConcurrencyFormatVisualTransformation.Companion.MAX_LENGTH

@Composable
Expand Down Expand Up @@ -60,7 +60,7 @@ fun ConcurrencyField(

class ConcurrencyFormatVisualTransformation(val suffixText: String = "") : VisualTransformation {
override fun filter(text: AnnotatedString): TransformedText {
val numberWithComma = text.text.toNumberFormat()
val numberWithComma = text.text.toConcurrency()

return TransformedText(
text = AnnotatedString(numberWithComma + suffixText),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package com.lighthouse.presentation.ui.common.dialog.datepicker

import androidx.lifecycle.ViewModel
import com.lighthouse.presentation.extension.toDayOfMonth
import com.lighthouse.presentation.extension.toMonth
import com.lighthouse.presentation.extension.toYear
import com.lighthouse.core.exts.toDayOfMonth
import com.lighthouse.core.exts.toMonth
import com.lighthouse.core.exts.toYear
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.asStateFlow
import java.util.Calendar
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package com.lighthouse.presentation.ui.common.view

import android.content.Context
import android.util.AttributeSet
import com.lighthouse.presentation.extension.toDigit
import com.lighthouse.core.exts.toDigit
import java.text.DecimalFormat

class BalanceTextInputEditText(context: Context, attrs: AttributeSet) : FormattedTextInputEditText(context, attrs) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ import android.net.Uri
import androidx.lifecycle.SavedStateHandle
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import com.lighthouse.core.utils.flow.MutableEventFlow
import com.lighthouse.core.utils.flow.asEventFlow
import com.lighthouse.presentation.R
import com.lighthouse.presentation.extra.Extras
import com.lighthouse.presentation.ui.cropgifticon.event.CropGifticonEvent
import com.lighthouse.presentation.ui.cropgifticon.view.CropImageInfo
import com.lighthouse.presentation.util.flow.MutableEventFlow
import com.lighthouse.presentation.util.flow.asEventFlow
import com.lighthouse.presentation.util.resource.UIText
import dagger.hilt.android.lifecycle.HiltViewModel
import kotlinx.coroutines.launch
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@ package com.lighthouse.presentation.ui.detailgifticon
import androidx.lifecycle.SavedStateHandle
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import com.lighthouse.core.exts.toConcurrency
import com.lighthouse.core.exts.toDayOfMonth
import com.lighthouse.core.exts.toMonth
import com.lighthouse.core.exts.toYear
import com.lighthouse.domain.model.DbResult
import com.lighthouse.domain.usecase.GetGifticonUseCase
import com.lighthouse.domain.usecase.GetUsageHistoriesUseCase
import com.lighthouse.domain.usecase.UnUseGifticonUseCase
import com.lighthouse.domain.usecase.UseCashCardGifticonUseCase
import com.lighthouse.domain.usecase.UseGifticonUseCase
import com.lighthouse.presentation.R
import com.lighthouse.presentation.extension.toConcurrency
import com.lighthouse.presentation.extension.toDayOfMonth
import com.lighthouse.presentation.extension.toMonth
import com.lighthouse.presentation.extension.toYear
import com.lighthouse.presentation.extra.Extras.KEY_GIFTICON_ID
import com.lighthouse.presentation.mapper.toPresentation
import com.lighthouse.presentation.model.CashAmountPreset
Expand Down
Loading

0 comments on commit 4c1989a

Please sign in to comment.