kiwwwi
1
I use 3D Touch Native Plugin in Ionic 3 app.
How can I open page after application opened from 3D Touch Menu? In app.component.ts my code:
this.platform.ready().then(() => {
//3d Touch
this.threeDeeTouch.isAvailable().then((isAvailable) => {
if(isAvailable == true) {
let actions: Array<ThreeDeeTouchQuickAction> = [
{
type: 'projects',
title: 'Projects',
iconType: 'Bookmark'
},
{
type: 'messages',
title: 'Messages',
iconType: 'Message'
},
];
this.threeDeeTouch.configureQuickActions(actions);
this.threeDeeTouch.onHomeIconPressed().subscribe((payload) => {
alert(payload.type) ;
//!!!!OPEN PAGE!!!!
}) ;
}
});
}) ;
Ordinary NavController
interaction doesn’t work there?
I managed to make it work, but it does not open the corresponding page. Clicking any button only opens the home.
platform.ready().then(() => {
this.threeDeeTouch.isAvailable().then(isAvailable => console.log('3D Touch available? ' + isAvailable));
this.threeDeeTouch.watchForceTouches()
.subscribe(
(data: ThreeDeeTouchForceTouch) => {
console.log('Force touch %' + data.force);
console.log('Force touch timestamp: ' + data.timestamp);
console.log('Force touch x: ' + data.x);
console.log('Force touch y: ' + data.y);
}
);
let actions: Array<ThreeDeeTouchQuickAction> = [
{
type: 'quemsomos',
title: 'Moore Stephens',
subtitle: 'Saiba mais sobre nós!',
iconType: 'Home'
},
{
type: 'faleconosco',
title: 'Enviar Mensagem',
subtitle: 'Fale conosco!',
iconType: 'Message'
},
{
type: 'escritorios',
title: 'Escritórios',
subtitle: 'Conheça as unidades!',
iconType: 'Bookmark'
},
{
type: 'wpposts',
title: 'Blog',
subtitle: 'Notícias MS Brasil!',
iconType: 'Bookmark'
}
];
this.threeDeeTouch.configureQuickActions(actions);
this.threeDeeTouch.onHomeIconPressed().subscribe((payload) => {
// returns an object that is the button you presed
console.log('Pressed the ${payload.title} button')
console.log(payload.type);
if (payload.type == 'quemsomos') {
this.navCtrl.push('QuemsomosPage');
} else if (payload.type == 'faleconosco') {
this.navCtrl.push('FaleconoscoPage');
} else if (payload.type == 'escritorios') {
this.navCtrl.push('EscritoriosPage');
} else if (payload.type == 'wpposts') {
this.navCtrl.push('WppostsPage');
};
})
});