Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
aritchie committed Mar 14, 2024
2 parents 3e0dd15 + 24b0238 commit 2d9bb6d
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
using Firebase.CloudMessaging;
using Firebase.Core;
using Foundation;
using Microsoft.Extensions.Logging;

namespace Shiny.Push;

Expand All @@ -15,9 +14,7 @@ public class FirebasePushProvider : NotifyPropertyChanged, IPushProvider, IPushT
readonly FirebaseConfiguration config;


public FirebasePushProvider(
FirebaseConfiguration config
)
public FirebasePushProvider(FirebaseConfiguration config)
{
this.config = config;
}
Expand Down Expand Up @@ -57,7 +54,10 @@ public async Task AddTag(string tag)
var tags = this.RegisteredTags?.ToList() ?? new List<string>(1);
tags.Add(tag);

await Messaging.SharedInstance.SubscribeAsync(tag);
await Messaging
.SharedInstance
.SubscribeAsync(tag)
.ConfigureAwait(false);
this.RegisteredTags = tags.ToArray();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,6 @@
<Description>Shiny Push Integration - Google Firebase Cloud Messaging</Description>
</PropertyGroup>

<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<CreatePackage>false</CreatePackage>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<CreatePackage>false</CreatePackage>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\Shiny.Push\Shiny.Push.csproj" />
</ItemGroup>
Expand Down
6 changes: 6 additions & 0 deletions src/Shiny.Push/IPushManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ public interface IPushManager
/// </summary>
string? RegistrationToken { get; }

/// <summary>
/// This is from the OS and does not necessarily represent the registration token with
/// your push provider. You should use RegistrationToken for everything else - this is for debugging
/// </summary>
string? NativeRegistrationToken { get; }

/// <summary>
/// Requests platform permission to send push notifications
/// </summary>
Expand Down
10 changes: 5 additions & 5 deletions src/Shiny.Push/Platforms/Android/PushManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ public async void Start()

try
{
this.NativeToken = await this.RequestNativeToken();
var regToken = await this.provider.Register(this.NativeToken); // never null on firebase
this.NativeRegistrationToken = await this.RequestNativeToken();
var regToken = await this.provider.Register(this.NativeRegistrationToken); // never null on firebase

if (regToken != this.RegistrationToken)
{
Expand Down Expand Up @@ -100,7 +100,7 @@ public string? RegistrationToken


string? nativeToken;
public string? NativeToken
public string? NativeRegistrationToken
{
get => this.nativeToken;
set => this.Set(ref this.nativeToken, value);
Expand Down Expand Up @@ -132,7 +132,7 @@ await this.services
)
.ConfigureAwait(false);
}
this.NativeToken = nativeToken;
this.NativeRegistrationToken = nativeToken;
this.RegistrationToken = regToken;

return new PushAccessState(AccessState.Available, this.RegistrationToken);
Expand All @@ -151,7 +151,7 @@ await this.services
)
.ConfigureAwait(false);

this.NativeToken = null;
this.NativeRegistrationToken = null;
this.RegistrationToken = null;
}

Expand Down
6 changes: 3 additions & 3 deletions src/Shiny.Push/Platforms/Apple/PushManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public string? RegistrationToken


string? nativeToken;
public string? NativeToken
public string? NativeRegistrationToken
{
get => this.nativeToken;
set => this.Set(ref this.nativeToken, value);
Expand Down Expand Up @@ -133,7 +133,7 @@ await this.services
.ConfigureAwait(false);
}

this.NativeToken = nativeToken;
this.NativeRegistrationToken = nativeToken;
this.RegistrationToken = regToken;

return new PushAccessState(AccessState.Available, this.RegistrationToken);
Expand All @@ -160,7 +160,7 @@ await this.services
)
.ConfigureAwait(false);

this.NativeToken = null;
this.NativeRegistrationToken = null;
this.RegistrationToken = null;
}

Expand Down

0 comments on commit 2d9bb6d

Please sign in to comment.