Skip to content

Commit

Permalink
Merge pull request #152 from edgiardina/fix-calendardisplay
Browse files Browse the repository at this point in the history
Fixes #150 where android reminders didn't remind on new tournies
  • Loading branch information
edgiardina authored Jul 27, 2024
2 parents cd4daf4 + 8ac728a commit e183c61
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 19 deletions.
26 changes: 13 additions & 13 deletions IfpaMaui.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -48,35 +48,35 @@

<!-- Package References -->
<ItemGroup>
<PackageReference Include="Microsoft.Maui.Controls" Version="8.0.60" />
<PackageReference Include="Microsoft.Maui.Controls.Compatibility" Version="8.0.60" />
<PackageReference Include="Microsoft.Maui.Controls.Maps" Version="8.0.60" />
<PackageReference Include="Microsoft.Maui.Controls" Version="8.0.70" />
<PackageReference Include="Microsoft.Maui.Controls.Compatibility" Version="8.0.70" />
<PackageReference Include="Microsoft.Maui.Controls.Maps" Version="8.0.70" />
<PackageReference Include="AathifMahir.Maui.MauiIcons.Fluent" Version="2.1.2" />
<PackageReference Include="CommunityToolkit.Maui" Version="8.0.1" />
<PackageReference Include="LiveChartsCore.SkiaSharpView.Maui" Version="2.0.0-beta.911" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="8.0.0" />
<PackageReference Include="PinballApi" Version="3.0.1" />
<PackageReference Include="Plugin.Maui.Calendar" Version="1.1.9" />
<PackageReference Include="Plugin.Maui.Calendar" Version="1.2.0" />
<PackageReference Include="Scrutor" Version="4.2.2" />
<PackageReference Include="Serilog.Sinks.Xamarin" Version="1.0.0" />
<PackageReference Include="Shiny.Core" Version="3.2.2" />
<PackageReference Include="Shiny.Hosting.Maui" Version="3.2.2" />
<PackageReference Include="Shiny.Extensions.Configuration" Version="3.2.2" />
<PackageReference Include="Shiny.Jobs" Version="3.2.2" />
<PackageReference Include="Shiny.Notifications" Version="3.2.2" />
<PackageReference Include="sqlite-net-pcl" Version="1.8.116" />
<PackageReference Include="Shiny.Core" Version="3.3.3" />
<PackageReference Include="Shiny.Hosting.Maui" Version="3.3.3" />
<PackageReference Include="Shiny.Extensions.Configuration" Version="3.3.3" />
<PackageReference Include="Shiny.Jobs" Version="3.3.3" />
<PackageReference Include="Shiny.Notifications" Version="3.3.3" />
<PackageReference Include="sqlite-net-pcl" Version="1.9.172" />
<PackageReference Include="SQLitePCLRaw.core" Version="2.1.8" />
<PackageReference Include="SQLitePCLRaw.bundle_green" Version="2.1.8" />
<PackageReference Include="SQLitePCLRaw.provider.dynamic_cdecl" Version="2.1.8" />
<PackageReference Include="SQLitePCLRaw.provider.sqlite3" Version="2.1.8" />
<PackageReference Include="Syncfusion.Maui.Core" Version="24.1.45" />
<PackageReference Include="Syncfusion.Maui.TabView" Version="24.1.45" />
<PackageReference Include="System.ServiceModel.Syndication" Version="8.0.0" />
<PackageReference Include="Serilog" Version="3.1.1" />
<PackageReference Include="Serilog" Version="4.0.1" />
<PackageReference Include="Serilog.Extensions.Logging" Version="8.0.0" />
<PackageReference Include="Serilog.Sinks.Console" Version="5.0.1" />
<PackageReference Include="Serilog.Sinks.Debug" Version="2.0.0" />
<PackageReference Include="Serilog.Sinks.Console" Version="6.0.0" />
<PackageReference Include="Serilog.Sinks.Debug" Version="3.0.0" />
</ItemGroup>

<!-- Maui Specifics -->
Expand Down
2 changes: 1 addition & 1 deletion Models/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public static string CalendarRankingSystem

