Skip to content

Display IAP discounts#641

Merged
SailReal merged 2 commits into
developfrom
feature/add-iap-sale
Jun 24, 2026
Merged

Display IAP discounts#641
SailReal merged 2 commits into
developfrom
feature/add-iap-sale

Conversation

@SailReal

Copy link
Copy Markdown
Member

No description provided.

@coderabbitai

coderabbitai Bot commented Jun 24, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 4548691a-19d7-4dd3-99fa-c9e8b47969c2

📥 Commits

Reviewing files that changed from the base of the PR and between acd4ce2 and 76a2c40.

📒 Files selected for processing (2)
  • presentation/src/playstoreiap/java/org/cryptomator/presentation/service/IapBillingService.kt
  • presentation/src/test/java/org/cryptomator/presentation/service/ProductInfoTest.kt
🚧 Files skipped from review as they are similar to previous changes (1)
  • presentation/src/test/java/org/cryptomator/presentation/service/ProductInfoTest.kt

Walkthrough

The PR adds lifetime promotional discount support across the IAP flow. ProductInfo now exposes price plus optional discount fields, and ProductPrices includes matching lifetime discount values. IapBillingService maps Play Billing product details into the new model, including promotional one-time offers and updated subscription phase selection, and uses the promotional offer token when launching purchases. The license screen layout, strings, and binder were updated to render lifetime discount UI. Tests cover the new resolveProductPrices() cases.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • cryptomator/android#630: Introduced the IAP pricing plumbing (ProductInfo, ProductPrices, resolveProductPrices) that this PR extends with lifetime discount fields and promotional offer handling.
🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 13.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ❓ Inconclusive No pull request description was provided, so there is nothing to assess beyond the title. Add a brief description summarizing the IAP discount pricing and UI changes.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title matches the main change: adding support for displaying IAP discounts.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/add-iap-sale

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.

@coderabbitai coderabbitai 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.

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@presentation/src/playstoreiap/java/org/cryptomator/presentation/service/IapBillingService.kt`:
- Around line 179-180: The yearly subscription price is currently taken from the
first pricing phase in IapBillingService’s offer handling, which can pick up a
trial or introductory phase instead of the recurring cost. Update the price
extraction in the subscription details mapping to use the recurring/base pricing
phase from details.subscriptionOfferDetails and its pricingPhases rather than
the first entry, so the “Yearly Subscription” label reflects the actual
repeating price.
- Around line 157-165: The ProductInfo mapping in IapBillingService should not
create a lifetime entry with an empty base price when only a promotional offer
is present; update the logic around the baseOffer/promoOffer handling to either
fall back to a non-empty offer price or only attach discount metadata when a
valid base offer exists. Also fix the subscription pricing lookup in the same
service by changing the first-phase selection to explicitly choose the recurring
pricing phase instead of blindly using the first phase, so the displayed
subscription price reflects the actual recurring charge.

In
`@presentation/src/test/java/org/cryptomator/presentation/service/ProductInfoTest.kt`:
- Around line 82-91: The null-path test for resolveProductPrices only verifies
lifetimeDiscountPrice, so update the ProductInfoTest cases that cover
no-discount behavior to also assert lifetimeDiscountPercent and
lifetimeDiscountEndTimeMillis are null. Use the resolveProductPrices result in
these tests to fully lock the mapping contract for all lifetime discount fields.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 5294b373-be47-40f5-9063-5c6fed9a81cc

📥 Commits

Reviewing files that changed from the base of the PR and between 342ef08 and acd4ce2.

📒 Files selected for processing (6)
  • presentation/src/main/java/org/cryptomator/presentation/service/ProductInfo.kt
  • presentation/src/main/java/org/cryptomator/presentation/ui/layout/LicenseContentViewBinder.kt
  • presentation/src/main/res/layout/view_license_check_content.xml
  • presentation/src/main/res/values/strings.xml
  • presentation/src/playstoreiap/java/org/cryptomator/presentation/service/IapBillingService.kt
  • presentation/src/test/java/org/cryptomator/presentation/service/ProductInfoTest.kt

@SailReal SailReal merged commit c8b1746 into develop Jun 24, 2026
2 checks passed
@SailReal SailReal deleted the feature/add-iap-sale branch June 24, 2026 14:27
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