Üzenetküldés frontenden

This commit is contained in:
2025-04-07 17:05:40 +02:00
parent a3be387ee1
commit b02fb58f2e
14 changed files with 338 additions and 70 deletions
@@ -1,14 +1,18 @@
using Android.Content;
using Android.Util;
using AutoMapper;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using Microsoft.IdentityModel.Tokens;
using Newtonsoft.Json;
using System.Net.Http.Json;
using System.Text;
using WorkFlowCheck.Common.DTO;
using WorkFlowCheck.MAUI.DataLayer;
using WorkFlowCheck.MAUI.DataLayer.Entities;
using WorkFlowCheck.MAUI.Handlers;
using WorkFlowCheck.MAUI.Services.Interfaces;
using static Android.Renderscripts.ScriptGroup;
using Location = WorkFlowCheck.MAUI.DataLayer.Entities.Location;
namespace WorkFlowCheck.MAUI.Services
@@ -16,10 +20,13 @@ namespace WorkFlowCheck.MAUI.Services
public class SyncService : BaseService, ISyncService
{
private readonly IUserService _userService;
public SyncService(HttpClient httpClient, IConfiguration configuration, AppDbContext dbContext, IMapper mapper, IUserService userService) : base(httpClient, configuration, dbContext, mapper)
{
_userService = userService;
}
public async Task SyncDatas(Action<double, string> reportProgress)
{
await SyncCheckPoints_Down(reportProgress);
@@ -372,5 +379,28 @@ namespace WorkFlowCheck.MAUI.Services
var responseList = JsonConvert.DeserializeObject<ApiResponseDTO<List<T>>>(jsonString);
return responseList;
}
public async Task<List<DeviceMessageDTO>> DeviceMessageReadUnreaded(string deviceId)
{
var deviceIdBase64= Base64UrlEncoder.Encode(Encoding.UTF8.GetBytes(deviceId));
string endpoint = $"{_httpClient.BaseAddress}api/Sync/DeviceMessageReadUnreaded/{deviceIdBase64}";
var retVal = new List<DeviceMessageDTO>();
try
{
var response = await _httpClient.GetFromJsonAsync<ApiResponseDTO<List<DeviceMessageDTO>>>(endpoint);
if (response != null)
{
if (response.IsSuccess)
{
return response.Data;
}
}
}
catch (Exception ex)
{
}
return retVal;
}
}
}