Controlling the Back Button after Navigation Punchout - bixby

I have been trying to control the back button behavior on how far back it goes to the capsule after leaving the navigation punchout command. Such as, after pressing the back button on the website that was punchout, it takes me back two layout screens, rather than one.
The model of my capsule goes in this flow:
(Vocal input) -> Object List (After vocal input) -> Object Page (After selecting an object) -> Website Link Punchout (After an on-click event of the object page)
Website Link Punchout:
result-view {
match : ObjectWebsite (this) {
min(Required) max (One)
}
render {
}
app-launch {
payload-uri("object website link")
}
}
The expected result, while being on the website page, is to return to the object page, not to the object list page.
The output results in returning to the object list page after I press back button to exit the website link.

Thank you for raising this question. The scenario you have mentioned would be a bug, pending verification on our end. Please open a ticket with Developer Support to be notified when this bug is fixed/closed.

Related

Is there a way to prevent the user pressing the back button on their device from popping the current view from the stack?

I'm using React-Native-Navigation from Wix (version 2) to setup navigation in my React Native app. I'm using the sideMenu layout with the center section being a stack. When the user selects one of the side menu items the selected view is pushed onto that center stack. If the user presses their back button on Android, then the view is popped from the stack, but I don't always want this to happen, mainly if the view they selected is a WebView.
If the view is a WebView, I want to manually handle the user pressing the hardware back button. If the WebView can "goBack" then the view will go back, but if it can't then the view will be popped from the stack (as it normally would).
I've tried overriding the back button press using the BackHandler class from react-native and this allows me to capture that press and have the WebView go back if able, but the act of popping the view from the stack also fires. Is there a way in React-Native-Navigation v2 to tell it, "Hey I got this, don't pop unless I tell you to."?
My current code for this section is as follows:
componentDidMount() {
BackHandler.addEventListener('hardwareBackPress', this.backHandler);
}
componentWillUnmount() {
BackHandler.removeEventListener('hardwareBackPress', this.backHandler);
}
backHandler = () => {
if (this.state.canGoBack) {
this.webviewRef.current.goBack();
// I thought this might force the back press to be
// ignored by react-native-navigation, but no dice.
return false;
} else {
// WebView can't go back so pop view like normal
Navigation.pop(this.props.componentId);
}
}
I was expecting this to only pop the view from the stack if the WebView can't currently go back and otherwise just have the WebView go back.
What actually occurs is both events fire. I.e. the WebView goes back, but the view is also popped from the stack.
I was able to find the answer to this through some more digging in the React Native Navigation and React Native docs.
The event subscriptions are called in reverse order (i.e. last registered subscription first), and if one subscription returns true then subscriptions registered earlier will not be called.
So the issue was in my backHandler method. Instead of returning false I needed to return true.
backHandler = () => {
if (this.state.canGoBack) {
this.webviewRef.current.goBack();
// We've handled the event so we return true and the
// handler on the view's parent can effectively be ignored. Yay!
return true;
} else {
// WebView can't go back so pop view like normal
Navigation.pop(this.props.componentId);
}
}

Return to Previous Url MVC 5

I started learning MVC and i am stuck in this problem.
I have an Order Details page in which I have a button "Edit". When the user clicks on it, opens up a Bootstrap Modal, which i called from a Partial View.
Now Modal opens up and shows the data, loaded from database and saves the data to database.
Everything is working just fine.
I just want the user to go back to that Specific Detail Page from where He/She clicked "Edit" Button.
For example
Detail Page URL is
../orders/details/2
form saves at
..order_detail/edit/[id]
after form submit it should go back to
../orders/details/2
How can i achieve this?
Any help would be much appreciated
Instead of returning on your current View after executing post method you can redirect to the action you want, passing the id. For example:
public ActionResult Edit(int id) {
...
return RedirectToAction("YourDetailsActionHere", new { id = id});
}
And if your action is in different controller you have to pass the controller name as well
return RedirectToAction("YourDetailsActionHere", "YourOtherController", new { id = id});

Messed up BackStage with Universal App (Windows Phone 8.1)

