Skip to content
Browse files

Fixes #72

Fixed the tile header target string, also added event raising for device
subscription expired in windows phone
  • Loading branch information...
1 parent d1f7c97 commit 6f85ca8027bb25b7546b4843bc71eeed34fb3a78 @Redth committed Dec 27, 2012
Showing with 12 additions and 5 deletions.
  1. +12 −5 PushSharp.WindowsPhone/WindowsPhonePushChannel.cs
View
17 PushSharp.WindowsPhone/WindowsPhonePushChannel.cs
@@ -65,7 +65,7 @@ protected override void SendNotification(Notification notification)
if (wpNotification is WindowsPhoneToastNotification)
wr.Headers.Add("X-WindowsPhone-Target", "toast");
else if (wpNotification is WindowsPhoneTileNotification)
- wr.Headers.Add("X-WindowsPhone-Target", "Tile");
+ wr.Headers.Add("X-WindowsPhone-Target", "token");
var payload = wpNotification.PayloadToString();
@@ -87,7 +87,7 @@ protected override void SendNotification(Notification notification)
//Handle different httpstatuses
var status = ParseStatus(wex.Response as HttpWebResponse, wpNotification);
- HandleStatus(status);
+ HandleStatus(status, wpNotification);
}
}
@@ -106,7 +106,7 @@ void getResponseCallback(IAsyncResult asyncResult)
var status = ParseStatus(resp, wpNotification);
- HandleStatus(status);
+ HandleStatus(status, wpNotification);
}
WindowsPhoneMessageStatus ParseStatus(HttpWebResponse resp, WindowsPhoneNotification notification)
@@ -139,9 +139,16 @@ WindowsPhoneMessageStatus ParseStatus(HttpWebResponse resp, WindowsPhoneNotifica
return result;
}
+
+ void HandleStatus(WindowsPhoneMessageStatus status, WindowsPhoneNotification notification = null)
+ {
+ if (status.SubscriptionStatus == WPSubscriptionStatus.Expired)
+ {
+ Events.RaiseDeviceSubscriptionExpired(PlatformType.WindowsPhone, notification.EndPointUrl, notification);
+ Events.RaiseNotificationSendFailure(notification, new WindowsPhoneNotificationSendFailureException(status));
+ return;
+ }
- void HandleStatus(WindowsPhoneMessageStatus status)
- {
if (status.HttpStatus == HttpStatusCode.OK
&& status.NotificationStatus == WPNotificationStatus.Received)
{

0 comments on commit 6f85ca8

Please sign in to comment.
Something went wrong with that request. Please try again.