#1672 add notification api
e418cabe
Michael Schmitz
committed
succeeded
4 changed files
INotificationsApi.cs
/WPE.App.Services/Push/INotificationsApi.cs+26
/WPE.App.Services/Push/INotificationsApi.cs
Add comment 1 Plus  namespace Infsoft.WPE.App.Services.Push
Add comment 2 Plus  {
Add comment 3 Plus   /// <summary>
Add comment 4 Plus   /// Api to manage handled state for notifications
Add comment 5 Plus   /// </summary>
Add comment 6 Plus   /// <remarks>
Add comment 7 Plus   /// Note: Only user specific, non-silent pushes are supported at the moment, others are not cached.
Add comment 8 Plus   /// </remarks>
Add comment 9 Plus   public interface INotificationsApi
Add comment 10 Plus   {
Add comment 11 Plus   /// <summary>
Add comment 12 Plus   /// Mark given notification as handled
Add comment 13 Plus   /// </summary>
Add comment 14 Plus   /// <param name="notificationId">Identifier of notification</param>
Add comment 15 Plus   /// <returns>Success of operation</returns>
Add comment 16 Plus   Task<bool> MarkHandled(Guid notificationId);
Add comment 17 Plus  
Add comment 18 Plus   /// <summary>
Add comment 19 Plus   /// Query, whether a notification is already handled
Add comment 20 Plus   /// </summary>
Add comment 21 Plus   /// <param name="notificationId">Identifier of notification</param>
Add comment 22 Plus   /// <returns><see langword="true"/> or <see langword="false"/> to indicate the handled state, <see langword="null"/> if not found</returns>
Add comment 23 Plus   Task<bool?> IsHandled(Guid notificationId);
Add comment 24 Plus   }
Add comment 25 Plus  }
Add comment 26 Plus  
ServiceCollectionExtensions.cs
/WPE.App.Services/ServiceCollectionExtensions.cs-2+6
/WPE.App.Services/ServiceCollectionExtensions.cs
Add comment 187 }
Add comment 188
Add comment 189 /// <summary>
Add comment 190 Minus   /// Add push action service handler
Add comment 190 Plus   /// Add push action service handler and notifications api
Add comment 191 /// </summary>
Add comment 192 /// <param name="services">Service collection to call on</param>
Add comment 193 /// <returns>Service collection to chain calls</returns>
Add comment 194 Minus   public static IServiceCollection AddPushActions(this IServiceCollection services) =>
Add comment 194 Plus   public static IServiceCollection AddNotifications<TNotificationsApi>(this IServiceCollection services) where TNotificationsApi : class, INotificationsApi
Add comment 195 Plus   {
Add comment 196 Plus   services.AddTransient<INotificationsApi, TNotificationsApi>();
Add comment 195 197 services.AddSingleton<INotificationActionService, NotificationActionService>();
Add comment 198 Plus   return services;
Add comment 199 Plus   }
Add comment 196 200 }
Add comment 197 201 }
Add comment 198 202
WPE.App.Services.csproj
/WPE.App.Services/WPE.App.Services.csproj-1+1
/WPE.App.Services/WPE.App.Services.csproj
Add comment 16 <PackageIcon>icon.png</PackageIcon>
Add comment 17 <PackageReadmeFile>ReadMe.md</PackageReadmeFile>
Add comment 18 <PackageTags>WPE;Workplace Experience;infsoft</PackageTags>
Add comment 19 Minus   <Version>0.9.0</Version>
Add comment 19 Plus   <Version>0.9.1</Version>
Add comment 20 <GenerateDocumentationFile>true</GenerateDocumentationFile>
Add comment 21 </PropertyGroup>
Add comment 22
ReadMe.md
/ReadMe.md+1
/ReadMe.md
Add comment 9 - **[ITimeZoneService](WPE.App.Services/ITimeZoneService.cs)** Provides the timeZone information based on subscriptions.
Add comment 10 - **[IAnalyticsService](WPE.App.Services/Analytics/IAnalyticsService.cs)** Allows the application to track analytics events.
Add comment 11 - **[INotificationActionService](WPE.App.Services/Push/INotificationActionService.cs)** Allows to respond to push notifications.
Add comment 12 Plus  - **[INotificationsApi](WPE.App.Services/Push/INotificationsApi.cs)** Allows to query or update the handled state of notifications.
Add comment 12 13
Add comment 13 14 ## Delegating handlers
Add comment 14 15 Additionally two delegating handlers are defined.