Compare commits

...

3 Commits

8 changed files with 251 additions and 14 deletions

View File

@ -1,4 +1,5 @@
using CommunityToolkit.Maui; using Plugin.Maui.AppRating;
using CommunityToolkit.Maui;
using gehGassi.LocalNotifications; using gehGassi.LocalNotifications;
using gehGassiApp.Constants; using gehGassiApp.Constants;
using gehGassiApp.Core.Data; using gehGassiApp.Core.Data;
@ -484,6 +485,7 @@ public static class MauiProgram
SetHandler(); SetHandler();
builder.Services.AddSingleton<IAppRating>(AppRating.Default);
return builder.Build(); return builder.Build();
} }

View File

@ -539,7 +539,12 @@ namespace gehGassiApp.ViewModels
request.Distance = Location.CalculateDistance(CurrentLocation.Lat.Value, CurrentLocation.Lng.Value, request.Lat, request.Lng, DistanceUnits.Kilometers); request.Distance = Location.CalculateDistance(CurrentLocation.Lat.Value, CurrentLocation.Lng.Value, request.Lat, request.Lng, DistanceUnits.Kilometers);
} }
Walkers = requests.Value.ToObservableCollection(); // Sortierung: Entfernung, dann mit Foto, dann mit Rating
Walkers = requests.Value
.OrderBy(x => x.Distance)
.ThenByDescending(x => !string.IsNullOrWhiteSpace(x.Photo))
.ThenByDescending(x => x.AverageRating > 0)
.ToObservableCollection();
_total = requests.Total; _total = requests.Total;
_skip = requests.Skip + requests.Take; _skip = requests.Skip + requests.Take;

View File

@ -1,4 +1,5 @@
using System.Text.Json; using Plugin.Maui.AppRating;
using System.Text.Json;
using CommunityToolkit.Maui.Core; using CommunityToolkit.Maui.Core;
using CommunityToolkit.Mvvm.ComponentModel; using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input; using CommunityToolkit.Mvvm.Input;
@ -31,6 +32,7 @@ namespace gehGassiApp.ViewModels.More
private readonly ISystemMessageService _systemMessageService; private readonly ISystemMessageService _systemMessageService;
private readonly IDispatcher _dispatcher; private readonly IDispatcher _dispatcher;
private readonly IPushnotificationService _pushnotificationService; private readonly IPushnotificationService _pushnotificationService;
private readonly IAppRating _appRating;
/// <summary> /// <summary>
/// Erstellt eine Instanz /// Erstellt eine Instanz
@ -41,7 +43,7 @@ namespace gehGassiApp.ViewModels.More
/// <param name="dispatcher">Instanz eines IDispatcher</param> /// <param name="dispatcher">Instanz eines IDispatcher</param>
/// <param name="pushnotificationService">Instanz eines IPushnotificationService</param> /// <param name="pushnotificationService">Instanz eines IPushnotificationService</param>
public MoreViewModel(IAccountService accountService, IDialogService dialogService, ISystemMessageService systemMessageService, IDispatcher dispatcher, public MoreViewModel(IAccountService accountService, IDialogService dialogService, ISystemMessageService systemMessageService, IDispatcher dispatcher,
IPushnotificationService pushnotificationService) IPushnotificationService pushnotificationService, IAppRating appRating)
{ {
_accountService = accountService; _accountService = accountService;
_dialogService = dialogService; _dialogService = dialogService;
@ -50,6 +52,43 @@ namespace gehGassiApp.ViewModels.More
_pushnotificationService = pushnotificationService; _pushnotificationService = pushnotificationService;
Title = Text.View_Title_More; Title = Text.View_Title_More;
SelectedMenu = MenuSelected.More; SelectedMenu = MenuSelected.More;
_appRating = appRating;
}
/// <summary>
/// Command für die Store-Bewertung
/// </summary>
[RelayCommand]
public async Task RateApp()
{
try
{
await _appRating.PerformRatingOnStoreAsync(
packageName: "com.gehgassi.gehgassi",
applicationId: "id1662116305"
);
}
catch (Exception ex)
{
await TrackErrorAsync(ex, true);
}
}
/// <summary>
/// Command für das Teilen der App
/// </summary>
[RelayCommand]
public async Task ShareApp()
{
string url = DeviceInfo.Platform == DevicePlatform.iOS
? "https://apps.apple.com/us/app/gehgassi/id1662116305"
: "https://play.google.com/store/apps/details?id=com.gehgassi.gehgassi";
string text = $"Schau dir die gehgassi App an! {url}";
await Share.Default.RequestAsync(new ShareTextRequest
{
Text = text,
Title = "App teilen"
});
} }
/// <summary> /// <summary>

