Skip to content

Is there any way to determine the trigger of when().approved() or when().finished()? #1718

Description

@JordinKee

Is there any way inside when().approved() or when().finished() to determine whether the trigger was a call to store.order(), store.restorePurchases(), or store.initialize()? I'd like to notify the user of a restored/finished purchase, but don't want to annoy them in case they just made a normal order. I tried to keep track using the promises that store.restorePurchases() and store.initialize() return, but they seem to complete before when().approved() fires.

Related is the following scenario:

  • The user makes a purchase using the slow test card
  • The user closes the app
  • The purchase is completed
  • The user starts the app
  • store.initialize() is called and in turn fires store.productUpdated(). The product has canPurchase=false. The UI is updated accordingly.
  • Then, when().approved() is fired and the purchase is finished. The product, presumably, now has canPurchase=true, but I can't be sure unless I call store.update(). But calling that every time a purchase finishes feels wrong and its throttling mechanism would yield mixed results anyway.

What is the intended way to deal with this scenario?

Any help is appreciated!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions