Hi all,
I want to load the page as first when I open via the notification alert. But the problem is that it will load first all the views. And when the view are ready then it will load the page where I navigate to when I open via the notification alert. Below is my code. You can see the init view and the init for the notification.
So how can I fix this? That the notification page will load as first and not as last?
Thank You!
initializeViews();
function initializeViews() {
var mainView = app.views.create('.view-main', {
url: '/',
stackPages: true,
});
var searchView = app.views.create('.view-search', {
url: '/search',
iosDynamicNavbar: false,
stackPages: true,
});
var heartView = app.views.create('.view-heart', {
url: '/heart',
stackPages: true,
//iosSwipeBack: false,
});
var profileView = app.views.create('.view-profile', {
url: '/profile',
stackPages: true,
});
}
var appPush = {
initialize: function() {
document.addEventListener('deviceready', this.onDeviceReady.bind(this), false);
},
onDeviceReady: function() {
this.registerForPush();
},
registerForPush: function(){
var push = PushNotification.init({
ios: {
alert: "true",
badge: "true",
sound: "true",
clearBadge: "true"
}
});
push.on('notification', function (data) {
app.tab.show("#tab-heart");
--This is finally what I want to load as FIRST!
app.views.current.router.navigate(data.additionalData.url);
});
}
appPush.initialize();