Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrated to .NET 5 #934

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion PushSharp.Amazon/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
// The form "{Major}.{Minor}.*" will automatically update the build and revision,
// and "{Major}.{Minor}.{Build}.*" will update just the revision.

[assembly: AssemblyVersion ("1.0.*")]
[assembly: AssemblyVersion ("1.0")]

// The following attributes are used to specify the signing key for the assembly,
// if desired. See the Mono documentation for more information about signing.
Expand Down
42 changes: 5 additions & 37 deletions PushSharp.Amazon/PushSharp.Amazon.csproj
Original file line number Diff line number Diff line change
@@ -1,56 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{2468C63B-C964-4FC3-9B16-13DC17CF7D11}</ProjectGuid>
<TargetFramework>netstandard2.1</TargetFramework>
<OutputType>Library</OutputType>
<RootNamespace>PushSharp.Amazon</RootNamespace>
<AssemblyName>PushSharp.Amazon</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>..\PushSharp-Signing.snk</AssemblyOriginatorKeyFile>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug</OutputPath>
<DefineConstants>DEBUG;</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>full</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Net.Http" />
<Reference Include="Newtonsoft.Json">
<HintPath>..\packages\Newtonsoft.Json.7.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<ProjectReference Include="..\PushSharp.Core\PushSharp.Core.csproj" />
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="AdmConnection.cs" />
<Compile Include="AdmConfiguration.cs" />
<Compile Include="AdmNotification.cs" />
<Compile Include="Exceptions.cs" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<ItemGroup>
<ProjectReference Include="..\PushSharp.Core\PushSharp.Core.csproj">
<Project>{2B44A8DA-60BC-4577-A2D7-D9D53F164B2E}</Project>
<Name>PushSharp.Core</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
<PackageReference Include="Newtonsoft.Json" Version="9.0.1" />
</ItemGroup>
</Project>
4 changes: 0 additions & 4 deletions PushSharp.Amazon/packages.config

This file was deleted.

4 changes: 2 additions & 2 deletions PushSharp.Apple/ApnsConnection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -425,13 +425,13 @@ public SentNotification (CompletableApnsNotification notification)

public class CompletableApnsNotification
{
public CompletableApnsNotification (ApnsNotification notification)
public CompletableApnsNotification (IApnsNotification notification)
{
Notification = notification;
completionSource = new TaskCompletionSource<Exception> ();
}

public ApnsNotification Notification { get; private set; }
public IApnsNotification Notification { get; private set; }

TaskCompletionSource<Exception> completionSource;

Expand Down
5 changes: 3 additions & 2 deletions PushSharp.Apple/ApnsHttp2Connection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,8 @@ public async Task Send (ApnsHttp2Notification notification)
}

