fix(android): do not call exitEvent on activity restart (#9517)

This commit is contained in:
Eduardo Speroni
2021-08-18 13:09:50 -03:00
committed by GitHub
parent 3a3b505167
commit 2f630dc464

View File

@ -1190,12 +1190,18 @@ class ActivityCallbacksImplementation implements AndroidActivityCallbacks {
rootView._tearDownUI(true); rootView._tearDownUI(true);
} }
// this may happen when the user changes the system theme
// In such case, isFinishing() is false (and isChangingConfigurations is true), and the app will start again (onCreate) with a savedInstanceState
// as a result, launchEvent will never be called
// possible alternative: always fire launchEvent and exitEvent, but pass extra flags to make it clear what kind of launch/destroy is happening
if (activity.isFinishing()) {
const exitArgs = { const exitArgs = {
eventName: application.exitEvent, eventName: application.exitEvent,
object: application.android, object: application.android,
android: activity, android: activity,
}; };
application.notify(exitArgs); application.notify(exitArgs);
}
} finally { } finally {
superFunc.call(activity); superFunc.call(activity);
} }