Describe the bug
#1146 in v0.35.0 changed the generation of Event::Resumed from applicationDidBecomeActive to applicationWillEnterForeground. Unfortunately these events are not synonymous and can lead to situations where an app gets stuck in the Suspended state.
Steps To Reproduce
-
While your iOS app is in the foreground, open the iOS control center or app switcher. applicationWillResignActive is received which generates Event::Suspended as expected.
-
Close the control center or app switcher to return to your app. applicationWillEnterForeground is never called because the app remained in the foreground while it was inactive. Therefore Event::Resumed is never generated which leaves the app thinking it is in the Suspended state while it is actually active.
Expected behavior
Event::Resumed and Event::Suspended should be generated symmetrically. I think that #1146 should be reverted and the previous behavior where the Resumed/Suspended state track the "active" state of the app be restored.
Alternately, if there is a strong desire for the Resumed/Suspended state to track the foreground state of the app instead, then Event::Suspended should only be generated from applicationDidEnterBackground not applicationWillResignActive and other events need to be generated for the "active" state (possibly WindowEvent::Focus, but I'm not sure it makes sense to generate that for an application-level event).
I'm happy to provide a PR for the desired solution.
Platform and Versions (please complete the following information):
OS: iOS
Rustc: 1.97.1
Describe the bug
#1146 in v0.35.0 changed the generation of
Event::ResumedfromapplicationDidBecomeActivetoapplicationWillEnterForeground. Unfortunately these events are not synonymous and can lead to situations where an app gets stuck in theSuspendedstate.Steps To Reproduce
While your iOS app is in the foreground, open the iOS control center or app switcher.
applicationWillResignActiveis received which generatesEvent::Suspendedas expected.Close the control center or app switcher to return to your app.
applicationWillEnterForegroundis never called because the app remained in the foreground while it was inactive. ThereforeEvent::Resumedis never generated which leaves the app thinking it is in theSuspendedstate while it is actually active.Expected behavior
Event::ResumedandEvent::Suspendedshould be generated symmetrically. I think that #1146 should be reverted and the previous behavior where theResumed/Suspendedstate track the "active" state of the app be restored.Alternately, if there is a strong desire for the
Resumed/Suspendedstate to track the foreground state of the app instead, thenEvent::Suspendedshould only be generated fromapplicationDidEnterBackgroundnotapplicationWillResignActiveand other events need to be generated for the "active" state (possiblyWindowEvent::Focus, but I'm not sure it makes sense to generate that for an application-level event).I'm happy to provide a PR for the desired solution.
Platform and Versions (please complete the following information):
OS: iOS
Rustc: 1.97.1