-
Notifications
You must be signed in to change notification settings - Fork 374
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
fix/error removing handlers when SDK is not initialized #1639
fix/error removing handlers when SDK is not initialized #1639
Conversation
Signed-off-by: Guilherme Ribas <guilherme.ribas.tech@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 1 of 1 files at r1, all commit messages.
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @Ribas187)
Hello guys. What's the status of this? it seems like everyone is facing the same issue. |
Hey @jpangan I need approval from @nan-li or @jennantilla on this one. I faced the same issue in my company, but while we wait for the new version, we did a workaround by applying this change using a patch in the node_module package |
Thank you @Ribas187 for submitting and testing this PR! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
Description
Fix for the "initWithContext" error while trying to remove handlers when the SDK is not initialized
Details
Motivation
This issue happens in Android specifically when the app is closed and the OneSignal SDK has not been initialized yet
The error accused in the log is this one "Must call 'initWithContext' before use", and can be seen in the opened issue [Bug]: initWithContext error in android-1554
Scope
The mentioned code is inside the
removeHandlers()
method which is called insideonHostDestroy()
andonCatalystInstanceDestroy()
and causes a crash when the SDK has not been initialized before.This PR adds one verification to check whether the initialization is made with the value
oneSignalInitDone
Affected code checklist
Checklist
Overview
Testing
Final pass
This change is