Feature/subscription check on startup#22
Merged
Android-PowerUser merged 2 commits intoBetter_textfrom May 31, 2025
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.