Skip to content

Commit 6b69f21

Browse files
committed
chore: lint fixes
1 parent 60e0348 commit 6b69f21

File tree

5 files changed

+205
-198
lines changed

5 files changed

+205
-198
lines changed

.github/workflows/deploy.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ jobs:
7373
run: |
7474
yarn lint:tsc
7575
npx eslint --ext .ts,.tsx,.js,.jsx src plugin/src
76-
npx prettier --check "**/*.{md,js,jsx,ts,tsx}"
76+
npx prettier --check "**/*.{md,js,jsx,ts,tsx}" "!example-expo/**"
7777
7878
- name: Configure Git user
7979
run: |

example-expo/app/subscription-flow.tsx

Lines changed: 97 additions & 97 deletions
Original file line numberDiff line numberDiff line change
@@ -84,115 +84,115 @@ const PlanChangeControls = React.memo(function PlanChangeControls({
8484
let currentBasePlan = 'unknown';
8585
let activeSub: ActiveSubscription | undefined = undefined;
8686

87-
if (Platform.OS === 'ios') {
88-
// On iOS, find the most recent subscription (in case both exist during transition)
89-
// Sort by transaction date to get the most recent one
90-
const sortedSubs = [...premiumSubs].sort((a, b) => {
91-
const dateA = a.transactionDate ?? 0;
92-
const dateB = b.transactionDate ?? 0;
93-
return dateB - dateA;
94-
});
87+
if (Platform.OS === 'ios') {
88+
// On iOS, find the most recent subscription (in case both exist during transition)
89+
// Sort by transaction date to get the most recent one
90+
const sortedSubs = [...premiumSubs].sort((a, b) => {
91+
const dateA = a.transactionDate ?? 0;
92+
const dateB = b.transactionDate ?? 0;
93+
return dateB - dateA;
94+
});
9595

96-
activeSub = sortedSubs[0];
96+
activeSub = sortedSubs[0];
9797

98-
// Check for the most recent purchase to determine actual plan
99-
// First, check if both products exist (transition state)
100-
const hasYearly = premiumSubs.some(
101-
(s) => s.productId === 'dev.hyo.martie.premium_year',
102-
);
103-
const hasMonthly = premiumSubs.some(
104-
(s) => s.productId === 'dev.hyo.martie.premium',
105-
);
98+
// Check for the most recent purchase to determine actual plan
99+
// First, check if both products exist (transition state)
100+
const hasYearly = premiumSubs.some(
101+
(s) => s.productId === 'dev.hyo.martie.premium_year',
102+
);
103+
const hasMonthly = premiumSubs.some(
104+
(s) => s.productId === 'dev.hyo.martie.premium',
105+
);
106106

107-
if (lastPurchasedPlan) {
108-
// If we have a recently purchased plan, use that
109-
currentBasePlan = lastPurchasedPlan;
110-
console.log('Using last purchased plan:', lastPurchasedPlan);
111-
} else if (hasYearly && !hasMonthly) {
112-
// Only yearly exists - user has yearly
107+
if (lastPurchasedPlan) {
108+
// If we have a recently purchased plan, use that
109+
currentBasePlan = lastPurchasedPlan;
110+
console.log('Using last purchased plan:', lastPurchasedPlan);
111+
} else if (hasYearly && !hasMonthly) {
112+
// Only yearly exists - user has yearly
113+
currentBasePlan = 'premium-year';
114+
} else if (!hasYearly && hasMonthly) {
115+
// Only monthly exists - user has monthly
116+
currentBasePlan = 'premium';
117+
} else if (activeSub) {
118+
// Both exist or transition state - use the most recent one
119+
if (activeSub.productId === 'dev.hyo.martie.premium_year') {
113120
currentBasePlan = 'premium-year';
114-
} else if (!hasYearly && hasMonthly) {
115-
// Only monthly exists - user has monthly
121+
} else if (activeSub.productId === 'dev.hyo.martie.premium') {
116122
currentBasePlan = 'premium';
117-
} else if (activeSub) {
118-
// Both exist or transition state - use the most recent one
119-
if (activeSub.productId === 'dev.hyo.martie.premium_year') {
120-
currentBasePlan = 'premium-year';
121-
} else if (activeSub.productId === 'dev.hyo.martie.premium') {
122-
currentBasePlan = 'premium';
123-
}
124123
}
124+
}
125+
} else {
126+
// Android uses base plans within the same product
127+
activeSub = premiumSubs[0];
128+
const extendedSub = activeSub as ExtendedActiveSubscription;
129+
if (extendedSub.basePlanId) {
130+
currentBasePlan = extendedSub.basePlanId;
131+
} else if (lastPurchasedPlan) {
132+
currentBasePlan = lastPurchasedPlan;
125133
} else {
126-
// Android uses base plans within the same product
127-
activeSub = premiumSubs[0];
128-
const extendedSub = activeSub as ExtendedActiveSubscription;
129-
if (extendedSub.basePlanId) {
130-
currentBasePlan = extendedSub.basePlanId;
131-
} else if (lastPurchasedPlan) {
132-
currentBasePlan = lastPurchasedPlan;
133-
} else {
134-
// Default to monthly if we can't detect
135-
currentBasePlan = 'premium';
136-
}
134+
// Default to monthly if we can't detect
135+
currentBasePlan = 'premium';
137136
}
137+
}
138138

139-
console.log(
140-
'Button section - current base plan:',
141-
currentBasePlan,
142-
'Active sub:',
143-
activeSub?.productId,
144-
);
139+
console.log(
140+
'Button section - current base plan:',
141+
currentBasePlan,
142+
'Active sub:',
143+
activeSub?.productId,
144+
);
145145

146-
// iOS doesn't need upgrade/downgrade buttons as it's handled automatically by the App Store
147-
if (Platform.OS === 'ios') {
148-
return null;
149-
}
146+
// iOS doesn't need upgrade/downgrade buttons as it's handled automatically by the App Store
147+
if (Platform.OS === 'ios') {
148+
return null;
149+
}
150150

151-
return (
152-
<View style={styles.planChangeSection}>
153-
{currentBasePlan === 'premium' && (
154-
<TouchableOpacity
155-
style={[styles.changePlanButton, styles.upgradeButton]}
156-
onPress={() =>
157-
handlePlanChange(
158-
activeSub?.productId || 'dev.hyo.martie.premium',
159-
'upgrade',
160-
'premium',
161-
)
162-
}
163-
disabled={isProcessing}
164-
>
165-
<Text style={styles.changePlanButtonText}>
166-
⬆️ Upgrade to Yearly Plan
167-
</Text>
168-
<Text style={styles.changePlanButtonSubtext}>
169-
Save with annual billing
170-
</Text>
171-
</TouchableOpacity>
172-
)}
151+
return (
152+
<View style={styles.planChangeSection}>
153+
{currentBasePlan === 'premium' && (
154+
<TouchableOpacity
155+
style={[styles.changePlanButton, styles.upgradeButton]}
156+
onPress={() =>
157+
handlePlanChange(
158+
activeSub?.productId || 'dev.hyo.martie.premium',
159+
'upgrade',
160+
'premium',
161+
)
162+
}
163+
disabled={isProcessing}
164+
>
165+
<Text style={styles.changePlanButtonText}>
166+
⬆️ Upgrade to Yearly Plan
167+
</Text>
168+
<Text style={styles.changePlanButtonSubtext}>
169+
Save with annual billing
170+
</Text>
171+
</TouchableOpacity>
172+
)}
173173

174-
{currentBasePlan === 'premium-year' && (
175-
<TouchableOpacity
176-
style={[styles.changePlanButton, styles.downgradeButton]}
177-
onPress={() =>
178-
handlePlanChange(
179-
activeSub?.productId || 'dev.hyo.martie.premium_year',
180-
'downgrade',
181-
'premium-year',
182-
)
183-
}
184-
disabled={isProcessing}
185-
>
186-
<Text style={styles.changePlanButtonText}>
187-
⬇️ Downgrade to Monthly Plan
188-
</Text>
189-
<Text style={styles.changePlanButtonSubtext}>
190-
More flexibility with monthly billing
191-
</Text>
192-
</TouchableOpacity>
193-
)}
194-
</View>
195-
);
174+
{currentBasePlan === 'premium-year' && (
175+
<TouchableOpacity
176+
style={[styles.changePlanButton, styles.downgradeButton]}
177+
onPress={() =>
178+
handlePlanChange(
179+
activeSub?.productId || 'dev.hyo.martie.premium_year',
180+
'downgrade',
181+
'premium-year',
182+
)
183+
}
184+
disabled={isProcessing}
185+
>
186+
<Text style={styles.changePlanButtonText}>
187+
⬇️ Downgrade to Monthly Plan
188+
</Text>
189+
<Text style={styles.changePlanButtonSubtext}>
190+
More flexibility with monthly billing
191+
</Text>
192+
</TouchableOpacity>
193+
)}
194+
</View>
195+
);
196196
});
197197

198198
/**

example-expo/scripts/copy-screens.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,4 +68,11 @@ if [ $copied_files -eq 0 ]; then
6868
echo "⚠️ No screen files found to copy."
6969
else
7070
echo "✅ Successfully copied $copied_files screen files!"
71+
72+
# Run prettier on copied files to ensure consistent formatting
73+
if command -v npx >/dev/null 2>&1; then
74+
echo "🎨 Running prettier on copied files..."
75+
npx prettier --write "app/available-purchases.tsx" "app/offer-code.tsx" "app/subscription-flow.tsx" "app/purchase-flow.tsx" 2>/dev/null || true
76+
echo "✅ Prettier formatting complete!"
77+
fi
7178
fi

0 commit comments

Comments
 (0)