Skip to content

Feature/subscription check on startup#22

Merged
Android-PowerUser merged 2 commits intoBetter_textfrom
feature/subscription-check-on-startup
May 31, 2025
Merged

Feature/subscription check on startup#22
Android-PowerUser merged 2 commits intoBetter_textfrom
feature/subscription-check-on-startup

Conversation

@Android-PowerUser
Copy link
Owner

No description provided.

This commit implements a check for active subscriptions every time the app
starts (via MainActivity's onResume -> queryActiveSubscriptions).

Key changes:
- Added `TrialManager.clearPurchaseMark()` to reset the app's purchased
  status if Google Play Billing reports no active subscription, or if the
  query to Play Billing fails. This function sets the internal 'purchased'
  flag to false and resets the 'initial setup' flag for trial logic.
- In `MainActivity.queryActiveSubscriptions()`:
    - If no active subscription is found (or the query fails) and the app
      previously considered itself purchased, `TrialManager.clearPurchaseMark()`
      is called.
    - After updating the trial state, if the state is
      `EXPIRED_INTERNET_TIME_CONFIRMED`, a toast message "Subscription is
      deactivated" is displayed, and the existing logic will show the
      trial expired dialog.

This ensures that if a subscription is cancelled or expires, the app
correctly reverts to the appropriate trial/expired state and informs
you.
The previous commit failed to build because MainActivity could not
access TrialManager.isPurchased due to it being private.

This commit changes the visibility of `TrialManager.isPurchased`
from `private` to `internal` to allow access from MainActivity
within the same module, resolving the build error.
@Android-PowerUser Android-PowerUser merged commit c6cffd4 into Better_text May 31, 2025
1 check passed
@Android-PowerUser Android-PowerUser deleted the feature/subscription-check-on-startup branch May 31, 2025 08:55
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