Skip to content

Commit 60bb3cb

Browse files
authored
v1.8.02 (#428)
1 parent 54cdc75 commit 60bb3cb

22 files changed

Lines changed: 652 additions & 186 deletions

App/App.xaml.cs

Lines changed: 25 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using CommunityToolkit.Maui;
2+
using CommunityToolkit.Maui.Alerts;
23
using CommunityToolkit.Maui.ApplicationModel;
34
using CommunityToolkit.Maui.Extensions;
45
using CommunityToolkit.Maui.Views;
@@ -155,15 +156,6 @@ protected override void OnStart()
155156

156157
}
157158

158-
IFirebasePushNotification.Current.RegisterNotificationCategories(new[]
159-
{
160-
new NotificationCategory("daily_catchup", new[]
161-
{
162-
new NotificationAction("open_in_app", "Open in the app", NotificationActionType.Foreground),
163-
new NotificationAction("open_in_browser", "Open in the browser", NotificationActionType.Foreground),
164-
})
165-
});
166-
167159
// Reset notificaiton badges
168160
Badge.Default.SetCount(0);
169161
#if __IOS__
@@ -274,7 +266,7 @@ protected override void OnResume()
274266
/// </summary>
275267
/// <param name="popUp">pop up to open</param>
276268
/// <param name="page">parent page</param>
277-
public void OpenPopUp(Popup popUp, Page page = null)
269+
public void OpenPopUp(Popup popUp, Page page = null, bool bgTapToClose = true)
278270
{
279271
try
280272
{
@@ -286,14 +278,15 @@ public void OpenPopUp(Popup popUp, Page page = null)
286278
page = Shell;
287279
if (page.Navigation.NavigationStack.Any(p => p?.Id == popUp!.Id))
288280
return;
289-
MainThread.BeginInvokeOnMainThread(async () => await page.ShowPopupAsync(popUp, options: new PopupOptions()
290-
{
291-
Shape = new RoundRectangle
281+
MainThread.BeginInvokeOnMainThread(async () => await page.ShowPopupAsync(popUp, options: new PopupOptions()
292282
{
293-
StrokeThickness = 0
294-
}
295-
}));
296-
}
283+
CanBeDismissedByTappingOutsideOfPopup = bgTapToClose,
284+
Shape = new RoundRectangle
285+
{
286+
StrokeThickness = 0
287+
}
288+
}));
289+
}
297290
#if DEBUG
298291
catch (Exception ex)
299292
{
@@ -307,6 +300,21 @@ public void OpenPopUp(Popup popUp, Page page = null)
307300
#endif
308301
}
309302

303+
/// <summary>
304+
/// Display an error message as snack bar with a link to support email
305+
/// </summary>
306+
/// <param name="message">error message to be displayed</param>
307+
public static async Task DisplaySoftError(string message)
308+
{
309+
310+
await Snackbar.Make(message,
311+
() =>
312+
{
313+
Email.ComposeAsync(subject: "", body: "", to: new string[] { "support@gamhub.io" });
314+
},
315+
actionButtonText: "contact support").Show();
316+
}
317+
310318
/// <summary>
311319
/// Setup the instance for a device
312320
/// </summary>

App/AppShell.xaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,8 @@
297297
<!-- Donate -->
298298
<Grid Grid.Row="0"
299299
VerticalOptions="End"
300-
ColumnDefinitions="60,*">
300+
ColumnDefinitions="60,*"
301+
IsVisible="{Binding DonationEnabled}">
301302
<Grid.GestureRecognizers>
302303
<TapGestureRecognizer Command="{Binding BrowseTo}"
303304
CommandParameter="https://buymeacoffee.com/gamhub_io"/>

App/AppShell.xaml.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using GamHubApp.ViewModels;
22
using GamHubApp.Views;
3+
using Plugin.FirebasePushNotifications;
34

45
namespace GamHubApp;
56

