Issue with node-notifier module - node-notifier

I'm working on a NodeJS/Electron/Angular app and I am using the node-notifier module. Every things work correctly but at the bottom of my notification message I have an inappropriate "toast" string.
It only happens when I use the "icon" property.
What should I do to remove that string ?
Thanks in advance.
const notifier = SystemJS._nodeRequire('node-notifier');
notifier.notify({
title: 'Example of a notification',
message: 'Message of the notification',
icon: `${APP_ROOTDIR}/shared/assets/images/new-notification-icon.png`,
timout: 5}, () => { });
PS : My operating system is Windows 10 and this is a screenshot of the notification :

Try the following code and let me if this works out for you, it worked fine for me. The default timeout period is 5 seconds.
const notifier = require('node-notifier');
notifier.notify({
'title': 'My notification',
'message': 'Hello, there!',
'icon': '/home/xxx/Desktop/icon.jpg'
});
Here's the output:

Related

Django Paypal integration - Rendering button not working when changing language

I've integrated Paypal to my website and everything worked as expected. However when i added a new language (greek) i got a problem when pressing pay with paypal button. When change back to english everything works and button is rendering with no probs.
The error i got from paypal is:
Code i'm using:
<div id="paypal-button-container">
<!--Paypal button will load-->
</div>
// Render the PayPal button into #paypal-button-container
paypal.Buttons({
style: {
color: 'blue',
shape: 'rect',
label: 'pay',
height: 40
},
// Set up the transaction
createOrder: function(data, actions) {
console.log('kostas');
console.log(actions);
return actions.order.create({
purchase_units: [{
amount: {
value: amount,
}
}]
});
},
// Finalize the transaction
onApprove: function(data, actions) {
return actions.order.capture().then(function(details) {
// Show a success message to the buyer
console.log(details);
sendData();
function sendData() {
fetch(url, {
method: "POST",
headers: {
"Content-type": "application/json",
"X-CSRFToken": csrftoken,
},
body: JSON.stringify ({
orderID: orderID,
transID: details.id,
payment_method: payment_method,
status: details.status,
}),
})
.then((response) => response.json())
}).render('#paypal-button-container');
Since is the first attempt to work with paypal i would appreciate any help if you can give me any hint on the below error or any idea on how to troubleshoot.
Many Thanks
when i added a new language (greek) i got a problem when pressing pay with paypal button.
You don't show the code you are adding, so it's impossible to say what specifically is triggering the error, but it appears it may be something in the order creation call, which is not the correct place for changing button text.
To change the language of the buttons to something other than the default (auto-detected based on the browser's language), use the locale query string parameter on the SDK src line.
Here is the documentation: https://developer.paypal.com/docs/checkout/reference/customize-sdk/#locale

Invoke another player when one media response(audio playing) is done

I have a problem.
I pick up a dialogflow, google action sample (playing a audio file)
I want to build for several audio files.
So when media response is done, media status is invoked.
So at that time, I want to play next audio automatically.
Please help me. I need your kind help.
Thanks.
This is my code.
'use strict';
const {
dialogflow,
SimpleResponse,
Image,
Suggestions,
MediaObject,
} = require('actions-on-google');
const functions = require('firebase-functions');
const app = dialogflow({debug: true});
app.intent('Media Response', (conv) => {
if (!conv.surface.capabilities
.has('actions.capability.MEDIA_RESPONSE_AUDIO')) {
conv.ask('Sorry, this device does not support audio playback.');
conv.ask('Which response would you like to see next?');
return;
}
conv.ask('This is a media response example.');
conv.ask(new MediaObject({
name: 'Jazz in Paris',
url: 'https://storage.googleapis.com/automotive-media/Jazz_In_Paris.mp3',
description: 'A funky Jazz tune',
icon: new Image({
url: 'https://storage.googleapis.com/automotive-media/album_art.jpg',
alt: 'Album cover of an ocean view',
}),
}));
conv.ask(new Suggestions(['cancel']));
});
app.intent('Media Status', (conv) => {
const mediaStatus = conv.arguments.get('MEDIA_STATUS');
let response = 'Unknown media status received.';
if (mediaStatus && mediaStatus.status === 'FINISHED') {
response = 'Hope you enjoyed the tune! ';
}
conv.ask(response);
conv.ask('Media ended successfully');
conv.ask(new Suggestions(['exit']));
});
exports.dialogflowFirebaseFulfillment = functions.https.onRequest(app);
I tried to invoke another response on 'Media Status' intent.
app.intent('Media Status', (conv) => {
const mediaStatus = conv.arguments.get('MEDIA_STATUS');
let response = 'Unknown media status received.';
if (mediaStatus && mediaStatus.status === 'FINISHED') {
conv.ask(new MediaObject({
name: 'Jazz in Paris',
url: 'https://storage.googleapis.com/automotive-media/Jazz_In_Paris.mp3',
description: 'A funky Jazz tune',
icon: new Image({
url: 'https://storage.googleapis.com/automotive-media/album_art.jpg',
alt: 'Album cover of an ocean view',
}),
}));
conv.ask(new Suggestions(['cancel']));
});
}
});
Then "Webhook failed for intent: Media Status" error happend. How should I solve this problem? Thank you.
All responses that include a MediaObject must also include a SimpleResponse - which is usually just some text that is said before the Media.
For example, in the "Media Response" Intent Handler when you send your first MediaObject, you have the line:
conv.ask('This is a media response example.');
But this sort of line is missing from the "Media Status" Intent Handler.

media-plugin-with-compression - TypeError: window.Media is not a constructor

This plugin: media-with-compression worked well a few days ago, but now I'm getting this when I try to record: EXCEPTION: Uncaught (in promise): TypeError: window.Media is not a constructor
I already have declared:
declare var window: any;
declare var Media: any;
And I was using it this way:
this.audioFile = new window.Media(this.audioDirectory + this.audioName,
.....
I don't know if its because a new version of #ionic-native, or what happened, but I didn't touch this code for weeks and now its not working.
Any clue if with the new versions of #ionic-native, non native plugins are working different?
Thank you!
You cannot run this on the browser.You have to run this on the Actual device.
Here you can see that how to set the path.iOS Media Plugin
The trick on iOS AND Android is to use .toInternalURL() instead of
.toURL() on the file object. This code will work perfectly on both
platforms:
window.requestFileSystem(
LocalFileSystem.PERSISTENT,
0,
function(fileSystem) {
fileSystem.root.getDirectory('app-data/main-packages/en/', {create: false}, function(sourceDir){
sourceDir.getFile('2.mp3', {create: false}, function(file){
console.log('file url: ', file.toInternalURL());
var mymedia = new Media(file.toInternalURL());
mymedia.play();
});
});
},
function(err){
console.log('Error in requestFilesystem, err.code', err.code);
}
);

Ionic2: Property 'present' does not exist on type 'NavController'

I am using Ionic 2 rc4. I am following the advise here and am trying to do the following:
import { NavController } from 'ionic-angular';
...
this.nav.present(this.loading).then(() => {
However, to me it looks like the NavController does not have a present function, because I get:
[ts] Property 'present' does not exist on type 'NavController'.
any
Am I correct, or am I doing something wrong? How do they get to access this "phantom" function?
Any advise appreciated.
UPDATE
Here is my code that results in the following error (on this.loading.present().then(() => {):
"Cannot read property 'nativeElement' of null"
It presents loading the first time. but after the alert is presented if submit() is run again, it gets this error.
submit() {
this.loading.present().then(() => {
let alert = this.alertCtrl.create({
title: 'Verify Email',
subTitle: 'Please verify your email address before you log in.',
message: 'Check your Spam folder if you cannot find the email.',
buttons: [
{
text: 'Resend',
handler: data => {
firebaseUser.sendEmailVerification().then((data) => {
this.doAlert('Verify Email', 'Verification Email Sent.').then((data) => {
//navCtrl.setRoot(navCtrl.getActive());
});
});
}
},
{
text: 'Okay',
handler: data => {
//navCtrl.setRoot(navCtrl.getActive());
}
}
]
});
alert.present();
this.loading.dismiss();
});
}
Looking at this changelog for Beta 11
They have removed present function from Navcontroller.
You need to refactor your code and use some other function based on your requirement.
this.loading.present()
For the error, check the Loading controller docs.
Note that after the component is dismissed, it will not be usable
anymore and another one must be created. This can be avoided by
wrapping the creation and presentation of the component in a reusable
function
Just do :
this.loading = this.loadingCtrl.create({
//loading properties
});
inside submit() before this.loading.present()

Datepicker is not working properly first time

I am facing one problem that Datepicker is not working properly first time, i.e. first time when i open the page and click on "from"/"to" input field, the datepicker opens but I cannot select a date as I get an error on console: "Uncaught Missing instance data for this datepicker". But when I refresh page, it perfectly works!
Why does this happens?
This is my code:
$('.datepicker').live('focus',function(){
$(this).datepicker({
defaultDate : "+1w",
changeMonth : true,
numberOfMonth : 1,
dateFormat: 'dd-mm-yy'
});
});
can you tell is it right to use '.live' method here?
i guess you are doing this
$("#datepicker").click(function(){
$(this).datepicker({ dateFormat: 'yy-mm-dd' }).val();
});
May be only this will work as it did for me
$(function() {
$("#datepicker").datepicker({ dateFormat: 'yy-mm-dd' }).val();
});
If its for multiple inputs just make use of class name instead of id.
$('.datepicker').on('focus',function(){
$(this).datepicker({
defaultDate : "+1w",
changeMonth : true,
numberOfMonth : 1,
dateFormat: 'dd-mm-yy'
});
});
Try this
for it to show first time you can do this inside on click:
$("#datepicker").datepicker().datepicker( "show" )
You can try this
$('body').on('focus',".datepicker", function(){
$(this).datepicker();
});​