Comments (9)
I can confirm that there is offline support which I was missing for some reasons.
from purchases-flutter.
Will get back to you with what I find, I might have missed something.
from purchases-flutter.
Yes that can work, thanks! Need to think the approach since I don't want to block or remove pro status to a lifetime or annual user just because he is not connecting to the internet, when all the features in the app works offline, Thanks again!
from purchases-flutter.
I'm assuming that by Entitlements, you mean the entitlements that the user has purchased, which would be inside the purchaserInfo
object. Let me know if I missed something there.
The SDK will cache purchaserInfo
for only 5 minutes. The thinking is that since purchaserInfo
could change at any time outside the app, we want it to be up to date.
When you call getPurchaserInfo
, if the local cache is outdated (i.e.: it's been more than 5 minutes since the last refresh), it will return the cached information + trigger a refresh that will come up in a callback.
This method should still work without connectivity, since you'll receive the latest cache information.
Does this cover your case?
from purchases-flutter.
Question, what if the user cancel the subscription and only opens the app for a month with no connectivity, will still return as active from the cache??
from purchases-flutter.
@armandojimenez that's correct. Most apps require some sort of network connectivity to offer their functionality, so the way the system is designed works for most apps.
from purchases-flutter.
I understand. My app does not need Internet connection, it just unlock stuff in the app, how can I deal with this? Maybe checking if has the entitlement but also checking expiring date? is there a way to know if the cache is old or outdated? I can see it on the logs
from purchases-flutter.
PurchaserInfo
has a requestDate
property that you can check to block the user if the cache is too old and force them to connect. I think that could work in your case?
from purchases-flutter.
I am in the exact same situation as @armandojimenez, where my app can be fully used offline. So when the phone is offline I am relying on these 2 parameters to make sure the user has access to the premium entitlement:
- purchaserInfo.entitlements[premiumEntitlementID].isActive == true
- purchaserInfo.requestDate is not older than 24h
Now I would like to point out that during my tests in the sandbox environment, I have noticed something strange regarding purchaserInfo.requestDate while I had granted a test user with lifetime access to the premium entitlement:
It seems like purchaserInfo.requestDate gets roughly stuck to the same date/time as when I granted lifetime access. The user can thus not use the premium features after 24h even if the phone has an active internet connection. This obviously defeats the purpose of granting lifetime access.
No matter how frequently I call Purchases.shared.purchaserInfo(), purchaserInfo.requestDate does not get updated!
To give more details I call Purchases.shared.purchaserInfo(){} whenever the app becomes active and also as the app is active, whenever the internet connection becomes active. I save the purchaserInfo returned by its block in a class variable for later use: like just before the user tries to access a premium feature.
As a workaround to this issue I call:
if purchaserInfo.entitlements[premiumEntitlementID].productIdentifier == "rc_promo_premium_lifetime" {
// Special case even though purchaserInfo.requestDate is long stale,
// the user can still access premium features while in offline or online mode for that matter.
return true
}
Am I missing something? Or is it the intended behaviour that purchaserInfo.requestDate is always stale when lifetime access was granted?
Original question posted here: https://community.revenuecat.com/sdks-51/purchaserinfo-requestdate-is-always-stale-when-i-grant-a-user-with-lifetime-access-672
from purchases-flutter.
Related Issues (20)
- no built in Android HOT 3
- MacOS two factor window is sized wrong and is jumpy, see video HOT 5
- Expiration date is same as purchase date (macOS) HOT 4
- Preload paywalls HOT 2
- The content behind the paywall reacts when users click on the paywall background. HOT 3
- latest version Fails for macOS HOT 3
- iOS Are there any plans to add Privacy Manifests? HOT 7
- Paywall Fullscreen template renders off center for ios HOT 4
- Dart Support HOT 2
- iOS lifetime purchase (non-consumable) never expired in sandbox HOT 5
- invalidateCustomerInfoCache not working (customer info is not updating still cached) HOT 3
- getOfferings not work HOT 11
- macOS purchases ui flutter registrant error and paywall opening not supported HOT 2
- Caught `Couldn't find package` exception when purchasing promotional offer HOT 5
- Transfer to new App User ID doesn't sync Firebase Integration HOT 1
- Crashes on iOS 17.3+ HOT 5
- Support custom Paywall view modes HOT 3
- Android is all of a sudden DEAD - getCustomerInfo doesn't work and getOfferings HOT 7
- Paywall doesn't show trial text HOT 3
- Paywall doesn't have configurable close button color HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from purchases-flutter.