Skip to content

Commit

Permalink
Add support for Toast notifications
Browse files Browse the repository at this point in the history
  • Loading branch information
elvis512 committed Oct 20, 2016
1 parent 5abac61 commit 5c711b6
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion PushSharp.Windows/WnsConnection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,10 @@ public async Task Send (WnsNotification notification)
if (winTileBadge != null && winTileBadge.CachePolicy.HasValue)
http.DefaultRequestHeaders.Add("X-WNS-Cache-Policy", winTileBadge.CachePolicy == WnsNotificationCachePolicyType.Cache ? "cache" : "no-cache");
}
else if(notification.Type == WnsNotificationType.Toast)
{
http.DefaultRequestHeaders.TryAddWithoutValidation("X-WindowsPhone-Target", notification.Type.ToString().ToLower());
}

HttpContent content = null;

Expand Down Expand Up @@ -161,7 +165,7 @@ WnsNotificationStatus ParseStatus(HttpResponseMessage resp, WnsNotification noti
var wnsDeviceConnectionStatus = TryGetHeaderValue (resp.Headers, "X-WNS-DEVICECONNECTIONSTATUS") ?? "connected";
var wnsErrorDescription = TryGetHeaderValue (resp.Headers, "X-WNS-ERROR-DESCRIPTION") ?? "";
var wnsMsgId = TryGetHeaderValue (resp.Headers, "X-WNS-MSG-ID");
var wnsNotificationStatus = TryGetHeaderValue (resp.Headers, "X-WNS-NOTIFICATIONSTATUS") ?? "";
var wnsNotificationStatus = TryGetHeaderValue (resp.Headers, "X-WNS-NOTIFICATIONSTATUS") ?? TryGetHeaderValue(resp.Headers, "X-NOTIFICATIONSTATUS") ?? "" ;

result.DebugTrace = wnsDebugTrace;
result.ErrorDescription = wnsErrorDescription;
Expand Down

0 comments on commit 5c711b6

Please sign in to comment.