Contextual FileActions - display/hide an action

reading the source, I can display my action in the 3-dot-menu based on the mimetype of the file, I saw some callback also. But it there a way to display/hide my action based on current events ?

Can you provide any information you found on that? I’ve been looking at the OCR app, which is making changes to the file menu. I want to do something similar, but I don’t have a clue where to start.

Here is some code that is related, but I’m not sure what it’s calling or what the options are.

    OcaService.prototype.registerFileActions = function () {
        OCA.Files.fileActions.registerAction({
            actionHandler: this.fileActionHandler,
            altText: t('ocr', 'OCR'),
            displayName: t('ocr', 'OCR'),
            iconClass: 'icon-ocr',
            mime: 'application/pdf',
            name: 'Ocr',
            order: 100,
            permissions: this.OC.PERMISSION_UPDATE,
        });
        OCA.Files.fileActions.registerAction({
            actionHandler: this.fileActionHandler,
            altText: t('ocr', 'OCR'),
            displayName: t('ocr', 'OCR'),
            iconClass: 'icon-ocr',
            mime: 'image',
            name: 'Ocr',
            order: 100,
            permissions: this.OC.PERMISSION_UPDATE,
        });
    };

Any help would be appreciated.

hello,
what do you need?

feel free to check here
in my case I am looping all audio mimes for the player. all in the js ready-function

					OCA.Files.fileActions.registerAction({
						name: 'audioplayer play',
						displayName: t('audioplayer', 'Play'),
						mime: mime_array[i],
						permissions: OC.PERMISSION_READ,
						icon: function () {return OC.imagePath('core', 'actions/sound');},
						actionHandler: audioPlayer.onView
					});
					OCA.Files.fileActions.register(mime_array[i], 'View', OC.PERMISSION_READ, '', audioPlayer.onView);
					OCA.Files.fileActions.setDefault(mime_array[i], 'View');

https://github.com/Rello/audioplayer/blob/master/js/viewer.js#L75-L84