Commit ba298b6
committed
fix: prevent crash when cleaning up uninitialized SDK on destroy
* Wrap removeHandlers() and removeObservers() calls in try-catch blocks within onHostDestroy() and onCatalystInstanceDestroy() to handle cases where the native OneSignal SDK throws "Must call 'initWithContext' before use" during activity destruction.
* Also move the oneSignalInitDone flag further down past the native `OneSignal.initWithContext(context, appId)` call.1 parent 1429d6e commit ba298b6
File tree
1 file changed
+18
-6
lines changed- android/src/main/java/com/onesignal/rnonesignalandroid
1 file changed
+18
-6
lines changedLines changed: 18 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
172 | 172 | | |
173 | 173 | | |
174 | 174 | | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
175 | 180 | | |
176 | 181 | | |
177 | 182 | | |
| |||
226 | 231 | | |
227 | 232 | | |
228 | 233 | | |
229 | | - | |
230 | | - | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
231 | 240 | | |
232 | 241 | | |
233 | 242 | | |
| |||
238 | 247 | | |
239 | 248 | | |
240 | 249 | | |
241 | | - | |
242 | | - | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
243 | 256 | | |
244 | 257 | | |
245 | 258 | | |
| |||
254 | 267 | | |
255 | 268 | | |
256 | 269 | | |
257 | | - | |
258 | | - | |
259 | 270 | | |
260 | 271 | | |
261 | 272 | | |
262 | 273 | | |
263 | 274 | | |
264 | 275 | | |
265 | 276 | | |
| 277 | + | |
266 | 278 | | |
267 | 279 | | |
268 | 280 | | |
| |||
0 commit comments