i have just had an app denied in the windows phone market place because i didn't adhere to the "close application on back button" rule.
currently i am doing the following:
open app
if you've never entered your details, navigate to the save details page
on arriving at this "first entry" page i cancel the use of the back button
because as you can see the first view that the user sees is my "first entry" page although i'm trying to be smart and lock the user from going back to an empty main page (because they havent entered their details) i'm really stopping them from exiting on the first screen.
as there is no way to exit using code in silverlight as per
http://blogs.msdn.com/b/ptorr/archive/2010/08/01/exiting-a-windows-phone-application.aspx
what am i supposed to do?
should i let the user navigate back and then try and capture that they have just hit back and navigate back again? (this seems like and odd way of doing it)
or is there a way for me to capture the first navigation instance and simply not store the first page actually loading into the history, so that when they hit back, it exits anyway?
I'm going to assume you mean "close app on back button rule"
I think the approach that will work for you and stick within cert reqs is to redirect the intial navigation... this will cause your initial page to not enter the backstack. Peter offers two implementations for this here.
Redirecting an initial navigation - Peter Torr's Blog
Related
Have a nice day, everyone!
I have a problem. I have an application written in React/TypeScript using Redux and react router . There is a table in which the user can make changes. But if the user wants to save the changes, then he definitely needs to click the "Save" button. I want to help the user and warn him if he wants to leave the page without saving. I need so that when the user tries to close the browser tab, do back or forward in the browser tab, refresh the browser tab or insert a new address in the address bar and follow it - I could block this action and warn the user that the data was not saved.
onbeforeunload - does not fit my application. This does not work correctly in React. And besides, I also need to control the change in the address bar and the movement back and forth
I understand that this is an outdated approach in terms of comfort and security and that modern browsers do not allow you to do this (as I understand it), but I want to clarify - is this realistic to do and if so, how? And what would you better advise me to do in such a situation and how to warn the user then?
P.S. I can not make changes to be saved without the "Save" button on the entire table. Then the server may crash.
I'm new to Robot Framework and stuck with quite simple login web page test using SeleniumLibrary:
*** Test Cases ***
Valid Login
Open Browser To Login Page
Input Username admin
Input Password test
Submit Credentials
Dashboard Page Should Be Open
[Teardown] Close Browser
Most of the keywords are irrelevant to the question, except
Submit Credentials
Click Button login-button
Dashboard Page Should Be Open
Location Should Be ${DASHBOARD URL}
Title Should Be Dashboard
If I run this test, it will fail, because Location Should Be check is executed too early, while browser is still on the original login page. I found two solutions that work, but both seems to be conceptually wrong:
Use sleep
Submit Credentials
sleep ${DELAY}
Dashboard Page Should Be Open
In this case ${DELAY} should be quite big (e.g. 10s) to be sure that page is definitely loaded or it may fail anyway. Also, I've read that best practice is to avoid sleeps. And I can't use some Wait Until Page Contains, because I don't know, whether login page will be loaded again with some error message or Dashboard page loaded in success.
Use Form Submit instead of Click Button:
Submit Credentials
Submit Form login-form
The Form Submit works fine, but it's different from actually clicking a button, because button may have some onclick handler that would prevent submitting a form.
Using Wait Until Keyword Succeeds as suggested in some other threads doesn't seem to help, as Click Button succeeds right away.
You definitely should not use sleep since it introduces artificial delays that may make your whole suite slower than it needs to be. I personally also thing Wait until keyword succeeds should almost never be used. It litters the log with messages as it retries. Plus, I think it masks problems instead of fixing them.
The answer is to use one of the wait keywords. You say you can't use Wait Until Page Contains ""because I don't know, whether login page will be loaded again with some error message or Dashboard page loaded in success". I don't understand that reasoning.
Your application should be deterministic. That is, if you enter correct login credentials than you should be guaranteed that it will go to the dashboard page, and if you enter the wrong conditions you should see an error and/or be redirected back to the login page.
The point of the test is to verify those conditions. So, for a test that verifies whether you get the dashboard page or not, you should find an element on the dashboard page and wait for it to be visible after submitting the form. If it doesn't appear in the proper amount of time, your test should throw an error.
Personally I recommend using page objects. The library I wrote [1], for example, has a mechanism to wait for a page refresh, and assertions to verify you are on the page you think you should be on. You don't need to use my library though -- the core of the code is only a couple hundred lines of code, so it's easy to write your own.
[1] https://github.com/boakley/robotframework-pageobjectlibrary
I've been working on replacing alert() pop-ups in our Angular code with Angular overlay modals. I'm almost done with the exception of one problem.
I have a modal that opens when the user login has timed out. Some pages will load, fire the script properly and the overlay will be in focus, waiting for the user to click "ok" which sends them to the login page - which is what I want.
On other pages, content will partially load, then fire the overlay modal and for a split second I will see it, then the page continues to load, the modal goes away and even though they get logged out the page doesn't go to the login page.
I need some direction determining what code I should add after the overlay fires to prevent any other code from executing so the user has to interact with the overlay.
I'm sorry I can't share any code - it's proprietary - I just need some direction to go in.
This is very difficult to answer without having access to any code or fully understanding how you are managing various states/views.
A simple solution would be adding a function to the $rootScope which constantly checks if a user is authenticated (aka not timed out). And then have it perform some action if the user is no longer authenticated.
How you store the authentication indicator is completely up to you. Without knowing more about the app it would be difficult to say where the best place would be.
Example code:
$rootScope.checkAuth(){
if (!$sessionStorage.auth){
$state.go(login)
}
}
setTimeout($rootScope.checkAuth,10000)
You could also handle this by not resolving each view/state until a user has been confirmed as authenticated. Once again, how you set that up would be dependent on the structure of your app.
I recently updated from CefSharp 1.25.7 to the most recent (39.0.0-pre02) in the hopes that it would be easier to detect when a link is clicked. In 1.25.7 there was a navigation type but that was very unreliable and even directly clicking links would just count as "other" instead of "link clicked".
Basically my use case is that I have a hosted "start page" in my application that has many links. I would like to let the user open those links in their external browser, which isn't hard other than the fact that I don't know what is a link click and what is the page just navigating around. Most of our users (myself included) will have firewalls so when they open the first time it will redirect a bunch. Unfortunately some of those redirections and navigations have transition type of "LinkClicked" for some reason so I can't just check that in the IRequest in OnBeforeBrowse. Any ideas how I could tell that a link was actually clicked so I know to direct it to the system to open in their default browser?
I have a login page which is shown on first launch. After the user puts in his credentials he is taken to the main page of the application. At this point, if the user presses the back key I want it to skip the login page and exit. I tried what was suggested here: Remove a page from Navigation Stack (in OnNavigatedTo, use NavigationService.GoBack()) but it throws an exception because there is nothing else in the back stack. I read some other places that not handling exceptions is basically the only way to close the app...
The problem with this method of closing the app is, well other than being a hack, it doesn't hit Application_Closing() so my state isn't saved.
Anyone know how I can skip the login page when hitting the back key, save state, and exit the application?
Thanks in advance!
Yeah, this is becoming a huge problem with Navigation in WP7 - many folks are complaining about this same type of issue. The key to remember is that Navigation mimics navigation of a website - it acts a lot less like UserForms and more like web pages and their static history.
The easiest way around this which is both transparent to your users and easy for you is to make that first login page you are reference as User Control that sits on top of your actual main page (i.e. don't use a phone:PhoneApplicationPage for your login page - just a control that is part of your main page phone:PhoneApplicationPage). Use a boolean in your OnNavigatedTo on the main page that says "if user is not logged in, display login control, otherwise, just show main page."
On saving state (i.e. tombstoning), ask another question as that's another topic.
The general best practice is to not use a page for anything you dont want in the navigation stack.
In my case i chose to use a Popup to host my Login Control. I pop it from my mainpage if they are not logged in. If they are i dont show it. This way if they are not logged in and hit back, they exit the app. However if they are logged in and also on teh main page, they see their data, and if they hit back they also exit the app (not see the login page).
For the login / home page scenario one thing you can do is on successful login rather than navigating to the home page you call "GoBack", this will take them back to the home page, but pop the login page off the navigation stack and allow the user to exit the app on the next press of the back button.