View File

@ -1,4 +1,5 @@
using System.Text.Json; using Plugin.Maui.AppRating;
using System.Text.Json;
using CommunityToolkit.Maui.Core; using CommunityToolkit.Maui.Core;
using CommunityToolkit.Mvvm.ComponentModel; using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input; using CommunityToolkit.Mvvm.Input;
@ -31,6 +32,7 @@ namespace gehGassiApp.ViewModels.More
private readonly ISystemMessageService _systemMessageService; private readonly ISystemMessageService _systemMessageService;
private readonly IDispatcher _dispatcher; private readonly IDispatcher _dispatcher;
private readonly IPushnotificationService _pushnotificationService; private readonly IPushnotificationService _pushnotificationService;
private readonly IAppRating _appRating;
/// <summary> /// <summary>
/// Erstellt eine Instanz /// Erstellt eine Instanz
@ -42,7 +44,7 @@ namespace gehGassiApp.ViewModels.More
/// <param name="dispatcher">Instanz eines IDispatcher</param> /// <param name="dispatcher">Instanz eines IDispatcher</param>
/// <param name="pushnotificationService">Instanz eines IPushnotificationService</param> /// <param name="pushnotificationService">Instanz eines IPushnotificationService</param>
public MoreWalkerViewModel(IAccountService accountService, IDialogService dialogService, IUserService userService, ISystemMessageService systemMessageService, IDispatcher dispatcher, public MoreWalkerViewModel(IAccountService accountService, IDialogService dialogService, IUserService userService, ISystemMessageService systemMessageService, IDispatcher dispatcher,
IPushnotificationService pushnotificationService) IPushnotificationService pushnotificationService, IAppRating appRating)
{ {
_accountService = accountService; _accountService = accountService;
_dialogService = dialogService; _dialogService = dialogService;
@ -52,8 +54,43 @@ namespace gehGassiApp.ViewModels.More
_pushnotificationService = pushnotificationService; _pushnotificationService = pushnotificationService;
Title = Text.View_Title_More; Title = Text.View_Title_More;
SelectedMenu = MenuSelected.More; SelectedMenu = MenuSelected.More;
_appRating = appRating;
} }
/// <summary>
/// Command für die Store-Bewertung
/// </summary>
[RelayCommand]
public async Task RateApp()
{
try
{
await _appRating.PerformRatingOnStoreAsync(
packageName: "com.gehgassi.gehgassi",
applicationId: "id1662116305"
);
}
catch (Exception ex)
{
await TrackErrorAsync(ex, true);
}
}
/// <summary>
/// Command für das Teilen der App
/// </summary>
[RelayCommand]
public async Task ShareApp()
{
string url = DeviceInfo.Platform == DevicePlatform.iOS
? "https://apps.apple.com/us/app/gehgassi/id1662116305"
: "https://play.google.com/store/apps/details?id=com.gehgassi.gehgassi";
string text = $"Schau dir die gehgassi App an! {url}";
await Share.Default.RequestAsync(new ShareTextRequest
{
Text = text,
Title = "App teilen"
});
}
/// <summary> /// <summary>
/// Gibt an ob Switch verfügbar ist /// Gibt an ob Switch verfügbar ist
/// </summary> /// </summary>

View File

