Drop the in-app unlock key: only the PRO apk opens PRO

The set is two apks and the unlock key was a second, weaker lock on the
same door. A verifier that runs offline has to carry its secret inside
the lite apk, so anyone who unpacked it could mint a key. Nothing in the
lite build can flip the gate now.

- entitlement.ts keeps the gate (which look is PRO, what an export
  carries in lite) and exports IS_PRO straight from the build flag.
- SETTINGS loses the key field; the plan chip still says LITE / PRO
  ACTIVE and the helper text says what lite cannot export.
- The upsell alerts just name the build that has the feature.
- tools/keygen.mjs goes with the verifier it fed.
This commit is contained in:
2026-09-14 20:09:12 +07:00
parent 97949e449d
commit 1b60ca2f22
6 changed files with 35 additions and 210 deletions
+7 -45
View File
@@ -1,5 +1,5 @@
import React, { useEffect, useState } from 'react';
import { View, Text, Keyboard, Modal, ScrollView, TouchableOpacity, TextInput } from 'react-native';
import { View, Text, Keyboard, Modal, ScrollView, TouchableOpacity } from 'react-native';
import * as Haptics from 'expo-haptics';
import { X, Volume2, Info, ChevronRight, MapPin, Settings as SettingsIcon } from 'lucide-react-native';
import { AspectRatio, MeterMode, ShutterSound, StartupMode } from '../types';
@@ -37,11 +37,8 @@ interface SettingsModalProps {
onGpsEnabled: (enabled: boolean) => void;
startupMode: StartupMode;
onStartupMode: (mode: StartupMode) => void;
// Lite vs PRO. The unlock key is verified in App (the entitlement module owns
// the maths) and comes back false for a bad key, which is all this sheet needs
// to know — let alone store.
// LITE vs PRO, decided at build time (no key, nothing to enter here).
pro: boolean;
onUnlock: (key: string) => Promise<boolean>;
}
function ChipRow({ chips }: { chips: Chip[] }) {
@@ -104,11 +101,8 @@ export default function SettingsModal({
startupMode,
onStartupMode,
pro,
onUnlock,
}: SettingsModalProps) {
const [showCredits, setShowCredits] = useState(false);
const [keyDraft, setKeyDraft] = useState('');
const [keyError, setKeyError] = useState(false);
// The RN Modal is its own dialog window, so the IME does not resize it and
// the card ends up under the keyboard. Track the keyboard height and lift the
// card by that much instead.
@@ -262,8 +256,8 @@ export default function SettingsModal({
<CameraOnlyNote cameraMode={cameraMode} />
</View>
{/* Lite vs PRO. Every look is free to preview and edit; the key buys
the export: no mark, and PRO presets/frames/watermarks allowed. */}
{/* LITE vs PRO. Every look is free to preview and edit; the PRO build
buys the export: no mark, and PRO presets/frames/watermarks. */}
<View>
<SectionLabel>PRO</SectionLabel>
<ChipRow
@@ -271,42 +265,10 @@ export default function SettingsModal({
{ key: 'plan', label: pro ? 'PRO ACTIVE' : 'LITE', active: pro, disabled: true, onPress: () => {} },
]}
/>
{!pro && (
<View className="flex-row items-center mt-2">
<TextInput
value={keyDraft}
onChangeText={(t) => {
setKeyDraft(t);
setKeyError(false);
}}
placeholder="XXXX-XXXX-XXXX-XXXX"
placeholderTextColor="#52525b"
autoCapitalize="characters"
autoCorrect={false}
className={`flex-1 rounded-md border bg-black/40 px-3 py-2 font-mono text-xs font-bold ${
keyError ? 'border-red-500/70 text-red-400' : 'border-zinc-700 text-zinc-200'
}`}
/>
<TouchableOpacity
onPress={async () => {
haptic();
const ok = await onUnlock(keyDraft);
setKeyError(!ok);
if (ok) setKeyDraft('');
}}
activeOpacity={0.7}
className="ml-2 rounded-md border border-amber-500/70 bg-amber-500/15 px-3 py-2"
>
<Text className="font-mono text-[11px] font-bold text-amber-500">UNLOCK</Text>
</TouchableOpacity>
</View>
)}
<Text className="text-zinc-600 font-mono text-[10px] mt-1.5 ml-1">
{keyError
? 'That key is not valid. Check all 16 characters.'
: pro
? 'Every look exports clean: no mark, no limits. Thanks!'
: 'LITE is free forever. Any preset, frame and watermark can be previewed and edited, but a PRO look cannot be exported and every export carries the RECIPESCAM mark. Enter your key to lift both.'}
{pro
? 'Every look exports clean: no mark, no limits.'
: 'LITE is free forever. Any preset, frame and watermark can be previewed and edited, but a PRO look cannot be exported and every export carries the RECIPESCAM mark.'}
</Text>
</View>