Closed phuongwd closed 5 months ago
Thanks for the PR. We are closing it here and we apply the fix. Thanks.
Thanks for response @roland-misica
Just for understand, why did you not merge the pull request from community?
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
Hi @phuongwd, fix already released as a part of Exponea RN 1.9.0 version
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 thetrackPushToken
method, ensuring the promise is resolved successfully. This change aligns the iOS implementation with the existing Android implementation, maintaining consistency across platforms.Changes:
resolve(nil)
afterExponea.exponeaInstance.trackPushToken(token)
to ensure the promise is resolved.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:
trackPushToken
method now resolves the promise successfully on iOS.