-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(push): use APNs instead of FCM for Apple devices (#219)
* feat(push): use APNs instead of FCM for Apple devices * fix(push): use CertContent and singletons * feat(push): enable use of APNs dev server * refactor(push): move expo to separate configuration * refactor(push): improved DRYness and documentation
- Loading branch information
Showing
17 changed files
with
626 additions
and
84 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
25 changes: 25 additions & 0 deletions
25
src/Eurofurence.App.Server.Services/Abstractions/PushNotifications/ApnsConfiguration.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,25 @@ | ||
using Microsoft.Extensions.Configuration; | ||
|
||
namespace Eurofurence.App.Server.Services.Abstractions.PushNotifications | ||
{ | ||
public class ApnsConfiguration | ||
{ | ||
public bool IsConfigured => !string.IsNullOrWhiteSpace(BundleId) && !string.IsNullOrWhiteSpace(CertContent) && !string.IsNullOrWhiteSpace(KeyId) && !string.IsNullOrWhiteSpace(TeamId); | ||
public string BundleId { get; set; } | ||
public string CertFilePath { get; set; } | ||
public string CertContent { get; set; } | ||
public string KeyId { get; set; } | ||
public string TeamId { get; set; } | ||
public bool UseDevelopmentServer { get; set; } | ||
|
||
public static ApnsConfiguration FromConfiguration(IConfiguration configuration) | ||
=> new ApnsConfiguration | ||
{ | ||
BundleId = configuration["push:apns:bundleId"], | ||
CertContent = configuration["push:apns:certContent"], | ||
KeyId = configuration["push:apns:keyId"], | ||
TeamId = configuration["push:apns:teamId"], | ||
UseDevelopmentServer = bool.TryParse(configuration["push:apns:useDevelopmentServer"], out bool shouldUseDevelopmentServer) ? shouldUseDevelopmentServer : true, | ||
}; | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
src/Eurofurence.App.Server.Services/Abstractions/PushNotifications/ExpoConfiguration.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,18 @@ | ||
using Microsoft.Extensions.Configuration; | ||
|
||
namespace Eurofurence.App.Server.Services.Abstractions.PushNotifications | ||
{ | ||
public class ExpoConfiguration | ||
{ | ||
public bool IsConfigured => !string.IsNullOrWhiteSpace(ExperienceId) && !string.IsNullOrWhiteSpace(ScopeKey); | ||
public string ExperienceId { get; set; } | ||
public string ScopeKey { get; set; } | ||
|
||
public static ExpoConfiguration FromConfiguration(IConfiguration configuration) | ||
=> new ExpoConfiguration | ||
{ | ||
ExperienceId = configuration["push:expo:experienceId"], | ||
ScopeKey = configuration["push:expo:scopeKey"] | ||
}; | ||
} | ||
} |
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.