Skip to content

Commit

Permalink
Merge pull request #6 from xamplum/adaptToNewFirebasePlugins
Browse files Browse the repository at this point in the history
Adapt to new firebase plugins
  • Loading branch information
SebastianStehle authored Aug 1, 2022
2 parents d94af6a + e13c408 commit 7a98e72
Show file tree
Hide file tree
Showing 23 changed files with 2,540 additions and 19,538 deletions.
19,553 changes: 76 additions & 19,477 deletions sample/Sample.Android/Resources/Resource.designer.cs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion sample/Sample.Android/Sample.Android.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
<PackageReference Include="Xamarin.Firebase.Common">
<Version>119.5.0</Version>
</PackageReference>
<PackageReference Include="Xamarin.Forms" Version="5.0.0.2012" />
<PackageReference Include="Xamarin.Forms" Version="5.0.0.2515" />
<PackageReference Include="Xamarin.Essentials" Version="1.6.1" />
</ItemGroup>
<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion sample/Sample.iOS/Sample.iOS.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@
<PackageReference Include="System.Text.Json">
<Version>5.0.1</Version>
</PackageReference>
<PackageReference Include="Xamarin.Forms" Version="5.0.0.2012" />
<PackageReference Include="Xamarin.Forms" Version="5.0.0.2515" />
<PackageReference Include="Xamarin.Essentials" Version="1.6.1" />
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.iOS.CSharp.targets" />
Expand Down
2 changes: 1 addition & 1 deletion sample/Sample/Sample.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="System.Text.Json" Version="5.0.1" />
<PackageReference Include="Xamarin.Forms" Version="5.0.0.2012" />
<PackageReference Include="Xamarin.Forms" Version="5.0.0.2515" />
<PackageReference Include="Xamarin.Essentials" Version="1.6.1" />
</ItemGroup>

Expand Down
2 changes: 1 addition & 1 deletion sdk/Notifo.SDK.FirebasePlugin/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageProjectUrl>https://notifo.io</PackageProjectUrl>
<PackageTags>notifo xamarin firebase</PackageTags>
<Version>0.0.8-beta</Version>
<Version>0.0.9-beta</Version>
</PropertyGroup>
</Project>
128 changes: 72 additions & 56 deletions sdk/Notifo.SDK.FirebasePlugin/Notifo.SDK.FirebasePlugin.csproj
Original file line number Diff line number Diff line change
@@ -1,59 +1,75 @@
<Project Sdk="MSBuild.Sdk.Extras/3.0.22">

<PropertyGroup>
<TargetFrameworks>netstandard2.1;xamarinios10;monoandroid12.0;</TargetFrameworks>
<LangVersion>8.0</LangVersion>
<Nullable>enable</Nullable>
<RootNamespace>Notifo.SDK.FirebasePlugin</RootNamespace>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
</PropertyGroup>

<ItemGroup>
<None Include="logo-squared.png" Pack="true" PackagePath="\" />
</ItemGroup>

<PropertyGroup>
<CodeAnalysisRuleSet>..\..\Notifo.ruleset</CodeAnalysisRuleSet>
<AssemblyName>Notifo.Xamarin.FirebasePlugin</AssemblyName>
</PropertyGroup>

<ItemGroup>
<AdditionalFiles Include="..\..\stylecop.json" Link="stylecop.json" />
</ItemGroup>

<ItemGroup>
<Compile Remove="**\*.netstandard.cs" />
<Compile Remove="**\*.android.cs" />
<Compile Remove="**\*.ios.cs" />
</ItemGroup>

<ItemGroup Condition=" $(TargetFramework.StartsWith('netstandard')) ">
<Compile Include="**\*.netstandard.cs" />
</ItemGroup>

<ItemGroup Condition=" $(TargetFramework.StartsWith('xamarinios')) ">
<Compile Include="**\*.ios.cs" />
</ItemGroup>

<ItemGroup Condition=" $(TargetFramework.StartsWith('monoandroid')) ">
<Compile Include="**\*.android.cs" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="5.0.0" />
<PackageReference Include="Plugin.FirebasePushNotification" Version="3.4.22" />
<PackageReference Include="RefactoringEssentials" Version="5.6.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Notifo.SDK\Notifo.SDK.Core.csproj" />
</ItemGroup>
<PropertyGroup>
<TargetFrameworks>netstandard2.1;xamarinios10;monoandroid12.0;</TargetFrameworks>
<LangVersion>8.0</LangVersion>
<Nullable>enable</Nullable>
<RootNamespace>Notifo.SDK.FirebasePlugin</RootNamespace>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
</PropertyGroup>

