MOBILE BUGFIX-ek

This commit is contained in:
2025-04-25 10:29:14 +02:00
parent 1294a00219
commit 62419a2c28
10 changed files with 266 additions and 67 deletions
+16 -7
View File
@@ -1,6 +1,7 @@
using Android.Util;
using CommunityToolkit.Maui.Alerts;
using CommunityToolkit.Maui.Core;
using DevExpress.Maui.Core.Internal;
using Microsoft.Extensions.Configuration;
using System;
using System.Collections.Generic;
@@ -18,7 +19,7 @@ namespace WorkFlowCheck.MAUI.Helper
public static string DatabaseName = "";
public static bool Syncronised = false;
public static UserDTO SystemUserDTO;
public static string ProgramVersion = "v1.1.018";
public static string ProgramVersion = "v1.1.020";
#if DEBUG
public static string ApiBaseUrl = $"https://dev.wfcapi.nuvolar.hu/";
@@ -57,20 +58,20 @@ namespace WorkFlowCheck.MAUI.Helper
}
}
public async static Task ShowSnackBar(string message,
string actionButtonTextColor = "#FF0000",
string backgroundColor = "#FF0000",
string textColor = "#FF0000",
string actionButtonTextColor = "#FFFFFF00",
string backgroundColor = "#FFFF0000",
string textColor = "##FFFFFF00",
int duration = 10,
string actionButtonText = "Ok",
Func<Task> action = null)
{
var visualOptions = new SnackbarOptions
{
ActionButtonTextColor = Colors.Yellow,
ActionButtonTextColor = Color.FromArgb(actionButtonTextColor),
CornerRadius = new CornerRadius(10),
Font = Microsoft.Maui.Font.SystemFontOfSize(16),
BackgroundColor = Colors.Red,
TextColor = Colors.Yellow
BackgroundColor = Color.FromArgb(backgroundColor),
TextColor = Color.FromArgb(textColor)
};
var snackbar = Snackbar.Make(
@@ -86,5 +87,13 @@ namespace WorkFlowCheck.MAUI.Helper
);
await snackbar.Show();
}
public static string ColorToHex(Color color)
{
// ARGB értékek lekérése
uint colorInt = (uint)color.ToArgb();
// Hexadecimális stringgé alakítás, és a '#'-t is hozzáadjuk
return $"#{colorInt:X8}";
}
}
}
@@ -38,32 +38,61 @@
</HorizontalStackLayout>
</Grid>
</Shell.TitleView>
<Grid RowDefinitions="*,*" Padding="30,30">
<Frame Grid.Row="0"
<Grid RowDefinitions="*,4*,2*" Padding="30,30">
<VerticalStackLayout Grid.Row="0" Margin="0,0,0,0">
<Label x:Name="progressLabel" Text="Folyamatjelző" FontSize="Medium" HorizontalOptions="Center" />
<HorizontalStackLayout HorizontalOptions="Center" Spacing="10">
<ActivityIndicator x:Name="LoadingIndicator"
IsRunning="False"
IsVisible="False"
VerticalOptions="Center"
HorizontalOptions="Center" />
<ProgressBar x:Name="progressBar"
WidthRequest="310"
HeightRequest="30"
VerticalOptions="Center" />
<Button x:Name="SyncBtn"
ImageSource="cloud_download"
Text=""
Clicked="OnSyncClicked"
HeightRequest="50"
MaximumHeightRequest="50"
WidthRequest="50"
MaximumWidthRequest="50"
CornerRadius="25"
VerticalOptions="Center" />
</HorizontalStackLayout>
</VerticalStackLayout>
<Frame Grid.Row="1"
BorderColor="Gray"
Padding="5"
Margin="1"
CornerRadius="10"
HasShadow="True">
<ScrollView >
<VerticalStackLayout>
<Label Text="Megkezdett ellenőrzések" FontAttributes="Bold" FontSize="Medium" HorizontalOptions="Center" />
<CollectionView x:Name="CheckList">
<CollectionView.ItemTemplate>
<DataTemplate>
<Frame BorderColor="Gray" Padding="15" Margin="5" HasShadow="True" BackgroundColor="WhiteSmoke">
<Grid ColumnDefinitions="*,Auto">
<!-- Bal oldali oszlop: Két Label egymás alatt -->
<StackLayout Grid.Column="0" Spacing="2">
<Label Text="{Binding DocumentNumber}" FontSize="14" FontAttributes="Bold" />
<Label Text="{Binding DateExecution}" FontSize="12" />
<Label Text="{Binding CheckListTemplateHeaderDTO.ShortName}" FontSize="10" />
<Label Text="{Binding StatusName}" FontSize="10" />
</StackLayout>
<RefreshView x:Name="CheckListRefreshView"
IsRefreshing="{Binding IsRefreshing}"
Command="{Binding RefreshCommand}">
<ScrollView >
<VerticalStackLayout>
<Label Text="Megkezdett ellenőrzések" FontAttributes="Bold" FontSize="Medium" HorizontalOptions="Center" />
<CollectionView x:Name="CheckList">
<CollectionView.ItemTemplate>
<DataTemplate>
<Frame BorderColor="Gray" Padding="15" Margin="5" HasShadow="True" BackgroundColor="WhiteSmoke">
<Grid ColumnDefinitions="*,Auto">
<!-- Bal oldali oszlop: Két Label egymás alatt -->
<StackLayout Grid.Column="0" Spacing="2">
<Label Text="{Binding DocumentNumber}" FontSize="14" FontAttributes="Bold" />
<Label Text="{Binding DateExecution}" FontSize="12" />
<Label Text="{Binding CheckListTemplateHeaderDTO.ShortName}" FontSize="10" />
<Label Text="{Binding StatusName}" FontSize="10" />
</StackLayout>
<!-- Jobb oldali oszlop: Két gomb egymás mellett -->
<HorizontalStackLayout Grid.Column="1" HorizontalOptions="End" Spacing="3">
<Button Text=""
<!-- Jobb oldali oszlop: Két gomb egymás mellett -->
<HorizontalStackLayout Grid.Column="1" HorizontalOptions="End" Spacing="3">
<Button Text=""
Margin="0,0,0,0"
ImageSource="arrow_down.svg"
BackgroundColor="Red"
@@ -75,20 +104,21 @@
IsVisible="{Binding CheckStatus, Converter={StaticResource BlockedConverter}}"
Command="{Binding BindingContext.BlockCommand, Source={x:Reference CheckList}}"
CommandParameter="{Binding .}">
</Button>
<Button Text="Feloldás"
</Button>
<Button Text=""
ImageSource="arrow_up.svg"
Margin="0,0,0,0"
BackgroundColor="Green"
HeightRequest="50"
MaximumHeightRequest="50"
WidthRequest="120"
MaximumWidthRequest="120"
WidthRequest="50"
MaximumWidthRequest="50"
CornerRadius="25"
IsVisible="{Binding CheckStatus, Converter={StaticResource UnBlockedConverter}}"
Command="{Binding BindingContext.UnblockCommand, Source={x:Reference CheckList}}"
CommandParameter="{Binding .}">
</Button>
<Button Text=""
</Button>
<Button Text=""
ImageSource="check_circle.svg"
Margin="0,0,0,0"
BackgroundColor="DarkGreen"
@@ -100,8 +130,8 @@
IsVisible="{Binding CheckStatus, Converter={StaticResource AcceptConverter}}"
Command="{Binding BindingContext.AcceptCommand, Source={x:Reference CheckList}}"
CommandParameter="{Binding .}">
</Button>
<Button Text=""
</Button>
<Button Text=""
ImageSource="arrow_right.svg"
Margin="0,0,0,0"
BackgroundColor="Blue"
@@ -113,18 +143,19 @@
IsVisible="{Binding CheckStatus, Converter={StaticResource ContinueConverter}, ConverterParameter = {Binding IsNFCSupported}}"
Command="{Binding BindingContext.ContinueCommand, Source={x:Reference CheckList}}"
CommandParameter="{Binding .}">
</Button>
</HorizontalStackLayout>
</Grid>
</Frame>
</DataTemplate>
</CollectionView.ItemTemplate>
</CollectionView>
</VerticalStackLayout>
</ScrollView>
</Button>
</HorizontalStackLayout>
</Grid>
</Frame>
</DataTemplate>
</CollectionView.ItemTemplate>
</CollectionView>
</VerticalStackLayout>
</ScrollView>
</RefreshView>
</Frame>
<Frame Grid.Row="1"
<Frame Grid.Row="2"
BorderColor="Gray"
Padding="5"
Margin="1"
@@ -27,6 +27,7 @@ public partial class CheckListPage : ContentPage
public ICommand UnblockCommand { get; set; }
public ICommand BlockCommand { get; set; }
public ICommand AcceptCommand { get; set; }
public ICommand RefreshCommand { get; }
public bool IsLoading
{
@@ -47,6 +48,20 @@ public partial class CheckListPage : ContentPage
}
}
private bool _isRefreshing;
public bool IsRefreshing
{
get => _isRefreshing;
set
{
if (_isRefreshing != value)
{
_isRefreshing = value;
OnPropertyChanged(nameof(IsRefreshing));
}
}
}
public CheckListPage()
{
InitializeComponent();
@@ -58,8 +73,55 @@ public partial class CheckListPage : ContentPage
UnblockCommand = new Command<CheckListHeaderDTO>(OnUnblockItem);
BlockCommand = new Command<CheckListHeaderDTO>(OnBlockItem);
AcceptCommand = new Command<CheckListHeaderDTO>(OnAcceptItem);
RefreshCommand = new Command(async () => await OnRefresh());
}
private async void OnSyncClicked(object sender, EventArgs e)
{
SyncBtn.IsEnabled = false;
LoadingIndicator.IsRunning = true;
LoadingIndicator.IsVisible = true;
progressLabel.Text = "Szinkronizálás indítása...";
progressBar.Progress = 0;
try
{
await Task.Run(async () =>
{
await _syncService.SyncCheckListHeader_Down((percentage, infostring) =>
{
// Direkt UI frissítés
MainThread.BeginInvokeOnMainThread(() =>
{
progressBar.Progress = percentage / 100;
progressLabel.Text = $"{infostring}: {percentage:0.00}%";
});
});
});
SystemHelper.Syncronised = true;
progressLabel.Text = "Szinkronizálás befejezve!";
}
catch (Exception ex)
{
progressLabel.Text = $"Hiba történt: {ex.Message}";
}
finally
{
SyncBtn.IsEnabled = true;
LoadingIndicator.IsVisible = false;
LoadingIndicator.IsRunning = false;
}
}
private async Task OnRefresh()
{
IsRefreshing = true;
//await _syncService.SyncCheckListHeader_Down((d, s) => { });
await LoadCheckList();
IsRefreshing = false;
}
private void SetInfo()
{
@@ -170,18 +232,55 @@ public partial class CheckListPage : ContentPage
bool answer = await DisplayAlert("Megerõsítés", "Biztosan feloldod a blokkolást?", "Igen", "Mégsem");
if (answer)
{
await _checkListService.UnBlockCheckListHeader(checkListHeaderDTO);
await LoadCheckList();
var success = await _checkListService.UnBlockCheckListHeader(checkListHeaderDTO);
if (success)
{
IsRefreshing = true;
await LoadCheckList();
IsRefreshing = false;
await SystemHelper.ShowSnackBar("Blokkolás feloldás sikeres!",
SystemHelper.ColorToHex(Colors.Green),
SystemHelper.ColorToHex(Colors.Green),
SystemHelper.ColorToHex(Colors.White),
5);
}
else
{
await SystemHelper.ShowSnackBar("Blokkolás feloldás SIKERTELEN!",
SystemHelper.ColorToHex(Colors.Red),
SystemHelper.ColorToHex(Colors.Red),
SystemHelper.ColorToHex(Colors.Yellow),
15);
}
}
}
private async void OnBlockItem(CheckListHeaderDTO checkListHeaderDTO)
{
bool answer = await DisplayAlert("Megerõsítés", "Biztosan blokkolod a folyamatot?", "Igen", "Mégsem");
if (answer)
{
await _checkListService.BlockCheckListHeader(checkListHeaderDTO);
await LoadCheckList();
var success = await _checkListService.BlockCheckListHeader(checkListHeaderDTO);
if (success)
{
IsRefreshing = true;
await LoadCheckList();
IsRefreshing = false;
await SystemHelper.ShowSnackBar("Blokkolás sikeres!",
SystemHelper.ColorToHex(Colors.Green),
SystemHelper.ColorToHex(Colors.Green),
SystemHelper.ColorToHex(Colors.White),
5);
}
else
{
await SystemHelper.ShowSnackBar("Blokkolás SIKERTELEN!",
SystemHelper.ColorToHex(Colors.Red),
SystemHelper.ColorToHex(Colors.Red),
SystemHelper.ColorToHex(Colors.Yellow),
15);
}
}
}
private async void OnAcceptItem(CheckListHeaderDTO checkListHeaderDTO)
@@ -189,8 +288,27 @@ public partial class CheckListPage : ContentPage
bool answer = await DisplayAlert("Megerõsítés", "Biztosan jóváhagyod a folyamatot?", "Igen", "Mégsem");
if (answer)
{
await _checkListService.AcceptCheckListHeader(checkListHeaderDTO);
await LoadCheckList();
var success = await _checkListService.AcceptCheckListHeader(checkListHeaderDTO);
if (success)
{
IsRefreshing = true;
await LoadCheckList();
IsRefreshing = false;
await SystemHelper.ShowSnackBar("Jóváhagyás sikeres!",
SystemHelper.ColorToHex(Colors.Green),
SystemHelper.ColorToHex(Colors.Green),
SystemHelper.ColorToHex(Colors.White),
5);
}
else
{
await SystemHelper.ShowSnackBar("Jóváhagyás SIKERTELEN!",
SystemHelper.ColorToHex(Colors.Red),
SystemHelper.ColorToHex(Colors.Red),
SystemHelper.ColorToHex(Colors.Yellow),
15);
}
}
}
private async Task LoadCheckListTemplate()
@@ -43,8 +43,8 @@ public partial class CheckListWorkPage : ContentPage
_syncService = MauiProgram.ServiceProvider.GetRequiredService<ISyncService>();
_userService = MauiProgram.ServiceProvider.GetRequiredService<IUserService>();
SaveCommand = new Command(OnSave);
SendCommand = new Command(OnSend);
SaveCommand = new Command(async () => await OnSave());
SendCommand = new Command(async () => await OnSend());
}
private async Task SetInfo()
{
@@ -60,14 +60,14 @@ public partial class CheckListWorkPage : ContentPage
}
}
private async void OnSend()
private async Task OnSend()
{
IsLoading = true;
sendButton.IsEnabled = false;
saveButton.IsEnabled = false;
try
{
OnSave();
await OnSave();
await Task.Run(async () =>
{
@@ -109,7 +109,7 @@ public partial class CheckListWorkPage : ContentPage
}
}
private async void OnSave()
private async Task OnSave()
{
IsLoading = true;
try
@@ -156,6 +156,7 @@ public partial class CheckListWorkPage : ContentPage
{
if (MediaPicker.IsCaptureSupported)
{
await OnSave();
var photo = await MediaPicker.CapturePhotoAsync();
if (photo != null)
{
@@ -3,7 +3,7 @@
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="WorkFlowCheck.MAUI.Pages.Security.LoginPage"
xmlns:local="clr-namespace:WorkFlowCheck.MAUI.Pages"
Title="Workflow Check Application (v1.1.018)"
Title=""
BackgroundColor="#f0f0f0">
<ContentView x:Name="LoginContent">
@@ -33,10 +33,9 @@ public partial class LoginPage : BasePage
if (response != null && response.IsSuccess)
{
_userService.SetCurrentUser(response.Data);
SystemHelper.SystemUserDTO = response.Data;
//await _syncService.SyncDatas();
var wFCUser = Newtonsoft.Json.JsonConvert.SerializeObject(response.Data);
await SecureStorage.Default.SetAsync("WFCUser", "wFCUser");
@@ -67,10 +66,27 @@ public partial class LoginPage : BasePage
await snackbar.Show();
}
}
catch (Exception)
catch (Exception ex)
{
var visualOptions = new SnackbarOptions
{
ActionButtonTextColor = Colors.Yellow,
CornerRadius = new CornerRadius(10),
Font = Microsoft.Maui.Font.SystemFontOfSize(16),
BackgroundColor = Microsoft.Maui.Graphics.Color.Parse("Red"),
TextColor = Colors.Yellow
};
var snackbar = Snackbar.Make(
"Invalid login credentials.",
duration: TimeSpan.FromSeconds(10),
action: () => Console.WriteLine("Snackbar dismissed"),
actionButtonText: "OK",
visualOptions: visualOptions
);
await snackbar.Show();
throw;
}
finally
{
@@ -101,8 +117,7 @@ public partial class LoginPage : BasePage
if (response != null && response.IsSuccess)
{
_userService.SetCurrentUser(response.Data);
//await _syncService.SyncDatas();
SystemHelper.SystemUserDTO = response.Data;
var wFCUser = Newtonsoft.Json.JsonConvert.SerializeObject(response.Data);
await SecureStorage.Default.SetAsync("WFCUser", "wFCUser");
@@ -0,0 +1,4 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="#FFFFFF" class="bi bi-cloud-download" viewBox="0 0 16 16">
<path d="M4.406 1.342A5.53 5.53 0 0 1 8 0c2.69 0 4.923 2 5.166 4.579C14.758 4.804 16 6.137 16 7.773 16 9.569 14.502 11 12.687 11H10a.5.5 0 0 1 0-1h2.688C13.979 10 15 8.988 15 7.773c0-1.216-1.02-2.228-2.313-2.228h-.5v-.5C12.188 2.825 10.328 1 8 1a4.53 4.53 0 0 0-2.941 1.1c-.757.652-1.153 1.438-1.153 2.055v.448l-.445.049C2.064 4.805 1 5.952 1 7.318 1 8.785 2.23 10 3.781 10H6a.5.5 0 0 1 0 1H3.781C1.708 11 0 9.366 0 7.318c0-1.763 1.266-3.223 2.942-3.593.143-.863.698-1.723 1.464-2.383"/>
<path d="M7.646 15.854a.5.5 0 0 0 .708 0l3-3a.5.5 0 0 0-.708-.708L8.5 14.293V5.5a.5.5 0 0 0-1 0v8.793l-2.146-2.147a.5.5 0 0 0-.708.708z"/>
</svg>

After

Width:  |  Height:  |  Size: 765 B

@@ -188,7 +188,7 @@ namespace WorkFlowCheck.MAUI.Services
if (checkListHeader != null)
{
var userDTO = _userService.GetCurrentUser();
var endpoint = $"{_httpClient.BaseAddress}api/CheckList/BlockCheckListHeader/{checkListHeaderDTO.Id}/{userDTO.Id}";
var endpoint = $"{_httpClient.BaseAddress}api/CheckList/UnBlockCheckListHeader/{checkListHeaderDTO.Id}/{userDTO.Id}";
var response = await _httpClient.GetFromJsonAsync<ApiResponseDTO<bool>>(endpoint);
if (response != null)
{
@@ -219,7 +219,7 @@ namespace WorkFlowCheck.MAUI.Services
if (checkListHeader != null)
{
var userDTO = _userService.GetCurrentUser();
var endpoint = $"{_httpClient.BaseAddress}api/CheckList/UnBlockCheckListHeader/{checkListHeaderDTO.Id}/{userDTO.Id}";
var endpoint = $"{_httpClient.BaseAddress}api/CheckList/BlockCheckListHeader/{checkListHeaderDTO.Id}/{userDTO.Id}";
var response = await _httpClient.GetFromJsonAsync<ApiResponseDTO<bool>>(endpoint);
if (response != null)
{
+20 -1
View File
@@ -34,7 +34,7 @@ namespace WorkFlowCheck.MAUI.Services
await SyncEquipments_Down(reportProgress);
await SyncCheckListTemplates_Down(reportProgress);
await SyncCheckListHeader_Down(reportProgress);
await SyncUsers_Down(reportProgress);
await SyncUsers_Down(reportProgress);
}
public async Task DownloadAPK(Action<double, string> reportProgress)
{
@@ -290,6 +290,25 @@ namespace WorkFlowCheck.MAUI.Services
reportProgress(itemPercentage, "Adatbázis szinkronizáció..."); // Közvetlen progress jelentés
i++;
}
foreach (var checkListHeaderDTO in responseList.Data)
{
var checkListHeader = await _dbContext.CheckListHeaders.Where(w => w.Id == checkListHeaderDTO.Id).FirstOrDefaultAsync();
if (checkListHeader != null)
{
checkListHeader.CheckStatus = checkListHeaderDTO.CheckStatus;
await _dbContext.SaveChangesAsync();
//foreach (var checkListRow in checkListHeader.CheckListRows)
//{
// var checkListRowDTO = checkListHeaderDTO.CheckListRowDTO.Where(w => w.GuidNumber == checkListRow.GuidNumber).FirstOrDefault();
// if (checklistrow{
// }
//}
}
}
}
}
catch (Exception ex)
@@ -83,6 +83,8 @@
<PackageReference Include="Microsoft.Maui.Controls.Compatibility" Version="$(MauiVersion)" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="8.0.1" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="Serilog" Version="4.2.0" />
<PackageReference Include="Serilog.Sinks.File" Version="6.0.0" />
<PackageReference Include="SixLabors.ImageSharp" Version="3.1.7" />
<PackageReference Include="SkiaSharp" Version="3.116.1" />
<PackageReference Include="sqlite-net-pcl" Version="1.9.172" />