public static long LastCalendarIdSeen
{
get => Preferences.Get("LastCalendarIdSeen", 0);
get => Preferences.Get("LastCalendarIdSeen", 0L);
set => Preferences.Set("LastCalendarIdSeen", value);
}

Expand Down
10 changes: 10 additions & 0 deletions Services/NotificationService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ public async Task NotifyIfUserHasNewlySubmittedTourneyResults()
{
if (Settings.HasConfiguredMyStats)
{
logger.LogInformation("Checking for user's new tournament results");

try
{
var results = await PinballRankingApi.GetPlayerResults(Settings.MyStatsPlayerId);
Expand Down Expand Up @@ -104,6 +106,8 @@ public async Task NotifyIfUsersRankChanged()
{
if (Settings.HasConfiguredMyStats)
{
logger.LogInformation("Checking for user's rank change");

try
{
var results = await PinballRankingApi.GetPlayerRecord(Settings.MyStatsPlayerId);
Expand Down Expand Up @@ -144,6 +148,8 @@ public async Task NotifyIfNewBlogItemPosted()
{
if(Settings.NotifyOnNewBlogPost)
{
logger.LogInformation("Checking for new blog posts");

try
{
var latestPosts = await BlogPostService.GetBlogPosts();
Expand Down Expand Up @@ -174,6 +180,8 @@ public async Task NotifyIfNewCalendarEntry()
{
if (Settings.NotifyOnNewCalendarEntry)
{
logger.LogInformation("Checking for new calendar entries");

try
{
var geoLocation = await Geocoding.GetLocationsAsync(Settings.LastCalendarLocation);
Expand Down Expand Up @@ -227,6 +235,8 @@ private async Task UpdateBadgeIfNeeded()

public async Task SendNotification(string title, string description, string url)
{
logger.LogInformation("Sending notification: {0} - {1}", title, description);

var payload = new Dictionary<string, string>
{
{ "url", url }
Expand Down
8 changes: 4 additions & 4 deletions ViewModels/CalendarViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public enum CalendarType

public class CalendarViewModel : BaseViewModel
{
public EventCollection TournamentCalenderItems { get; set; } = new EventCollection();
public EventCollection TournamentCalendarItems { get; set; } = new EventCollection();
public ObservableCollectionRange<TournamentSearch> Tournaments { get; set; }

public CalendarType CurrentType { get; set; } = CalendarType.MapAndList;
Expand Down Expand Up @@ -99,16 +99,16 @@ public async Task ExecuteLoadItemsCommand(Location geoLocation, int distance)
LoadEventOntoCalendar(detail);
}

TournamentCalenderItems = new EventCollection();
TournamentCalendarItems = new EventCollection();

items.Tournaments
.Where(item => item.EventEndDate - item.EventStartDate <= 5.Days())
.Select(n => new TournamentWithDistance(n, (long)Location.CalculateDistance(latitude.Value, longitude.Value, n.Latitude, n.Longitude, DistanceUnits.Miles)))
.GroupBy(item => item.EventStartDate.Date)
.ToList()
.ForEach(date => TournamentCalenderItems.Add(date.Key, date.ToList()));
.ForEach(date => TournamentCalendarItems.Add(date.Key, date.ToList()));

OnPropertyChanged(nameof(TournamentCalenderItems));
OnPropertyChanged(nameof(TournamentCalendarItems));
OnPropertyChanged(nameof(Pins));
OnPropertyChanged(nameof(SelectedRankingSystem));
}
Expand Down
2 changes: 1 addition & 1 deletion Views/CalendarPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@
ArrowsBackgroundColor="{AppThemeBinding Light={StaticResource SecondaryBackgroundColor}, Dark={StaticResource SecondaryBackgroundColorDark}}"
ArrowsBorderColor="Transparent"
ArrowsColor="{StaticResource IconAccentColor}"
Events="{Binding TournamentCalenderItems}"
Events="{Binding TournamentCalendarItems}"
IsVisible="{Binding CurrentType, Converter={StaticResource IsEqualConverter}, ConverterParameter={x:Static vm:CalendarType.Calendar}}"
ShownDate="{Binding Source={x:Static sys:DateTime.Now}}"
ShowYearPicker="False"
Expand Down

0 comments on commit e183c61

Please sign in to comment.