Figyelmeztető üzenet javítása + hangjelzés
This commit is contained in:
@@ -5,6 +5,7 @@ using Microsoft.Extensions.DependencyInjection;
|
|||||||
using System.Threading;
|
using System.Threading;
|
||||||
using WorkFlowCheck.Common.DTO;
|
using WorkFlowCheck.Common.DTO;
|
||||||
using WorkFlowCheck.MAUI.DataLayer;
|
using WorkFlowCheck.MAUI.DataLayer;
|
||||||
|
using WorkFlowCheck.MAUI.Helper;
|
||||||
using WorkFlowCheck.MAUI.Services;
|
using WorkFlowCheck.MAUI.Services;
|
||||||
using WorkFlowCheck.MAUI.Services.Interfaces;
|
using WorkFlowCheck.MAUI.Services.Interfaces;
|
||||||
|
|
||||||
@@ -70,7 +71,7 @@ namespace WorkFlowCheck.MAUI
|
|||||||
{
|
{
|
||||||
var userDTO = _userService.GetCurrentUser();
|
var userDTO = _userService.GetCurrentUser();
|
||||||
|
|
||||||
if (userDTO != null && userDTO.Id > 0)
|
if (userDTO != null && userDTO.Id > 0 && SystemHelper.Syncronised)
|
||||||
{
|
{
|
||||||
if (userDTO.RoleDTO?.Count > 0)
|
if (userDTO.RoleDTO?.Count > 0)
|
||||||
{
|
{
|
||||||
@@ -81,7 +82,13 @@ namespace WorkFlowCheck.MAUI
|
|||||||
var deviceMessageDTOList = await _syncService.DeviceMessageReadUnreaded(_userService.DeviceId.ToUpper());
|
var deviceMessageDTOList = await _syncService.DeviceMessageReadUnreaded(_userService.DeviceId.ToUpper());
|
||||||
if (deviceMessageDTOList != null && deviceMessageDTOList.Count > 0)
|
if (deviceMessageDTOList != null && deviceMessageDTOList.Count > 0)
|
||||||
{
|
{
|
||||||
await ShowSnackbar(deviceMessageDTOList[0].Message);
|
await ShowSnackbar(deviceMessageDTOList[0].Message, async () => await GoToCheckListPage());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
deviceMessageDTOList = await _syncService.DeviceMessageReadUnreadedRole(roleDTO.Id);
|
||||||
|
if (deviceMessageDTOList != null && deviceMessageDTOList.Count > 0)
|
||||||
|
{
|
||||||
|
await ShowSnackbar(deviceMessageDTOList[0].Message, async () => await GoToCheckListPage());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -96,8 +103,32 @@ namespace WorkFlowCheck.MAUI
|
|||||||
await Task.Delay(TimeSpan.FromSeconds(5), cancellationToken);
|
await Task.Delay(TimeSpan.FromSeconds(5), cancellationToken);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private async Task ShowSnackbar(string message)
|
private async Task GoToCheckListPage()
|
||||||
{
|
{
|
||||||
|
await Shell.Current.GoToAsync("//CheckListPage");
|
||||||
|
}
|
||||||
|
private async Task ShowSnackbar(string message, Func<Task> action)
|
||||||
|
{
|
||||||
|
#if ANDROID
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var context = Android.App.Application.Context;
|
||||||
|
var player = Android.Media.MediaPlayer.Create(context, Resource.Raw.siren_alert);
|
||||||
|
player.Start();
|
||||||
|
|
||||||
|
// Ha lejátszás után el akarod engedni az erőforrást:
|
||||||
|
player.Completion += (s, e) =>
|
||||||
|
{
|
||||||
|
player.Release();
|
||||||
|
player.Dispose();
|
||||||
|
};
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Console.WriteLine("Hanglejátszás hiba: " + ex.Message);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
var visualOptions = new SnackbarOptions
|
var visualOptions = new SnackbarOptions
|
||||||
{
|
{
|
||||||
ActionButtonTextColor = Colors.Yellow,
|
ActionButtonTextColor = Colors.Yellow,
|
||||||
@@ -105,17 +136,18 @@ namespace WorkFlowCheck.MAUI
|
|||||||
Font = Microsoft.Maui.Font.SystemFontOfSize(16),
|
Font = Microsoft.Maui.Font.SystemFontOfSize(16),
|
||||||
BackgroundColor = Microsoft.Maui.Graphics.Color.Parse("Red"),
|
BackgroundColor = Microsoft.Maui.Graphics.Color.Parse("Red"),
|
||||||
TextColor = Colors.Yellow
|
TextColor = Colors.Yellow
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
var snackbar = Snackbar.Make(message,
|
var snackbar = Snackbar.Make(message,
|
||||||
duration: TimeSpan.FromSeconds(10),
|
duration: TimeSpan.FromSeconds(10),
|
||||||
action: () => Console.WriteLine("Snackbar dismissed"),
|
action: async () => await action(),
|
||||||
actionButtonText: "OK",
|
actionButtonText: "OK",
|
||||||
visualOptions: visualOptions
|
visualOptions: visualOptions
|
||||||
);
|
);
|
||||||
|
|
||||||
await snackbar.Show();
|
await snackbar.Show();
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task<ApiResponseDTO<UserDTO>> CheckSecurity()
|
private async Task<ApiResponseDTO<UserDTO>> CheckSecurity()
|
||||||
{
|
{
|
||||||
var isLogged = await SecureStorage.Default.GetAsync("WFCUser");
|
var isLogged = await SecureStorage.Default.GetAsync("WFCUser");
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ namespace WorkFlowCheck.MAUI.Helper
|
|||||||
public static class SystemHelper
|
public static class SystemHelper
|
||||||
{
|
{
|
||||||
public static string DatabaseName = "";
|
public static string DatabaseName = "";
|
||||||
|
public static bool Syncronised = false;
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
public static string ApiBaseUrl = $"https://dev.wfcapi.nuvolar.hu/";
|
public static string ApiBaseUrl = $"https://dev.wfcapi.nuvolar.hu/";
|
||||||
public static string ApiKey = $"RUJeLSpSMzVASUdaRCEzUyYxRSE0VyFISFRSJC0zRzhLM1hCSDU=";
|
public static string ApiKey = $"RUJeLSpSMzVASUdaRCEzUyYxRSE0VyFISFRSJC0zRzhLM1hCSDU=";
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
using Android.DeviceLock;
|
using Android.DeviceLock;
|
||||||
using WorkFlowCheck.Common.DTO;
|
using WorkFlowCheck.Common.DTO;
|
||||||
|
using WorkFlowCheck.MAUI.Helper;
|
||||||
using WorkFlowCheck.MAUI.Services.Interfaces;
|
using WorkFlowCheck.MAUI.Services.Interfaces;
|
||||||
|
|
||||||
namespace WorkFlowCheck.MAUI.Pages.System;
|
namespace WorkFlowCheck.MAUI.Pages.System;
|
||||||
@@ -49,7 +50,7 @@ public partial class SyncPage : ContentPage
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
SystemHelper.Syncronised = true;
|
||||||
progressLabel.Text = "Szinkronizálás befejezve!";
|
progressLabel.Text = "Szinkronizálás befejezve!";
|
||||||
await Shell.Current.GoToAsync("//MainPage");
|
await Shell.Current.GoToAsync("//MainPage");
|
||||||
}
|
}
|
||||||
|
|||||||
Binary file not shown.
@@ -22,6 +22,7 @@ namespace WorkFlowCheck.MAUI.Services.Interfaces
|
|||||||
Task<ApiResponseDTO<string>> SyncCheckListHeader_Up(int Id, Action<double, string> reportProgress);
|
Task<ApiResponseDTO<string>> SyncCheckListHeader_Up(int Id, Action<double, string> reportProgress);
|
||||||
|
|
||||||
Task<List<DeviceMessageDTO>> DeviceMessageReadUnreaded(string deviceIdBase64);
|
Task<List<DeviceMessageDTO>> DeviceMessageReadUnreaded(string deviceIdBase64);
|
||||||
|
Task<List<DeviceMessageDTO>> DeviceMessageReadUnreadedRole(int roleId);
|
||||||
|
|
||||||
Task<ApiResponseDTO<string>> SyncUsers_Up(Action<double, string> reportProgress);
|
Task<ApiResponseDTO<string>> SyncUsers_Up(Action<double, string> reportProgress);
|
||||||
Task SyncUsers_Down(Action<double, string> reportProgress);
|
Task SyncUsers_Down(Action<double, string> reportProgress);
|
||||||
|
|||||||
@@ -405,6 +405,27 @@ namespace WorkFlowCheck.MAUI.Services
|
|||||||
}
|
}
|
||||||
return retVal;
|
return retVal;
|
||||||
}
|
}
|
||||||
|
public async Task<List<DeviceMessageDTO>> DeviceMessageReadUnreadedRole(int roleId)
|
||||||
|
{
|
||||||
|
string endpoint = $"{_httpClient.BaseAddress}api/Sync/DeviceMessageReadUnreadedRole/{roleId}";
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
public async Task<ApiResponseDTO<string>> SyncUsers_Up(Action<double, string> reportProgress)
|
public async Task<ApiResponseDTO<string>> SyncUsers_Up(Action<double, string> reportProgress)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user