diff --git a/Jugenddienst Stunden/Types/Settings.cs b/Jugenddienst Stunden/Types/Settings.cs index ce33e93..bf2e1ba 100644 --- a/Jugenddienst Stunden/Types/Settings.cs +++ b/Jugenddienst Stunden/Types/Settings.cs @@ -30,4 +30,9 @@ public class Settings { public List? Freistellungen { get; set; } public List Nominal { get; set; } + + /// + /// Version der API + /// + public string Version { get; set; } } diff --git a/Jugenddienst Stunden/ViewModels/StundenViewModel.cs b/Jugenddienst Stunden/ViewModels/StundenViewModel.cs index 9ce41c8..8ddc37b 100644 --- a/Jugenddienst Stunden/ViewModels/StundenViewModel.cs +++ b/Jugenddienst Stunden/ViewModels/StundenViewModel.cs @@ -7,6 +7,7 @@ using System.Runtime.CompilerServices; using System.Windows.Input; using CommunityToolkit.Maui.Alerts; using CommunityToolkit.Maui.Core; +using static System.Runtime.InteropServices.JavaScript.JSType; namespace Jugenddienst_Stunden.ViewModels; @@ -195,6 +196,10 @@ internal partial class StundenViewModel : ObservableObject, IQueryAttributable, try { BaseResponse dat = await HoursBase.LoadBase("hours&month=" + DateToday.ToString("MM")); _hour = dat.hour; + + if (dat.settings.Version != AppInfo.Current.VersionString) { + InfoEvent?.Invoke(this, "Du solltest deine Programmversion: " + AppInfo.Current.VersionString + " auf Version: " + dat.settings.Version + " updaten"); + } //_hour = await HoursBase.LoadData(); RefreshProperties(); } catch (Exception e) { @@ -217,12 +222,10 @@ internal partial class StundenViewModel : ObservableObject, IQueryAttributable, Settings = dat.settings; GemeindeAktivSet = Settings.GemeindeAktivSet; ProjektAktivSet = Settings.ProjektAktivSet; - OnPropertyChanged(nameof(GemeindeAktivSet)); OnPropertyChanged(nameof(ProjektAktivSet)); - List _soll; TimeSpan span = TimeSpan.Zero; bool merker = false; @@ -249,7 +252,10 @@ internal partial class StundenViewModel : ObservableObject, IQueryAttributable, } catch (Exception e) { DayTimes = new List(); //TODO: hier könnte auch ein Fehler kommen, dann wäre InfoEvent falsch. - InfoEvent?.Invoke(this, e.Message); + + if (Settings.Version != AppInfo.Current.VersionString) { + InfoEvent?.Invoke(this, "Du solltest deine Programmversion: " + AppInfo.Current.VersionString + " auf Version: " + Settings.Version + " updaten"); + } else { InfoEvent?.Invoke(this, e.Message); } } finally { OnPropertyChanged(nameof(DayTotal)); OnPropertyChanged(nameof(Sollstunden)); diff --git a/Jugenddienst Stunden/Views/StundenPage.xaml.cs b/Jugenddienst Stunden/Views/StundenPage.xaml.cs index 689540d..1234bae 100644 --- a/Jugenddienst Stunden/Views/StundenPage.xaml.cs +++ b/Jugenddienst Stunden/Views/StundenPage.xaml.cs @@ -55,7 +55,7 @@ public partial class StundenPage : ContentPage { MainThread.BeginInvokeOnMainThread(async () => { CancellationTokenSource cts = new CancellationTokenSource(); ToastDuration duration = ToastDuration.Short; - double fontSize = 20; + double fontSize = 16; var toast = Toast.Make(e, duration, fontSize); await toast.Show(cts.Token); });