Open dialog disappears after screen turns off - codenameone

When my app has an open dialog e.g. dlg.show(); and the screen turns off by timeout the active and displayed dialog is disappeared after turning on the screen again. I'd like to have the dialog still preset.
Is there a good/recommended way to fix/workaround this behavior?
For a solution, I could imagine one of the following approaches, but could not find further information:
Disabling screen timeout globally for the app.
Disabling screen timeout for dialog specifically.
Using another dialog type (modal, modeless or interaction) that keeps staying.
Maybe there are other ways to fix this?

Use a variable that you store the state of in Preferences. Perhaps a Boolean so when the dialog shows it is true, and if someone exits the app you save it in preferences (you can use exit form action or add something to the lifecycle methods). When the app restarts, get the state from Preferences and display the dialog again if the variable is true.
You could use and integer or string if there are multiple possible dialogs that you might need to show.

Related

What kind of component I should use to inform a user that an action has been completed successfully?

I have an app where the user can download a photo. After downloading it, I want to display a small message saying "Download successful". Initially I wanted to show Modal from https://reactnative.dev/docs/modal but then I wanted this info to disappear either in 5 sec, or if the user taps outside of the modal. So I thought I should wrap my Modal inside an Animated component https://reactnative.dev/docs/animations
Am I on the right track? Is this the way to show a user friendly message - wrapping modal inside animated. Or there is another component which I can use?
I think it will be better if you use SnackBar for such purposes.
You can use any snackbar library in your project. Your wrap it around with your project, Then whenever you need to throw information message or error message you just called the hook for that snackbar. Also it will automatically disappear after showing the message. you won't need to take care of seconds.
notistack package : https://www.npmjs.com/package/notistack
You can also checkout the Material UI Alerts.

Detect when a user leaves the single page app

I want to pop a modal with "Cancel" and "Yes" buttons when a user attempts to leave the single-page app.
To provide some context, I am working on a single page app that appears on a larger site that is not part of the single page app (so, the header and footer is part of the larger site, and single-page-app is the content). When a user attempts to leave to another part of the site (by clicking somewhere in the nav for instance) that is not part of the single page app, I want a warning modal to display with a warning. A user can close or refresh the page as much as they want, and it shouldn't pop a modal. Same thing if a user hard-codes a url (say, google.com in the browser), the modal should not pop.
So far the other similar threads I found on stackoverflow either uses Prompt component, or window.onbeforeunload. Both of these have the issue of them popping a default text box with a warning, and not a custom modal, which is an important problem, but that isn't all of the issue.
Prompt, to my understanding triggers whenever a user redirects within the single page app, which is not the behavior that I want.
window.onbeforeunload, to my undertstanding triggers even when refresh or close, which is not the behavior I want.
Maybe this isn't such a common problem, since I can't seem to find an easy solution for this, but any and all ideas are greatly appreciated.

Globally disable click out side of ionicModal

ionicModal is appearing like a popup along with backdrop in iPad (Fine in android tabs with full screen view). Modal is closing whenever user clicks on backdrop. It will be an issue if user is filling a form.
Yes, I can use backdropClickToClose: false property while creating modal but I used over 60 modals all over my app. Is there any way to set backdropClickToClose:false globally in a config like
$ionicModal.config {
backdropClickToClose : false
}
Thanks in advance.
Unfortunately, I have not been able to find how to do this using config. There currently doesn't seem to be a way to do it that way.
The only thing I found is the commit for the backdropClickToClose configuration for $ionicModal, which may give others a clue as to how this can be achieved.
Another idea would be to wrap the $ionicModal in a service and have some default parameters implemented in there, but I am not sure whether that would be a solution to your problem.
If you really want to be able to configure this, you may want to consider submitting an issue on GitHub, which you can do here.

Enabling microsoft accessibility for Flex Window hangs application after clicking on identified object

After enabling accessibility for a flex window object, I fired an object.click which brought up a dialog-box. After closing the dialog box, the application went to hung state. So I found the coordinates of object using getrect , restarted both application and silk, kept accessibility disabled clicked on the mainwindow using the coordinates and the problem did not recur. The problem even when I retrieved the coordinates with accessibility and manually clicked on the icon.
I am even unable to fetch locator hierarchy with accessibility enabled when I try to retrieve for objects that are visible only through enabled accessibility. Nothing is captured (blank recorder hierarchy) and the recording stops working any further. I guess the agent goes into some kind of loop or excepts out. Kindly advise.
This was a product issue and got this fixed - not an issue on SilkTest side

WPF Popup getting closed in a seamless citrix mode

First things first, this problem only happens while working in Citrix XenApp seamless mode (which, in simplest of words means the actual app is running on some citrix host but it is simulated as residing in your own desktop). I will take this up with Citrix Support as well but just wanted to poll the group in case someone faced a problem like this before.
I have a WPF app which uses Winforms NotifyIcon to reside in system tray until mouse clicked. In Citrix seamless mode, as user clicks the icon in system tray, the popup flashes and immediately closes on its own.
The Popup window is a vanilla one created with StaysOpen as FALSE and same works in every other environment.
Any suggestions ? This is what I've noticed so far:
The window stays open if I use StaysOpen as true. But then I don't have a way to close the window manually when it loses focus. LostFocus Event doesn't get fired on popup when user clicks outside.
In citrix seamless mode, the MouseEnter event is captured but MouseLeave is NOT so the approach of closing the window if user mouse is outside the window for X secs is not achievable.
Tried the workaround of starting the popup with Staysopen as FALSE and then reset staysopen after like 2 secs so that the pop sticks. It works but a soon as I set StaysOpen as FALSE once the timer is hit, the pop up closes on its own.
Without all these workarounds, if a user quickly clicks (leftclick) on the window before it disappears, the pop up sticks so I tried few ways to simulate the mouse click on the popup as it opens up but that doesn't cut it either.
Thanks
I can't help you with specific advice for tweaking your app to work around the issue, however there is always the hit it very hard with a hammer approach, i.e. tell consumers of your app to disable seamless for your application:
http://support.citrix.com/article/CTX116357/
Update: I pinged the original seamless dev - he said it sounds like a bug where seamless is not correctly routing all the necessary mouse messages between client and server. He said the best way to diagnose this was to run the Spy++ tool on the XenApp server and on the client, and then compare the messages each side sees to identify what messages are not getting translated. Since it sounds like a genuine bug, your best bet is to raise a support ticket with Citrix support and provide them with a sample app that can repro the bug.

Resources