Skip to content

Commit

Permalink
fix categories issue and update verison
Browse files Browse the repository at this point in the history
  • Loading branch information
salmanA169 committed Jul 29, 2023
1 parent d137fd7 commit 5e3e6d1
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 11 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ android {
applicationId "com.masrofy"
minSdk 28
targetSdk 33
versionCode 9
versionName "3.5.1"
versionCode 10
versionName "3.5.2"

kapt {
arguments {
Expand Down
2 changes: 0 additions & 2 deletions app/src/main/java/com/masrofy/MainViewModel.kt
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,7 @@ class MainViewModel @Inject constructor(

fun checkCategories(){
viewModelScope.launch(dispatcherProvider.io) {
// TODO: fix here if update app no categories inserted
val getCategories = categoryRepository.getCategories()
Log.d("MainViewModel", "checkCategories: ${getCategories.isEmpty()}")
if (getCategories.isEmpty()){
val toCategoryEntity = TransactionCategory.values().map {
CategoryEntity(0,it.nameCategory,it.type.name,true,it.position)
Expand Down
7 changes: 0 additions & 7 deletions app/src/main/java/com/masrofy/data/database/RoomCallback.kt
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,6 @@ class RoomCallback @Inject constructor(
val database = this.db.get()
CoroutineScope(Job()+Dispatchers.IO).launch {
database.transactionDao.addAccount(defaultAccount)
val getCategories = database.categoryDao.getCategories()
if (getCategories.isEmpty()){
val toCategoryEntity = TransactionCategory.values().map {
CategoryEntity(0,it.nameCategory,it.type.name,true,it.position)
}
database.categoryDao.upsertCategory(toCategoryEntity)
}
}
}
}

0 comments on commit 5e3e6d1

Please sign in to comment.