generated from Integry/Template_NetMauiBlazorHybrid
38 lines
1.2 KiB
C#
38 lines
1.2 KiB
C#
using IntegryApiClient.Core.Domain.Abstraction.Contracts.Account;
|
|
using IntegryApiClient.Core.Domain.RestClient.Contacts;
|
|
using Microsoft.Extensions.Logging;
|
|
using salesbook.Maui.Core.RestClient.IntegryApi.Dto;
|
|
using salesbook.Shared.Core.Interface.IntegryApi;
|
|
|
|
namespace salesbook.Maui.Core.RestClient.IntegryApi;
|
|
|
|
public class IntegryRegisterNotificationRestClient(
|
|
ILogger<IntegryRegisterNotificationRestClient> logger,
|
|
IUserSession userSession,
|
|
IIntegryApiRestClient integryApiRestClient
|
|
) : IIntegryRegisterNotificationRestClient
|
|
{
|
|
public async Task Register(string fcmToken, ILogger? logger1 = null)
|
|
{
|
|
logger1 ??= logger;
|
|
|
|
var userDeviceToken = new RegisterDeviceDTO()
|
|
{
|
|
UserDeviceToken = new WtbUserDeviceTokenDTO()
|
|
{
|
|
DeviceToken = fcmToken,
|
|
Platform = OperatingSystem.IsAndroid() ? "Android" : "iOS",
|
|
Username = userSession.User.Username
|
|
}
|
|
};
|
|
try
|
|
{
|
|
await integryApiRestClient.AuthorizedPost<object>($"device_tokens/insert", userDeviceToken,
|
|
logger: logger1);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
SentrySdk.CaptureException(ex);
|
|
}
|
|
}
|
|
} |