Skip to content

Commit 640027b

Browse files
authored
Merge pull request #309 from martijn00/cleanup
Some code cleanup
2 parents 84fd1a4 + 452f102 commit 640027b

24 files changed

Lines changed: 374 additions & 422 deletions

FirebasePushNotification.sln

Lines changed: 0 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FirebasePushSample.Android"
2626
EndProject
2727
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FirebasePushSample.iOS", "Samples\FirebasePushSample.iOS\FirebasePushSample.iOS.csproj", "{FA3C97AC-3E34-4566-A146-CE8B49669AC8}"
2828
EndProject
29-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FirebasePushSample.UWP", "Samples\FirebasePushSample.UWP\FirebasePushSample.UWP.csproj", "{48BCB86C-151B-4385-B315-317F434F4218}"
30-
EndProject
3129
Global
3230
GlobalSection(SolutionConfigurationPlatforms) = preSolution
3331
Ad-Hoc|Any CPU = Ad-Hoc|Any CPU
@@ -255,68 +253,6 @@ Global
255253
{FA3C97AC-3E34-4566-A146-CE8B49669AC8}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator
256254
{FA3C97AC-3E34-4566-A146-CE8B49669AC8}.Release|x64.ActiveCfg = Release|iPhone
257255
{FA3C97AC-3E34-4566-A146-CE8B49669AC8}.Release|x86.ActiveCfg = Release|iPhone
258-
{48BCB86C-151B-4385-B315-317F434F4218}.Ad-Hoc|Any CPU.ActiveCfg = Release|x86
259-
{48BCB86C-151B-4385-B315-317F434F4218}.Ad-Hoc|Any CPU.Build.0 = Release|x86
260-
{48BCB86C-151B-4385-B315-317F434F4218}.Ad-Hoc|Any CPU.Deploy.0 = Release|x86
261-
{48BCB86C-151B-4385-B315-317F434F4218}.Ad-Hoc|ARM.ActiveCfg = Release|ARM
262-
{48BCB86C-151B-4385-B315-317F434F4218}.Ad-Hoc|ARM.Build.0 = Release|ARM
263-
{48BCB86C-151B-4385-B315-317F434F4218}.Ad-Hoc|ARM.Deploy.0 = Release|ARM
264-
{48BCB86C-151B-4385-B315-317F434F4218}.Ad-Hoc|iPhone.ActiveCfg = Release|x86
265-
{48BCB86C-151B-4385-B315-317F434F4218}.Ad-Hoc|iPhone.Build.0 = Release|x86
266-
{48BCB86C-151B-4385-B315-317F434F4218}.Ad-Hoc|iPhone.Deploy.0 = Release|x86
267-
{48BCB86C-151B-4385-B315-317F434F4218}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Release|x86
268-
{48BCB86C-151B-4385-B315-317F434F4218}.Ad-Hoc|iPhoneSimulator.Build.0 = Release|x86
269-
{48BCB86C-151B-4385-B315-317F434F4218}.Ad-Hoc|iPhoneSimulator.Deploy.0 = Release|x86
270-
{48BCB86C-151B-4385-B315-317F434F4218}.Ad-Hoc|x64.ActiveCfg = Release|x64
271-
{48BCB86C-151B-4385-B315-317F434F4218}.Ad-Hoc|x64.Build.0 = Release|x64
272-
{48BCB86C-151B-4385-B315-317F434F4218}.Ad-Hoc|x64.Deploy.0 = Release|x64
273-
{48BCB86C-151B-4385-B315-317F434F4218}.Ad-Hoc|x86.ActiveCfg = Release|x86
274-
{48BCB86C-151B-4385-B315-317F434F4218}.Ad-Hoc|x86.Build.0 = Release|x86
275-
{48BCB86C-151B-4385-B315-317F434F4218}.Ad-Hoc|x86.Deploy.0 = Release|x86
276-
{48BCB86C-151B-4385-B315-317F434F4218}.AppStore|Any CPU.ActiveCfg = Release|x86
277-
{48BCB86C-151B-4385-B315-317F434F4218}.AppStore|Any CPU.Build.0 = Release|x86
278-
{48BCB86C-151B-4385-B315-317F434F4218}.AppStore|Any CPU.Deploy.0 = Release|x86
279-
{48BCB86C-151B-4385-B315-317F434F4218}.AppStore|ARM.ActiveCfg = Release|ARM
280-
{48BCB86C-151B-4385-B315-317F434F4218}.AppStore|ARM.Build.0 = Release|ARM
281-
{48BCB86C-151B-4385-B315-317F434F4218}.AppStore|ARM.Deploy.0 = Release|ARM
282-
{48BCB86C-151B-4385-B315-317F434F4218}.AppStore|iPhone.ActiveCfg = Release|x86
283-
{48BCB86C-151B-4385-B315-317F434F4218}.AppStore|iPhone.Build.0 = Release|x86
284-
{48BCB86C-151B-4385-B315-317F434F4218}.AppStore|iPhone.Deploy.0 = Release|x86
285-
{48BCB86C-151B-4385-B315-317F434F4218}.AppStore|iPhoneSimulator.ActiveCfg = Release|x86
286-
{48BCB86C-151B-4385-B315-317F434F4218}.AppStore|iPhoneSimulator.Build.0 = Release|x86
287-
{48BCB86C-151B-4385-B315-317F434F4218}.AppStore|iPhoneSimulator.Deploy.0 = Release|x86
288-
{48BCB86C-151B-4385-B315-317F434F4218}.AppStore|x64.ActiveCfg = Release|x64
289-
{48BCB86C-151B-4385-B315-317F434F4218}.AppStore|x64.Build.0 = Release|x64
290-
{48BCB86C-151B-4385-B315-317F434F4218}.AppStore|x64.Deploy.0 = Release|x64
291-
{48BCB86C-151B-4385-B315-317F434F4218}.AppStore|x86.ActiveCfg = Release|x86
292-
{48BCB86C-151B-4385-B315-317F434F4218}.AppStore|x86.Build.0 = Release|x86
293-
{48BCB86C-151B-4385-B315-317F434F4218}.AppStore|x86.Deploy.0 = Release|x86
294-
{48BCB86C-151B-4385-B315-317F434F4218}.Debug|Any CPU.ActiveCfg = Debug|x86
295-
{48BCB86C-151B-4385-B315-317F434F4218}.Debug|Any CPU.Build.0 = Debug|x86
296-
{48BCB86C-151B-4385-B315-317F434F4218}.Debug|Any CPU.Deploy.0 = Debug|x86
297-
{48BCB86C-151B-4385-B315-317F434F4218}.Debug|ARM.ActiveCfg = Debug|ARM
298-
{48BCB86C-151B-4385-B315-317F434F4218}.Debug|ARM.Build.0 = Debug|ARM
299-
{48BCB86C-151B-4385-B315-317F434F4218}.Debug|ARM.Deploy.0 = Debug|ARM
300-
{48BCB86C-151B-4385-B315-317F434F4218}.Debug|iPhone.ActiveCfg = Debug|x86
301-
{48BCB86C-151B-4385-B315-317F434F4218}.Debug|iPhoneSimulator.ActiveCfg = Debug|x86
302-
{48BCB86C-151B-4385-B315-317F434F4218}.Debug|x64.ActiveCfg = Debug|x64
303-
{48BCB86C-151B-4385-B315-317F434F4218}.Debug|x64.Build.0 = Debug|x64
304-
{48BCB86C-151B-4385-B315-317F434F4218}.Debug|x64.Deploy.0 = Debug|x64
305-
{48BCB86C-151B-4385-B315-317F434F4218}.Debug|x86.ActiveCfg = Debug|x86
306-
{48BCB86C-151B-4385-B315-317F434F4218}.Debug|x86.Build.0 = Debug|x86
307-
{48BCB86C-151B-4385-B315-317F434F4218}.Debug|x86.Deploy.0 = Debug|x86
308-
{48BCB86C-151B-4385-B315-317F434F4218}.Release|Any CPU.ActiveCfg = Release|x86
309-
{48BCB86C-151B-4385-B315-317F434F4218}.Release|ARM.ActiveCfg = Release|ARM
310-
{48BCB86C-151B-4385-B315-317F434F4218}.Release|ARM.Build.0 = Release|ARM
311-
{48BCB86C-151B-4385-B315-317F434F4218}.Release|ARM.Deploy.0 = Release|ARM
312-
{48BCB86C-151B-4385-B315-317F434F4218}.Release|iPhone.ActiveCfg = Release|x86
313-
{48BCB86C-151B-4385-B315-317F434F4218}.Release|iPhoneSimulator.ActiveCfg = Release|x86
314-
{48BCB86C-151B-4385-B315-317F434F4218}.Release|x64.ActiveCfg = Release|x64
315-
{48BCB86C-151B-4385-B315-317F434F4218}.Release|x64.Build.0 = Release|x64
316-
{48BCB86C-151B-4385-B315-317F434F4218}.Release|x64.Deploy.0 = Release|x64
317-
{48BCB86C-151B-4385-B315-317F434F4218}.Release|x86.ActiveCfg = Release|x86
318-
{48BCB86C-151B-4385-B315-317F434F4218}.Release|x86.Build.0 = Release|x86
319-
{48BCB86C-151B-4385-B315-317F434F4218}.Release|x86.Deploy.0 = Release|x86
320256
EndGlobalSection
321257
GlobalSection(SolutionProperties) = preSolution
322258
HideSolutionNode = FALSE
@@ -325,7 +261,6 @@ Global
325261
{980092DB-4DC0-49FA-A577-F6FC83B79F88} = {B2390FE8-170A-467A-B4F1-9939609BA01B}
326262
{524779F2-E29E-4BA2-B346-BAA571729A1B} = {B2390FE8-170A-467A-B4F1-9939609BA01B}
327263
{FA3C97AC-3E34-4566-A146-CE8B49669AC8} = {B2390FE8-170A-467A-B4F1-9939609BA01B}
328-
{48BCB86C-151B-4385-B315-317F434F4218} = {B2390FE8-170A-467A-B4F1-9939609BA01B}
329264
EndGlobalSection
330265
GlobalSection(ExtensibilityGlobals) = postSolution
331266
SolutionGuid = {5817F944-7ACB-4681-B3D6-32F6B0E2546B}

