Skip to content

Commit

Permalink
no message
Browse files Browse the repository at this point in the history
  • Loading branch information
freever committed Jul 26, 2023
1 parent b95e601 commit c9c4cab
Show file tree
Hide file tree
Showing 9 changed files with 28 additions and 28 deletions.
24 changes: 13 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,17 +69,19 @@ Enter the server key in the Azure Notification Hub Google (GCM / FCM) section.

Install Xamarin.Firebase.Messaging and Blauhaus.Push.Client.Maui from nuget:

<!--Project references-->
<ItemGroup>
<ProjectReference Include="..\Lumen.Maui\Lumen.Maui.csproj" />
</ItemGroup>
```xml
<!--Project references-->
<ItemGroup>
<ProjectReference Include="..\Lumen.Maui\Lumen.Maui.csproj" />
</ItemGroup>

<!--Android packages-->
<ItemGroup Condition="'$(TargetFramework)' == 'net7.0-android'">
<PackageReference Include="Xamarin.Firebase.Messaging">
<Version>123.1.2.2</Version>
</PackageReference>
</ItemGroup>
<!--Android packages-->
<ItemGroup Condition="'$(TargetFramework)' == 'net7.0-android'">
<PackageReference Include="Xamarin.Firebase.Messaging">
<Version>123.1.2.2</Version>
</PackageReference>
</ItemGroup>
```

At the moment it also looks like we have to install Xamarin.Google.Dagger:
https://stackoverflow.com/questions/64428377/java-lang-nosuchmethoderror-no-static-method-checkbuilderrequirement
Expand Down Expand Up @@ -152,7 +154,7 @@ In OnCreate, add a call to Initialize the Android handler:
```c#
protected override void OnCreate(Bundle savedInstanceState)
{
base.OnCreate(message);
base.OnCreate(savedInstanceState);
AppServiceLocator.Resolve<AndroidPushNotificationHandler>()
.Initialize(this, Intent, (NotificationManager)GetSystemService(NotificationService));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace Blauhaus.Push.Client.Config
namespace Blauhaus.Push.Abstractions.Client
{
public interface IPushNotificationsClientConfig
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,16 @@ public class AndroidPushNotificationHandler
private readonly IAnalyticsLogger<AndroidPushNotificationHandler> _logger;

private readonly AndroidPushNotificationsClientService _pushNotificationsService;
private readonly PushNotificationsClientOptions _options;
private readonly IPushNotificationsClientConfig _options;

public AndroidPushNotificationHandler(
IAnalyticsLogger<AndroidPushNotificationHandler> logger,
IPushNotificationsClientService pushNotificationsService,
IOptions<PushNotificationsClientOptions> options)
IPushNotificationsClientConfig options)
{
_logger = logger;
_pushNotificationsService = (AndroidPushNotificationsClientService)pushNotificationsService;
_options = options.Value;
_options = options;
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public class WindowsPushNotificationHandler
{

private readonly IAnalyticsService _analyticsService;
private readonly PushNotificationsClientOptions _options;
private readonly IPushNotificationsClientConfig _options;
private readonly WindowsPushNotificationsClientService _pushNotificationsService;
private bool _appIsActive;
private static bool _appIsInitialized;
Expand All @@ -27,11 +27,11 @@ public class WindowsPushNotificationHandler
public WindowsPushNotificationHandler(
IAnalyticsService analyticsService,
IPushNotificationsClientService pushNotificationsService,
IOptions<PushNotificationsClientOptions> options)
IPushNotificationsClientConfig options)
{
_pushNotificationsService = (WindowsPushNotificationsClientService)pushNotificationsService;
_analyticsService = analyticsService;
_options = options.Value;
_options = options;
}

public async Task InitializeAsync(Window currentWindow)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,17 @@ namespace Blauhaus.Push.Client.Maui
public class IosPushNotificationHandler
{
private readonly IAnalyticsService _analyticsService;
private readonly PushNotificationsClientOptions _options;
private readonly IPushNotificationsClientConfig _options;
private readonly IosPushNotificationsClientService _pushNotificationsService;

public IosPushNotificationHandler(
IAnalyticsService analyticsService,
IPushNotificationsClientService pushNotificationsService,
IOptions<PushNotificationsClientOptions> options)
IPushNotificationsClientConfig options)
{
_pushNotificationsService = (IosPushNotificationsClientService) pushNotificationsService;
_analyticsService = analyticsService;
_options = options.Value;
_options = options;
}


Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Blauhaus.Common.Configuration.Extensions;
using Blauhaus.Push.Abstractions.Client;
using Microsoft.Extensions.Configuration;

namespace Blauhaus.Push.Client.Config
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
namespace Blauhaus.Push.Client.Config
using Blauhaus.Push.Abstractions.Client;

namespace Blauhaus.Push.Client.Config
{
public class PushNotificationsClientConfig : IPushNotificationsClientConfig
{
Expand Down
6 changes: 1 addition & 5 deletions src/Blauhaus.Push.Client/.Ioc/ServiceCollectionExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,7 @@ public static IServiceCollection AddPushNotificationsClient<TPushNotificationHan
return services
.AddSingleton<TPushNotificationHandler>()
.AddSingleton<IPushNotificationTapHandler>(sp => sp.GetRequiredService<TPushNotificationHandler>())
.AddSingleton<IPushNotificationsClientConfig>(new PushNotificationsClientConfig
{
NotificationHubName = configuration.GetRequiredString("PushNotifications", nameof(IPushNotificationsClientConfig.NotificationHubName)),
ConnectionString = configuration.GetRequiredString("PushNotifications", nameof(IPushNotificationsClientConfig.ConnectionString)),
});
.AddSingleton<IPushNotificationsClientConfig, ConfigurationPushNotificationsClientConfig>();
}

private static IServiceCollection AddClient<TConfig, THandler>(this IServiceCollection services)
Expand Down
1 change: 0 additions & 1 deletion src/Blauhaus.Push.Client/Blauhaus.Push.Client.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

<ItemGroup>
<Compile Include=".Base\BasePushNotificationsClientService.cs" />
<Compile Include=".Config\IPushNotificationsClientConfig.cs" />
<Compile Include=".Config\ConfigurationPushNotificationsClientConfig.cs" />
<Compile Include=".Config\PushNotificationsClientConfig.cs" />
<Compile Include=".Ioc\EmptyPushNotificationTapHandler.cs" />
Expand Down

0 comments on commit c9c4cab

Please sign in to comment.