RevenueCat / purchases-kmp

RevenueCat SDK for Kotlin Multiplatform
MIT License
70 stars 2 forks source link

Fixes a PaywallListener crash #170

Closed JayShortway closed 2 weeks ago

JayShortway commented 2 weeks ago

As the title says. Also added a listener to the tester app, and was able to reproduce it with that. Verified no more crashes on both Android and iOS.

Cause

We were unsafely casting, which worked fine before when everything was a type alias. That's no longer the case. StoreTransaction was already converted away from a type alias in 1.0.0-beta.3, and we made it "worse" on main by converting the rest.

Fix

For some weird reason we have double Kotlin mappings for the same underlying ObjC class. For now, I'm casting one to the other (which works because it's the same thing), and then calling our mapper function.

I also checked some other casts we do, and they seem okay so far.

Closes #168