-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Translation for Push Notifications (#675)
* feat: first attempt at providing translations for push notifications * feat: restrict notifications to IPushNotification. Prepare to load language code from Devices table. * chore: fix formatting * chore: update csproj. Add test stub * chore: further experiments with tests * feat: add test to ensure PushNotifications translation strings exist * chore: fix merge * fix: missing translations * feat: remove usage of Localizer. Use ResourceManager directly. Redo tests * refactor: fix formatting * chore: remove needless AssemblyInfo files * refactor: rename to PushNotificationTextProvider * refactor: rename variable * chore: restore Data for TestPushNotification * feat: add reference to pt resx file * chore: try another way the CI pipeline is failing for some reason. * feat: use device communication language code for sending notifications * refactor: move IPushNotification to Application module * chore: add data to test with TestPushNotification * refactor: rename vars * chore: tests' fixes * chore: move resource files elsewhere, simplify their usage. * refactor: fix formatting * refactor: resource → resources * chore: tests must extend AbstractTestBase * test: add TestDataGenerator * refactor: simplify/improve PushNotificationTextProvider * chore: add further tests and complete pt translations * refactor: extract domain event id randomization into base class * refactor: introduce PushNotificationResourceManager * refactor: rename notificationTextService to notificationTextProvider at all places * test: change test names to match naming convention * feat: register PushNotificationResourceManager to avoid creation of multiple instances * refactor: add abstraction for PushNotificationTextProvider * test: use refactor: add abstraction for PushNotificationTextProvider to fix ApplePushNotificationServiceConnectorTests * chore: extract IPushNotificationTextProvider into file * refactor: make setter of Device.CommunicationLanguage private * test: use [Theory] for PushNotificationTextProviderTests * chore: fix formatting --------- Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> Co-authored-by: Timo Notheisen <[email protected]> Co-authored-by: Timo Notheisen <[email protected]>
- Loading branch information
1 parent
2b468be
commit 97839bc
Showing
40 changed files
with
720 additions
and
143 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
BuildingBlocks/src/BuildingBlocks.Application/PushNotifications/IPushNotification.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
namespace Backbone.BuildingBlocks.Application.PushNotifications; | ||
|
||
public interface IPushNotification; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 3 additions & 2 deletions
5
...astructure/PushNotifications/Datawallet/DatawalletModificationsCreatedPushNotification.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
using Backbone.BuildingBlocks.Application.PushNotifications; | ||
|
||
namespace Backbone.Modules.Devices.Application.Infrastructure.PushNotifications.Datawallet; | ||
|
||
[NotificationText(Title = NotificationTextAttribute.DEFAULT_TITLE, Body = NotificationTextAttribute.DEFAULT_BODY)] | ||
public record DatawalletModificationsCreatedPushNotification(string CreatedByDevice); | ||
public record DatawalletModificationsCreatedPushNotification(string CreatedByDevice) : IPushNotification; |
5 changes: 3 additions & 2 deletions
5
...n/Infrastructure/PushNotifications/DeletionProcess/DeletionProcessApprovedNotification.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
using Backbone.BuildingBlocks.Application.PushNotifications; | ||
|
||
namespace Backbone.Modules.Devices.Application.Infrastructure.PushNotifications.DeletionProcess; | ||
|
||
[NotificationText(Title = "A deletion process has been approved", Body = "One of your identity's deletion processes was approved and will be processed shortly.")] | ||
public record DeletionProcessApprovedNotification(int DaysUntilDeletion); | ||
public record DeletionProcessApprovedNotification(int DaysUntilDeletion) : IPushNotification; |
5 changes: 3 additions & 2 deletions
5
...tructure/PushNotifications/DeletionProcess/DeletionProcessCancelledByOwnerNotification.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
using Backbone.BuildingBlocks.Application.PushNotifications; | ||
|
||
namespace Backbone.Modules.Devices.Application.Infrastructure.PushNotifications.DeletionProcess; | ||
|
||
[NotificationText(Title = "A deletion process has been cancelled", Body = "One of your identity's deletion processes was cancelled by you.")] | ||
public record DeletionProcessCancelledByOwnerNotification(); | ||
public record DeletionProcessCancelledByOwnerNotification : IPushNotification; |
5 changes: 3 additions & 2 deletions
5
...ucture/PushNotifications/DeletionProcess/DeletionProcessCancelledBySupportNotification.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
using Backbone.BuildingBlocks.Application.PushNotifications; | ||
|
||
namespace Backbone.Modules.Devices.Application.Infrastructure.PushNotifications.DeletionProcess; | ||
|
||
[NotificationText(Title = "A deletion process has been cancelled", Body = "One of your identity's deletion processes was cancelled by the support team.")] | ||
public record DeletionProcessCancelledBySupportNotification(); | ||
public record DeletionProcessCancelledBySupportNotification : IPushNotification; |
5 changes: 3 additions & 2 deletions
5
...e/PushNotifications/DeletionProcess/DeletionProcessGracePeriodReminderPushNotification.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
using Backbone.BuildingBlocks.Application.PushNotifications; | ||
|
||
namespace Backbone.Modules.Devices.Application.Infrastructure.PushNotifications.DeletionProcess; | ||
|
||
[NotificationText(Title = "Your Identity will be deleted", Body = "Your Identity will be deleted in a few days. You can still cancel up to this point.")] | ||
public record DeletionProcessGracePeriodReminderPushNotification(int DaysUntilDeletion); | ||
public record DeletionProcessGracePeriodReminderPushNotification(int DaysUntilDeletion) : IPushNotification; |
5 changes: 3 additions & 2 deletions
5
...nfrastructure/PushNotifications/DeletionProcess/DeletionProcessStartedPushNotification.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
using Backbone.BuildingBlocks.Application.PushNotifications; | ||
|
||
namespace Backbone.Modules.Devices.Application.Infrastructure.PushNotifications.DeletionProcess; | ||
|
||
[NotificationText(Title = "Deletion process started", Body = "A Deletion Process was started for your Identity.")] | ||
public record DeletionProcessStartedPushNotification; | ||
public record DeletionProcessStartedPushNotification : IPushNotification; |
6 changes: 3 additions & 3 deletions
6
...otifications/DeletionProcess/DeletionProcessWaitingForApprovalReminderPushNotification.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
using Backbone.BuildingBlocks.Application.PushNotifications; | ||
|
||
namespace Backbone.Modules.Devices.Application.Infrastructure.PushNotifications.DeletionProcess; | ||
|
||
[NotificationText(Title = "Deletion process waiting for approval.", | ||
Body = "There is a deletion process for your identity that waits for your approval. If you don't approve it within a few days, the process will be terminated.")] | ||
public record DeletionProcessWaitingForApprovalReminderPushNotification(int DaysUntilApprovalPeriodEnds); | ||
public record DeletionProcessWaitingForApprovalReminderPushNotification(int DaysUntilApprovalPeriodEnds) : IPushNotification; |
9 changes: 2 additions & 7 deletions
9
...cation/Infrastructure/PushNotifications/DeletionProcess/DeletionStartsPushNotification.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,5 @@ | ||
using System.Reflection; | ||
using Backbone.Modules.Devices.Domain.Entities.Identities; | ||
using Backbone.BuildingBlocks.Application.PushNotifications; | ||
|
||
namespace Backbone.Modules.Devices.Application.Infrastructure.PushNotifications.DeletionProcess; | ||
|
||
[NotificationText(Title = "Your identity is now deleted.", Body = "")] | ||
public record DeletionStartsPushNotification | ||
{ | ||
public DeletionStartsPushNotification() => GetType().GetCustomAttribute<NotificationTextAttribute>()!.Body = IdentityDeletionConfiguration.DeletionStartsNotification.Text; | ||
}; | ||
public record DeletionStartsPushNotification : IPushNotification; |
5 changes: 3 additions & 2 deletions
5
...n/Infrastructure/PushNotifications/ExternalEvents/ExternalEventCreatedPushNotification.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
using Backbone.BuildingBlocks.Application.PushNotifications; | ||
|
||
namespace Backbone.Modules.Devices.Application.Infrastructure.PushNotifications.ExternalEvents; | ||
|
||
[NotificationText(Title = NotificationTextAttribute.DEFAULT_TITLE, Body = NotificationTextAttribute.DEFAULT_BODY)] | ||
public record ExternalEventCreatedPushNotification; | ||
public record ExternalEventCreatedPushNotification : IPushNotification; |
10 changes: 0 additions & 10 deletions
10
...ces/src/Devices.Application/Infrastructure/PushNotifications/NotificationTextAttribute.cs
This file was deleted.
Oops, something went wrong.
8 changes: 8 additions & 0 deletions
8
.../Devices/src/Devices.Application/Infrastructure/PushNotifications/TestPushNotification.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
using Backbone.BuildingBlocks.Application.PushNotifications; | ||
|
||
namespace Backbone.Modules.Devices.Application.Infrastructure.PushNotifications; | ||
|
||
public record TestPushNotification : IPushNotification | ||
{ | ||
public object? Data { get; set; } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.