more fixes idk

This commit is contained in:
LilleBRG 2025-05-13 15:38:11 +02:00
parent 1e01d1ee90
commit 2c22f8d8e1
7 changed files with 6 additions and 8 deletions

View File

@ -124,5 +124,5 @@ data class ShoppingListAddRecipeRequest(val id: Int, val multiplier: Int)
fun AddRecipeToShoppingList(ctx: Context, id: Int, multiplier: Int) { fun AddRecipeToShoppingList(ctx: Context, id: Int, multiplier: Int) {
val request = ShoppingListAddRecipeRequest(id, multiplier) val request = ShoppingListAddRecipeRequest(id, multiplier)
return requestJson<ShoppingListAddRecipeRequest, Unit>(ctx, "ADD", "/api/ShoppingList/recipeadd", request) return requestJson<ShoppingListAddRecipeRequest, Unit>(ctx, "POST", "/api/ShoppingList/recipeadd", request)
} }

View File

@ -19,7 +19,7 @@ fun createRecipe(ctx: Context, recipe: Recipe) {
@Serializable @Serializable
data class GetAllRecipesResponse(val id: Int, val name: String, val description: String) data class GetAllRecipesResponse(val id: Int, val name: String, val description: String)
fun getAllRecipies(ctx: Context): List<GetAllRecipesResponse> { fun getAllRecipes(ctx: Context): List<GetAllRecipesResponse> {
return requestJson<Unit, List<GetAllRecipesResponse>>(ctx, "GET", "/api/Recipe/getall", null) return requestJson<Unit, List<GetAllRecipesResponse>>(ctx, "GET", "/api/Recipe/getall", null)
} }

View File

@ -15,9 +15,6 @@ import androidx.appcompat.app.AppCompatActivity
import tech.mercantec.easyeat.R import tech.mercantec.easyeat.R
import tech.mercantec.easyeat.helpers.ApiRequestException import tech.mercantec.easyeat.helpers.ApiRequestException
import tech.mercantec.easyeat.helpers.createRecipe import tech.mercantec.easyeat.helpers.createRecipe
import tech.mercantec.easyeat.helpers.request
import tech.mercantec.easyeat.models.CreateIngredient
import tech.mercantec.easyeat.models.CreateRecipe
import tech.mercantec.easyeat.models.Ingredient import tech.mercantec.easyeat.models.Ingredient
import tech.mercantec.easyeat.models.Recipe import tech.mercantec.easyeat.models.Recipe
import kotlin.concurrent.thread import kotlin.concurrent.thread

View File

@ -112,7 +112,7 @@ class DishDetailsActivity : AppCompatActivity() {
// You can do the same for directions if needed // You can do the same for directions if needed
} }
val saveButton: Button = findViewById(R.id.saveDishButton) val saveButton: Button = findViewById(R.id.addDishToShoppingList)
saveButton.setOnClickListener { saveButton.setOnClickListener {

View File

@ -17,6 +17,7 @@ import tech.mercantec.easyeat.helpers.ApiRequestException
import tech.mercantec.easyeat.helpers.GetAllRecipesResponse import tech.mercantec.easyeat.helpers.GetAllRecipesResponse
import tech.mercantec.easyeat.helpers.getAllRecipes import tech.mercantec.easyeat.helpers.getAllRecipes
import tech.mercantec.easyeat.models.DishListItem import tech.mercantec.easyeat.models.DishListItem
import tech.mercantec.easyeat.models.Recipe
import kotlin.concurrent.thread import kotlin.concurrent.thread
class DishesFragment : Fragment() { class DishesFragment : Fragment() {

View File

@ -27,7 +27,7 @@ class GenerateRecipeActivity : AppCompatActivity() {
progressDialog.show() progressDialog.show()
thread { thread {
val response: GenerateRecipeResponse // val response: GenerateRecipeResponse
try { try {
val recipe = generateRecipeWithAI(this, name, Locale.getDefault().displayLanguage) val recipe = generateRecipeWithAI(this, name, Locale.getDefault().displayLanguage)

View File

@ -86,7 +86,7 @@
android:layout_marginHorizontal="10sp"/> android:layout_marginHorizontal="10sp"/>
<Button <Button
android:id="@+id/add_dish" android:id="@+id/addDishToShoppingList"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center" android:layout_gravity="center"