diff --git a/Nextcloud Cookbook iOS Client.xcodeproj/project.xcworkspace/xcuserdata/vincie.xcuserdatad/UserInterfaceState.xcuserstate b/Nextcloud Cookbook iOS Client.xcodeproj/project.xcworkspace/xcuserdata/vincie.xcuserdatad/UserInterfaceState.xcuserstate index c61aa18..d2cf90a 100644 Binary files a/Nextcloud Cookbook iOS Client.xcodeproj/project.xcworkspace/xcuserdata/vincie.xcuserdatad/UserInterfaceState.xcuserstate and b/Nextcloud Cookbook iOS Client.xcodeproj/project.xcworkspace/xcuserdata/vincie.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/Nextcloud Cookbook iOS Client/Views/Recipes/RecipeCardView.swift b/Nextcloud Cookbook iOS Client/Views/Recipes/RecipeCardView.swift index 924a91a..8a6a880 100644 --- a/Nextcloud Cookbook iOS Client/Views/Recipes/RecipeCardView.swift +++ b/Nextcloud Cookbook iOS Client/Views/Recipes/RecipeCardView.swift @@ -48,7 +48,6 @@ struct RecipeCardView: View { } .background(Color.backgroundHighlight) .clipShape(RoundedRectangle(cornerRadius: 17)) - .padding(.horizontal) .task { recipeThumb = await appState.getImage( id: recipe.recipe_id, @@ -67,5 +66,6 @@ struct RecipeCardView: View { fetchMode: UserSettings.shared.storeThumb ? .preferServer : .onlyServer ) } + .frame(height: 80) } } diff --git a/Nextcloud Cookbook iOS Client/Views/Recipes/RecipeListView.swift b/Nextcloud Cookbook iOS Client/Views/Recipes/RecipeListView.swift index 7911346..c93c370 100644 --- a/Nextcloud Cookbook iOS Client/Views/Recipes/RecipeListView.swift +++ b/Nextcloud Cookbook iOS Client/Views/Recipes/RecipeListView.swift @@ -17,10 +17,9 @@ struct RecipeListView: View { @State var searchText: String = "" @Binding var showEditView: Bool @State var selectedRecipe: Recipe? = nil - @State var presentRecipeView: Bool = false var body: some View { - ScrollView(showsIndicators: false) { + /*ScrollView(showsIndicators: false) { LazyVStack { ForEach(recipesFiltered(), id: \.recipe_id) { recipe in NavigationLink(value: recipe) { @@ -31,17 +30,35 @@ struct RecipeListView: View { .buttonStyle(.plain) .onTapGesture { selectedRecipe = recipe - presentRecipeView = true + //presentRecipeView = true } } } + + }*/ + List(recipesFiltered(), id: \.recipe_id) { recipe in + RecipeCardView(recipe: recipe) + .shadow(radius: 2) + .background( + NavigationLink(value: recipe) { + EmptyView() + } + .buttonStyle(.plain) + .opacity(0) + ) + .frame(height: 85) + .listRowInsets(EdgeInsets(top: 5, leading: 10, bottom: 5, trailing: 10)) + .listRowSeparatorTint(.clear) } + .listStyle(.plain) + .searchable(text: $searchText, prompt: "Search recipes/keywords") + .navigationTitle(categoryName == "*" ? String(localized: "Other") : categoryName) + .navigationDestination(for: Recipe.self) { recipe in RecipeView(viewModel: RecipeView.ViewModel(recipe: recipe)) .environmentObject(appState) .environmentObject(groceryList) } - .navigationTitle(categoryName == "*" ? String(localized: "Other") : categoryName) .toolbar { ToolbarItem(placement: .topBarTrailing) { Button { @@ -52,7 +69,6 @@ struct RecipeListView: View { } } } - .searchable(text: $searchText, prompt: "Search recipes/keywords") .task { await appState.getCategory( named: categoryName, diff --git a/Nextcloud Cookbook iOS Client/Views/Tabs/RecipeTabView.swift b/Nextcloud Cookbook iOS Client/Views/Tabs/RecipeTabView.swift index 8e10b75..d9c6199 100644 --- a/Nextcloud Cookbook iOS Client/Views/Tabs/RecipeTabView.swift +++ b/Nextcloud Cookbook iOS Client/Views/Tabs/RecipeTabView.swift @@ -13,13 +13,12 @@ struct RecipeTabView: View { @EnvironmentObject var appState: AppState @EnvironmentObject var groceryList: GroceryList @EnvironmentObject var viewModel: RecipeTabView.ViewModel - @EnvironmentObject var mainViewModel: AppState var body: some View { NavigationSplitView { List(selection: $viewModel.selectedCategory) { // Categories - ForEach(mainViewModel.categories) { category in + ForEach(appState.categories) { category in if category.recipe_count != 0 { NavigationLink(value: category) { HStack(alignment: .center) { @@ -72,11 +71,17 @@ struct RecipeTabView: View { } .tint(.nextcloudBlue) .task { - viewModel.serverConnection = await mainViewModel.checkServerConnection() + let connection = await appState.checkServerConnection() + DispatchQueue.main.async { + viewModel.serverConnection = connection + } } .refreshable { - viewModel.serverConnection = await mainViewModel.checkServerConnection() - await mainViewModel.getCategories() + let connection = await appState.checkServerConnection() + DispatchQueue.main.async { + viewModel.serverConnection = connection + } + await appState.getCategories() } }