@ -597,6 +597,8 @@ namespace gehGassiApp.ViewModels.Walks
CheckSubscription(AppMode.DogOwner); CheckSubscription(AppMode.DogOwner);
} }
} }
DogSelectionChanged();
} }
/// <summary> /// <summary>
@ -615,10 +617,22 @@ namespace gehGassiApp.ViewModels.Walks
{ {
Dogs = dogs.ToObservableCollection(); Dogs = dogs.ToObservableCollection();
SelectedDog = Dogs.FirstOrDefault(); SelectedDog = Dogs.FirstOrDefault();
// Ersten Hund automatisch zur Auswahl hinzufügen
if (Dogs.Count > 0)
{
SelectedDogs.Clear();
SelectedDogs.Add(Dogs.First());
DogsSelected = true;
// DogSelectionChanged Command manuell auslösen für UI-Update
}
} }
else else
{ {
Dogs?.Clear(); Dogs?.Clear();
SelectedDogs?.Clear();
DogsSelected = false;
} }
HasNoDog = Dogs.Count == 0; HasNoDog = Dogs.Count == 0;

View File

@ -398,6 +398,76 @@
<Border Style="{StaticResource Separator}" /> <Border Style="{StaticResource Separator}" />
<Grid
ColumnDefinitions="24,*,24"
ColumnSpacing="12"
HorizontalOptions="FillAndExpand"
VerticalOptions="StartAndExpand">
<Image Grid.Column="0" HeightRequest="24">
<Image.Source>
<FontImageSource
FontFamily="MaterialIconsRegular"
Glyph="thumb_up"
Color="{StaticResource Primary_DarkBlue}" />
</Image.Source>
</Image>
<Label
Grid.Column="1"
HorizontalOptions="StartAndExpand"
LineBreakMode="TailTruncation"
Style="{StaticResource H5_Blue}"
Text="App bewerten"
VerticalOptions="Center" />
<Image Grid.Column="2" HeightRequest="24">
<Image.Source>
<FontImageSource
FontFamily="IconMoon"
Glyph="{x:Static i:IconsMoon.Icon_Chevron_Right}"
Color="{StaticResource Primary_DarkBlue}" />
</Image.Source>
</Image>
<Grid.GestureRecognizers>
<TapGestureRecognizer Command="{Binding RateAppCommand}" />
</Grid.GestureRecognizers>
</Grid>
<Border Style="{StaticResource Separator}" />
<Grid
ColumnDefinitions="24,*,24"
ColumnSpacing="12"
HorizontalOptions="FillAndExpand"
VerticalOptions="StartAndExpand">
<Image Grid.Column="0" HeightRequest="24">
<Image.Source>
<FontImageSource
FontFamily="MaterialIconsRegular"
Glyph="share"
Color="{StaticResource Primary_DarkBlue}" />
</Image.Source>
</Image>
<Label
Grid.Column="1"
HorizontalOptions="StartAndExpand"
LineBreakMode="TailTruncation"
Style="{StaticResource H5_Blue}"
Text="App teilen"
VerticalOptions="Center" />
<Image Grid.Column="2" HeightRequest="24">
<Image.Source>
<FontImageSource
FontFamily="IconMoon"
Glyph="{x:Static i:IconsMoon.Icon_Chevron_Right}"
Color="{StaticResource Primary_DarkBlue}" />
</Image.Source>
</Image>
<Grid.GestureRecognizers>
<TapGestureRecognizer Command="{Binding ShareAppCommand}" />
</Grid.GestureRecognizers>
</Grid>
<Border Style="{StaticResource Separator}" />
<Grid <Grid
ColumnDefinitions="24,*,24" ColumnDefinitions="24,*,24"
ColumnSpacing="12" ColumnSpacing="12"

View File

