Can we able to have context menu activation logic in main app

We are implementing a file system extension using the file provider replicated extension for an application on Mac OS. On part of it, we need to show context menus for items(files/folders) inside the file provider's mounted folder.

But we don't want to show the context menu based on the 'activation rule' key's value declared on each NSExtensionFileProviderActions item in the info.plist file but with the main app's code logic. Because if we use the info.plist activation rule, we need to use each item's instance variables as part of predicate query(which decides on showing the context menu item), and after performing the action, we need to change the value of that instance variable so that we can show opposite context menu of the previous one (for example if previously 'set offline' is clicked, now 'set online' have to be shown) but doing this is tedious process.

Also, we already implemented the code logic in our main app(that is not written in swift) to choose what are the context menu items to be shown and so we want to use it.

So, Instead, we are hoping to do it either:

  1. By handling the get-menu function call or
  2. By handling the predicate checking function call.

Kindly let us know if is there any function we can override or inform the system to do at least any one of the above things.

Thanks in advance.

Can we able to have context menu activation logic in main app
 
 
Q