Refactor subscription success popup handling and improve UI consistency across popups; add width request to buttons in Profile views.

This commit is contained in:
Max Mannstein 2025-10-05 12:43:56 +02:00
parent 7cfecb836f
commit ddaf7e0e28
6 changed files with 177 additions and 207 deletions

View File

@ -33,6 +33,7 @@ namespace gehGassiApp.ViewModels.Subscriptions
private readonly IDispatcher _dispatcher;
private readonly IDialogService _dialogService;
private readonly IPopupService _popupService;
private bool _hasShownSuccessPopupThisSession;
/// <summary>
/// ERstellt eine Instanz
@ -209,15 +210,7 @@ namespace gehGassiApp.ViewModels.Subscriptions
await LoadAsync();
if (MySubscriptions != null && MySubscriptions.Any())
{
var popupResult = await _popupService.ShowPopupAsync<SubscriptionSuccessPopup, SubscriptionSuccessResult>(
Shell.Current
);
var result = popupResult.Result;
if (result != null && result.HasOpenedStrayz)
{
// User hat STRAYZ geöffnet
}
await ShowSubscriptionSuccessPopupAsync(force: true);
}
}
else
@ -436,17 +429,29 @@ namespace gehGassiApp.ViewModels.Subscriptions
IsBusy = false;
if (MySubscriptions != null && MySubscriptions.Any())
{
await ShowSubscriptionSuccessPopupAsync();
}
}
private async Task ShowSubscriptionSuccessPopupAsync(bool force = false)
{
if (_hasShownSuccessPopupThisSession && !force)
{
return;
}
var popupResult = await _popupService.ShowPopupAsync<SubscriptionSuccessPopup, SubscriptionSuccessResult>(
Shell.Current
);
_hasShownSuccessPopupThisSession = true;
var result = popupResult.Result;
if (result != null && result.HasOpenedStrayz)
{
// User hat STRAYZ geöffnet
}
}
}
/// <summary>
/// Laden der verfügbaren Abos
@ -889,6 +894,8 @@ namespace gehGassiApp.ViewModels.Subscriptions
HasError = false;
ErrorMessage = string.Empty;
_hasShownSuccessPopupThisSession = false;
await TrackPageViewAsync("Subscriptions");
ShowSubscriptions = false;
@ -914,6 +921,8 @@ namespace gehGassiApp.ViewModels.Subscriptions
HasError = false;
ErrorMessage = string.Empty;
_hasShownSuccessPopupThisSession = false;
return base.DisappearingAsync(sender);
}

View File

@ -7,24 +7,14 @@
xmlns:toolkit="http://schemas.microsoft.com/dotnet/2022/maui/toolkit"
xmlns:viewModels="clr-namespace:gehGassiApp.ViewModels.Popups"
x:DataType="viewModels:AGBUpdatePopupViewModel"
CanBeDismissedByTappingOutsideOfPopup="False">
<!-- Popup Content -->
<Border
BackgroundColor="{AppThemeBinding Light={StaticResource Primary_White},
Dark={StaticResource Primary_White_Dark}}"
CanBeDismissedByTappingOutsideOfPopup="False"
VerticalOptions="Center">
<Grid
Padding="0"
BackgroundColor="White"
StrokeShape="RoundRectangle 16"
StrokeThickness="0"
RowDefinitions="Auto,*,Auto"
WidthRequest="350">
<!-- Drop Shadow Effect -->
<Border.Shadow>
<Shadow
Brush="{AppThemeBinding Light={StaticResource Grey_Dark},
Dark={StaticResource Grey_Dark_Dark}}"
Opacity="0.3"
Radius="8"
Offset="0,4" />
</Border.Shadow>
<Grid RowDefinitions="Auto,Auto,Auto">
<!-- Header -->
<Border
Grid.Row="0"
@ -40,6 +30,7 @@
Dark={StaticResource Primary_White_Dark}}"
VerticalOptions="Center" />
</Border>
<!-- Content Bereich -->
<VerticalStackLayout
Grid.Row="1"
@ -49,12 +40,14 @@
LineHeight="1.4"
Style="{StaticResource BodyS_GreyDark}"
Text="{x:Static res:Text.AGB_Popup_Description}" />
<!-- Link zu den AGB -->
<Label Style="{StaticResource LinkLabelStyle}" Text="{x:Static res:Text.AGB_Popup_LinkButton}">
<Label.GestureRecognizers>
<TapGestureRecognizer Command="{Binding OpenAGBCommand}" />
</Label.GestureRecognizers>
</Label>
<!-- Zustimmungs-Checkbox -->
<HorizontalStackLayout Margin="0,8,0,0" Spacing="12">
<CheckBox
@ -70,10 +63,11 @@
VerticalOptions="Center" />
</HorizontalStackLayout>
</VerticalStackLayout>
<!-- Action Buttons -->
<Button
Grid.Row="2"
Margin="10"
Margin="20"
BackgroundColor="{Binding AcceptButtonColor}"
Command="{Binding AcceptCommand}"
CornerRadius="12"
@ -83,5 +77,4 @@
Text="{x:Static res:Text.AGB_Popup_Confirm}"
TextColor="White" />
</Grid>
</Border>
</toolkit:Popup>

View File

