How to disable Previous and Next buttons in a Alexa Custom Skill? - alexa

I'm developing a radio skill for Alexa and would like to disable the next and previous buttons when the skill is appearing on an Echo Show device.
I've tested other radio skills and they have these buttons disabled.
I haven't found anything on AudioPlayer Interface and PlaybackControllers Interface docs.
I'm using a radio.co stream. Take this as example: https://streams.radio.co/s931d44131/listen

No, those buttons can't be disabled.
But you can (and should) handle those kinds of requests too and return an empty response. We come to that issue with our project Convoworks and below is an empty response that we are using in such cases. Note that it ends the session, just as any other media related response.
{
"version" : "1.0",
"response" : {
"shouldEndSession" : true,
"type" : "_DEFAULT_RESPONSE"
},
}

Related

How to edit this popup in Jhipster?

Popup in Jhipster
I don't know how to edit this popup , I can't find the file where it is modified. I use react for the front-end
Notification content is built by java backend in REST controller and passed to client through HTTP headers (i18n message key and its params)
.headers(HeaderUtil.createEntityCreationAlert(applicationName, true, ENTITY_NAME, result.getId().toString()))
When frontend receives response, the popup is built in notification-middleware.ts, the message key is extracted for translation to retrieve localized message template and then the params are injected to produce final localized text:
toast.success(translate(alert, { param: alertParam }));
You can see the headers when inspecting the response in the browser's console.
So, if you want to change the text for one entity, you must modify the message with "created" key in src/main/webapp/i18n/<Language>/<Entity name>.json for each language that your app supports.

How can I prevent hammerspoon hotkeys from overriding hotkeys in other applications?

I'm looking at having a certain hotkey only available in Google Chrome:
hs.hotkey.bind({"cmd"}, "0", function()
if hs.window.focusedWindow():application():name() == 'Google Chrome' then
hs.eventtap.keyStrokes("000000000000000000")
end
end)
The issue with this approach is the hotkey will become un-usable on other apps. E.g. CMD+0 will not trigger the Reset Zoom command in Discord.
How can I prevent that?
The hs.hotkey API doesn't provide functionality to be able to propagate the captured keydown event. The hs.eventtap API does, but using it would involve watching for every keyDown event.
I'll point to what is mentioned in a somewhat related GitHub issue:
If you're wanting the key combo to do something for most applications, but not for a few specific ones, you're better off using a window filter or application watcher and enabling/disabling the hotkey(s) when the active application changes.
In other words, for what you're trying to achieve, it's recommended you use the hs.window.filter API to enable the hotkey binding when entering the application, and disable it when leaving the application, i.e. something like:
-- Create a new hotkey
local yourHotkey = hs.hotkey.new({ "cmd" }, "0", function()
hs.eventtap.keyStrokes("000000000000000000")
end)
-- Initialize a Google Chrome window filter
local GoogleChromeWF = hs.window.filter.new("Google Chrome")
-- Subscribe to when your Google Chrome window is focused and unfocused
GoogleChromeWF
:subscribe(hs.window.filter.windowFocused, function()
-- Enable hotkey in Google Chrome
yourHotkey:enable()
end)
:subscribe(hs.window.filter.windowUnfocused, function()
-- Disable hotkey when focusing out of Google Chrome
yourHotkey:disable()
end)

How to change Request before submitting data to a Form?

