Skip to content

empty api key safety; refactoring and more misc cleanup#70

Merged
salami merged 2 commits into
mainfrom
misc-cleanup
Apr 18, 2026
Merged

empty api key safety; refactoring and more misc cleanup#70
salami merged 2 commits into
mainfrom
misc-cleanup

Conversation

@salami

@salami salami commented Apr 17, 2026

Copy link
Copy Markdown
Collaborator

Note

Medium Risk
Moderate risk because it changes initialization gating and event/purchase status handling across JS, Android, and iOS, which could affect whether the SDK initializes or whether queued events/purchase results are processed as before.

Overview
Adds defensive initialization across JS, Android, and iOS: initialize now aborts (with logging) when apiKey is missing/empty, avoiding partial setup.

Adjusts bridge reliability behavior by making JS listener cleanup resilient to emitter errors, and changing Android’s queued-event flush to drop events that fail to emit instead of re-queuing them.

Tightens purchase result parsing on both platforms by no longer treating "completed" as a successful purchase status (only "purchased" maps to success).

Reviewed by Cursor Bugbot for commit 962d285. Bugbot is set up for automated code reviews on this repo. Configure here.

@coderabbitai

coderabbitai Bot commented Apr 17, 2026

Copy link
Copy Markdown

Warning

Rate limit exceeded

@salami has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 45 minutes and 6 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 45 minutes and 6 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 1fa6f629-e5d2-4208-8d94-b4de615a5919

📥 Commits

Reviewing files that changed from the base of the PR and between a510096 and 962d285.

📒 Files selected for processing (3)
  • android/src/main/java/com/paywallsdkreactnative/HeliumBridge.kt
  • ios/HeliumSwiftInterface.swift
  • src/native-interface.tsx
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch misc-cleanup

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 3d17e48. Configure here.


val status: HeliumPaywallTransactionStatus = when (statusString.lowercase()) {
"completed", "purchased" -> HeliumPaywallTransactionStatus.Purchased
"purchased" -> HeliumPaywallTransactionStatus.Purchased

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed "completed" mapping breaks DemoHeliumCallbacks purchase flow

High Severity

The "completed" status string was removed from the native handlePurchaseResult mapping on both Android and iOS, but DemoHeliumCallbacks.makePurchase in src/purchase-handlers.ts still returns { status: 'completed' as HeliumTransactionStatus }. Any code using this exported demo class (or any custom handler returning "completed") will now have successful purchases incorrectly treated as Failed on the native side, since "completed" falls through to the else/default branch.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 3d17e48. Configure here.

@salami salami merged commit f8febce into main Apr 18, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant