Feat: Implementiert Navigation zum übergeordneten Verzeichnis nach dem Sperren und behebt die Anzeige des Schlosssymbols.
This commit is contained in:
@@ -657,7 +657,7 @@ fun AppShell(
|
||||
title = context.getString(R.string.unlock_item),
|
||||
subtitle = "",
|
||||
fragmentActivity = context.findActivity() as FragmentActivity,
|
||||
onSuccess = {
|
||||
onSuccess = { _ ->
|
||||
when (type) {
|
||||
is Screen.ShoppingListDetail -> selectedListId = id
|
||||
is Screen.NoteDetail -> selectedNoteId = id
|
||||
@@ -1107,12 +1107,16 @@ fun AppShell(
|
||||
onSetListProtection = { password ->
|
||||
selectedListId?.let { listId ->
|
||||
shoppingListsViewModel.setProtection(listId, password)
|
||||
currentScreen = Screen.ShoppingLists
|
||||
}
|
||||
selectedListId = null
|
||||
showSetListPasswordDialog = false
|
||||
},
|
||||
|
||||
onSetListProtectionBiometric = { id -> shoppingListsViewModel.setProtectionBiometric(id) },
|
||||
onSetListProtectionBiometric = { id ->
|
||||
shoppingListsViewModel.setProtectionBiometric(id)
|
||||
currentScreen = Screen.ShoppingLists
|
||||
},
|
||||
txtImportLauncher = txtImportLauncher,
|
||||
showNoteDialog = showNoteDialog,
|
||||
onShowNoteDialogChange = { showNoteDialog = it },
|
||||
@@ -1120,7 +1124,10 @@ fun AppShell(
|
||||
onNoteDetailsChange = { notesViewModel.updateNoteDetails(it) },
|
||||
onSaveNote = { scope.launch { notesViewModel.saveNote() } },
|
||||
onResetNoteDetails = { notesViewModel.resetNoteDetails() },
|
||||
onSetNoteProtectionBiometric = { id -> notesViewModel.setProtectionBiometric(id) },
|
||||
onSetNoteProtectionBiometric = { id ->
|
||||
notesViewModel.setProtectionBiometric(id)
|
||||
currentScreen = Screen.Notes
|
||||
},
|
||||
noteImportLauncher = noteImportLauncher,
|
||||
showRecipeDialog = showRecipeDialog,
|
||||
onShowRecipeDialogChange = { showRecipeDialog = it },
|
||||
@@ -1128,7 +1135,10 @@ fun AppShell(
|
||||
onRecipeDetailsChange = { recipesViewModel.updateRecipeDetails(it) },
|
||||
onSaveRecipe = { scope.launch { recipesViewModel.saveRecipe() } },
|
||||
onResetRecipeDetails = { recipesViewModel.resetRecipeDetails() },
|
||||
onSetRecipeProtectionBiometric = { id -> recipesViewModel.setProtectionBiometric(id) },
|
||||
onSetRecipeProtectionBiometric = { id ->
|
||||
recipesViewModel.setProtectionBiometric(id)
|
||||
currentScreen = Screen.Recipes
|
||||
},
|
||||
recipeImportLauncher = recipeImportLauncher,
|
||||
recipesTitle = recipesTitle,
|
||||
showJsonDialog = showJsonDialog,
|
||||
@@ -1143,6 +1153,7 @@ fun AppShell(
|
||||
notesViewModel.setProtectionPassword(password)
|
||||
selectedNoteId = null
|
||||
showSetPasswordDialog = false
|
||||
currentScreen = Screen.Notes
|
||||
},
|
||||
showSetRecipePasswordDialog = showSetRecipePasswordDialog,
|
||||
onShowSetRecipePasswordDialogChange = { showSetRecipePasswordDialog = it },
|
||||
@@ -1150,6 +1161,7 @@ fun AppShell(
|
||||
recipesViewModel.setProtectionPassword(password)
|
||||
selectedRecipeId = null
|
||||
showSetRecipePasswordDialog = false
|
||||
currentScreen = Screen.Recipes
|
||||
},
|
||||
showSetListPasswordDialog = showSetListPasswordDialog,
|
||||
onShowSetListPasswordDialogChange = { showSetListPasswordDialog = it },
|
||||
@@ -1246,6 +1258,7 @@ fun AppShell(
|
||||
}
|
||||
LockMethod.BIOMETRIC -> {
|
||||
shoppingListsViewModel.setProtectionBiometric(id)
|
||||
currentScreen = Screen.ShoppingLists
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1257,6 +1270,7 @@ fun AppShell(
|
||||
}
|
||||
LockMethod.BIOMETRIC -> {
|
||||
notesViewModel.setProtectionBiometric(id)
|
||||
currentScreen = Screen.Notes
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1268,6 +1282,7 @@ fun AppShell(
|
||||
}
|
||||
LockMethod.BIOMETRIC -> {
|
||||
recipesViewModel.setProtectionBiometric(id)
|
||||
currentScreen = Screen.Recipes
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1281,4 +1296,4 @@ fun AppShell(
|
||||
canUseBiometrics = canUseBiometrics,
|
||||
itemToLockType = itemToLockType,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -106,7 +106,8 @@ class NotesViewModel(private val noteshopRepository: NoteshopRepository) : ViewM
|
||||
val hash = PasswordHasher.hashPassword(password)
|
||||
val updatedNote = currentNoteDetails.toNote().copy(
|
||||
protectionHash = hash,
|
||||
protectionType = 1 // 1 for password protection
|
||||
protectionType = 1, // 1 for password protection
|
||||
lockMethod = 1
|
||||
)
|
||||
noteshopRepository.updateNote(updatedNote)
|
||||
updateNoteDetails(updatedNote) // Update the UI state
|
||||
@@ -114,7 +115,8 @@ class NotesViewModel(private val noteshopRepository: NoteshopRepository) : ViewM
|
||||
// Password is blank, so we remove protection
|
||||
val updatedNote = currentNoteDetails.toNote().copy(
|
||||
protectionHash = "",
|
||||
protectionType = 0
|
||||
protectionType = 0,
|
||||
lockMethod = 0
|
||||
)
|
||||
noteshopRepository.updateNote(updatedNote)
|
||||
updateNoteDetails(updatedNote) // Update the UI state
|
||||
@@ -128,7 +130,8 @@ class NotesViewModel(private val noteshopRepository: NoteshopRepository) : ViewM
|
||||
note?.let {
|
||||
val updatedNote = it.copy(
|
||||
protectionHash = "", // Clear password hash
|
||||
protectionType = 2 // 2 for biometric protection
|
||||
protectionType = 2, // 2 for biometric protection
|
||||
lockMethod = 2
|
||||
)
|
||||
noteshopRepository.updateNote(updatedNote)
|
||||
// No need to update _noteDetails.value here as it's for editing, not for the note itself
|
||||
|
||||
@@ -104,7 +104,8 @@ class RecipesViewModel(private val noteshopRepository: NoteshopRepository) : Vie
|
||||
val hash = PasswordHasher.hashPassword(password)
|
||||
val updatedRecipe = currentRecipeDetails.toRecipe().copy(
|
||||
protectionHash = hash,
|
||||
protectionType = 1 // 1 for password protection
|
||||
protectionType = 1, // 1 for password protection
|
||||
lockMethod = 1
|
||||
)
|
||||
noteshopRepository.updateRecipe(updatedRecipe)
|
||||
updateRecipeDetails(updatedRecipe) // Update the UI state
|
||||
@@ -112,7 +113,8 @@ class RecipesViewModel(private val noteshopRepository: NoteshopRepository) : Vie
|
||||
// Password is blank, so we remove protection
|
||||
val updatedRecipe = currentRecipeDetails.toRecipe().copy(
|
||||
protectionHash = "",
|
||||
protectionType = 0
|
||||
protectionType = 0,
|
||||
lockMethod = 0
|
||||
)
|
||||
noteshopRepository.updateRecipe(updatedRecipe)
|
||||
updateRecipeDetails(updatedRecipe) // Update the UI state
|
||||
@@ -126,7 +128,8 @@ class RecipesViewModel(private val noteshopRepository: NoteshopRepository) : Vie
|
||||
recipe?.let {
|
||||
val updatedRecipe = it.copy(
|
||||
protectionHash = "", // Clear password hash
|
||||
protectionType = 2 // 2 for biometric protection
|
||||
protectionType = 2, // 2 for biometric protection
|
||||
lockMethod = 2
|
||||
)
|
||||
noteshopRepository.updateRecipe(updatedRecipe)
|
||||
// No need to update _recipeDetails.value here as it's for editing, not for the recipe itself
|
||||
|
||||
@@ -155,7 +155,8 @@ class ShoppingListsViewModel(private val noteshopRepository: NoteshopRepository,
|
||||
val hash = PasswordHasher.hashPassword(password)
|
||||
val updatedList = existingList.copy(
|
||||
protectionHash = hash,
|
||||
protectionType = 1 // 1 for password protection
|
||||
protectionType = 1, // 1 for password protection
|
||||
lockMethod = 1
|
||||
)
|
||||
noteshopRepository.updateShoppingList(updatedList)
|
||||
updateListDetails(updatedList) // Update the UI state
|
||||
@@ -163,7 +164,8 @@ class ShoppingListsViewModel(private val noteshopRepository: NoteshopRepository,
|
||||
// Password is blank, so we remove protection
|
||||
val updatedList = existingList.copy(
|
||||
protectionHash = "",
|
||||
protectionType = 0
|
||||
protectionType = 0,
|
||||
lockMethod = 0
|
||||
)
|
||||
noteshopRepository.updateShoppingList(updatedList)
|
||||
updateListDetails(updatedList) // Update the UI state
|
||||
@@ -180,7 +182,8 @@ class ShoppingListsViewModel(private val noteshopRepository: NoteshopRepository,
|
||||
list?.let {
|
||||
val updatedList = it.copy(
|
||||
protectionHash = "", // Clear password hash
|
||||
protectionType = 2 // 2 for biometric protection
|
||||
protectionType = 2, // 2 for biometric protection
|
||||
lockMethod = 2
|
||||
)
|
||||
noteshopRepository.updateShoppingList(updatedList)
|
||||
// No need to update _listDetails.value here as it's for editing, not for the list itself
|
||||
|
||||
Reference in New Issue
Block a user