@@ -59,6 +60,15 @@ protected override async void OnAppearing()
5960
{
6061
base.OnAppearing();
6162

63+
IFirebasePushNotification.Current.RegisterNotificationCategories(new[]
64+
{
65+
new NotificationCategory("daily_catchup", new[]
66+
{
67+
new NotificationAction("open_in_app", "Open in the app", NotificationActionType.Foreground),
68+
new NotificationAction("open_in_browser", "Open in the browser", NotificationActionType.Foreground),
69+
})
70+
});
71+
6272
_currentApp = (App.Current as App);
6373
Task gemTask = _vm.UpdateGems();
6474
Task dealTask = _vm.UpdateDeals();

App/Controls/ArticlePreview.xaml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@
99
xmlns:mct="http://schemas.microsoft.com/dotnet/2022/maui/toolkit"
1010
x:DataType="ctrs:ArticlePreview"
1111
x:Name="preview"
12-
Margin="2,5"
13-
xmlns:toolkit="http://schemas.microsoft.com/dotnet/2022/maui/toolkit">
12+
Margin="2,5">
1413
<Border StrokeShape="RoundRectangle 15"
1514
StrokeThickness="0"
1615
HeightRequest="221"
@@ -20,11 +19,11 @@
2019
<!-- Backgournd -->
2120
<Grid IsVisible="{Binding Article, Converter={StaticResource ArticleNullToBoolConverter}}">
2221
<Grid.Behaviors>
23-
<toolkit:AnimationBehavior EventName="Loaded">
24-
<toolkit:AnimationBehavior.AnimationType>
22+
<mct:AnimationBehavior EventName="Loaded">
23+
<mct:AnimationBehavior.AnimationType>
2524
<local:ItemAnimation Length="1000" />
26-
</toolkit:AnimationBehavior.AnimationType>
27-
</toolkit:AnimationBehavior>
25+
</mct:AnimationBehavior.AnimationType>
26+
</mct:AnimationBehavior>
2827
</Grid.Behaviors>
2928
</Grid>
3029
<Grid BackgroundColor="{StaticResource Dark}"

App/GamHubApp.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@
112112
<PackageReference Include="CommunityToolkit.Maui" Version="14.2.0" />
113113
<PackageReference Include="CommunityToolkit.Maui.Core" Version="14.2.0" />
114114
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.4.0" />
115-
<PackageReference Include="Custard" Version="0.4.0.4-rc" />
115+
<PackageReference Include="Custard" Version="0.4.0.5-rc" />
116116
<PackageReference Include="Kebechet.Maui.RevenueCat.InAppBilling" Version="7.0.1" />
117117
<PackageReference Include="Microsoft.Maui.Controls.Core" Version="10.0.71" />
118118
<PackageReference Include="Microsoft.Maui.Core" Version="10.0.71" />

App/MauiProgram.cs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
using Plugin.FirebasePushNotifications.Model.Queues;
88
using Maui.RevenueCat.InAppBilling;
99
using GamHubApp.Core;
10+
using CustardApi.Objects;
1011

1112

1213
#if IOS
@@ -48,11 +49,6 @@ public static MauiApp CreateMauiApp()
4849
})
4950
.ConfigureFonts(fonts =>
5051
{
51-
fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular");
52-
fonts.AddFont("OpenSans-Semibold.ttf", "OpenSansSemibold");
53-
fonts.AddFont("ComicShark.otf", "ComicShark");
54-
fonts.AddFont("SonicComics.ttf", "SonicComics");
55-
fonts.AddFont("MouseMemoirs-Regular.ttf", "MouseMemoirs-Regular");
5652
fonts.AddFont("FontAwesome6Free-Regular-400.otf", "FaRegular");
5753
fonts.AddFont("FontAwesome6Brands-Regular-400.otf", "FaBrand");
5854
fonts.AddFont("FontAwesome6Free-Solid-900.otf", "FaSolid");
@@ -79,7 +75,14 @@ public static MauiApp CreateMauiApp()
7975
{
8076
handlers.AddHandler<Shell, TabbarBadgeRenderer>();
8177
});
82-
78+
#if DEBUG_LOCALHOST
79+
builder.Services.AddCustard(host: AppConstant.Localhost,
80+
port: 255,
81+
sslCertificate: false);
82+
#else
83+
builder.Services.AddCustard(host: "api.gamhub.io",
84+
sslCertificate: true);
85+
#endif
8386
builder.Services.AddSingleton<Fetcher>();
8487

8588
builder.Services.AddSingleton<CommunityToolkit.Maui.Behaviors.TouchBehavior>();

App/Models/ArticleTrend.cs

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,8 @@
1-
using Newtonsoft.Json;
2-
using SQLite;
3-
using System.Collections.ObjectModel;
1+

2+
namespace GamHubApp.Models;
43

5-
namespace GamHubApp.Models
4+
public class ArticleTrend : TrendItem
65
{
7-
public class ArticleTrend
8-
{
9-
[JsonProperty("_id")]
10-
public string Id { get; set; }
11-
public int Count { get; set; }
126

13-
public Article Article { get; set; }
14-
}
7+
public Article Article { get; set; }
158
}

App/Models/ArticleTrendResponse.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
using System.Collections.ObjectModel;
2+
3+
namespace GamHubApp.Models;
4+
5+
public class ArticleTrendResponse
6+
{
7+
public Collection<ArticleTrend> Data { get; set; }
8+
}

App/Models/DealTrend.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
namespace GamHubApp.Models;
2+
3+
public class DealTrend : TrendItem
4+
{
5+
6+
public Deal Deal { get; set; }
7+
}

App/Models/DealTrendResponse.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+

2+
using System.Collections.ObjectModel;
3+
4+
namespace GamHubApp.Models;
5+
6+
public class DealTrendResponse
7+
{
8+
public Collection<DealTrend> Data { get; set; }
9+
}

0 commit comments

Comments
 (0)