From a9a2c4d856dea88697e688f990144bee0448af2c Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Wed, 9 Oct 2013 00:44:15 +0400 Subject: HTTPS for WP8 --- Juick/ViewModels/AppViewModel.cs | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) (limited to 'Juick/ViewModels') diff --git a/Juick/ViewModels/AppViewModel.cs b/Juick/ViewModels/AppViewModel.cs index e3a58bb..2aff819 100644 --- a/Juick/ViewModels/AppViewModel.cs +++ b/Juick/ViewModels/AppViewModel.cs @@ -38,13 +38,8 @@ namespace Juick.ViewModels pushChannel = new HttpNotificationChannel(channelName); // Register for all the events before attempting to open the channel. - pushChannel.ChannelUriUpdated += (sender, e) => { - EnableNotifications(); - }; - pushChannel.ErrorOccurred += (sender, e) => - { - DisableNotifications(); - }; + pushChannel.ChannelUriUpdated += (sender, e) => EnableNotifications(); + pushChannel.ErrorOccurred += (sender, e) => DisableNotifications(); // Register for this notification only if you need to receive the notifications while your application is running. // Register for this notification only if you need to receive the notifications while your application is running. @@ -76,10 +71,7 @@ namespace Juick.ViewModels else { // The channel was already open, so just register for all the events. - pushChannel.ChannelUriUpdated += (sender, e) => - { - EnableNotifications(); - }; + pushChannel.ChannelUriUpdated += (sender, e) => EnableNotifications(); pushChannel.ErrorOccurred += (sender, e) => DisableNotifications(); // Register for this notification only if you need to receive the notifications while your application is running. @@ -149,11 +141,14 @@ namespace Juick.ViewModels } private RestClient _cl; + + private readonly string _juickUri = HttpsHelper.CanUseHttps ? "https://api.juick.com" : "http://api.juick.com"; + public RestClient Client { get { - return _cl ?? (_cl = new RestClient("http://api.juick.com") + return _cl ?? (_cl = new RestClient(_juickUri) { UserAgent = "Juick 1.1/Windows Phone " + Environment.OSVersion.Version }); -- cgit v1.2.3