Updated recipe editing user interface

This commit is contained in:
Vicnet
2023-10-05 22:59:53 +02:00
parent 85a8e631d0
commit c3a068a1c0
7 changed files with 277 additions and 155 deletions

View File

@@ -47,13 +47,15 @@ import SwiftUI
}
/// Try to load the recipe list from store or the server.
/// - Warning: The category named '\*' is translated into '\_' for network calls and storage requests in this function. This is necessary for the nextcloud cookbook api.
/// - Parameters
/// - categoryName: The name of the category containing the requested list of recipes.
/// - needsUpdate: If true, the recipe will be loaded from the server directly, otherwise it will be loaded from store first.
func loadRecipeList(categoryName: String, needsUpdate: Bool = false) async {
let categoryString = categoryName == "*" ? "_" : categoryName
if let recipeList: [Recipe] = await loadObject(
localPath: "category_\(categoryName).data",
networkPath: .RECIPE_LIST(categoryName: categoryName),
localPath: "category_\(categoryString).data",
networkPath: .RECIPE_LIST(categoryName: categoryString),
needsUpdate: needsUpdate
) {
recipes[categoryName] = recipeList