mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-12-02 17:26:24 +00:00
fix(native): typecheck, lint and knip on the native code; wire he's native bundle
The full suite, which the feature-branch CI does not run, catches four things the native work still had: a non-narrowed union in the claim flow (tsc), a helper named useFake that the react-hooks rule read as a hook (eslint), two iap types exported but used only inside the file (knip), and the Hebrew native strings present as a file but never spread into he's merged bundle (the aggregated key parity test). All four fixed.
This commit is contained in:
+13
-16
@@ -432,11 +432,8 @@ async function slugStatus(slug: string): Promise<SlugStatus> {
|
||||
}
|
||||
}
|
||||
|
||||
interface RedeemOk {
|
||||
ok: true
|
||||
instanceUrl: string
|
||||
}
|
||||
async function redeemPurchase(slug: string, email: string, purchase: Purchase): Promise<RedeemOk | { ok: false; code: string }> {
|
||||
type RedeemResult = { ok: true; instanceUrl: string } | { ok: false; code: string }
|
||||
async function redeemPurchase(slug: string, email: string, purchase: Purchase): Promise<RedeemResult> {
|
||||
try {
|
||||
const res = await CapacitorHttp.post({
|
||||
url: `${CLOUD_URL}/api/iap/redeem`,
|
||||
@@ -561,19 +558,19 @@ function showClaim(plan: CloudPlan, interval: 'month' | 'year', opts: { back?: b
|
||||
}
|
||||
|
||||
const redeemed = await redeemPurchase(slug, email, outcome.purchase)
|
||||
if (redeemed.ok) {
|
||||
showProvisioning(redeemed.instanceUrl)
|
||||
if (!redeemed.ok) {
|
||||
void notify(NotificationType.Error)
|
||||
restore()
|
||||
if (redeemed.code === 'slug-taken') {
|
||||
shake(slugField)
|
||||
slugNote.textContent = t('native.claim.taken')
|
||||
slugNote.className = 'hint bad'
|
||||
} else {
|
||||
error.textContent = t('native.claim.redeemFailed')
|
||||
}
|
||||
return
|
||||
}
|
||||
void notify(NotificationType.Error)
|
||||
restore()
|
||||
if (redeemed.code === 'slug-taken') {
|
||||
shake(slugField)
|
||||
slugNote.textContent = t('native.claim.taken')
|
||||
slugNote.className = 'hint bad'
|
||||
} else {
|
||||
error.textContent = t('native.claim.redeemFailed')
|
||||
}
|
||||
showProvisioning(redeemed.instanceUrl)
|
||||
})
|
||||
|
||||
show(
|
||||
|
||||
Reference in New Issue
Block a user