58 lines
1.6 KiB
C#
58 lines
1.6 KiB
C#
using CommunityToolkit.Maui.Views;
|
|
using CommunityToolkit.Mvvm.ComponentModel;
|
|
using CommunityToolkit.Mvvm.Input;
|
|
|
|
namespace gehGassiApp.ViewModels.Popups
|
|
{
|
|
/// <summary>
|
|
/// ViewModel für das Zahlungshinweis-Popup
|
|
///
|
|
/// Verwendung:
|
|
/// // Prüfen ob bereits angezeigt
|
|
/// if (!PaymentInfoPopupViewModel.HasInfoBeenShown())
|
|
/// {
|
|
/// var popup = new PaymentInfoPopup();
|
|
/// await Shell.Current.CurrentPage.ShowPopupAsync(popup);
|
|
/// }
|
|
/// </summary>
|
|
public partial class PaymentInfoPopupViewModel : ObservableObject
|
|
{
|
|
private readonly Popup _popup;
|
|
private const string PAYMENT_INFO_SHOWN_KEY = "payment_info_july_shown_2025";
|
|
|
|
public PaymentInfoPopupViewModel(Popup popup)
|
|
{
|
|
_popup = popup;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Prüft, ob der Zahlungshinweis bereits angezeigt wurde
|
|
/// </summary>
|
|
public static bool HasInfoBeenShown()
|
|
{
|
|
return Preferences.Get(PAYMENT_INFO_SHOWN_KEY, false);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Markiert den Hinweis als angezeigt
|
|
/// </summary>
|
|
private static void MarkInfoAsShown()
|
|
{
|
|
Preferences.Set(PAYMENT_INFO_SHOWN_KEY, true);
|
|
}
|
|
|
|
/// <summary>
|
|
/// User hat den Hinweis zur Kenntnis genommen
|
|
/// </summary>
|
|
[RelayCommand]
|
|
private async Task Acknowledge()
|
|
{
|
|
// Hinweis als angezeigt markieren
|
|
MarkInfoAsShown();
|
|
|
|
// Popup schließen
|
|
await _popup.CloseAsync(true);
|
|
}
|
|
}
|
|
}
|