@ -7,39 +7,24 @@
xmlns:toolkit="http://schemas.microsoft.com/dotnet/2022/maui/toolkit"
xmlns:viewModels="clr-namespace:gehGassiApp.ViewModels.Popups"
x:DataType="viewModels:SubscriptionOfferPopupViewModel"
CanBeDismissedByTappingOutsideOfPopup="True">
<!-- Popup Content -->
<Border
Padding="0"
BackgroundColor="{StaticResource Primary_LightBlue_Dark}"
HeightRequest="350"
StrokeShape="RoundRectangle 20"
StrokeThickness="0"
WidthRequest="350">
CanBeDismissedByTappingOutsideOfPopup="True"
VerticalOptions="Center">
<!-- Drop Shadow Effect -->
<Border.Shadow>
<Shadow
Brush="{AppThemeBinding Light={StaticResource Grey_Dark},
Dark={StaticResource Grey_Dark_Dark}}"
Opacity="0.3"
Radius="12"
Offset="0,6" />
</Border.Shadow>
<Grid RowDefinitions="Auto,*,Auto">
<Grid
Padding="24"
RowDefinitions="Auto,*,Auto">
<!-- Close Button -->
<Button
Grid.Row="0"
Margin="0,5,0,-20"
Background="Transparent"
BackgroundColor="Transparent"
Command="{Binding DeclineCommand}"
FontAttributes="Bold"
FontFamily="MaterialIconsRegular"
FontSize="40"
HorizontalOptions="End"
Style="{StaticResource LinkButton}"
Text="close"
TextColor="White"
VerticalOptions="Start" />
@ -47,21 +32,19 @@
<!-- Content Bereich -->
<VerticalStackLayout
Grid.Row="1"
Margin="0,-30,0,20"
Margin="0,12,0,0"
HorizontalOptions="Center"
Spacing="10"
Spacing="16"
VerticalOptions="Center">
<!-- Icon - Gestapelte Napf-Icons -->
<Image
Margin="0,0,0,-20"
HeightRequest="120"
HorizontalOptions="Center"
Source="coins.png"
VerticalOptions="Center"
WidthRequest="120" />
<!-- Titel -->
<Label
FontAttributes="Bold"
@ -110,7 +93,7 @@
<!-- Action Button -->
<Button
Grid.Row="2"
Margin="30,0,30,20"
Margin="0,20,0,0"
BackgroundColor="{AppThemeBinding Light={StaticResource Primary_DarkBlue},
Dark={StaticResource Primary_DarkBlue_Dark}}"
Command="{Binding AcceptCommand}"
@ -121,5 +104,4 @@
TextColor="White" />
</Grid>
</Border>
</toolkit:Popup>

View File

@ -8,32 +8,16 @@
xmlns:viewModels="clr-namespace:gehGassiApp.ViewModels.Popups"
x:DataType="viewModels:SubscriptionSuccessPopupViewModel"
CanBeDismissedByTappingOutsideOfPopup="True"
BackgroundColor="{StaticResource Primary_LightBlue}"
VerticalOptions="Center">
<!-- Popup Content -->
<Border
Padding="0"
BackgroundColor="{StaticResource Primary_LightBlue}"
StrokeShape="RoundRectangle 20"
StrokeThickness="0"
WidthRequest="350">
<!-- Drop Shadow Effect -->
<Border.Shadow>
<Shadow
Brush="{AppThemeBinding Light={StaticResource Grey_Dark},
Dark={StaticResource Grey_Dark_Dark}}"
Opacity="0.3"
Radius="12"
Offset="0,6" />
</Border.Shadow>
<Grid RowDefinitions="Auto,*,Auto">
<!-- Close Button -->
<Button
Grid.Row="0"
Margin="0,20,20,-20"
BackgroundColor="Transparent"
Command="{Binding CloseCommand}"
FontAttributes="Bold"
@ -48,18 +32,18 @@
<!-- Content Bereich -->
<VerticalStackLayout
Grid.Row="1"
Padding="30,0,30,20"
Spacing="20"
VerticalOptions="Center">
<!-- Herz Icon -->
<Image
Margin="-20"
HeightRequest="120"
Margin="-30"
HeightRequest="100"
HorizontalOptions="Center"
Source="heart.png"
VerticalOptions="Center"
WidthRequest="120" />
WidthRequest="100" />
<!-- Titel -->
<Label
@ -100,8 +84,9 @@
<!-- Action Button -->
<Button
Margin="0,20,0,0"
Grid.Row="2"
Margin="30,0,30,30"
BackgroundColor="{AppThemeBinding Light={StaticResource Primary_DarkBlue},
Dark={StaticResource Primary_DarkBlue_Dark}}"
Command="{Binding OpenStrayzCommand}"
@ -111,5 +96,4 @@
Text="{x:Static res:Text.SubSuccess_Popup_ButtonText}"
TextColor="White" />
</Grid>
</Border>
</toolkit:Popup>

View File

@ -521,6 +521,7 @@
AbsoluteLayout.LayoutFlags="PositionProportional"
Command="{Binding SaveCommand}"
HorizontalOptions="Center"
WidthRequest="300"
IsVisible="{Binding HasChanges}"
Text="{x:Static res:Text.Button_Done}"
VerticalOptions="End">

View File

@ -1028,6 +1028,7 @@
AbsoluteLayout.LayoutFlags="PositionProportional"
Command="{Binding SaveCommand}"
HorizontalOptions="Center"
WidthRequest="300"
IsVisible="{Binding HasChanges}"
Text="{x:Static res:Text.Button_Done}"
VerticalOptions="End">