diff --git a/app/src/main/java/com/lighthouse/navigator/MainNavigatorImpl.kt b/app/src/main/java/com/lighthouse/navigator/MainNavigatorImpl.kt
index 5f8c038ae..0c02573c7 100644
--- a/app/src/main/java/com/lighthouse/navigator/MainNavigatorImpl.kt
+++ b/app/src/main/java/com/lighthouse/navigator/MainNavigatorImpl.kt
@@ -3,13 +3,13 @@ package com.lighthouse.navigator
import android.content.Context
import android.content.Intent
import com.lighthouse.features.common.navigator.MainNavigator
-import com.lighthouse.features.main.ui.MainActivity
+import com.lighthouse.features.main.ui.MainContainerFragment
import javax.inject.Inject
internal class MainNavigatorImpl @Inject constructor() : MainNavigator {
override fun openMain(context: Context) {
- val intent = Intent(context, MainActivity::class.java)
+ val intent = Intent(context, MainContainerFragment::class.java)
context.startActivity(intent)
}
}
diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml
index bab157945..dff29de81 100644
--- a/app/src/main/res/layout/activity_main.xml
+++ b/app/src/main/res/layout/activity_main.xml
@@ -6,7 +6,7 @@
+ type="com.lighthouse.features.main.ui.MainContainerViewModel" />
+ ): Flow
/**
* 사용 가능한 기프티콘 중에서 count 만큼만 갖고 오기
@@ -76,7 +80,12 @@ internal interface GifticonSearchDao {
* 3. 가져올 개수
* */
@Query(
- "SELECT * FROM gifticon_table " +
+ "SELECT id, cropped_uri, name, brand, expire_at, is_cash_card, total_cash, remain_cash, " +
+ "Cast(" +
+ "JulianDay(date(expire_at / 1000), 'unixepoch') - " +
+ "JulianDay(date('now')) as Integer" +
+ ") as d_day " +
+ "FROM gifticon_table " +
"WHERE user_id = :userId AND expire_at = :time AND is_used = 0 " +
"LIMIT :count"
)
@@ -84,7 +93,7 @@ internal interface GifticonSearchDao {
userId: String,
time: Date,
count: Int
- ): Flow>
+ ): Flow>
/**
* 기프티콘 리스트를 가져온다
@@ -93,14 +102,19 @@ internal interface GifticonSearchDao {
* 최신순으로 정렬
* */
@Query(
- "SELECT * FROM gifticon_table " +
+ "SELECT id, cropped_uri, name, brand, expire_at, is_cash_card, total_cash, remain_cash, " +
+ "Cast(" +
+ "JulianDay(date(expire_at / 1000), 'unixepoch') - " +
+ "JulianDay(date('now')) as Integer" +
+ ") as d_day " +
+ "FROM gifticon_table " +
"WHERE user_id = :userId AND is_used = :isUsed " +
"ORDER BY created_at DESC"
)
fun getAllGifticonsSortByRecent(
userId: String,
isUsed: Boolean
- ): Flow>
+ ): Flow>
/**
* 기프티콘 리스트를 가져온다
@@ -110,7 +124,12 @@ internal interface GifticonSearchDao {
* 최신순으로 정렬
* */
@Query(
- "SELECT * FROM gifticon_table " +
+ "SELECT id, cropped_uri, name, brand, expire_at, is_cash_card, total_cash, remain_cash, " +
+ "Cast(" +
+ "JulianDay(date(expire_at / 1000), 'unixepoch') - " +
+ "JulianDay(date('now')) as Integer" +
+ ") as d_day " +
+ "FROM gifticon_table " +
"WHERE user_id = :userId AND is_used = :isUsed AND expire_at > :expired " +
"ORDER BY created_at DESC"
)
@@ -118,7 +137,7 @@ internal interface GifticonSearchDao {
userId: String,
isUsed: Boolean,
expired: Date
- ): Flow>
+ ): Flow>
/**
* 기프티콘 리스트를 가져온다
@@ -127,14 +146,19 @@ internal interface GifticonSearchDao {
* 만료일기준으로 정렬
* */
@Query(
- "SELECT * FROM gifticon_table " +
+ "SELECT id, cropped_uri, name, brand, expire_at, is_cash_card, total_cash, remain_cash, " +
+ "Cast(" +
+ "JulianDay(date(expire_at / 1000), 'unixepoch') - " +
+ "JulianDay(date('now')) as Integer" +
+ ") as d_day " +
+ "FROM gifticon_table " +
"WHERE user_id = :userId AND is_used = :isUsed " +
"ORDER BY expire_at"
)
fun getAllGifticonsSortByDeadline(
userId: String,
isUsed: Boolean
- ): Flow>
+ ): Flow>
/**
* 기프티콘 리스트를 가져온다
@@ -144,7 +168,12 @@ internal interface GifticonSearchDao {
* 만료일기준으로 정렬
* */
@Query(
- "SELECT * FROM gifticon_table " +
+ "SELECT id, cropped_uri, name, brand, expire_at, is_cash_card, total_cash, remain_cash, " +
+ "Cast(" +
+ "JulianDay(date(expire_at / 1000), 'unixepoch') - " +
+ "JulianDay(date('now')) as Integer" +
+ ") as d_day " +
+ "FROM gifticon_table " +
"WHERE user_id = :userId AND is_used = :isUsed AND expire_at > :expired " +
"ORDER BY expire_at"
)
@@ -152,7 +181,7 @@ internal interface GifticonSearchDao {
userId: String,
isUsed: Boolean,
expired: Date
- ): Flow>
+ ): Flow>
/**
* 브랜드 이름으로 필터된 기프티콘 리스트를 가져온다
@@ -162,7 +191,12 @@ internal interface GifticonSearchDao {
* 최신순으로 정렬
* */
@Query(
- "SELECT * FROM gifticon_table " +
+ "SELECT id, cropped_uri, name, brand, expire_at, is_cash_card, total_cash, remain_cash, " +
+ "Cast(" +
+ "JulianDay(date(expire_at / 1000), 'unixepoch') - " +
+ "JulianDay(date('now')) as Integer" +
+ ") as d_day " +
+ "FROM gifticon_table " +
"WHERE user_id = :userId AND is_used = :isUsed AND UPPER(brand) IN(:filters) " +
"ORDER BY created_at DESC"
)
@@ -170,7 +204,7 @@ internal interface GifticonSearchDao {
userId: String,
isUsed: Boolean,
filters: Set
- ): Flow>
+ ): Flow>
/**
* 브랜드 이름으로 필터된 기프티콘 리스트를 가져온다
@@ -181,7 +215,12 @@ internal interface GifticonSearchDao {
* 최신순으로 정렬
* */
@Query(
- "SELECT * FROM gifticon_table " +
+ "SELECT id, cropped_uri, name, brand, expire_at, is_cash_card, total_cash, remain_cash, " +
+ "Cast(" +
+ "JulianDay(date(expire_at / 1000), 'unixepoch') - " +
+ "JulianDay(date('now')) as Integer" +
+ ") as d_day " +
+ "FROM gifticon_table " +
"WHERE user_id = :userId AND " +
"is_used = :isUsed AND " +
"UPPER(brand) IN(:filters) AND " +
@@ -193,7 +232,7 @@ internal interface GifticonSearchDao {
isUsed: Boolean,
filters: Set,
expired: Date
- ): Flow>
+ ): Flow>
/**
* 브랜드 이름으로 필터된 기프티콘 리스트를 가져온다
@@ -203,7 +242,12 @@ internal interface GifticonSearchDao {
* 만료일기준으로 정렬
* */
@Query(
- "SELECT * FROM gifticon_table " +
+ "SELECT id, cropped_uri, name, brand, expire_at, is_cash_card, total_cash, remain_cash, " +
+ "Cast(" +
+ "JulianDay(date(expire_at / 1000), 'unixepoch') - " +
+ "JulianDay(date('now')) as Integer" +
+ ") as d_day " +
+ "FROM gifticon_table " +
"WHERE user_id = :userId AND is_used = :isUsed AND UPPER(brand) IN(:filters) " +
"ORDER BY expire_at"
)
@@ -211,7 +255,7 @@ internal interface GifticonSearchDao {
userId: String,
isUsed: Boolean,
filters: Set
- ): Flow>
+ ): Flow>
/**
* 브랜드 이름으로 필터된 기프티콘 리스트를 가져온다
@@ -222,7 +266,12 @@ internal interface GifticonSearchDao {
* 만료일기준으로 정렬
* */
@Query(
- "SELECT * FROM gifticon_table " +
+ "SELECT id, cropped_uri, name, brand, expire_at, is_cash_card, total_cash, remain_cash, " +
+ "Cast(" +
+ "JulianDay(date(expire_at / 1000), 'unixepoch') - " +
+ "JulianDay(date('now')) as Integer" +
+ ") as d_day " +
+ "FROM gifticon_table " +
"WHERE user_id = :userId AND " +
"is_used = :isUsed AND " +
"UPPER(brand) IN(:filters) AND " +
@@ -234,7 +283,7 @@ internal interface GifticonSearchDao {
isUsed: Boolean,
filters: Set,
expired: Date
- ): Flow>
+ ): Flow>
/**
* 브랜드 이름과 해당 브랜드의 기프티콘 개수를 가져오기
@@ -292,14 +341,19 @@ internal interface GifticonSearchDao {
* 3. 브랜드 이름
* */
@Query(
- "SELECT * FROM gifticon_table " +
+ "SELECT id, cropped_uri, name, brand, expire_at, is_cash_card, total_cash, remain_cash, " +
+ "Cast(" +
+ "JulianDay(date(expire_at / 1000), 'unixepoch') - " +
+ "JulianDay(date('now')) as Integer" +
+ ") as d_day " +
+ "FROM gifticon_table " +
"WHERE user_id = :userId AND is_used = :isUsed AND brand =:brand"
)
fun getGifticonByBrand(
userId: String,
isUsed: Boolean,
brand: String
- ): Flow>
+ ): Flow>
/**
* 기프티콘 리스트 가져오기
@@ -309,7 +363,12 @@ internal interface GifticonSearchDao {
* 4. 만료일
* */
@Query(
- "SELECT * FROM gifticon_table " +
+ "SELECT id, cropped_uri, name, brand, expire_at, is_cash_card, total_cash, remain_cash, " +
+ "Cast(" +
+ "JulianDay(date(expire_at / 1000), 'unixepoch') - " +
+ "JulianDay(date('now')) as Integer" +
+ ") as d_day " +
+ "FROM gifticon_table " +
"WHERE user_id = :userId AND " +
"is_used = :isUsed AND " +
"brand =:brand AND " +
@@ -320,7 +379,7 @@ internal interface GifticonSearchDao {
isUsed: Boolean,
brand: String,
expired: Date
- ): Flow>
+ ): Flow>
/**
* 기프티콘 존재여부 확인
diff --git a/data/data-database/src/main/java/com/lighthouse/data/database/dao/GifticonUsageHistoryDao.kt b/data/data-database/src/main/java/com/lighthouse/data/database/dao/GifticonUsageHistoryDao.kt
index 5065e7d4a..abaee25ef 100644
--- a/data/data-database/src/main/java/com/lighthouse/data/database/dao/GifticonUsageHistoryDao.kt
+++ b/data/data-database/src/main/java/com/lighthouse/data/database/dao/GifticonUsageHistoryDao.kt
@@ -33,10 +33,10 @@ internal interface GifticonUsageHistoryDao {
* 2. 기프티콘 ID
* */
@Query(
- "SELECT balance FROM gifticon_table " +
+ "SELECT remain_cash FROM gifticon_table " +
"WHERE user_id = :userId AND id = :gifticonId"
)
- suspend fun getCurrentGifticonBalance(
+ suspend fun getCurrentGifticonRemainCash(
userId: String,
gifticonId: String
): Int
@@ -47,7 +47,7 @@ internal interface GifticonUsageHistoryDao {
* 2. 기프티콘 ID
* */
@Query(
- "SELECT SUM(balance + " +
+ "SELECT SUM(remain_cash + " +
"(SELECT SUM(amount) FROM usage_history_table " +
"WHERE gifticon_id = :gifticonId " +
"GROUP BY gifticon_id)) " +
@@ -55,7 +55,7 @@ internal interface GifticonUsageHistoryDao {
"WHERE user_id = :userId AND id = :gifticonId " +
"LIMIT 1"
)
- suspend fun getTotalGifticonBalance(
+ suspend fun getTotalGifticonRemainCash(
userId: String,
gifticonId: String
): Int
@@ -85,13 +85,13 @@ internal interface GifticonUsageHistoryDao {
* */
@Query(
"UPDATE gifticon_table " +
- "SET balance = :balance " +
+ "SET remain_cash = :remainCash " +
"WHERE user_id = :userId AND id = :gifticonId"
)
- suspend fun updateGifticonBalance(
+ suspend fun updateGifticonRemainCash(
userId: String,
gifticonId: String,
- balance: Int
+ remainCash: Int
): Int
/**
@@ -140,13 +140,13 @@ internal interface GifticonUsageHistoryDao {
usageHistory: DBUsageHistoryEntity
) {
val gifticonId = usageHistory.gifticonId
- val balance = getCurrentGifticonBalance(userId, gifticonId)
+ val balance = getCurrentGifticonRemainCash(userId, gifticonId)
if (balance < amount) {
throw DBUpdateException("사용할 금액이 잔액보다 많습니다.")
}
- if (updateGifticonBalance(userId, gifticonId, balance - amount) == 0) {
+ if (updateGifticonRemainCash(userId, gifticonId, balance - amount) == 0) {
throw DBNotFoundException("업데이트할 기프티콘을 찾을 수 없습니다.")
}
@@ -173,8 +173,8 @@ internal interface GifticonUsageHistoryDao {
) {
val isCashCard = getGifticonIsCashCard(userId, gifticonId)
if (isCashCard) {
- val totalBalance = getTotalGifticonBalance(userId, gifticonId)
- if (updateGifticonBalance(userId, gifticonId, totalBalance) == 0) {
+ val totalBalance = getTotalGifticonRemainCash(userId, gifticonId)
+ if (updateGifticonRemainCash(userId, gifticonId, totalBalance) == 0) {
throw DBNotFoundException("기프티콘의 정보를 찾을 수 없습니다.")
}
}
diff --git a/data/data-database/src/main/java/com/lighthouse/data/database/entity/DBGifticonEntity.kt b/data/data-database/src/main/java/com/lighthouse/data/database/entity/DBGifticonEntity.kt
index b07cb3963..07bb8c512 100644
--- a/data/data-database/src/main/java/com/lighthouse/data/database/entity/DBGifticonEntity.kt
+++ b/data/data-database/src/main/java/com/lighthouse/data/database/entity/DBGifticonEntity.kt
@@ -21,7 +21,8 @@ internal data class DBGifticonEntity(
@ColumnInfo(name = "expire_at") val expireAt: Date,
@ColumnInfo(name = "barcode") val barcode: String,
@ColumnInfo(name = "is_cash_card") val isCashCard: Boolean,
- @ColumnInfo(name = "balance") val balance: Int,
+ @ColumnInfo(name = "total_cash") val totalCash: Int,
+ @ColumnInfo(name = "remain_cash") val remainCash: Int,
@ColumnInfo(name = "memo") val memo: String,
@ColumnInfo(name = "is_used") val isUsed: Boolean
) {
diff --git a/data/data-database/src/main/java/com/lighthouse/data/database/mapper/gifticon/edit/DBGifticonWithCropMapper.kt b/data/data-database/src/main/java/com/lighthouse/data/database/mapper/gifticon/edit/DBGifticonWithCropMapper.kt
index 18eb11358..11b416523 100644
--- a/data/data-database/src/main/java/com/lighthouse/data/database/mapper/gifticon/edit/DBGifticonWithCropMapper.kt
+++ b/data/data-database/src/main/java/com/lighthouse/data/database/mapper/gifticon/edit/DBGifticonWithCropMapper.kt
@@ -17,7 +17,8 @@ internal fun DBGifticonWithCrop.toDomain(): GifticonWithCrop {
expireAt,
barcode,
isCashCard,
- balance,
+ totalCash,
+ remainCash,
memo,
croppedRect.toDomain(),
isUsed,
@@ -36,7 +37,8 @@ internal fun DBGifticonWithCrop.toGifticonEntity(): DBGifticonEntity {
expireAt = expireAt,
barcode = barcode,
isCashCard = isCashCard,
- balance = balance,
+ totalCash = totalCash,
+ remainCash = remainCash,
memo = memo,
isUsed = isUsed,
createdAt = createdAt
diff --git a/data/data-database/src/main/java/com/lighthouse/data/database/mapper/gifticon/edit/GifticonWithCropMapper.kt b/data/data-database/src/main/java/com/lighthouse/data/database/mapper/gifticon/edit/GifticonWithCropMapper.kt
index a9e565094..ce5c59c1e 100644
--- a/data/data-database/src/main/java/com/lighthouse/data/database/mapper/gifticon/edit/GifticonWithCropMapper.kt
+++ b/data/data-database/src/main/java/com/lighthouse/data/database/mapper/gifticon/edit/GifticonWithCropMapper.kt
@@ -22,7 +22,8 @@ internal fun GifticonWithCrop.toEntity(): DBGifticonWithCrop {
expireAt,
barcode,
isCashCard,
- balance,
+ totalCash,
+ remainCash,
memo,
croppedRect.toRect(),
isUsed,
diff --git a/data/data-database/src/main/java/com/lighthouse/data/database/mapper/gifticon/search/DBGifticonEntityMapper.kt b/data/data-database/src/main/java/com/lighthouse/data/database/mapper/gifticon/search/DBGifticonEntityMapper.kt
deleted file mode 100644
index 3e579554d..000000000
--- a/data/data-database/src/main/java/com/lighthouse/data/database/mapper/gifticon/search/DBGifticonEntityMapper.kt
+++ /dev/null
@@ -1,29 +0,0 @@
-package com.lighthouse.data.database.mapper.gifticon.search
-
-import com.lighthouse.beep.model.gifticon.Gifticon
-import com.lighthouse.data.database.entity.DBGifticonEntity
-
-internal fun List.toDomain(): List {
- return map {
- it.toDomain()
- }
-}
-
-internal fun DBGifticonEntity.toDomain(): Gifticon {
- return Gifticon(
- id = id,
- createdAt = createdAt,
- userId = userId,
- hasImage = hasImage,
- croppedUri = croppedUri.toString(),
- name = name,
- brand = brand,
- expireAt = expireAt,
- barcode = barcode,
- isCashCard = isCashCard,
- balance = balance,
- memo = memo,
- isUsed = isUsed,
- 0
- )
-}
diff --git a/data/data-database/src/main/java/com/lighthouse/data/database/mapper/gifticon/search/DBGifticonMapper.kt b/data/data-database/src/main/java/com/lighthouse/data/database/mapper/gifticon/search/DBGifticonMapper.kt
index 2f907f63a..d235fb528 100644
--- a/data/data-database/src/main/java/com/lighthouse/data/database/mapper/gifticon/search/DBGifticonMapper.kt
+++ b/data/data-database/src/main/java/com/lighthouse/data/database/mapper/gifticon/search/DBGifticonMapper.kt
@@ -1,7 +1,6 @@
package com.lighthouse.data.database.mapper.gifticon.search
import com.lighthouse.beep.model.gifticon.Gifticon
-import com.lighthouse.common.mapper.toDomain
import com.lighthouse.data.database.model.DBGifticon
internal fun List.toDomain(): List {
@@ -12,19 +11,14 @@ internal fun List.toDomain(): List {
internal fun DBGifticon.toDomain(): Gifticon {
return Gifticon(
- id,
- createdAt,
- userId,
- hasImage,
- croppedUri.toDomain(),
- name,
- brand,
- expireAt,
- barcode,
- isCashCard,
- balance,
- memo,
- isUsed,
- dDay
+ id = id,
+ croppedUri = croppedUri.toString(),
+ name = name,
+ brand = brand,
+ expireAt = expireAt,
+ isCashCard = isCashCard,
+ totalCash = totalCash,
+ remainCash = remainCash,
+ dDay = dDay
)
}
diff --git a/data/data-database/src/main/java/com/lighthouse/data/database/model/DBGifticon.kt b/data/data-database/src/main/java/com/lighthouse/data/database/model/DBGifticon.kt
index 960602f74..77e091652 100644
--- a/data/data-database/src/main/java/com/lighthouse/data/database/model/DBGifticon.kt
+++ b/data/data-database/src/main/java/com/lighthouse/data/database/model/DBGifticon.kt
@@ -6,17 +6,12 @@ import java.util.Date
internal class DBGifticon(
@ColumnInfo(name = "id") val id: String,
- @ColumnInfo(name = "created_at") val createdAt: Date,
- @ColumnInfo(name = "user_id") val userId: String,
- @ColumnInfo(name = "has_image") val hasImage: Boolean,
@ColumnInfo(name = "cropped_uri") val croppedUri: Uri?,
@ColumnInfo(name = "name") val name: String,
@ColumnInfo(name = "brand") val brand: String,
@ColumnInfo(name = "expire_at") val expireAt: Date,
- @ColumnInfo(name = "barcode") val barcode: String,
@ColumnInfo(name = "is_cash_card") val isCashCard: Boolean,
- @ColumnInfo(name = "balance") val balance: Int,
- @ColumnInfo(name = "memo") val memo: String,
- @ColumnInfo(name = "is_used") val isUsed: Boolean,
+ @ColumnInfo(name = "total_cash") val totalCash: Int,
+ @ColumnInfo(name = "remain_cash") val remainCash: Int,
@ColumnInfo(name = "d_day") val dDay: Int
)
diff --git a/data/data-database/src/main/java/com/lighthouse/data/database/model/DBGifticonWithCrop.kt b/data/data-database/src/main/java/com/lighthouse/data/database/model/DBGifticonWithCrop.kt
index f2fd1641d..123fe2557 100644
--- a/data/data-database/src/main/java/com/lighthouse/data/database/model/DBGifticonWithCrop.kt
+++ b/data/data-database/src/main/java/com/lighthouse/data/database/model/DBGifticonWithCrop.kt
@@ -15,7 +15,8 @@ internal class DBGifticonWithCrop(
@ColumnInfo(name = "expire_at") val expireAt: Date,
@ColumnInfo(name = "barcode") val barcode: String,
@ColumnInfo(name = "is_cash_card") val isCashCard: Boolean,
- @ColumnInfo(name = "balance") val balance: Int,
+ @ColumnInfo(name = "total_cash") val totalCash: Int,
+ @ColumnInfo(name = "remain_cash") val remainCash: Int,
@ColumnInfo(name = "memo") val memo: String,
@ColumnInfo(name = "cropped_rect") val croppedRect: Rect,
@ColumnInfo(name = "is_used") val isUsed: Boolean,
diff --git a/data/data/src/main/java/com/lighthouse/mapper/GifticonForAddtionMapper.kt b/data/data/src/main/java/com/lighthouse/mapper/GifticonForAddtionMapper.kt
index dc170597e..bd1217682 100644
--- a/data/data/src/main/java/com/lighthouse/mapper/GifticonForAddtionMapper.kt
+++ b/data/data/src/main/java/com/lighthouse/mapper/GifticonForAddtionMapper.kt
@@ -22,7 +22,8 @@ internal fun GifticonForAddition.toGifticonWithCrop(
expireAt = expiredAt,
barcode = barcode,
isCashCard = isCashCard,
- balance = balance,
+ totalCash = totalCash,
+ remainCash = remainCash,
memo = memo,
croppedRect = croppedRect.sampling(result?.sampleSize),
isUsed = false,
diff --git a/data/data/src/main/java/com/lighthouse/mapper/GifticonForUpdateMapper.kt b/data/data/src/main/java/com/lighthouse/mapper/GifticonForUpdateMapper.kt
index 39b16cc11..22d570461 100644
--- a/data/data/src/main/java/com/lighthouse/mapper/GifticonForUpdateMapper.kt
+++ b/data/data/src/main/java/com/lighthouse/mapper/GifticonForUpdateMapper.kt
@@ -18,7 +18,8 @@ internal fun GifticonForUpdate.toGifticonWithCrop(
expireAt = expiredAt,
barcode = barcode,
isCashCard = isCashCard,
- balance = balance,
+ totalCash = totalCash,
+ remainCash = remainCash,
memo = memo,
croppedRect = croppedRect,
isUsed = isUsed,
diff --git a/features/ui-intro/src/main/java/com/lighthouse/features/intro/ui/IntroFragment.kt b/features/ui-intro/src/main/java/com/lighthouse/features/intro/ui/IntroFragment.kt
index 0f4e798e1..6a0311659 100644
--- a/features/ui-intro/src/main/java/com/lighthouse/features/intro/ui/IntroFragment.kt
+++ b/features/ui-intro/src/main/java/com/lighthouse/features/intro/ui/IntroFragment.kt
@@ -12,6 +12,7 @@ import com.lighthouse.auth.google.exception.FailedApiException
import com.lighthouse.auth.google.exception.FailedConnectException
import com.lighthouse.auth.google.exception.FailedLoginException
import com.lighthouse.auth.google.repository.GoogleClient
+import com.lighthouse.features.common.binding.viewBindings
import com.lighthouse.features.common.dialog.progress.ProgressDialog
import com.lighthouse.features.common.ext.repeatOnStarted
import com.lighthouse.features.common.ext.show
@@ -27,7 +28,7 @@ import javax.inject.Inject
@AndroidEntryPoint
class IntroFragment : Fragment(R.layout.fragment_intro) {
- private lateinit var binding: FragmentIntroBinding
+ private val binding by viewBindings()
private val viewModel: IntroViewModel by viewModels()
diff --git a/features/ui-intro/src/main/res/values/navigation.xml b/features/ui-intro/src/main/res/values/navigation.xml
new file mode 100644
index 000000000..a6b3daec9
--- /dev/null
+++ b/features/ui-intro/src/main/res/values/navigation.xml
@@ -0,0 +1,2 @@
+
+
\ No newline at end of file
diff --git a/features/ui-main/src/main/java/com/lighthouse/features/main/ui/MainActivity.kt b/features/ui-main/src/main/java/com/lighthouse/features/main/ui/MainContainerFragment.kt
similarity index 55%
rename from features/ui-main/src/main/java/com/lighthouse/features/main/ui/MainActivity.kt
rename to features/ui-main/src/main/java/com/lighthouse/features/main/ui/MainContainerFragment.kt
index 2af856c38..b7f6d22ae 100644
--- a/features/ui-main/src/main/java/com/lighthouse/features/main/ui/MainActivity.kt
+++ b/features/ui-main/src/main/java/com/lighthouse/features/main/ui/MainContainerFragment.kt
@@ -1,42 +1,40 @@
package com.lighthouse.features.main.ui
import android.os.Bundle
-import androidx.activity.viewModels
-import androidx.appcompat.app.AppCompatActivity
-import androidx.databinding.DataBindingUtil
+import android.view.View
+import androidx.fragment.app.Fragment
+import androidx.fragment.app.viewModels
import androidx.navigation.fragment.NavHostFragment
import androidx.navigation.ui.setupWithNavController
import com.lighthouse.core.android.utils.permission.StoragePermissionManager
import com.lighthouse.core.android.utils.permission.core.permissions
+import com.lighthouse.features.common.binding.viewBindings
import com.lighthouse.features.main.R
-import com.lighthouse.features.main.databinding.ActivityMainBinding
+import com.lighthouse.features.main.databinding.FragmentMainContainerBinding
import com.lighthouse.features.main.navigator.MainNav
import dagger.hilt.android.AndroidEntryPoint
import javax.inject.Inject
@AndroidEntryPoint
-class MainActivity : AppCompatActivity() {
+class MainContainerFragment : Fragment(R.layout.fragment_main_container) {
- private lateinit var binding: ActivityMainBinding
+ private val binding by viewBindings()
- private val viewModel: MainViewModel by viewModels()
+ private val viewModel: MainContainerViewModel by viewModels()
private val storagePermission: StoragePermissionManager by permissions()
@Inject
lateinit var nav: MainNav
- override fun onCreate(savedInstanceState: Bundle?) {
- super.onCreate(savedInstanceState)
- binding = DataBindingUtil.setContentView(this, R.layout.activity_main)
+ override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
+ super.onViewCreated(view, savedInstanceState)
setUpBottomNavigation()
}
private fun setUpBottomNavigation() {
- val navHostFragment =
- supportFragmentManager.findFragmentById(R.id.fcv) as NavHostFragment
-
+ val navHostFragment = childFragmentManager.findFragmentById(R.id.fcv) as NavHostFragment
val navController = navHostFragment.navController
binding.bnv.setupWithNavController(navController)
}
diff --git a/features/ui-main/src/main/java/com/lighthouse/features/main/ui/MainViewModel.kt b/features/ui-main/src/main/java/com/lighthouse/features/main/ui/MainContainerViewModel.kt
similarity index 61%
rename from features/ui-main/src/main/java/com/lighthouse/features/main/ui/MainViewModel.kt
rename to features/ui-main/src/main/java/com/lighthouse/features/main/ui/MainContainerViewModel.kt
index 83d2bc2dd..d41a785b0 100644
--- a/features/ui-main/src/main/java/com/lighthouse/features/main/ui/MainViewModel.kt
+++ b/features/ui-main/src/main/java/com/lighthouse/features/main/ui/MainContainerViewModel.kt
@@ -3,4 +3,4 @@ package com.lighthouse.features.main.ui
import androidx.lifecycle.ViewModel
import javax.inject.Inject
-class MainViewModel @Inject constructor() : ViewModel()
+class MainContainerViewModel @Inject constructor() : ViewModel()
diff --git a/features/ui-main/src/main/res/layout/activity_main.xml b/features/ui-main/src/main/res/layout/fragment_main_container.xml
similarity index 96%
rename from features/ui-main/src/main/res/layout/activity_main.xml
rename to features/ui-main/src/main/res/layout/fragment_main_container.xml
index d4732a85a..e183d56fd 100644
--- a/features/ui-main/src/main/res/layout/activity_main.xml
+++ b/features/ui-main/src/main/res/layout/fragment_main_container.xml
@@ -6,7 +6,7 @@
+ type="com.lighthouse.features.main.ui.MainContainerViewModel" />
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+ android:layout_height="match_parent"
+ app:layout_behavior="@string/appbar_scrolling_view_behavior"/>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/model/src/main/java/com/lighthouse/beep/model/gifticon/GifticonForAddition.kt b/model/src/main/java/com/lighthouse/beep/model/gifticon/GifticonForAddition.kt
index b58cc7edc..86c9cb4aa 100644
--- a/model/src/main/java/com/lighthouse/beep/model/gifticon/GifticonForAddition.kt
+++ b/model/src/main/java/com/lighthouse/beep/model/gifticon/GifticonForAddition.kt
@@ -10,7 +10,8 @@ data class GifticonForAddition(
val barcode: String,
val expiredAt: Date,
val isCashCard: Boolean,
- val balance: Int,
+ val totalCash: Int,
+ val remainCash: Int,
val originUri: String,
val tempCroppedUri: String,
val croppedRect: Rectangle,
diff --git a/model/src/main/java/com/lighthouse/beep/model/gifticon/GifticonForUpdate.kt b/model/src/main/java/com/lighthouse/beep/model/gifticon/GifticonForUpdate.kt
index 726fb77bc..11faa94b9 100644
--- a/model/src/main/java/com/lighthouse/beep/model/gifticon/GifticonForUpdate.kt
+++ b/model/src/main/java/com/lighthouse/beep/model/gifticon/GifticonForUpdate.kt
@@ -12,7 +12,8 @@ data class GifticonForUpdate(
val barcode: String,
val expiredAt: Date,
val isCashCard: Boolean,
- val balance: Int,
+ val totalCash: Int,
+ val remainCash: Int,
val oldCroppedUri: String,
val croppedUri: String,
val croppedRect: Rectangle,
diff --git a/model/src/main/java/com/lighthouse/beep/model/gifticon/GifticonWithCrop.kt b/model/src/main/java/com/lighthouse/beep/model/gifticon/GifticonWithCrop.kt
index 5d6c3a742..1c496db6c 100644
--- a/model/src/main/java/com/lighthouse/beep/model/gifticon/GifticonWithCrop.kt
+++ b/model/src/main/java/com/lighthouse/beep/model/gifticon/GifticonWithCrop.kt
@@ -13,7 +13,8 @@ data class GifticonWithCrop(
val expireAt: Date,
val barcode: String,
val isCashCard: Boolean,
- val balance: Int,
+ val totalCash: Int,
+ val remainCash: Int,
val memo: String,
val croppedRect: Rectangle,
val isUsed: Boolean,