alexa-app icon indicating copy to clipboard operation
alexa-app copied to clipboard

Echo Show Support

Open fremail opened this issue 7 years ago • 6 comments

Would be nice to add built-in function to check Echo Show Support.

Also example in Docs isn't valid:

app.post(req, res, type, exception) {  
  // If the device does not support display directives then remove them from the response
  if (!system.supportsDisplay(req))) {
    res.response.response.directives = []
  }
}

The actual interface of app.post is app.post = function () {...}. And system is not defined ;-)

fremail avatar Mar 15 '18 11:03 fremail

Would appreciate if you could help track this down.

dblock avatar Mar 15 '18 12:03 dblock

This framework doesn't have supportsDisplay() function.

It needs to check that path: req.data.context.System.device.supportedInterfaces. Amazon Skill Testing tool contains this object in supportedInterfaces:

{ 
    AudioPlayer: {},
    Display: { 
        templateVersion: '1.0', 
        markupVersion: '1.0' 
    }
}

I don't know if Display must be empty or must not exist in case of no screen.

The second thing I want to say is don't suggest users to clear directives res.response.response.directives = []. This line will also remove other directives, AudioPlayer for example.

fremail avatar Mar 15 '18 13:03 fremail

I use my own helper function that I call within the app:

var has_display = function(request) {
    try {
        return !!request.data.context.System.device.supportedInterfaces.Display;
    }
    catch(e) { return false; }
};

I agree, stripping directives is a bad idea. Especially now that there are new non-display directives.

I plan to work on this, at some point, so there is more Display support built in.

matt-kruse avatar Apr 09 '18 04:04 matt-kruse

@matt-kruse @dblock What do you think about adding supports* helpers to alexa.response?

response.supportsVideoApp(): bool
response.supportsDisplay(): bool
response.supportsAudioPlayer(): bool

Or suggest your vision of the app structure.

fremail avatar Oct 14 '18 21:10 fremail

I realized that those functions will use request.data, but keeping them in response sounds better for me.

fremail avatar Oct 15 '18 07:10 fremail

I already have helper functions like these and many more in my local version of this lib, I just find the structure and tests required in the release version to be a bit too much for me to contribute them back.

Since the functions require request data, putting them in response isn't possible. But I've found this with other things, too. One fix is to actually put the request json into the response object when it's created, so it can reference data like this.

matt-kruse avatar Oct 15 '18 13:10 matt-kruse