Plugin.FirebasePushNotification/CrossFirebasePushNotification.shared.cs

Lines changed: 33 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,31 +2,42 @@
22

33
namespace Plugin.FirebasePushNotification
44
{
5-
/// <summary>
6-
/// Cross platform FirebasePushNotification implemenations
7-
/// </summary>
8-
public class CrossFirebasePushNotification
9-
{
10-
static Lazy<IFirebasePushNotification> Implementation = new Lazy<IFirebasePushNotification>(() => CreateFirebasePushNotification(), System.Threading.LazyThreadSafetyMode.PublicationOnly);
11-
125
/// <summary>
13-
/// Current settings to use
6+
/// Cross platform FirebasePushNotification implemenations
147
/// </summary>
15-
public static IFirebasePushNotification Current
8+
public static class CrossFirebasePushNotification
169
{
17-
get
18-
{
19-
var ret = Implementation.Value;
20-
if (ret == null)
10+
private static Lazy<IFirebasePushNotification> implementation = new Lazy<IFirebasePushNotification>(() => CreateFirebasePushNotification(), System.Threading.LazyThreadSafetyMode.PublicationOnly);
11+
12+
/// <summary>
13+
/// Gets if the plugin is supported on the current platform.
14+
/// </summary>
15+
public static bool IsSupported => implementation.Value == null ? false : true;
16+
17+
/// <summary>
18+
/// Current settings to use
19+
/// </summary>
20+
public static IFirebasePushNotification Current
2121
{
22-
throw NotImplementedInReferenceAssembly();
22+
get
23+
{
24+
var ret = implementation.Value;
25+
if (ret == null)
26+
{
27+
throw NotImplementedInReferenceAssembly();
28+
}
29+
return ret;
30+
}
2331
}
24-
return ret;
25-
}
26-
}
2732

28-
static IFirebasePushNotification CreateFirebasePushNotification()
29-
{
33+
#if ANDROID
34+
public static FirebasePushNotificationManager Android => (FirebasePushNotificationManager)Current;
35+
#elif IOS
36+
public static FirebasePushNotificationManager IOS => (FirebasePushNotificationManager)Current;
37+
#endif
38+
39+
private static IFirebasePushNotification CreateFirebasePushNotification()
40+
{
3041

3142
#if NETSTANDARD1_0 || NETSTANDARD2_0
3243
return null;
@@ -38,8 +49,8 @@ static IFirebasePushNotification CreateFirebasePushNotification()
3849
}
3950

4051
internal static Exception NotImplementedInReferenceAssembly()
41-
{
42-
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.");
52+
{
53+
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.");
54+
}
4355
}
44-
}
4556
}

0 commit comments

Comments
 (0)