I'm having problems with the Navigation in my windows phone 8.1 part of a universal app I created. I'll try to explain.
I have the following (sorry my spacing/tabbing appears to be messed up below!)
1) Home Page (click on a + on the app bar and it navigates to 2)
->> 2) New Item Page (click on the image preview and it navigates to 3)
->> 3) Capture Page (tap on a button)
->> From Cam button (not implemented)
->> From Photo button
->> 4) Select from album or Take a photo
[- -----Tap Accept and it goes back to New Item (2) and
display the photo as a preview.
But when I click on the back key, it should technically bring me back
to my Home Page(1) but instead it does the following:
First back press: Goes back to Capture Page (3)
Second back press: Goes back to New Item Page (2)
Third back press: Goes back to Home (1)
I'm using the WP File Picker to select a photo, but whether I select
one or press the back key, it goes to my OnActivated event located in
my App.xaml.cs
In the async Method (WPPickedFile) which is called when selecting a
photo or pressing the back key, it checks if args.Files.Count has
returned a photo or not and I've added the following lines of code to
see if it would make a difference:
if (((Frame)Window.Current.Content).BackStackDepth > 2)
((Frame)Window.Current.Content).BackStack.Remove(((Frame)
Window.Current.Content).BackStack[2]);
if (((Frame)Window.Current.Content).BackStackDepth > 1)
((Frame)Window.Current.Content).BackStack.Remove(((Frame)
Window.Current.Content).BackStack[1]);
but it doesn't make one bit of difference. If I press the back key
instead of selecting a photo, my BackStageDepth is 2 and it
contains the Home Page (1) and New Item Page (2). If I select a photo,
it contains these 2 and it also contains the Capture Page (3).
But here is the weird behaviour I don't get. Assume that I press the back
key and did not select a photo. My BackStageDepth is 2 and contains only
the Home Page (1) and the New Item Page (2) so when I get the the lines
described above, it skips the one with > 2 and it removes the New Item
Page (2). When I check it is removed and my BackStageDepth has dropped to 1.
This is not what I want to achieve but I'm trying to understand what's
going on. Anyway, when I continue running the code, I get my New Item Page (2)
displayed and my preview image remains empty since I pressed the back key
on the WP File Picker.
Now the strange is that when I press the back key once again, I put a
break point on the HardwareButtons_BackPressed which is located in
the NavigationHelper but if I check (Frame)
Window.Current.Content).BackStackDepth, it's now telling me that it 2
rather than 1. If I check it, (Frame)Window.Current.Content).BackStack[0]
is still my Home Page (1) but (Frame)Window.Current.Content).BackStack[1]
is now set to the Capture Page (3) which wasn't listed when I checked it
in the method WPPickedFile.
Why is that? I'm totally confused but I can't figure out what I'm doing wrong but it's obviously related to the fact that I'm leaving the app when the WP File Picker is launched as if I don't i.e. go from Home Page(1) to
Capture Page (3) without clicking on the button to launch the WP File Picker,
the navigation works as expected.
Any suggestions would be appreciated
Thanks.
PS: Sorry for the poor formatting but I couldn't fix it!
My backstack wasn't actually messed up. I found out the hard way that windows phone 8.1 could have multiple frames and I totally
In regards to navigating back to the previous page before the one that's calling the FilePicker, I finally figured out a way, which appears to be clean and doesn't call the nagivation and therefore the page to the backstack
#if WINDOWS_PHONE_APP
protected async override void OnActivated(IActivatedEventArgs e)
{
base.OnActivated(e);
continuationManager = new ContinuationManager();
Frame rootFrame = CreateRootFrame();
await RestoreStatusAsync(e.PreviousExecutionState);
if (rootFrame.Content == null)
{
rootFrame.Navigate(typeof(LocationsPage));
}
var continuationEventArgs = e as IContinuationActivatedEventArgs;
if (continuationEventArgs != null)
{
if (rootFrame.Content is CaptureTypePage)
{
if (rootFrame.CanGoBack)
rootFrame.GoBack();
}
// Call ContinuationManager to handle continuation activation
continuationManager.Continue(continuationEventArgs, rootFrame);
}
Window.Current.Activate();
}
#endif
The important part is:
if (rootFrame.Content is CaptureTypePage)
{
if (rootFrame.CanGoBack)
rootFrame.GoBack();
}
continuationManager.Continue(continuationEventArgs, rootFrame);
By calling the GoBack, it removes the CaptureTypePage and sets the CurrentSourcePageType of the rootFrame to the 'New Item Page' where the preview window is.
I then implemented the interface IFileOpenPickerContinuable on the 'New Item Page' and this is called by the continuationManager.Continue function i.e.
case ActivationKind.PickSaveFileContinuation:
var fileSavePickerPage = rootFrame.Content as IFileSavePickerContinuable;
if (fileSavePickerPage != null)
{
fileSavePickerPage.ContinueFileSavePicker(args as
FileSavePickerContinuationEventArgs);
}
break;
I hope this helps someone else and won't waste time the way I did! If you have a cleaner way of doing this, please add to this post. I'd love to know.
Thanks.

disable back button in browser

I have a website having frames. Clicking on button in one frame updates the pages to be loaded in other frames. Now when user press the back button few of the frames load previous pages. i want user not to move back to previous page.
I used the code history.forward() on onload event of all my pages.
This works fine when back is pressed. User got navigated to most recent page always.
But the case is suppose user navigate to number of pages by clicking on button in first frame which updates the pages to be loaded in other frames. After navigation user select a page from the list of browsing history, then it is move forward to only one page, not the last page he was viewing.
This Happens in IE.
In firefox it works fine. User can select any page from the browsing history, he is relocated to most recent page
My opinion is, you should review your concept, because you want to "reconfigure" the browser's navigation buttons. Disabling browser features is in my eyes old fashioned.
I used the code history.forward() on onload event
Try following this way:
In the head section, insert the javascript:
var historySize = history.length;
Then replace in onload event: history.forward() by history.go(historySize - 1). A positive value means move forward to a particular position in browser's history object (array).
I cannot guarantee that it will work, but it is worth to try out.
write this code between script tags
history.pushState(null, null, location.href);
window.onpopstate = function () {
history.go(1);
};

UITabBarController tab to act as a Logout button instead of showing the corresponding view

I have a UITabBarController based iphone application. I added a new tab called Log Out via the Interface Builder.
However I don't need its corresponding view. I want the Log Out tab to redirect to the Login view as soon as it is clicked (of course some session clearing code is executed as well).
The nearest I've got so far is to redirect from the Log Out View using the viewWillAppear. The result is the same but it doesnt look great because it goes into a blank screen for a couple of seconds and then it redirect to the login screen.
Any help would be appreciated.
You can use UITabbarDelegate methods to accomplish this
Use following delegate method to check for logout buttons index and if found then perform your tasks
- (void)tabBarController:(UITabBarController *)tabBarController didSelectViewController:(UIViewController *)viewController{
if (tabBarController.selectedIndex == 4)
{
// perform logout tasks
}
}

Resources