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

View File

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

View File

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

View File

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

View File

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

View File

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