feat: appStateChange event should have more states than just isActive #1153
Labels
platform: android
platform: ios
platform: web
plugin: app
type: feature request
A new feature, enhancement, or improvement
Feature Request
Description
appStateChange only having isActive as a state feels limited. For instance, appState.isActive will return false on iOS when control center is opened or faceId is used. I understand that this technically means the app is not in focus, but that doesn't mean is the app isn't active. This has been particularly challenging when trying to code for when a user switches to a different application and then requesting they re-authenticate, but this can get triggered by any number of menus being pulled up. Having one blanket boolean for all the times your app is not in scope is too limited, and it would feel a lot more robust if there were other states to track, such as if other native menus were open, whether our app was truly minimized, etc.
Platform(s)
Android, iOS. I haven't considered how much this could effect web or desktop, but it is definitely difficult to work with on mobile platforms.
Preferred Solution
There should be a way to know if your app is currently not active but hasn't actually been minimized or another app has been selected. Having state.isActive be equivalent whether control center is pulled up or the app is minimized is just too limited.
Alternatives
I honestly can't think of a great solution. The only thing I have figured out is to not show biometrics within a long timeout period, figuring that should cover any menu openings or biometrics being ran.
Additional Context
https://capacitorjs.com/docs/apis/app#addlistener
Definitely could use more nuance.
The text was updated successfully, but these errors were encountered: