From c9c4cab2f3951a076289a316bf42e50bb31c7f0b Mon Sep 17 00:00:00 2001 From: Adrian Frielinghaus Date: Wed, 26 Jul 2023 09:00:27 +0200 Subject: [PATCH] no message --- README.md | 24 ++++++++++--------- .../Client}/IPushNotificationsClientConfig.cs | 2 +- .../Android/AndroidPushNotificationHandler.cs | 6 ++--- .../Windows/WindowsPushNotificationHandler.cs | 6 ++--- .../iOS/IosPushNotificationsHandler.cs | 6 ++--- ...figurationPushNotificationsClientConfig.cs | 1 + .../.Config/PushNotificationsClientConfig.cs | 4 +++- .../.Ioc/ServiceCollectionExtensions.cs | 6 +---- .../Blauhaus.Push.Client.csproj | 1 - 9 files changed, 28 insertions(+), 28 deletions(-) rename src/{Blauhaus.Push.Client/.Config => Blauhaus.Push.Abstractions/Client}/IPushNotificationsClientConfig.cs (76%) diff --git a/README.md b/README.md index 202a491..94f817c 100644 --- a/README.md +++ b/README.md @@ -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: - - - - +```xml + + + + - - - - 123.1.2.2 - - + + + + 123.1.2.2 + + +``` 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 @@ -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() .Initialize(this, Intent, (NotificationManager)GetSystemService(NotificationService)); diff --git a/src/Blauhaus.Push.Client/.Config/IPushNotificationsClientConfig.cs b/src/Blauhaus.Push.Abstractions/Client/IPushNotificationsClientConfig.cs similarity index 76% rename from src/Blauhaus.Push.Client/.Config/IPushNotificationsClientConfig.cs rename to src/Blauhaus.Push.Abstractions/Client/IPushNotificationsClientConfig.cs index f00b650..e8df233 100644 --- a/src/Blauhaus.Push.Client/.Config/IPushNotificationsClientConfig.cs +++ b/src/Blauhaus.Push.Abstractions/Client/IPushNotificationsClientConfig.cs @@ -1,4 +1,4 @@ -namespace Blauhaus.Push.Client.Config +namespace Blauhaus.Push.Abstractions.Client { public interface IPushNotificationsClientConfig { diff --git a/src/Blauhaus.Push.Client.Maui/Platforms/Android/AndroidPushNotificationHandler.cs b/src/Blauhaus.Push.Client.Maui/Platforms/Android/AndroidPushNotificationHandler.cs index 5cf5811..a09970d 100644 --- a/src/Blauhaus.Push.Client.Maui/Platforms/Android/AndroidPushNotificationHandler.cs +++ b/src/Blauhaus.Push.Client.Maui/Platforms/Android/AndroidPushNotificationHandler.cs @@ -17,16 +17,16 @@ public class AndroidPushNotificationHandler private readonly IAnalyticsLogger _logger; private readonly AndroidPushNotificationsClientService _pushNotificationsService; - private readonly PushNotificationsClientOptions _options; + private readonly IPushNotificationsClientConfig _options; public AndroidPushNotificationHandler( IAnalyticsLogger logger, IPushNotificationsClientService pushNotificationsService, - IOptions options) + IPushNotificationsClientConfig options) { _logger = logger; _pushNotificationsService = (AndroidPushNotificationsClientService)pushNotificationsService; - _options = options.Value; + _options = options; } diff --git a/src/Blauhaus.Push.Client.Maui/Platforms/Windows/WindowsPushNotificationHandler.cs b/src/Blauhaus.Push.Client.Maui/Platforms/Windows/WindowsPushNotificationHandler.cs index 3d3ff48..266bf62 100644 --- a/src/Blauhaus.Push.Client.Maui/Platforms/Windows/WindowsPushNotificationHandler.cs +++ b/src/Blauhaus.Push.Client.Maui/Platforms/Windows/WindowsPushNotificationHandler.cs @@ -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; @@ -27,11 +27,11 @@ public class WindowsPushNotificationHandler public WindowsPushNotificationHandler( IAnalyticsService analyticsService, IPushNotificationsClientService pushNotificationsService, - IOptions options) + IPushNotificationsClientConfig options) { _pushNotificationsService = (WindowsPushNotificationsClientService)pushNotificationsService; _analyticsService = analyticsService; - _options = options.Value; + _options = options; } public async Task InitializeAsync(Window currentWindow) diff --git a/src/Blauhaus.Push.Client.Maui/Platforms/iOS/IosPushNotificationsHandler.cs b/src/Blauhaus.Push.Client.Maui/Platforms/iOS/IosPushNotificationsHandler.cs index 883bc3a..db59188 100644 --- a/src/Blauhaus.Push.Client.Maui/Platforms/iOS/IosPushNotificationsHandler.cs +++ b/src/Blauhaus.Push.Client.Maui/Platforms/iOS/IosPushNotificationsHandler.cs @@ -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 options) + IPushNotificationsClientConfig options) { _pushNotificationsService = (IosPushNotificationsClientService) pushNotificationsService; _analyticsService = analyticsService; - _options = options.Value; + _options = options; } diff --git a/src/Blauhaus.Push.Client/.Config/ConfigurationPushNotificationsClientConfig.cs b/src/Blauhaus.Push.Client/.Config/ConfigurationPushNotificationsClientConfig.cs index f4753b9..cb072f4 100644 --- a/src/Blauhaus.Push.Client/.Config/ConfigurationPushNotificationsClientConfig.cs +++ b/src/Blauhaus.Push.Client/.Config/ConfigurationPushNotificationsClientConfig.cs @@ -1,4 +1,5 @@ using Blauhaus.Common.Configuration.Extensions; +using Blauhaus.Push.Abstractions.Client; using Microsoft.Extensions.Configuration; namespace Blauhaus.Push.Client.Config diff --git a/src/Blauhaus.Push.Client/.Config/PushNotificationsClientConfig.cs b/src/Blauhaus.Push.Client/.Config/PushNotificationsClientConfig.cs index c89de7a..c56b493 100644 --- a/src/Blauhaus.Push.Client/.Config/PushNotificationsClientConfig.cs +++ b/src/Blauhaus.Push.Client/.Config/PushNotificationsClientConfig.cs @@ -1,4 +1,6 @@ -namespace Blauhaus.Push.Client.Config +using Blauhaus.Push.Abstractions.Client; + +namespace Blauhaus.Push.Client.Config { public class PushNotificationsClientConfig : IPushNotificationsClientConfig { diff --git a/src/Blauhaus.Push.Client/.Ioc/ServiceCollectionExtensions.cs b/src/Blauhaus.Push.Client/.Ioc/ServiceCollectionExtensions.cs index 59919f8..33ec52b 100644 --- a/src/Blauhaus.Push.Client/.Ioc/ServiceCollectionExtensions.cs +++ b/src/Blauhaus.Push.Client/.Ioc/ServiceCollectionExtensions.cs @@ -29,11 +29,7 @@ public static IServiceCollection AddPushNotificationsClient() .AddSingleton(sp => sp.GetRequiredService()) - .AddSingleton(new PushNotificationsClientConfig - { - NotificationHubName = configuration.GetRequiredString("PushNotifications", nameof(IPushNotificationsClientConfig.NotificationHubName)), - ConnectionString = configuration.GetRequiredString("PushNotifications", nameof(IPushNotificationsClientConfig.ConnectionString)), - }); + .AddSingleton(); } private static IServiceCollection AddClient(this IServiceCollection services) diff --git a/src/Blauhaus.Push.Client/Blauhaus.Push.Client.csproj b/src/Blauhaus.Push.Client/Blauhaus.Push.Client.csproj index 477b8bd..b517fbd 100644 --- a/src/Blauhaus.Push.Client/Blauhaus.Push.Client.csproj +++ b/src/Blauhaus.Push.Client/Blauhaus.Push.Client.csproj @@ -9,7 +9,6 @@ -