From d87f66efff6d08c494c97da7f37c5e6360a1dd7f Mon Sep 17 00:00:00 2001 From: AyrisAI Date: Thu, 20 Aug 2026 13:23:55 +0300 Subject: [PATCH] feat(mobile): gate publish behind subscription, surface free trial MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Publishing (including re-publishing after a lapsed subscription — PRD §15) now checks Pro entitlement first; if inactive, prompts the owner to the paywall instead of calling the publish endpoint. The paywall also flags packages with an active introductory offer as "7 gün ücretsiz dene" (both plans now have a 7-day free trial configured in App Store Connect, Turkey territory). --- apps/mobile/src/app/account/subscription.tsx | 5 +++++ apps/mobile/src/app/menu/index.tsx | 23 ++++++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/apps/mobile/src/app/account/subscription.tsx b/apps/mobile/src/app/account/subscription.tsx index faddc35..1588a9a 100644 --- a/apps/mobile/src/app/account/subscription.tsx +++ b/apps/mobile/src/app/account/subscription.tsx @@ -144,6 +144,11 @@ export default function SubscriptionScreen() { {pkg.product.priceString} / {pkg.packageType === "ANNUAL" ? "yıl" : "ay"} + {pkg.product.introPrice ? ( + + 7 gün ücretsiz dene + + ) : null} {purchasingPackageId === pkg.identifier ? ( diff --git a/apps/mobile/src/app/menu/index.tsx b/apps/mobile/src/app/menu/index.tsx index 35437d1..e1a18b7 100644 --- a/apps/mobile/src/app/menu/index.tsx +++ b/apps/mobile/src/app/menu/index.tsx @@ -16,6 +16,7 @@ import * as Haptics from "expo-haptics"; import { api } from "@/lib/api"; import { getActiveRestaurant, type ActiveRestaurant } from "@/lib/active-restaurant"; import { getPublicMenuUrl, getPublicMenuDisplayUrl } from "@/lib/urls"; +import { getCustomerInfo, isProActive } from "@/lib/purchases"; import { CategoryPillBar } from "@/components/menu/CategoryPillBar"; import { MenuItemCard, type MenuItemData } from "@/components/menu/MenuItemCard"; import { ItemDetailSheet } from "@/components/menu/ItemDetailSheet"; @@ -250,6 +251,28 @@ export default function MenuEditorScreen() { // Publish async function onPublish() { if (!active) return; + + // Publishing (and re-publishing after a lapsed subscription — PRD §15) + // requires an active Pro entitlement or trial. RevenueCat's SDK starts + // the trial automatically on first purchase if the customer is eligible. + try { + const info = await getCustomerInfo(); + if (!isProActive(info)) { + Alert.alert( + "Menünüzü yayınlamak için abone olun", + "7 gün ücretsiz deneyin, istediğiniz zaman iptal edin.", + [ + { text: "Vazgeç", style: "cancel" }, + { text: "Devam Et", onPress: () => router.push("/account/subscription") }, + ], + ); + return; + } + } catch (err) { + Alert.alert("Hata", err instanceof Error ? err.message : "Abonelik durumu kontrol edilemedi."); + return; + } + setPublishing(true); try { await api.post(`/menus/${active.menuId}/publish`);