Skip to content

Commit 88273bc

Browse files
author
Fix Bot
committed
Fix: updateDonationCard(isFreedom) now called last in onFreedomPurchaseStateChanged
Root cause of the previous fix not working: _applyTrialState() internally calls updateDonationCard() with NO argument (line ~5024), which re-reads Bridge.isFreedomPurchased() from native. Since onFreedomPurchaseStateChanged called updateDonationCard(isFreedom) BEFORE _applyTrialState(), the correct override was immediately clobbered by _applyTrialState's internal stale/ racy Bridge read - so the UI kept showing the Pro-only state. Fix: move the updateDonationCard(isFreedom) call to the very end of onFreedomPurchaseStateChanged, after _applyTrialState/_stopTrialTimer/ fetchFreedomFirebaseKeys have all run, so it always has the last word.
1 parent 0d0c1a2 commit 88273bc

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

index.html

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6587,7 +6587,6 @@
65876587
}
65886588
// Called by native code after Freedom purchase state changes
65896589
window.onFreedomPurchaseStateChanged = function(isFreedom) {
6590-
updateDonationCard(isFreedom);
65916590
if (isFreedom) {
65926591
// Freedom just purchased (or re-confirmed) – apply PURCHASED state immediately
65936592
// so the app doesn't keep behaving as if only Pro was bought until restart.
@@ -6610,6 +6609,10 @@
66106609
_startTrialTimerLoop();
66116610
}
66126611
}
6612+
// Always finish by applying the authoritative isFreedom value directly, since
6613+
// _applyTrialState()/updateDonationCard() calls above may have re-read
6614+
// Bridge.isFreedomPurchased() with a possibly not-yet-committed native value.
6615+
updateDonationCard(isFreedom);
66136616
};
66146617

66156618
/* ════════════════════════════════════════════════════════

0 commit comments

Comments
 (0)