cordova-plugin-3dtouch: onHomeIconPressed not working but configureQuickActions works fine

Hi added the plugin to a project but I have some issues; QuickActions added properly but not fired when I use it. I’m working with an iphone7 with iOS 10.3

Below is the code I used inside the app.run JS:

$ionicPlatform.ready(function ($cordovaGlobalization) {
   
   ThreeDeeTouch.configureQuickActions([
     {
       iconType: 'Search', // optional	  
       type: 'searchapplication', // optional, but can be used in the onHomeIconPressed callback
       title: 'Application', // mandatory
       subtitle: 'Search by Application' // optional
     },
     {
       iconType: 'Search', // optional, case insensitive	  
       type: 'searchcode',
       title: 'Code',
       subtitle: 'Search by Code' // optional
     },
     {
       iconType: 'Search', // iconType is case insensitive	  
       type: 'searchproduct',
       title: 'Product',
       subtitle: 'Search by Product' // optional		
     },
     {
       iconType: 'CapturePhoto', // iconType is case insensitive	  
       type: 'searchbarcode',
       title: 'Barcode',
       subtitle: 'Scan Barcode' // optional		
     }
   ]);

   ThreeDeeTouch.onHomeIconPressed = function(payload) {
     console.log("Icon pressed. Type: " + payload.type + ". Title: " + payload.title + ".");
     if 
     (payload.type == 'searchapplication') {$state.go('app.vehicles');} 
     else if 
     (payload.type == 'searchcode') {$state.go('app.code');} 
     else if 
     (payload.type == 'searchproduct') {$location.path('app/product');} 
     else if 
     (payload.type == 'searchbarcode') {$location.path('app/barcode');} 
     else {
       // wrapping in a timeout, otherwise it collides with the splashscreen
       setTimeout(function() {
         alert(JSON.stringify(payload));
       }, 500);
     }
   };
   	$rootScope.isWindows = device.platform == "windows";
   	
   	if (window.cordova && window.cordova.plugins && window.cordova.plugins.Keyboard && cordova.plugins.Keyboard.hideKeyboardAccessoryBar) {
           cordova.plugins.Keyboard.hideKeyboardAccessoryBar(false);
       }
   	cordova.plugins.Keyboard.disableScroll( true );

   	setTimeout(function() {
   		navigator.splashscreen.hide();
   	}, 100);
   	        $rootScope.$apply(); // This resolved!
   });

About this issue

  • Original URL
  • State: open
  • Created 7 years ago
  • Reactions: 2
  • Comments: 19 (4 by maintainers)

Most upvoted comments

Did we run into the same issue again?

The modification posted by @akaNightmare was done in a file that does not exist anymore on Ionic Native’s codebase.

And onHomeIconPressed does not fire for me either, although configureQuickActions works. From my debugging, the plugin’s performActionForShortcutItem is not running (using with Ionic/Capacitor).