@ -221,8 +221,8 @@
</Grid.GestureRecognizers> </Grid.GestureRecognizers>
</Grid> </Grid>
<Border Style="{StaticResource Separator}" />
<Border Style="{StaticResource Separator}" />
<Grid <Grid
ColumnDefinitions="24,*,24" ColumnDefinitions="24,*,24"
ColumnSpacing="12" ColumnSpacing="12"
@ -256,8 +256,9 @@
</Grid.GestureRecognizers> </Grid.GestureRecognizers>
</Grid> </Grid>
<Border Style="{StaticResource Separator}" />
<Border Style="{StaticResource Separator}" />
<Grid <Grid
ColumnDefinitions="24,*,24" ColumnDefinitions="24,*,24"
ColumnSpacing="12" ColumnSpacing="12"
@ -360,6 +361,74 @@
<TapGestureRecognizer Command="{Binding FeedbackCommand}" /> <TapGestureRecognizer Command="{Binding FeedbackCommand}" />
</Grid.GestureRecognizers> </Grid.GestureRecognizers>
</Grid> </Grid>
<Border Style="{StaticResource Separator}" />
<Grid
ColumnDefinitions="24,*,24"
ColumnSpacing="12"
HorizontalOptions="FillAndExpand"
VerticalOptions="StartAndExpand">
<Image Grid.Column="0" HeightRequest="24">
<Image.Source>
<FontImageSource
FontFamily="MaterialIconsRegular"
Glyph="thumb_up"
Color="{StaticResource Primary_DarkBlue}" />
</Image.Source>
</Image>
<Label
Grid.Column="1"
HorizontalOptions="StartAndExpand"
LineBreakMode="TailTruncation"
Style="{StaticResource H5_Blue}"
Text="App bewerten"
VerticalOptions="Center" />
<Image Grid.Column="2" HeightRequest="24">
<Image.Source>
<FontImageSource
FontFamily="IconMoon"
Glyph="{x:Static i:IconsMoon.Icon_Chevron_Right}"
Color="{StaticResource Primary_DarkBlue}" />
</Image.Source>
</Image>
<Grid.GestureRecognizers>
<TapGestureRecognizer Command="{Binding RateAppCommand}" />
</Grid.GestureRecognizers>
</Grid>
<Border Style="{StaticResource Separator}" />
<Grid
ColumnDefinitions="24,*,24"
ColumnSpacing="12"
HorizontalOptions="FillAndExpand"
VerticalOptions="StartAndExpand">
<Image Grid.Column="0" HeightRequest="24">
<Image.Source>
<FontImageSource
FontFamily="MaterialIconsRegular"
Glyph="share"
Color="{StaticResource Primary_DarkBlue}" />
</Image.Source>
</Image>
<Label
Grid.Column="1"
HorizontalOptions="StartAndExpand"
LineBreakMode="TailTruncation"
Style="{StaticResource H5_Blue}"
Text="App teilen"
VerticalOptions="Center" />
<Image Grid.Column="2" HeightRequest="24">
<Image.Source>
<FontImageSource
FontFamily="IconMoon"
Glyph="{x:Static i:IconsMoon.Icon_Chevron_Right}"
Color="{StaticResource Primary_DarkBlue}" />
</Image.Source>
</Image>
<Grid.GestureRecognizers>
<TapGestureRecognizer Command="{Binding ShareAppCommand}" />
</Grid.GestureRecognizers>
</Grid>
<Border Style="{StaticResource Separator}" /> <Border Style="{StaticResource Separator}" />

View File

@ -205,6 +205,7 @@
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="8.0.12" /> <PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="8.0.12" />
<PackageReference Include="Microsoft.Maui.Graphics.Skia" Version="8.0.100" /> <PackageReference Include="Microsoft.Maui.Graphics.Skia" Version="8.0.100" />
<PackageReference Include="Plugin.InAppBilling" Version="8.0.5" /> <PackageReference Include="Plugin.InAppBilling" Version="8.0.5" />
<PackageReference Include="Plugin.Maui.AppRating" Version="1.2.1" />
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="8.1.2" /> <PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="8.1.2" />
<PackageReference Include="Microsoft.Maui.Controls" Version="8.0.100" /> <PackageReference Include="Microsoft.Maui.Controls" Version="8.0.100" />
<PackageReference Include="Microsoft.Maui.Controls.Compatibility" Version="8.0.100" /> <PackageReference Include="Microsoft.Maui.Controls.Compatibility" Version="8.0.100" />