'Application Closed' gets triggered for system level overlays
I have made a macro such that whenever I close a specified app, it immediately opens another app. So, for that specified app I have added the 'Application Closed' trigger.
But the trigger gets triggered for system level overlays within the app. For example, if I click share and the Android file sharing menu appears then the macro gets triggered, or if I open camera within the app and camera Access is disabled system-wide then there is a pop-up asking me to enable the camera even then the macro gets triggered.
I am using legacy mechanism for the trigger because I cannot use accessibility in this specific instance. Is there any way to not trigger the macro in those above instances?