UIAlertView popup won't let me swipe up Control Center - ios

I'm currently working on a Xamarin MvvmCross ios app. I have it set to display a UIAlertView popup to inform the user when their internet is disabled (the app requires an internet connection).
The problem is that when this popup shows, the user can't swipe up the Control Center to activate their internet...
var dlg = new UIAlertView(config.Title ?? String.Empty, config.Message, null, config.CancelText, config.OkText);
dlg.Clicked += (s, e) =>
{
var ok = (dlg.CancelButtonIndex != e.ButtonIndex);
_activeDialog.DismissAlertDialog();
config.OnConfirm(ok);
};
dlg.Show();
They then have to either click OK and race the popup reappearing, or home the app, reactivate internet, then come back to the app...
Anyone any suggestions?

It's not possible to get around this, since UIAlertView is probably being displayed above the window that handles gestures for the Control Center. This is the way Apple made it.
I would use a custom view as a UIAlertView and fade the background view's alpha. Or you could use a library that already does this:
https://github.com/alexanderjarvis/PXAlertView
https://github.com/wimagguc/ios-custom-alertview
https://github.com/ChrisXu1221/CXAlertView
Related Questions:
Can't use Control Center when UIAlertView displayed (iOS 7)
UIAlertView Strange Behaviour with Shortcut Control center

Related

Appium Touch Actions 'Press' and 'Move To' is not working in iOS chrome app

I am learning mobile automation and I came across a scenario some thing like this
Launch chrome app in iOS
Load https://www.google.com
Hold/Press and pull down banner web element on the web page which will display some overlay with three options 'New tab, Reload & Close tab' (note: overlay will lost on releasing the banner web element)
Tap on the new tab button
So far I have written below script in python
def Test(self, driver_provider):
single_tap = appium.webdriver.common.touch_action.TouchAction(driver_provider.driver)
element = driver_provider.driver.find_element_by_accessibility_id('NTPHomeFakeOmniboxAccessibilityID')
single_tap.tap(element=element).perform()
element.send_keys('https://www.google.com')
single_tap.tap(element=driver_provider.driver.find_element_by_accessibility_id('Go')).perform()
time.sleep(1)
#Press banner and pull down will display the over scroll actions
#Then move to left to tap on the add button
banner_element = driver_provider.driver.find_element_by_accessibility_id('banner')
screen_size = driver_provider.driver.get_window_size()
height = screen_size.get('height')
width = screen_size.get('width')
single_tap.press(banner_element, x=banner_element.size.get(
'width')/2, y=banner_element.size.get('height')/2).wait(1).move_to(banner_element,
x=width/2, y=height/2).wait(0.5).move_to(banner_element, x=0, y=height/2).release().perform()
for some reason press and move_to actions are not happening and there is no error returned as well, I am not clear what went wrong here. Please share your view on what went wrong thanks.
it's failing to perform press and move to because of wait value is very small. When I use the wait(500) then the press and move to is happening.
single_tap.press(banner_element, x=banner_element.size.get(
'width')/2, y=banner_element.size.get('height')/2).wait(500).move_to(banner_element,
x=width/2, y=height/2).wait(500).move_to(banner_element, x=0, y=height/2).wait(500).release().perform()

Is there a way to catch and cancel the back button event in a NativeScript app on the iOS platform?

I'm working on a NativeScript-Angular app for both Android and iOS but have hit a problem with standard back button navigation. I have resolved the issue for Android, but cannot find a solution for iOS.
The event is causing a problem when going back to a particular page where routing data is expected, resulting in the exception:
"Error: Currently in page back navigation - component should be reattached instead of activated".
My Android solution catches the back button event and cancels it, then calls the router to do the navigation.
ngOnInit() {
if (app.android) {
app.android.on(app.AndroidApplication.activityBackPressedEvent,
(args: any) => this.backEvent(args));
}
}
backEvent(args) {
args.cancel = true;
this.backToRegister(false);
}
backToRegister(accepted: boolean){
this.router.navigate(['/register',
this.registerParametersEntered.password,
this.registerParametersEntered.confirmPassword,
this.registerParametersEntered.code,
this.registerParametersEntered.email,
accepted]);
}
I want to do something similar with iOS, such as: -
if (app.ios) {
this.page.on('navigatingFrom', (data) => {
// TODO cancel the back button event
this.backToRegister(false);
})
}
I can't find a way of doing this for iOS - my research is leading me to the conclusion it is not possible to cancel the iOS back button - for example, see here.
Any ideas or alternative suggestions greatly appreciated!
You can't override the back button for iOS. See this SO question. You basically need to create a custom button, you can mimic the appearance of the back button on iOS and add your own event handler. That's how you'd do it in a native iOS app, and how you do it in NativeScript since the native controls are used via NativeScript.
The actionbar in nativescript can have a custom layout inside or you can just use an action-item and position it on the left for iOS, while also hiding the button on Android if you desire.
Another solution would be, instead of catching the back button event just to throw it away/disable it - to just clear the history after you are switching a page where there no "back" to go to.
this.router.navigate(['level1'], {
clearHistory: true
}

UIActionSheet buttons lack visual feedback in iOS 8

I am seeing a small (but really annoying) difference between iOS 7 and 8 concerning UIActionSheet. In iOS 7, the button that the user taps in the action sheet is selected immediately, giving prompt visual feedback of which button was pressed. (By "selected" I mean the background color of the button changes.) However, in iOS 8 the button does not visually appear selected unless the user taps and holds an action sheet button. Since a normal tap is typically very brief (and not held), this has the effect of the button usually never looking selected in an iOS 8 action sheet.
What the user sees after tapping Option 2 in iOS 8: no selected button as the dialog does its close animation.
If the user taps and holds Option 2, the button finally appears selected. This is also what the user would see immediately after tapping in iOS 7.
UIActionSheet usage:
UIActionSheet *actionSheet = [[UIActionSheet alloc]
initWithTitle:nil
delegate:self
cancelButtonTitle:nil
destructiveButtonTitle:nil
otherButtonTitles:#"Option 1...", #"Option 2", #"Option 3", #"Option 4",
nil];
[actionSheet showFromBarButtonItem: myView.optionsButton animated: YES];
Please note that the action sheet otherwise functions as expected. The appropriate action call is made, etc. The issue is only the lack of visual feedback of the button press.
I know that UIActionSheet is deprecated in iOS 8, however, I have tried using UIAlertController with the same results. This seems to be an OS-wide user interface decision.
In iOS 7, there is immediate visual feedback when tapping an option in an action sheet. Is there anyway to get this behavior back in iOS 8?
Edit: The action sheet button in Mail in iOS 8 demonstrates the behavior. This is the Reply/Forward/Print button. Tapping an option does not give visual feedback, but tapping and holding the option does.

Is it possible to remove URL in popup

I have an application where I have used javascript alert popup box.
When I open that in smart device like iPhone then it shows the URL on top as shown below:
So is there a way to remove that URL.?
If you could find a way to set the delegate of that UIAlertView you can try to use
(void)willPresentAlertView:(UIAlertView *)alertView
You can then change the title from there if this would work.

Unable to use back button property in Popup screen in blackberry

In my application , am using popup screen, that implements FieldChangeListener.I used close() method for back button. but its not working.
Can some give sample code without using KeyListener,TrackwheelListener ?
if u want to close the popup screen on back button try this:
UiApplication.getUiApplication().
popScreen(UiApplication.getUiApplication().getActiveScreen());

Resources