Vaadin 14: how to set a notification to close on user interaction? - vaadin14

I am trying to show the users warnings/errors Notifications with duration(0) and I expected the notifications to close when users click on them but nothing happens, there is no way to make these notifications disappear.
How it suppose to work when setting the duration to zero?
I had this problem almost a year ago, there is an old post in Vaadin's forum but the issues on Github were deleted
old post

You can call notification.close() to close it programmatically.
Button closeButton = new Button("Close");
Notification notification = new Notification(new HorizontalLayout(new Span("Hello!"), closeButton));
notification.setDuration(0);
closeButton.addClickListener(click -> notification.close());
notification.open();

Related

history.go(-1) cannot work in IOS14 Beta2 App

My web app is working in a WebView of an IOS native application. There is a button on the top-left side of the page, and it will go back to the previous page after the button is clicked. So far so good, but recently many customers have upgraded their IOS to 14 Beta2 and now the back button doesn't work as expected.
I use the history.go(-1) to go back, but if the session history length is 2, it will execute the history.go(-1), but the page will not go back. The url also doesn't change. If the user continue to open new page, then it works again.
Does anyone have ideas of whats going on with it?
I meet the same problem. You can use setTimeout delay for a while when you use history.push,like this
setTimeout(() => {
history.push('xxx');
}, 100);

Bot Dialog Action button issue node.js

I am trying to create bot for MS Teams via Microsoft Bot Framework using some examples from the Internet.
I have created user card that has button "See Report"
function userCard(session, connector, name, workingStatus, TeamsID) {
var card = new builder.HeroCard(session)
.title(name)
.subtitle(workingStatus.toString())
.buttons([
builder.CardAction.dialogAction(session, 'userReport', TeamsID, 'See Report')
]);
return card;
}
Card is displayed without any issues. When I press on button it should trigger new dialog
//Begins the userReport dialog if the button on the userCard is pressed
bot.beginDialogAction('userReport', '/userReport');
This functionality works perfect when I test it in Bot Framework Emulator.
In MS Teams instead of triggering userReport dialog it goes to the main dialog (the one that is used when message is sent). So that this button does not work at all.
Could you, please, advise what should be adjusted/added in order to make this button work in MS Teams?
Thanks in advance!
Thank goodness you're just getting started. It looks like you're using Bot Framework V3, which is severely outdated. You should definitely switch to V4.
Teams has it's own additional trickiness. I recommend trying out and combing through each of these samples:
57.teams-conversation-bot
07.using-adaptive-cards
Then read through the Adaptive Cards blog post.
Basically, a response from an Adaptive Card comes back in activity.value, so in onTurn(), you'll want to use an if statement to watch activity.value for the value sent in your Adaptive Card when the user clicks "See Report". Then, use beginDialog or dialog.run(), as appropriate to start your dialog.

How to send silent push notification IOS13? Doesn't work since update (Xamarin.ios)

Our app has to receive silent notification from a service to work properly. Like check-in now with location info...etc.
It worked perfectly before IOS13. However it stopped working since the update. The phone receive the silent notification but IOS never wakes the app to process it if the app is in background.
I use the new headers :
request.Headers.Add("apns-id", Guid.NewGuid().ToString("D"));
request.Headers.Add("apns-push-type", "background");
request.Headers.Add("apns-priority", "5"));
request.Headers.Add("apns-topic", {BundleId});
My payload worked before however I tried the one from Apple docs as well still no luck :
{
"aps" : {
"content-available" : 1
},
"acme1" : "bar",
"acme2" : 42
}
I found on Apple forum few workarounds like send empty alert object..etc. I tried all of them still no luck.
And this all worked perfectly before IOS13!
Is anyone have any idea what is going on with the silent push notifications now on IOS13 and how to actually send one ?!
Update: maybe important info, I can send alerted notification so pushtoken..etc must be ok.
Also, when the phone connected to the Mac (not debugging, only connect trough USB) I get the silent notifications and the app waken up as before.
Found a workaround! I send a normal alerted message with the proper alert header, but add the content-available:1, then IOS13 does not show the notification, only lights the phone up for a sec, and wakes my application to process the message!
I have to send NOT the silent message format (with the "background" header)!!!, but the proper alerted message, like a normal push notification, but with content-available included!

Microsoft Graph Webhook/Subscription, getting multiple post to my notificationUrl

Im trying to receive push notification on calendar events through microsoft graph
the notificationURL points to webservice which is running on NodeJS
subscription I have made has these options.
{
"changeType": "created,updated,deleted",
"notificationUrl": "myurl",
"resource": "users/userid/events?$filter=sensitivity%20eq%20%27Normal%27",
"expirationDateTime":"2016-11-05T18:23:45.9356913Z",
"clientState": "customclientstate"
}
however im getting multiple POST calls(2~4) coming from subscription(all of them having identical body) whenever a single event is changed.
there is only one subscription active, a single calendar, and i am responding to the request with status code 204 without any content(tested with postman).
its a huge problem since im updating DB whenever the request comes in.
has anyone run into this problem? ive been looking all over without any results.
any input would be greatly appreciated!! =).
I have this same issue. When creating new event in office calendar I'll get everytime one notification with ChangeType: Created and at the same time three notifications with ChangeType: Updated. When I'm cancelling event in office I get always 3 x Updated notifications and finally 1 x ChangeType: Deleted.
What you can do here is to use ChangeKey validation. Everytime you get new notification from office you have to request that event from API, right?
Once you fetched that event you can check if event.ChangeKey property has changed.
It's same thing as etag in websites. If content changes, etag hash changes.
So when you get Created notification, take that event's ChangeKey and store it to array or db and whenever you get notification remember to validate if you have that event's ID already in array or db and also if ChangeKey has changed. If ChangeKey is same as last time, you won't need to update that event in db.
This also works with recurring events, if even one occurrence has changed SeriesMaster event's ChangeKey also changes.

Apple Push Notification - View Button Action

I have some problems with my Push Notifications. I can sent them well to my registered Devices. All works fine.
My Questions is: After clicking the VIEW button, the App is launching. At the moment without any content.
How can i add content here? This content should depend on the Push Notification i sent out.
For example: My Push Notification is about NEWS XYZ - then after clicking VIEW i should get more informations about NEWS XYZ
So i think i must get the news from my website. Perhabs with the ID they are posted on my side.
But how to implement this in the App?
I mean with every NEW Push Message, the must be shown the NEW News.
Also it should be possible to read all previous received NEWS in the App in a list, when getting back from NEWS Number 1.
You understand, what i mean?
I dont have any real idea...Would be nice if you can show me code regarding to an example.
Thanks.
This method invokes once you tap on the view button on the push notification,
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo {
if (application.applicationState == UIApplicationStateInactive) {
// Application came from the background
// Here you can request for the content
// This has the value of your payload
UILocalNotification *localNotif = (UILocalNotification *) [userInfo objectForKey:#"aps"];
}
else if (application.applicationState == UIApplicationStateActive) {
// Application is in the foreground
}
}

Resources