Skip to content

Commit

Permalink
Native registration token for push debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
aritchie committed Mar 14, 2024
1 parent b7d3d84 commit 24b0238
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 8 deletions.
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 24b0238

Please sign in to comment.