Detect when user closes pop up in iOS Safari web extension - ios

I'm trying to find a way to detect when the user closes or dismisses the pop-up in an iOS Safari web extension.
I've tried listening for onblur, pagehide, and visibilitychange events but they are not fired when the popup is closed. All of these events do fire on macOS Safari 16, though.
Opening up a port by running browser.runtime.connect() in the popup and listening for onConnect/onDisconnect events in the background script only causes the onConnect event to fire when the popup is opened.

I stumped over the same problem and discovered, that the visibility change event get only fired when:
Visible
Page reload
On page reload the hidden gets fired. But I need to get it when the popup is closed.
Looks like this is a bug but workarounds are welcome.

The best solution I found was listening for the blur event. It seems to be fired only when the pop up is closed, but only if the user first taps somewhere inside the popup.

Related

iOS: Dismiss presented ViewController which is an instance of specific Class

I am using NYAlertViewController to display dialogs in my iOS-App. It can happen that I just opened a dialog when a background process tries to trigger another dialog. If this happens, the second dialog is not shown. I would like to close all other dialogs before opening a new one. How could I do this?
The Dialogs are shown with presentViewControllerAnimatedCompletion.
Maybe I can dismiss all ViewControllers that are instances of NYAlertViewController?
Any thoughts on that? Thanks!

Web view did finish delegate method is not called in iOS

I am developing a product in which we have to render a web page. This particular web page can invoke our objective c methods. This is implemented using EasyJSWebview. Once the web page is loaded that has a timer running there. Web page is shown properly till the timer reaches the desintaiton time. Once that timer is reached, that page is reloaded with some event content. There the problem is occurred. The problem is that the page starts to load, activity indicator is shown but it does not close of finishing delegate method is not called. So, Activity Indicator is shown forever. But, Page is not loaded yet. But, If I navigate to the side menu and reload the page manually, That event web page is loaded properly and If I press home button when it reloads with the activity indicator, the app closes and I open it again, that activity indicator is hidden and the page is not loaded yet.
There are lots of hits to server during this event. It occurs only in live. But, If I test it in our development server with many hits with the help of JMeter, our application works properly.
So, It occurs only in live. Our live deployment consists of many replica's of servers. Can it occur due to this too?.
I am not able to find any solution for this. Please let me know if you have any solution for this.
Thanks in advance.
This was just an internet issue. The present code works properly.

How to find out if "resume" event is fired from click on an icon and not from waking up the tablet in appcelerator titanium?

I have an "resume" event listener and i want to be able to distinct from firing the event because the user clicked the application icon or the user locked the tablet and then unlocked.
It seems there's no way to do this in Obj-C/Swift, so the same goes for Titanium then. Although you might be able to do a hack similar to https://stackoverflow.com/a/19637857/4626813
There is one more event listener named as "resumed" Ti.App.addEventListener("resumed",function(){});
This will listen when device is unlocked.

Delphi XE6 and NotificationCenter only work with APP open

When I create an app using this component it just send notifications to Android while APP is opened or when she's in the background because I pressed the home button on the phone, if I close the app or exit using the back button notifications are no longer passed to the cell. Is there any way to fix this?
How do you expect for your app to create any notifications if it is not running? Your app needs to be rinning in order to create or post any notivications to the OS.
So now you would probably wanna focus on preventing the app instantly closing when back button is pressed in a way that you notiffy the user that closing the app will prevent its notifications to work and then give your user choice to either close the app or simply keep it workinng in the background.

How to detect user tapping into status bar from iOS Safari

Is there any way to detect whether a user browsing my website is tapping / expanding the status bar? Is any sort of javascript "out of focus" event fired?
We want to use this for alerting the user before navigating away during an ongoing transaction. window.onbeforeunload is apparently not supported by Mobile Safari.

Resources