fix: dismissing deletion dialog wasn't cancelling the deletion, also remove useless decorator in dao
This commit is contained in:
parent
cf161ed12c
commit
b5922d7280
3 changed files with 20 additions and 10 deletions
|
@ -94,12 +94,14 @@ fun HomeScreen(
|
|||
|
||||
if (deletionRequest) {
|
||||
DeletionDialog(
|
||||
model::dismissDeleteOne,
|
||||
model::deleteSelected
|
||||
)
|
||||
}
|
||||
|
||||
if (deletionDBRequest) {
|
||||
DeletionDBDialog(
|
||||
model::dismissDeleteAll,
|
||||
model::deleteAll
|
||||
)
|
||||
}
|
||||
|
@ -271,16 +273,18 @@ fun ErrorDialog(errMsg: String, dismiss: () -> Unit) = AlertDialog(onDismissRequ
|
|||
confirmButton = { Button(onClick = dismiss) { Text(text = "Ok") } })
|
||||
|
||||
@Composable
|
||||
fun DeletionDialog(dismiss: () -> Unit) = AlertDialog(onDismissRequest = dismiss,
|
||||
title = { Text(text = "Supprimer un jeu de question") },
|
||||
text = { Text(text = "Voulez-vous supprimer ce jeu de question ?") },
|
||||
confirmButton = { Button(onClick = dismiss) { Text(text = "Ok") } })
|
||||
fun DeletionDialog(dismiss: () -> Unit, confirm: () -> Unit) =
|
||||
AlertDialog(onDismissRequest = dismiss,
|
||||
title = { Text(text = "Supprimer un jeu de question") },
|
||||
text = { Text(text = "Voulez-vous supprimer ce jeu de question ?") },
|
||||
confirmButton = { Button(onClick = confirm) { Text(text = "Ok") } })
|
||||
|
||||
@Composable
|
||||
fun DeletionDBDialog(dismiss: () -> Unit) = AlertDialog(onDismissRequest = dismiss,
|
||||
title = { Text(text = "Supprimer la base de données") },
|
||||
text = { Text(text = "Voulez-vous supprimer la base de données ?") },
|
||||
confirmButton = { Button(onClick = dismiss) { Text(text = "Ok") } })
|
||||
fun DeletionDBDialog(dismiss: () -> Unit, confirm: () -> Unit) =
|
||||
AlertDialog(onDismissRequest = dismiss,
|
||||
title = { Text(text = "Supprimer la base de données") },
|
||||
text = { Text(text = "Voulez-vous supprimer la base de données ?") },
|
||||
confirmButton = { Button(onClick = confirm) { Text(text = "Ok") } })
|
||||
|
||||
@Composable
|
||||
fun ShowList(
|
||||
|
|
|
@ -4,7 +4,6 @@ import androidx.room.Dao
|
|||
import androidx.room.Delete
|
||||
import androidx.room.Insert
|
||||
import androidx.room.Query
|
||||
import androidx.room.Transaction
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
|
||||
@Dao
|
||||
|
@ -15,7 +14,6 @@ interface MemoDao {
|
|||
@Insert
|
||||
suspend fun insertQuestion(question: Question)
|
||||
|
||||
@Transaction
|
||||
@Query("SELECT * FROM SetQuestions")
|
||||
fun loadAllSets(): Flow<List<SetOfQuestions>>
|
||||
|
||||
|
|
|
@ -125,6 +125,14 @@ class HomeViewModel(application: Application) : AndroidViewModel(application) {
|
|||
creation.value = false
|
||||
}
|
||||
|
||||
fun dismissDeleteOne() {
|
||||
deletionSelect.value = false
|
||||
}
|
||||
|
||||
fun dismissDeleteAll() {
|
||||
deletionDB.value = false
|
||||
}
|
||||
|
||||
fun dismissModification() {
|
||||
modification.value = false
|
||||
}
|
||||
|
|
Reference in a new issue