Code Monkey home page Code Monkey logo

Comments (9)

erluxman avatar erluxman commented on May 31, 2024 2

I can confirm that there is offline support which I was missing for some reasons.

from purchases-flutter.

erluxman avatar erluxman commented on May 31, 2024 1

Will get back to you with what I find, I might have missed something.

from purchases-flutter.

armandojimenez avatar armandojimenez commented on May 31, 2024 1

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.

aboedo avatar aboedo commented on May 31, 2024

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.

armandojimenez avatar armandojimenez commented on May 31, 2024

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.

vegaro avatar vegaro commented on May 31, 2024

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

armandojimenez avatar armandojimenez commented on May 31, 2024

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.

vegaro avatar vegaro commented on May 31, 2024

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.

josselin-oudry avatar josselin-oudry commented on May 31, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.