Skip to content
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

Add appSessionID to PaywallEventsManager #4482

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

vegaro
Copy link
Contributor

@vegaro vegaro commented Nov 13, 2024

Added an appSessionID that can be shared between all events. Since at the moment session_identifier in the paywalls represent the paywall session, not the whole app session.

I just added the generation, a reset functionality and a fallback for now


Task {
await self.paywallEventsManager?.resetAppSessionID()
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am unsure about this, but paywallEventsManager is an actor

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, since paywallEventsManager is an actor, this call has to be async. Ideally, the login function itself would be async and we wouldn't have to spawn a child task here, but that's a whole other refactor 🤷‍♂️

I think the biggest risk is that login() completes before resetAppSessionID() is done, and then some event gets emitted without the new app session ID. I don't think it's likely, but if we want to be safe here, we could consider calling the completion handler in the Task after resetAppSessionID completes.

Copy link
Contributor

@fire-at-will fire-at-will left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like we're generating an app session ID when login/logout are called, but does one get created if the developer doesn't call those functions?

I don't have the full context on this feature, so it might not be necessary, but just wanted to make sure!

@vegaro
Copy link
Contributor Author

vegaro commented Nov 13, 2024

@fire-at-will Yes, in the init of PaywallEventsManager https://github.com/RevenueCat/purchases-ios/pull/4482/files#diff-dcba7f0e5ca516087d45ef4b0bcd031d91ad329aa90d8e86b0928e2484ad07d3R48. Maybe it's not clear enough?

Btw, I am happy to change the approach :)

I tested that old Paywall Events would have an associated app session ID (on the SDK only not in the event sent yet)

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

Successfully merging this pull request may close these issues.

2 participants