Hello,
I plan to use virtual currencies within my app.
For me, spending or gaining is straight forward and I will use my backend for such calls.
Evaluating the available tokens within the app raises more questions and I tried to understand the official doc here https://www.revenuecat.com/docs/offerings/virtual-currency but I still wonder about some aspects.
Exact use case: I need to know within my view models if the user has tokens or not.
What should I use: Purchases.shared.cachedVirtualCurrencies or Purchases.shared.virtualCurrencies()?
I understand the fact that I need to call the Purchases.shared.invalidateVirtualCurrenciesCache() each time there is a backend transaction, but then what?
Is calling Purchases.shared.invalidateVirtualCurrenciesCache() updating the Purchases.shared.cachedVirtualCurrencies? or do I need to fist call Purchases.shared.virtualCurrencies() and then use the cachedVirtualCurrencies
How about this flow:
- App launch call Purchases.shared.virtualCurrencies() and store it
- Use that instance until any spending event
- If the user spends/receives tokens, then call invalidate and call again Purchases.shared.virtualCurrencies()
I can’t find a place for cachedVirtualCurrencies in this case 🙈
