summaryrefslogtreecommitdiff
path: root/Juick
diff options
context:
space:
mode:
Diffstat (limited to 'Juick')
-rw-r--r--Juick/Classes/HttpsHelper.cs12
-rw-r--r--Juick/Juick.csproj1
-rw-r--r--Juick/ViewModels/AppViewModel.cs19
3 files changed, 20 insertions, 12 deletions
diff --git a/Juick/Classes/HttpsHelper.cs b/Juick/Classes/HttpsHelper.cs
new file mode 100644
index 0000000..18689fd
--- /dev/null
+++ b/Juick/Classes/HttpsHelper.cs
@@ -0,0 +1,12 @@
+using System;
+
+namespace Juick.Classes
+{
+ static class HttpsHelper
+ {
+ public static bool CanUseHttps
+ {
+ get { return Environment.OSVersion.Version.Major >= 8; }
+ }
+ }
+}
diff --git a/Juick/Juick.csproj b/Juick/Juick.csproj
index 73eb68b..f979405 100644
--- a/Juick/Juick.csproj
+++ b/Juick/Juick.csproj
@@ -86,6 +86,7 @@
<Compile Include="Classes\DateHelper.cs" />
<Compile Include="Classes\DelegateCommand.cs" />
<Compile Include="Classes\ExpressionHelper.cs" />
+ <Compile Include="Classes\HttpsHelper.cs" />
<Compile Include="Classes\InvokeDelegateCommandAction.cs" />
<Compile Include="Classes\LowProfileImageLoader.cs" />
<Compile Include="Classes\TileHelper.cs" />
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
});