4using System.Threading.Tasks;
20 private const int MaxAttempts = 3;
28 this.xmppService = XmppService;
40 CancellationToken.ThrowIfCancellationRequested();
46 if (
string.IsNullOrEmpty(Token))
51 (Attempt,
_) => TimeSpan.FromSeconds(Math.Pow(2, Attempt - 1)),
53 "Push token registration retry scheduled.",
54 new KeyValuePair<string, object?>(
"attempt", Attempt),
55 new KeyValuePair<string, object?>(
"delayMs", delay.TotalMilliseconds),
56 new KeyValuePair<string, object?>(
"exception", ex.Message)));
81 "Push token reported.",
93 return (DateTime.UtcNow.Subtract(ReportDate).TotalDays > 7) || (TokenInformation.Token != OldToken);
Runtime setting key names.
const string PushNotificationReportDate
When push-notification token was reported.
const string PushNotificationToken
Push-notification token.
A set of never changing property constants and helpful values.
Handles deduplication and reporting of push notification tokens to the broker.
async Task< bool > ReportTokenAsync(TokenInformation TokenInformation, bool ForceReport, CancellationToken CancellationToken)
Reports a push token to the broker if needed, applying deduplication and force rules.
PushTokenRegistrar(IXmppService XmppService)
Initializes a new instance of the PushTokenRegistrar class.
Executes async operations through a pipeline of policies (timeout, retry, bulkhead,...
Base class that references services in the app.
static ILogService LogService
Log service.
Static class managing persistent settings.
static async Task< string > GetAsync(string Key, string DefaultValue)
Gets a string-valued setting.
static async Task< bool > SetAsync(string Key, string Value)
Sets a string-valued setting.
Handles persistence and reporting of push notification tokens.
Represents an abstraction of a connection to an XMPP Server.