// Expired
throw new PushSharp.Core.DeviceSubscriptonExpiredException {
throw new PushSharp.Core.DeviceSubscriptionExpiredException(notification)
{
OldSubscriptionId = notification.DeviceToken,
NewSubscriptionId = null,
ExpiredAt = timestamp
Expand All @@ -125,7 +126,7 @@ public async Task Send (ApnsHttp2Notification notification)
// Get the reason
var reasonStr = json.Value<string> ("reason");

var reason = (ApnsHttp2FailureReason)Enum.Parse (typeof (ApnsHttp2FailureReason), reasonStr, true);
var reason = byte.Parse(reasonStr);

throw new ApnsHttp2NotificationException (reason, notification);
}
Expand Down
2 changes: 1 addition & 1 deletion PushSharp.Apple/ApnsHttp2Notification.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

namespace PushSharp.Apple
{
public class ApnsHttp2Notification : INotification
public class ApnsHttp2Notification : IApnsHttp2Notification
{
/// <summary>
/// Store whatever associated information you'd like here
Expand Down
2 changes: 1 addition & 1 deletion PushSharp.Apple/ApnsNotification.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

namespace PushSharp.Apple
{
public class ApnsNotification : INotification
public class ApnsNotification : IApnsNotification
{
static readonly object nextIdentifierLock = new object ();
static int nextIdentifier = 1;
Expand Down
43 changes: 36 additions & 7 deletions PushSharp.Apple/Exceptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,34 +18,63 @@ public enum ApnsNotificationErrorStatusCode
ConnectionError = 254,
Unknown = 255
}
public class ApnsHttp2NotificationException : NotificationException
{
public ApnsHttp2NotificationException(byte errorStatusCode, IApnsHttp2Notification notification)
: this(ToErrorStatusCode(errorStatusCode), notification)
{ }

public ApnsHttp2NotificationException(ApnsNotificationErrorStatusCode errorStatusCode, IApnsHttp2Notification notification)
: base("Apns notification error: '" + errorStatusCode + "'", notification)
{
Notification = notification;
ErrorStatusCode = errorStatusCode;
}

public ApnsHttp2NotificationException(ApnsNotificationErrorStatusCode errorStatusCode, IApnsHttp2Notification notification, Exception innerException)
: base("Apns notification error: '" + errorStatusCode + "'", notification, innerException)
{
Notification = notification;
ErrorStatusCode = errorStatusCode;
}

public new IApnsHttp2Notification Notification { get; set; }
public ApnsNotificationErrorStatusCode ErrorStatusCode { get; private set; }

internal static ApnsNotificationErrorStatusCode ToErrorStatusCode(byte errorStatusCode)
{
ApnsNotificationErrorStatusCode s;
Enum.TryParse(errorStatusCode.ToString(), out s);
return s;
}
}
public class ApnsNotificationException : NotificationException
{
public ApnsNotificationException(byte errorStatusCode, ApnsNotification notification)
public ApnsNotificationException(byte errorStatusCode, IApnsNotification notification)
: this(ToErrorStatusCode(errorStatusCode), notification)
{ }

public ApnsNotificationException (ApnsNotificationErrorStatusCode errorStatusCode, ApnsNotification notification)
public ApnsNotificationException (ApnsNotificationErrorStatusCode errorStatusCode, IApnsNotification notification)
: base ("Apns notification error: '" + errorStatusCode + "'", notification)
{
Notification = notification;
ErrorStatusCode = errorStatusCode;
}

public ApnsNotificationException (ApnsNotificationErrorStatusCode errorStatusCode, ApnsNotification notification, Exception innerException)
public ApnsNotificationException (ApnsNotificationErrorStatusCode errorStatusCode, IApnsNotification notification, Exception innerException)
: base ("Apns notification error: '" + errorStatusCode + "'", notification, innerException)
{
Notification = notification;
ErrorStatusCode = errorStatusCode;
}

public new ApnsNotification Notification { get; set; }
public new IApnsNotification Notification { get; set; }
public ApnsNotificationErrorStatusCode ErrorStatusCode { get; private set; }

private static ApnsNotificationErrorStatusCode ToErrorStatusCode(byte errorStatusCode)
internal static ApnsNotificationErrorStatusCode ToErrorStatusCode(byte errorStatusCode)
{
var s = ApnsNotificationErrorStatusCode.Unknown;
Enum.TryParse<ApnsNotificationErrorStatusCode>(errorStatusCode.ToString(), out s);
ApnsNotificationErrorStatusCode s;
Enum.TryParse(errorStatusCode.ToString(), out s);
return s;
}
}
Expand Down
22 changes: 22 additions & 0 deletions PushSharp.Apple/IApnsHttp2Notification.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
using Newtonsoft.Json.Linq;
using PushSharp.Core;
using System;

namespace PushSharp.Apple
{
public interface IApnsHttp2Notification: INotification
{
public string Uuid { get; set; }

public string DeviceToken { get; set; }

public JObject Payload { get; set; }

public DateTime? Expiration { get; set; }

public ApnsPriority? Priority { get; set; }

public string Topic { get; set; }

}
}
23 changes: 23 additions & 0 deletions PushSharp.Apple/IApnsNotification.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
using Newtonsoft.Json.Linq;
using PushSharp.Core;
using System;
using System.Collections.Generic;
using System.Text;

namespace PushSharp.Apple
{
public interface IApnsNotification: INotification
{
public int Identifier { get; }

public string DeviceToken { get; }

public JObject Payload { get; }

public DateTime? Expiration { get; }

public bool LowPriority { get; }

public byte[] ToBytes();
}
}
2 changes: 1 addition & 1 deletion PushSharp.Apple/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
// The form "{Major}.{Minor}.*" will automatically update the build and revision,
// and "{Major}.{Minor}.{Build}.*" will update just the revision.

[assembly: AssemblyVersion ("1.0.*")]
[assembly: AssemblyVersion ("1.0")]

// The following attributes are used to specify the signing key for the assembly,
// if desired. See the Mono documentation for more information about signing.
Expand Down
44 changes: 5 additions & 39 deletions PushSharp.Apple/PushSharp.Apple.csproj
Original file line number Diff line number Diff line change
@@ -1,58 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{A9D99F80-FEEB-4E74-96C5-66F17103C773}</ProjectGuid>
<TargetFramework>netstandard2.1</TargetFramework>
<OutputType>Library</OutputType>
<RootNamespace>PushSharp.Apple</RootNamespace>
<AssemblyName>PushSharp.Apple</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>..\PushSharp-Signing.snk</AssemblyOriginatorKeyFile>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug</OutputPath>
<DefineConstants>DEBUG;</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>full</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="Newtonsoft.Json">
<HintPath>..\packages\Newtonsoft.Json.7.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="System.Net.Http" />
<ProjectReference Include="..\PushSharp.Core\PushSharp.Core.csproj" />
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="ApnsServiceConnection.cs" />
<Compile Include="ApnsConnection.cs" />
<Compile Include="ApnsConfiguration.cs" />
<Compile Include="ApnsNotification.cs" />
<Compile Include="ApnsFeedbackService.cs" />
<Compile Include="Exceptions.cs" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<ItemGroup>
<ProjectReference Include="..\PushSharp.Core\PushSharp.Core.csproj">
<Project>{2B44A8DA-60BC-4577-A2D7-D9D53F164B2E}</Project>
<Name>PushSharp.Core</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
<PackageReference Include="Newtonsoft.Json" Version="9.0.1" />
</ItemGroup>
</Project>
4 changes: 0 additions & 4 deletions PushSharp.Apple/packages.config

This file was deleted.

2 changes: 1 addition & 1 deletion PushSharp.Blackberry/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
// The form "{Major}.{Minor}.*" will automatically update the build and revision,
// and "{Major}.{Minor}.{Build}.*" will update just the revision.

[assembly: AssemblyVersion ("1.0.*")]
[assembly: AssemblyVersion ("1.0")]

// The following attributes are used to specify the signing key for the assembly,
// if desired. See the Mono documentation for more information about signing.
Expand Down
Loading