Backbone history not filling when using tap event - events

I'm using backbone for a mobile app dev project (phonegap compiled) but have a problem with the router history. I'm firing the events on tap for extra responsiveness on the mobile platform, however pages visited by triggering tap do not appear to be included in the router's history. When hitting the back button, those are always skipped.
Is there any way to make the backbone router's history work with the tap event?
Thanks for your help

You must call use the navigate method in order to add a page to Backbone history. You can do it programmatically as follows:
var MyApp = new Backbone.Router();
MyApp.navigate('newPage', {trigger: true});
Basically whenever you fire a tap event you can navigate to a particular based on the tap event parameters.

Related

Livewire Event Causing Route Change Results in Nav Buttons Not Being Active

So I have this Laravel 9 project. In this view below you can see the navigation bar:
The menu above for the active link (Overview) styling (Tailwind) is active via the check below in the view for the component looking at the request information:
#if(request()->is('dashboard/*/overview'))
This works great as the url currently is
localhost/dashboard/{ID}/overview
When clicking the bottom nav link for the Dividends this fires a livewire event for this account as they don't have permissions to access the page. No navigation away from the page Overview is performed. This event is used to setup a popup when the user doesn't have access to a feature. (I have these in a few places)
The issue is that when one of these fires it sets the 'is' check value in the request to
/livewire/message/{COMPONENT_NAME}
This seems to be the expected behaviour of the livewire events. I attempted a similar check using the code below but the same result occurred as the data is still tied to the request.
#if(request()->pathInfo == "dashboard/7/overview")
If anyone knows of another way or a better way I could have the intended functionality so that the button keeps it's 'active' properties after a livewire event has ran, I'd appreciate it :)

NativeScript Vue: What is the purpose of navigatingTo, navigatingFrom and other Page events?

I am trying to understand how a Page event like navigatedFrom would be used.
Here is a base template:
<Page #navigatedFrom="navigatedFunc">
<StackLayout></StackLayout>
</Page>
Say in my script sections, I had the function navigatedFunc listed in the methods sections:
navigatedFunc: function(args) {
// what would I do here or check against? How would you check against a specific screen title you navigated from?
}
would it be used to check the specific view you navigated from? Like can I do a conditional check in that function that would say if a user comes from the Account page, then do something?
Those events are used if you want to run some code when a page appears or disappears. If you're familiar with native iOS apps, they're like the viewDidAppear and viewDidDisappear methods.
The navigatingTo event triggers when entering the page where it is registered.
The navigatedTo event triggers when when the navigation to the page has finished.
The navigatingFrom event triggers when a navigation away from the page starts.
The navigatedFrom event triggers when the navigation away from the page finished.
This image from the NativeScript documentation might help you visualize the flow:

How do I get the Router navigate extra "replaceUrl" to work correctly?

I have a contact addition form that can be navigated to from multiple screens in our application.
Once the form is submitted, I then take the user to a screen to view the contact that was added.
When the user then makes use of the back button it should take them back to the screen that they originated from.
This might be the Android back button or one that calls the RouterExtensions back function.
I have made use of the navigate extra replaceUrl when navigating away from the form to the view page.
I have also tried using the skipLocationChange extra when navigating to the form but this creates more issues.
I have created a simple playground page flow that creates not quite the same issue but does throw an error that I don't know what to do with either:
https://play.nativescript.org/?template=play-ng&id=BfVcGZ&v=2
In our app, by making use of the replaceUrl extra, the back button does take the user to the correct page.
However, there is a brief moment where they see the form again. This isn't an ideal user experience.
In the linked Playground I do get an error:
Cannot reattach ActivatedRouteSnapshot created from a different route.
This seems to tell me that replaceUrl is indeed removing the page from the route table.
However, the page isn't destroyed yet and so the app is trying to show a page that it shouldn't.
replaceUrl is not yet supported by Page Router Outlet, there is an open feature request, you might want to register your vote on the feature and follow up there for further updates.

Integrating Surveyjs with Nativescript + Angular

I am trying to merge surveyjs along with my NativeScript application. I have referred URL for merging the same with Angular application
From the Angular demo code given on website, we have to add event handler for Complete button where we can get the response from surveyjs. Is it possible to integrate similarly for Nativescript Mobile application? Here is the approach which i feel can be taken.
Display
Create a HTML as provided by SurveyJS with required CSS and JS
referenced and add them as a file in project.
Modify HTML once i get the survey question json back from server.
Show the HTML as part of WebView. This will take care of displaying
the survey on my Application.
Here are my challenges during Submission
As per the process given on SurveyJS, i need to add handler for
oncomplete which will get the result json for me. How can i add
handlers for Complete button click in my code? Also please note that
there is a possibility that there may be multiple surveys on a single
page.
Apart from Survey, there are other fields also on the page and user
will submit them all in one go by clicking submit button of the page.
Hence i am planning to hide Complete button provided by SurveyJS
page. This needs to be triggered via code. Can this be done?
If someone can give directions on whether this scenario can be handled in nativescript application with Angular,it would help immensely.
yes it can be done using nativescript-webview-interface plugin.
add jS code inside WebView to handle oncomplete event from surveyJS. and on that function call emit some event to native app. after that add nativescript code to listen for that event and get the JSON back.
inside webView JS function
var oWebViewInterface = window.nsWebViewInterface;
// emit event to native app
oWebViewInterface.emit('anyEvent', jsonData);
inside native App
oWebViewInterface.on('anyEvent', function(jsonData){
// perform action on event
});
for more details on this you can check plugin readme file https://github.com/shripalsoni04/nativescript-webview-interface

How to dismiss pages

I'm playing around with the wearable SDK and created some additional pages for my sample app.
Is there a convenient way to dismiss / delete a single page by e.g. swiping?
I just found calls for adding, but not for removing (even after an action)
As far as I know, this is not possible, because even a multi-page-notification is (from a technical point-of-view) just one single notification which can only disapper in its entirety.
The only possibility I see here is to set a pending intent to a broadcast receiver, figure somehow out on which page the user was when dismissing the notification, and then create a new notification without this page.

Resources