exponea / exponea-react-native-sdk

MIT License
8 stars 13 forks source link

Fix: Ensure trackPushToken resolves promise on success in iOS #120

Closed phuongwd closed 5 months ago

phuongwd commented 5 months ago

Description:

This PR addresses an issue in the iOS implementation of the trackPushToken method where the promise was not being resolved, causing the app to get stuck. The resolve block is now called after the trackPushToken method, ensuring the promise is resolved successfully. This change aligns the iOS implementation with the existing Android implementation, maintaining consistency across platforms.

Changes:

Reason for Change:

https://github.com/exponea/exponea-react-native-sdk/blob/a9a5c7607e76563fa72b22c033ab2245eb63e1ba/ios/Exponea%2BTracking.swift#L105-L115

Previously, the trackPushToken method did not call the resolve block, which caused the promise to remain unresolved and the application to hang. By resolving the promise, we ensure that the method completes successfully, allowing the app to continue execution as expected. This also ensures consistency with the Android implementation, which already resolves the promise after tracking the token.

Consistency with Android:

The Android implementation of trackPushToken already resolves the promise after tracking the push token: https://github.com/exponea/exponea-react-native-sdk/blob/a9a5c7607e76563fa72b22c033ab2245eb63e1ba/android/src/main/java/com/exponea/ExponeaModule.kt#L634-L640

By making this change to the iOS implementation, both platforms handle the promise resolution in a consistent manner, improving reliability and maintainability.

Testing:

roland-misica commented 5 months ago

Thanks for the PR. We are closing it here and we apply the fix. Thanks.

phuongwd commented 5 months ago

Thanks for response @roland-misica

Just for understand, why did you not merge the pull request from community?

xcibik00 commented 5 months ago

Hi @phuongwd , we are not merging/accepting PRs from community directly, as first because it not fits to our dev workflow and especially in this PR not all necessary fixes are implemented (we found out that its in multiple places).

But do not worry - we will work on it and incorporate this fix, aaand your PR is really helpful, so do not hesitate to create another in any case! Thanks

xcibik00 commented 2 months ago

Hi @phuongwd, fix already released as a part of Exponea RN 1.9.0 version