WIP - Complete App refactoring
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
import Foundation
|
||||
import SwiftUI
|
||||
|
||||
|
||||
/*
|
||||
class NextcloudDataInterface: CookbookInterface {
|
||||
var id: String
|
||||
|
||||
@@ -31,39 +31,35 @@ class NextcloudDataInterface: CookbookInterface {
|
||||
// MARK: - Nextcloud Read Interface
|
||||
extension NextcloudDataInterface: ReadInterface {
|
||||
|
||||
func getImage(id: String, size: RecipeImage.RecipeImageSize) async -> (UIImage?, UserAlert?) {
|
||||
let (image, error) = await api.getImage(auth: auth.token, id: id, size: size)
|
||||
if let image {
|
||||
return (image, nil)
|
||||
}
|
||||
return (nil, error)
|
||||
func getImage(id: String, size: RecipeImage.RecipeImageSize) async -> UIImage? {
|
||||
return await api.getImage(auth: auth.token, id: id, size: size).0
|
||||
}
|
||||
|
||||
func getRecipeStubs() async -> ([RecipeStub]?, UserAlert?) {
|
||||
return await api.getRecipes(auth: auth.token)
|
||||
func getRecipeStubs() async -> [RecipeStub]? {
|
||||
return await api.getRecipes(auth: auth.token).0
|
||||
}
|
||||
|
||||
func getRecipe(id: String) async -> (Recipe?, UserAlert?) {
|
||||
return await api.getRecipe(auth: auth.token, id: id)
|
||||
func getRecipe(id: String) async -> Recipe?{
|
||||
return await api.getRecipe(auth: auth.token, id: id).0
|
||||
}
|
||||
|
||||
func getCategories() async -> ([Category]?, UserAlert?) {
|
||||
return await api.getCategories(auth: auth.token)
|
||||
func getCategories() async -> [Category]? {
|
||||
return await api.getCategories(auth: auth.token).0
|
||||
}
|
||||
|
||||
func getRecipeStubsForCategory(named categoryName: String) async -> ([RecipeStub]?, UserAlert?) {
|
||||
func getRecipeStubsForCategory(named categoryName: String) async -> [RecipeStub]? {
|
||||
return await api.getCategory(
|
||||
auth: UserSettings.shared.authString,
|
||||
named: categoryName
|
||||
)
|
||||
).0
|
||||
}
|
||||
|
||||
func getTags() async -> ([RecipeKeyword]?, (any UserAlert)?) {
|
||||
return await api.getTags(auth: auth.token)
|
||||
func getTags() async -> [RecipeKeyword]? {
|
||||
return await api.getTags(auth: auth.token).0
|
||||
}
|
||||
|
||||
func getRecipesTagged(keyword: String) async -> ([RecipeStub]?, UserAlert?) {
|
||||
return await api.getRecipesTagged(auth: auth.token, keyword: keyword)
|
||||
func getRecipesTagged(keyword: String) async -> [RecipeStub]? {
|
||||
return await api.getRecipesTagged(auth: auth.token, keyword: keyword).0
|
||||
}
|
||||
|
||||
}
|
||||
@@ -93,3 +89,4 @@ extension NextcloudDataInterface: WriteInterface {
|
||||
}
|
||||
|
||||
}
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user