I'm building an API with Symfony 3 following the JSON API specification (Documentation).
When submitting new data, the request has this format :
{
"type": "entity",
"id" : null,
"attributes" : {
"name" : "Test name"
}
}
But the problem is the request does not fit the format expected by symfony's Forms because of the extra object attributes.
So I want to be able to transform the request before the form submit in order to make the form able to populate the underlying Entity.
I have tried to register an FormEvents:PRE_SUBMIT and do the logic in it but it seems I have no access to the Request content.
$builder->addEventListener(FormEvents::PRE_SUBMIT, function (FormEvent $event) {
$data = $event->getData();
var_dump($data);
die();
});
The $event->getData() is null.
I have also see there is possibility to register DataTransformer but it is registered per field, and has no access to the Request too.
I don't want to do it manually in the Controller as this will occur on all my forms (or at least the majority), so I search for a more generic way to transform the request, but at this point I can't figure out how to do this.
Thanks for help.
Your EventListener does not have access to your Request, nor does your Form itself.
The best and cleanest way to do this in my opinion would be to define a custom RequestHandler for your Forms, extending the NativeRequestHandler that parses your Request by default.
Then you only need to execute $builder->setRequestHandler() to apply this to your Forms.

Ionic Background to Foreground using Local Notification

First sorry for my bad English.
I'm new on Ionic and I'm trying to pass my app from background to foreground when local notification trigger. I'm using the Katzer API (https://github.com/katzer/cordova-plugin-local-notifications), and I want to show a view (skype style incoming call) for stop or postpone a notification. This example works ok, but I need a method or something in order to show the postpone screen even when the screen is locked.
cordova.plugins.notification.local.on('trigger', function (notification) {
alert("triggered");
}
Thanks in advance.
After more deeper researching I managed to do it, so I'll answer to myself and leave it here for anybody who needs it.
If you want to show your application in foreground when the notification is triggered you should modify the AbstractTriggerReceiver.java
I added this method in AbstractTriggerReceiver.java:
public void launchApp() {
Context context = getContextForApp();
String pkgName = context.getPackageName();
Intent intent = context
.getPackageManager()
.getLaunchIntentForPackage(pkgName);
intent.addFlags(
Intent.FLAG_ACTIVITY_REORDER_TO_FRONT | Intent.FLAG_ACTIVITY_SINGLE_TOP);
context.startActivity(intent);
}
So in your TriggerReceiver.java you can call launchApp(); in your onTrigger() method.
There isn't an easy solution for this, since you need to work mainly in the native layer.
E.g. In Android you should create an activity visible over the default lock screen, show it when the notification is triggered and start the Cordova activity on a button click.

How to integrate qooxdoo and PubNub?

PubNub works by calling callback functions you specify like this:
http://www.pubnub.com/account-javascript-api-include
How to integrate this properly with the Qooxdoo JS framework?
Qooxdoo application looks like this:
http://demo.qooxdoo.org/current/playground/#Hello%20World-ria
How do you load the external JS library and make the global "PUBNUB" available?
You could easily use the add-script config key, to load the pubnub-*.min.js before your app. Then add the PUBNUB.subscribe() call anywhere in your qooxdoo code where it suits you, e.g. in the main method of your main class or in an event handler of a GUI element like a button.
EDIT:
To add more details:
You add the add-script key in config.json, in the "jobs" section.
As you need the script in both the source and the build version, you should add it to the source-script and the build-script jobs, or you create a separate job for the key and extend source-script and build-script with it (that would I do).
The warning about the job shadowing is only to alert people that inadvertently use a pre-defined job name for self-defined job. But here this is exactly what you want, and you can silence the warning with the config-warnings key if you wish. But this doesn't affect the built app.
As for the definedness of PUBNUB you might run into a timing issue where your code using PUBNUB is already executed when the pubnub script file has not finished loading. In your running app, first check in the command line (e.g. Firebug or Chrome Developer Tools) if the PUBNUB symbol is known. If so, the loading was successful. In that case you might want to delay access to the PUBNUB symbol in your code, e.g. by placing it in an execute listener of a button.
Here is a fragment of the possible config.json entries:
...
"jobs" : {
"add-pubnub" : {
"add-script" : [
{
"uri": "http://cdn.pubnub.com/pubnub-3.3.min.js"
}
]
},
"source-script" : {
"extend" : ["add-pubnub"]
},
"build-script" : {
"extend" : ["add-pubnub"]
}
...

Resources