diff --git a/ios/Sources/ProductDetailView.swift b/ios/Sources/ProductDetailView.swift index 5e9b997..93d27c0 100644 --- a/ios/Sources/ProductDetailView.swift +++ b/ios/Sources/ProductDetailView.swift @@ -95,10 +95,16 @@ struct ProductDetailView: View { } if current.isObject { - Section("Gekauft bei") { - Picker("Shop", selection: $shopId) { - Text("– unbekannt / mehrere –").tag(Int?.none) - ForEach(shops) { shop in Text(shop.name).tag(Int?.some(shop.id)) } + // „Gekauft bei" gehört bei Einzelstücken zum einzelnen Stück + // (jedes kann woanders gekauft sein), nicht ans Modell – wie im + // Web wird der Shop hier dann ausgeblendet. Der Produktlink + // beschreibt das Produkt allgemein und bleibt. + Section(current.isIndividual ? "Produktlink" : "Gekauft bei") { + if !current.isIndividual { + Picker("Shop", selection: $shopId) { + Text("– unbekannt / mehrere –").tag(Int?.none) + ForEach(shops) { shop in Text(shop.name).tag(Int?.some(shop.id)) } + } } LabeledField(label: "Produktlink", text: $productUrl) if !productUrl.isEmpty, let url = URL(string: productUrl) { @@ -256,7 +262,8 @@ struct ProductDetailView: View { brand: brand.isEmpty ? nil : brand, packageSize: nil, packageLabel: nil, datePrecision: nil, groupId: nil, categoryId: categoryId, - shopId: shopId, + // Einzelstücke tragen den Shop je Stück – nichts ans Modell. + shopId: current.isIndividual ? nil : shopId, productUrl: productUrl.isEmpty ? nil : productUrl, fieldValues: fv ) diff --git a/ios/Sources/RootView.swift b/ios/Sources/RootView.swift index ec42317..69611b8 100644 --- a/ios/Sources/RootView.swift +++ b/ios/Sources/RootView.swift @@ -47,14 +47,19 @@ struct RootView: View { .task(id: router.openItemUid) { guard let uid = router.openItemUid else { return } router.openItemUid = nil + let host = session.activeProfile?.url?.host ?? "?" guard session.isLoggedIn else { - linkError = "Bitte zuerst am passenden Server anmelden, dann erneut scannen." + linkError = "Bitte zuerst am Server \(host) anmelden, dann erneut scannen." return } do { linkedItem = try await APIClient.shared.itemByUid(uid: uid) } catch { - linkError = "Einzelstück \(uid) nicht gefunden: \(error.localizedDescription)" + // Bei korrekter UID heißt 404 fast immer: der aktive Server ist ein + // anderer als der im QR-Code. Deshalb den Server benennen. + linkError = "Einzelstück \(uid) auf Server \(host) nicht gefunden. " + + "Zeigt der QR-Code auf denselben Server wie der oben gewählte? " + + "(\(error.localizedDescription))" } } .sheet(item: $linkedItem) { it in