diff --git a/Strings.Designer.cs b/Strings.Designer.cs
index 4352237..be640ef 100644
--- a/Strings.Designer.cs
+++ b/Strings.Designer.cs
@@ -411,6 +411,15 @@ internal static string CalendarPage_ToggleView {
}
}
+ ///
+ /// Looks up a localized string similar to Cancel.
+ ///
+ internal static string Cancel {
+ get {
+ return ResourceManager.GetString("Cancel", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to Event Count:.
///
@@ -492,6 +501,15 @@ internal static string CustomRankingsDetailPage_Rank {
}
}
+ ///
+ /// Looks up a localized string similar to Error.
+ ///
+ internal static string Error {
+ get {
+ return ResourceManager.GetString("Error", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to Delete.
///
@@ -663,6 +681,15 @@ internal static string NotificationService_NewTournamentOnCalendarTitle {
}
}
+ ///
+ /// Looks up a localized string similar to OK.
+ ///
+ internal static string OK {
+ get {
+ return ResourceManager.GetString("OK", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to %.
///
@@ -699,6 +726,24 @@ internal static string PlayerDetailPage_ActivityFeed {
}
}
+ ///
+ /// Looks up a localized string similar to This player has been added to your favorites.
+ ///
+ internal static string PlayerDetailPage_AddFavorite {
+ get {
+ return ResourceManager.GetString("PlayerDetailPage_AddFavorite", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to You have already configured your Stats page, do you wish to change your Stats to this player?.
+ ///
+ internal static string PlayerDetailPage_AlreadyConfigured {
+ get {
+ return ResourceManager.GetString("PlayerDetailPage_AlreadyConfigured", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to Avg Finish.
///
@@ -726,6 +771,15 @@ internal static string PlayerDetailPage_BestFinish {
}
}
+ ///
+ /// Looks up a localized string similar to Caution.
+ ///
+ internal static string PlayerDetailPage_Caution {
+ get {
+ return ResourceManager.GetString("PlayerDetailPage_Caution", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to Championship Series.
///
@@ -735,6 +789,33 @@ internal static string PlayerDetailPage_ChampionshipSeries {
}
}
+ ///
+ /// Looks up a localized string similar to You have now configured your Stats page!.
+ ///
+ internal static string PlayerDetailPage_ConfiguredStats {
+ get {
+ return ResourceManager.GetString("PlayerDetailPage_ConfiguredStats", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Configure your Stats.
+ ///
+ internal static string PlayerDetailPage_ConfigureYourStats {
+ get {
+ return ResourceManager.GetString("PlayerDetailPage_ConfigureYourStats", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Congratulations.
+ ///
+ internal static string PlayerDetailPage_Congratulations {
+ get {
+ return ResourceManager.GetString("PlayerDetailPage_Congratulations", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to Eff percent.
///
@@ -744,6 +825,15 @@ internal static string PlayerDetailPage_EffPercent {
}
}
+ ///
+ /// Looks up a localized string similar to There was an error trying to select this player as your 'My Stats' player..
+ ///
+ internal static string PlayerDetailPage_ErrorMyStats {
+ get {
+ return ResourceManager.GetString("PlayerDetailPage_ErrorMyStats", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to Events Outside Country.
///
@@ -762,6 +852,15 @@ internal static string PlayerDetailPage_Favorite {
}
}
+ ///
+ /// Looks up a localized string similar to Looks like you haven't configured your 'My Stats' page. Use the Player Search to find your Player, and press the Star to configure your Stats.
+ ///
+ internal static string PlayerDetailPage_HaventConfiguredMyStats {
+ get {
+ return ResourceManager.GetString("PlayerDetailPage_HaventConfiguredMyStats", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to Highest Rank.
///
@@ -861,6 +960,15 @@ internal static string PlayerDetailPage_RatingProgress {
}
}
+ ///
+ /// Looks up a localized string similar to This player has been removed from your favorites.
+ ///
+ internal static string PlayerDetailPage_RemoveFavorite {
+ get {
+ return ResourceManager.GetString("PlayerDetailPage_RemoveFavorite", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to Set to My Stats.
///
@@ -879,6 +987,15 @@ internal static string PlayerDetailPage_Share {
}
}
+ ///
+ /// Looks up a localized string similar to Share Player.
+ ///
+ internal static string PlayerDetailPage_SharePlayer {
+ get {
+ return ResourceManager.GetString("PlayerDetailPage_SharePlayer", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to times).
///
diff --git a/Strings.resx b/Strings.resx
index 395d79e..1500134 100644
--- a/Strings.resx
+++ b/Strings.resx
@@ -579,4 +579,43 @@
+
+ Cancel
+
+
+ Error
+
+
+ OK
+
+
+ This player has been added to your favorites
+
+
+ You have already configured your Stats page, do you wish to change your Stats to this player?
+
+
+ Caution
+
+
+ You have now configured your Stats page!
+
+
+ Configure your Stats
+
+
+ Congratulations
+
+
+ There was an error trying to select this player as your 'My Stats' player.
+
+
+ Looks like you haven't configured your 'My Stats' page. Use the Player Search to find your Player, and press the Star to configure your Stats
+
+
+ This player has been removed from your favorites
+
+
+ Share Player
+
\ No newline at end of file
diff --git a/ViewModels/CalendarViewModel.cs b/ViewModels/CalendarViewModel.cs
index 15de899..9bb55ff 100644
--- a/ViewModels/CalendarViewModel.cs
+++ b/ViewModels/CalendarViewModel.cs
@@ -32,7 +32,7 @@ public async Task ExecuteLoadItemsCommand(string address, int distance)
{
var sw = Stopwatch.StartNew();
CalendarDetails.Clear();
- //InlineCalendarItems.Clear();
+ Pins.Clear();
logger.LogDebug("Cleared collections in {0}", sw.ElapsedMilliseconds);
diff --git a/Views/CalendarPage.xaml.cs b/Views/CalendarPage.xaml.cs
index 44dbf30..a461c47 100644
--- a/Views/CalendarPage.xaml.cs
+++ b/Views/CalendarPage.xaml.cs
@@ -8,6 +8,7 @@
using Serilog.Core;
using Serilog;
using MauiIcons.Core;
+using Microsoft.Extensions.Logging;
namespace Ifpa.Views
{
@@ -25,10 +26,14 @@ public partial class CalendarPage : ContentPage
public CalendarPageView View { get; set; }
- public CalendarPage(CalendarViewModel viewModel)
+ private readonly ILogger logger;
+
+ public CalendarPage(CalendarViewModel viewModel, ILogger logger)
{
InitializeComponent();
+ this.logger = logger;
+
BindingContext = ViewModel = viewModel;
viewModel.IsBusy = true;
}
@@ -70,8 +75,7 @@ private async Task UpdateCalendarData()
catch (Exception e)
{
//don't let the calendar crash our entire app
- //TODO: dependency inject this?
- Log.Logger.Error(e, "Error loading calendar data");
+ logger.LogError(e, "Error loading calendar data");
}
}
@@ -85,14 +89,14 @@ private void ToggleView_Clicked(object sender, EventArgs e)
MapLayout.IsVisible = true;
calendar.IsVisible = false;
View = CalendarPageView.MapAndList;
- ToolbarItems.SingleOrDefault(n => n.Text == "Toggle View").IconImageSource = (FontImageSource)new MauiIcon() { Icon = FluentIcons.CalendarLtr28, IconColor = toolbarIconColor };
+ ToolbarItems.SingleOrDefault(n => n.Text == Strings.CalendarPage_ToggleView).IconImageSource = (FontImageSource)new MauiIcon() { Icon = FluentIcons.CalendarLtr28, IconColor = toolbarIconColor };
}
else
{
MapLayout.IsVisible = false;
calendar.IsVisible = true;
View = CalendarPageView.Calendar;
- ToolbarItems.SingleOrDefault(n => n.Text == "Toggle View").IconImageSource = (FontImageSource)new MauiIcon() { Icon = FluentIcons.Map24, IconColor = toolbarIconColor };
+ ToolbarItems.SingleOrDefault(n => n.Text == Strings.CalendarPage_ToggleView).IconImageSource = (FontImageSource)new MauiIcon() { Icon = FluentIcons.Map24, IconColor = toolbarIconColor };
}
}
diff --git a/Views/PlayerDetailPage.xaml.cs b/Views/PlayerDetailPage.xaml.cs
index 34d9580..056cf98 100644
--- a/Views/PlayerDetailPage.xaml.cs
+++ b/Views/PlayerDetailPage.xaml.cs
@@ -2,6 +2,9 @@
using Ifpa.Models;
using MauiIcons.Fluent;
using MauiIcons.Core;
+using CommunityToolkit.Maui.Alerts;
+using static System.Net.Mime.MediaTypeNames;
+using System.Threading;
namespace Ifpa.Views
{
@@ -33,8 +36,8 @@ protected async override void OnAppearing()
if (LoadMyStats)
{
- ToolbarItems.Remove(ToolbarItems.SingleOrDefault(n => n.Text == "Set to My Stats"));
- ToolbarItems.Remove(ToolbarItems.SingleOrDefault(n => n.Text == "Favorite"));
+ ToolbarItems.Remove(ToolbarItems.SingleOrDefault(n => n.Text == Strings.PlayerDetailPage_SetToMyStats));
+ ToolbarItems.Remove(ToolbarItems.SingleOrDefault(n => n.Text == Strings.PlayerDetailPage_Favorite));
if (Settings.HasConfiguredMyStats)
{
@@ -58,7 +61,7 @@ protected async override void OnAppearing()
{
if (Settings.HasConfiguredMyStats)
{
- ToolbarItems.Remove(ToolbarItems.SingleOrDefault(n => n.Text == "Set to My Stats"));
+ ToolbarItems.Remove(ToolbarItems.SingleOrDefault(n => n.Text == Strings.PlayerDetailPage_SetToMyStats));
//if player is in the existing favorites list, fill the heart icon.
if (await Settings.LocalDatabase.HasFavorite(ViewModel.PlayerId))
@@ -68,9 +71,9 @@ protected async override void OnAppearing()
}
else
{
- ToolbarItems.Remove(ToolbarItems.SingleOrDefault(n => n.Text == "Favorite"));
+ ToolbarItems.Remove(ToolbarItems.SingleOrDefault(n => n.Text == Strings.PlayerDetailPage_Favorite));
}
- ToolbarItems.Remove(ToolbarItems.SingleOrDefault(n => n.Text == "Activity Feed"));
+ ToolbarItems.Remove(ToolbarItems.SingleOrDefault(n => n.Text == Strings.PlayerDetailPage_ActivityFeed));
}
await ViewModel.ExecuteLoadItemsCommand();
@@ -108,7 +111,7 @@ private async void StarButton_Clicked(object sender, EventArgs e)
}
else
{
- var result = await DisplayAlert("Caution", "You have already configured your Stats page, do you wish to change your Stats to this player?", "OK", "Cancel");
+ var result = await DisplayAlert(Strings.PlayerDetailPage_Caution, Strings.PlayerDetailPage_AlreadyConfigured, Strings.OK, Strings.Cancel);
if (result)
{
await ChangePlayerAndRedirect();
@@ -117,7 +120,7 @@ private async void StarButton_Clicked(object sender, EventArgs e)
}
catch
{
- await DisplayAlert("Error", "There was an error trying to select this player as your 'My Stats' player.", "OK");
+ await DisplayAlert(Strings.Error, Strings.PlayerDetailPage_ErrorMyStats, Strings.OK);
}
}
@@ -126,14 +129,14 @@ private async Task ChangePlayerAndRedirect()
await Settings.SetMyStatsPlayer(ViewModel.PlayerId, ViewModel.PlayerRecord.PlayerStats.CurrentWpprRank);
await ViewModel.PrepopulateTourneyResults(ViewModel.PlayerId);
- await DisplayAlert("Congratulations", "You have now configured your Stats page!", "OK");
+ await DisplayAlert(Strings.PlayerDetailPage_Congratulations, Strings.PlayerDetailPage_ConfiguredStats, Strings.OK);
await Shell.Current.GoToAsync("///my-stats");
}
private async Task RedirectUserToPlayerSearch()
{
- await DisplayAlert("Configure your Stats", "Looks like you haven't configured your 'My Stats' page. Use the Player Search to find your Player, and press the Star to configure your Stats", "OK");
+ await DisplayAlert(Strings.PlayerDetailPage_ConfigureYourStats, Strings.PlayerDetailPage_HaventConfiguredMyStats, Strings.OK);
await Shell.Current.GoToAsync("///rankings/player-search");
}
@@ -147,7 +150,7 @@ private async void ShareButton_Clicked(object sender, EventArgs e)
await Share.RequestAsync(new ShareTextRequest
{
Uri = $"https://www.ifpapinball.com/player.php?p={ViewModel.PlayerId}",
- Title = "Share Player"
+ Title = Strings.PlayerDetailPage_SharePlayer
});
}
@@ -158,19 +161,20 @@ private async void FavoriteButton_Clicked(object sender, EventArgs e)
{
await Settings.LocalDatabase.RemoveFavorite(ViewModel.PlayerId);
SetCorrectFavoriteIcon(false);
- await DisplayAlert("Favorite Removed", "This player has been removed from your favorites!", "OK");
+
+ await Toast.Make(Strings.PlayerDetailPage_RemoveFavorite).Show();
}
else
{
await Settings.LocalDatabase.AddFavorite(ViewModel.PlayerId);
SetCorrectFavoriteIcon(true);
- await DisplayAlert("Favorite Added", "This player has been added to your favorites!", "OK");
+ await Toast.Make(Strings.PlayerDetailPage_AddFavorite).Show();
}
}
private void SetCorrectFavoriteIcon(bool isFavorite = true)
{
- var colorDictionary = Application.Current.Resources.MergedDictionaries.First();
+ var colorDictionary = Microsoft.Maui.Controls.Application.Current.Resources.MergedDictionaries.First();
var toolbarIconColor = (Color)colorDictionary["IconAccentColor"];
var filledHeartIcon = (FontImageSource)new MauiIcon() { Icon = FluentIcons.Heart48, IconColor = toolbarIconColor };
var unfilledHeartIcon = (FontImageSource)new MauiIcon() { Icon = FluentIcons.HeartBroken24, IconColor = toolbarIconColor };
@@ -178,11 +182,11 @@ private void SetCorrectFavoriteIcon(bool isFavorite = true)
if (isFavorite)
{
//if player is in the existing favorites list, fill the heart icon.
- ToolbarItems.SingleOrDefault(n => n.Text == "Favorite").IconImageSource = unfilledHeartIcon;
+ ToolbarItems.SingleOrDefault(n => n.Text == Strings.PlayerDetailPage_Favorite).IconImageSource = unfilledHeartIcon;
}
else
{
- ToolbarItems.SingleOrDefault(n => n.Text == "Favorite").IconImageSource = filledHeartIcon;
+ ToolbarItems.SingleOrDefault(n => n.Text == Strings.PlayerDetailPage_Favorite).IconImageSource = filledHeartIcon;
}
}