<ItemGroup>
<None Include="logo-squared.png" Pack="true" PackagePath="\" />
</ItemGroup>

<PropertyGroup>
<CodeAnalysisRuleSet>..\..\Notifo.ruleset</CodeAnalysisRuleSet>
<AssemblyName>Notifo.Xamarin.FirebasePlugin</AssemblyName>
<RunAnalyzersDuringBuild>false</RunAnalyzersDuringBuild>
</PropertyGroup>

<ItemGroup>
<AdditionalFiles Include="..\..\stylecop.json" Link="stylecop.json" />
</ItemGroup>

<ItemGroup>
<Compile Remove="**\*.netstandard.cs" />
<Compile Remove="**\*.android.cs" />
<Compile Remove="**\*.ios.cs" />
</ItemGroup>

<ItemGroup Condition=" $(TargetFramework.StartsWith('netstandard')) ">
<Compile Include="**\*.netstandard.cs" />
</ItemGroup>

<ItemGroup Condition=" $(TargetFramework.StartsWith('xamarinios')) ">
<Compile Include="**\*.ios.cs" />
<PackageReference Include="Xamarin.Firebase.iOS.CloudMessaging" Version="8.10.0" />
<PackageReference Include="Xamarin.Firebase.iOS.Installations" Version="8.10.0" />
<PackageReference Include="Xamarin.Firebase.iOS.Core" Version="8.10.0" />
<PackageReference Include="Xamarin.Firebase.iOS.InstanceID" Version="4.8.0" />
</ItemGroup>

<ItemGroup Condition=" $(TargetFramework.StartsWith('monoandroid')) ">
<Compile Include="**\*.android.cs" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="5.0.0" />
<PackageReference Include="RefactoringEssentials" Version="5.6.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Xamarin.Firebase.iOS.CloudMessaging" Version="8.10.0.1" />
<PackageReference Include="Xamarin.Firebase.iOS.Core" Version="8.10.0.1" />
<PackageReference Include="Xamarin.Firebase.iOS.Installations" Version="8.10.0.1" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Notifo.SDK\Notifo.SDK.Core.csproj" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'monoandroid12.0'">
<PackageReference Include="Xamarin.Firebase.Common">
<Version>120.0.0.5</Version>
</PackageReference>
<PackageReference Include="Xamarin.Firebase.Messaging">
<Version>122.0.0.5</Version>
</PackageReference>
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
using System;

namespace Plugin.FirebasePushNotification
{
/// <summary>
/// Cross platform FirebasePushNotification implemenations
/// </summary>
public static class CrossFirebasePushNotification
{
private static Lazy<IFirebasePushNotification> implementation = new Lazy<IFirebasePushNotification>(() => CreateFirebasePushNotification(), System.Threading.LazyThreadSafetyMode.PublicationOnly);

/// <summary>
/// Gets if the plugin is supported on the current platform.
/// </summary>
public static bool IsSupported => implementation.Value == null ? false : true;

/// <summary>
/// Current settings to use
/// </summary>
public static IFirebasePushNotification Current
{
get
{
var ret = implementation.Value;
if (ret == null)
{
throw NotImplementedInReferenceAssembly();
}
return ret;
}
}

#if ANDROID
public static FirebasePushNotificationManager Android => (FirebasePushNotificationManager)Current;
#elif IOS
public static FirebasePushNotificationManager IOS => (FirebasePushNotificationManager)Current;
#endif

private static IFirebasePushNotification CreateFirebasePushNotification()
{

#if NETSTANDARD1_0 || NETSTANDARD2_0 || NETSTANDARD2_1
return null;
#else
#pragma warning disable IDE0022 // Use expression body for methods
return new FirebasePushNotificationManager();
#pragma warning restore IDE0022 // Use expression body for methods
#endif
}

internal static Exception NotImplementedInReferenceAssembly()
{
return new NotImplementedException("This functionality is not implemented in the portable version of this assembly. You should reference the NuGet package from your main application project in order to reference the platform-specific implementation.");
}
}
}
Loading

0 comments on commit 7a98e72

Please sign in to comment.