-
Notifications
You must be signed in to change notification settings - Fork 53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Possible bug ? #1765
Comments
👀 We've just linked this issue to our internal tracker and notified the team. Thank you for reporting, we're checking this out! |
Hi @anmol-tray could you give some more context on why you believe this is a bug? It seems that the cancellation handling of |
Yes because when we cancel a coroutine using a job.cancel the suspendCoroutine doesn't cancel the revenueCat call.. but wrapping the normal non suspend function for get current customer in my own suspendCancellableCoroutine cancells the coroutine. Ref: android/codelab-kotlin-coroutines#8 It's important that the coroutine cancels properly with cancellation exception If you think it's not an issue please feel free to close this issue. Thanks! |
Hi, thanks for raising this! The reason we're not using Do you have any specific reproducer you could share, that would be fixed by using |
Yes, when I switch between users and try to synchronize purchases, I might receive a fallback for prev. user request. That's why we need support cancellation operation for that case. As an alternative, I might prepare not replacing all UPD. @JayShortway PR updated |
Hi @IlyaPavlovskii, thanks for providing more details. Can you share some code in a gist or repository that reproduces this behavior?
That way we can better analyze the problem and determine the root cause. |
Something like this:
|
Where are you getting a callback for a previous user? Is It would be great if you could create a git repository with a failing unit test. |
It might be catched in realtime with real network communication(we doesn't support UnitTesting with real remove communication). There is no any problem with authStateListener.
4.1 Logout immediately after this. In the logout section I terminate the scope( |
Try to reproduce it with simulation authorization and check behavior with 3 buttons: simulate_login_account_A, simulate_login_account_B, logout |
Thanks for providing more info! I have a few follow-up questions:
|
|
Restoring via a button is a recommendation, because it often leads to unexpected results if done programmatically. In your scenario, there's a Google account that bought the subscription, and multiple users logging in and out. Only the last user to log in will have access to the subscription of the Google account, because the purchase gets transferred upon restore. Regarding the PR, we have discussed it within the team and decided that it is best if our async methods reflect the underlying work as much as possible. That is, since the underlying async work is not directly cancellable, the async method kicking off that work shouldn't be either. To illustrate, if you start a restore wrapped in We recommend using the App User ID to determine if you need to process the current Happy to answer any other questions! |
purchases-android/purchases/src/defaults/kotlin/com/revenuecat/purchases/coroutinesExtensions.kt
Line 24 in 36ddd19
it should be suspendCancellableCoroutine instead of suspendCoroutine
The text was updated successfully, but these errors were encountered: