Skip to content

Commit 20c2c12

Browse files
authored
v1.6.45 (#267)
* fix - discord authentication (#199) * Flyout menu - reduce number of taps to sign in * App Shell - Make sure we fetch user data first then bind that data * Flyout - Fix Logout button * Arch - fetching data | setup a singleton to handle fetching structure and bind it to App Shell * Shell - Manage logout within the new mechanism * cleanup - Pages/views * Code base - Org | Organise the weak reference messages classes * News Page -| Setup singleton * Articlepage cleanup * About Page -| set as a singleton * Feeds page -| call as a singleton * Bookmarks - as for all give the singleton treatment * App Shell - remove OpenAuth reference * Android native - BakcPress | remove nullable reference types * fix: Custom feed not loading after navigating from an article (#202) * Fix - Feeds VM | make sure to manage `IsBusy` properly inside `UpdateFeeds()` * cleanup - Feed VM | Forgot to remove the previous setter of `IsBusy` * IOS properties - change Debug linker behaviour (#204) * BETA - Fix: crash sometimes experience on Launch (#205) * MCT - Regester TouchBehavior as a singleton * App.cs - Remove start DB on resume * Ressources - font references | fix the SemiBold reference (#206) * SQLite - update initialisation (#207) * fix: sqlite lockcrash (#208) * SQLite - update initialisation * SqLite - make sure we close the connection after we create the tables * Add sentry breadcrumbs to db creation process (#209) * SQLite - update initialisation * SqLite - make sure we close the connection after we create the tables * App - CreateWindow | add sentry breadcrumbs * imp: optimisation of local storage (#211) * SQLite - update initialisation * SqLite - make sure we close the connection after we create the tables * App - CreateWindow | add sentry breadcrumbs * Local Storage - SQLite | Create a class to genera DB actions * Local storage - general database | fix typo * Local storage - general sqlite DB | Implement the service accross the board * Feed - fix feed search * MainProg - DI | improve org of db singleton registration * Local storage - backup | create a service * fuck me sideways.... * Article Preview - share button | be more specific on the source (#213) * Fetcher - Sources | Utilise a static reference as Sources, as we only really set it once but need it all the time everywhere (#214) * Fix: bookmark status (#216) * Main feed - bookmark | fix the issue of the bookmark status not showing * Local storage - get bookmark | make sure that bookmarks are marked as IsSaved automatically * Local storage - main db | remove unecessary listing of artilces * Bookmark - db | Make sure the status is correctly set * feeds - view model | remove unused references (#217) * Fix: feed bookmark issue (#218) * article - bookmark | make sure to return the rescently added first * Fetcher - bookmarks | improve performance by caching all the bookmarks (as much as possible * Bookmark - caching | loas the bookmarks first thing * Fix: bookmark status not updating on main feed (#219) * Main feed - bookmark status | change the way we reload the article when receiving the bookmark message * Article Model - Change bookmark update * Hotfix: on start exception (#220) * App | Remove StartDb() * Change the way we update Sources * Fetcher.Sources | prevent nullable excepttions * fix: Fetcher - UpdateBackupSources | improve Error handling (#221) * App | Remove StartDb() * Change the way we update Sources * Fetcher.Sources | prevent nullable excepttions * Fetcher - UpdateBackupSources | improve Error handling * cleanup: stuff I forgot (#224) * xaml stuff * remove unused style declaration * Main Feed - Refresh DB | Make the try catch actually useful * Feat: notification setup (#225) * Add google services stuff to git ignore * Include google services files * deps | setup thomasgalliker's `Plugin.FirebasePushNotifications` * Update push notification setup * Apple Manifset - enable remote background thinggy * CI | use environment variable for package id * display packagename * CI/CD - iOS | install GoogleService-Info * CD - android | add secrets * d * CD - android | install google-services.json * prebuild - iOS | fix service tokens * Ci/CD - file google services installations * oops * d * Ci - update all * Notification - android | set the icon * for now let's just `hardcode` packagename (#226) * fix: android pre-build - fix environment variables (#228) * CD - android pre-build | fix environment variables * update xcode version * fix: pipelines xcode version (#229) * pipelines - dev | upgrade xcode * pipelines - prod | upgrade xcode * fix: notification setup (#230) * Ci - Adnroid | Check google services token * Prebuild - android | set the package name from the worflow * push notification - ios | fix setup * deps | Bump Plugin.FirebasePushNotifications to prerelease * Notiffication setup - Android | improve logging * fix: change the approach of Google Services credentials (#231) * CD - android | get google service token * forgot google_services_json * cd - android | Generate and import Google Services in their respective steps * CD - Android | change the way we generate google services * CD - iOS | generate google services * CI - main workflow | forgot google services PLIST * pre-build - android | remove unnecessary stuff * CI/CD - all | Remove redundant references of google services properties * CD - iOS | fix typo * same * workflow | update prod * s * fix - dev pipeline * dev deploy | remove * feat: notifications implement channels (#232) * Notifications - android | add channels * Notifications - Android | List channels * deps | downgrade `Plugin.FirebasePushNotifications` * workflow - android | set `changesNotSentForReview: true` * feat: notification navigation (#233) * Android - setup | enable `SingleTask` Launch Mode * Article - notification | handle navigation to the article * Notification - OnNotificationOpened | convert `articleId` to string * fix crash on notification nav * Article - notification | handle loading indicator better * Android - notification | improve permission request * Article - Notification | add option to handle action * cd-android.yml | unset changesNotSentForReview * Feat: notifications settings (#235) * Android - Notification | add `PostNotification` permission to the manifest * Notification Request | make it makes sense * Shell | add a totally empty settings page * Setting page | design * Settings page - open notification settings * notif - fix| OnNotificationOpened + OnNotificationAction -> escape null inputs (#238) * Hotfix: crash notification (#239) * notif - fix| OnNotificationOpened + OnNotificationAction -> escape null inputs * Notification - OnNotificationOpened | check `articleId` key exist * Notification - OnNotificationOpened | documentation * I'm a bit of an idiot * feat: deals page (#237) * Shell - Views | create and bind deals page * Styles - Add discount color * Deals page - Display deals * Article page - deals | change discount colour * Article page - deals | change size of the discount mark * SQLite - general DB | store deals * Deal Page | create a badge * General Storage | Complete `UpdateDeals` * Cleanp up | Article comparer * Deal page - Add loading indicator * Deal page -| reorder deals * feat: settings - deals (#242) * Settings - deal | enable/disable deal page * Settings - Deals | enable/disable deals on article page * Settings - vm | create a general method to handle updates * feat: add notif badges (#243) * fix: deals loadstuck (#244) * Deals page - fix | update deal `OnAppearing` * Deals page | order by expiring deals * random cleaup * hotfix: crash on notification opening (#246) * Article page - view Model | prevetn `System.ArgumentNullException` on deals * Article page - ViewModel | handle deals process exceptions * ArticleViewModel - constructor | check `Deals` before treating it * iOS - Tab badge | fix out of range issue (#248) * fix: News Feed doesn't reset when pressing its tab (#251) * AndroidShellRenderer - handler | declare it using genereci overload * Fix - android main feed reset | merge AndroidShellRenderer with TabbarBadgeRenderer * feat: dynamic time update (#253) * Converter - Time Span | reformat and clean up * Main feed - vm | create a method to refresh the timespan of the articles * Main Feed - On Resume | enhance the on resume behaviour * News page - update navigation stuff on resume * news page - view model | * Fetcher - ArticleExist | make sure to check for Bookmarks being null (#256) * fix: ios - UI settings tweaks (#257) * Settings Page - UI | Change title * Settings page - UI | tweak notification settings label * Settings page - view | format code * settings page - UI | improve the toggles * Settings page - UI | improve toggle colours * fix: DealPageSett (#258) * Settings Page - UI | Change title * Settings page - UI | tweak notification settings label * Settings page - view | format code * settings page - UI | improve the toggles * Settings page - UI | improve toggle colours * fix: DealPageSett * feat: display source image (#261) * UI - Article Preview | display the logo of the source if available * UI - Article Page | Add source image or badge as title closes #249 * fix: ios badge thread issue (#264) * ios - tab badge | run that on the main thread * ios - tab badge | UpdateBadge() error handling * fix: no internet connection handler (#265) Resolves #262 * fetcher - error handler | prevent internet connection related error from being reported * fcm - offline | notification setup disable if device offline * Fetcher - HTTP error handler | move the internet connection check at the top * fix: update deals on article navigation (#266) * App Shell - vm | make sure to reload the deals when we call `UpdateDeals()` * App Shell - navigation | update deal on each navigation * feat: deals - display time remaining until deals expire (#268) * Converters - | create a time until converter * Deals - page | display time until it expires * Deals page | improving time until display * TimeUntilConverter - correction * TimeUntilConverter - converters | improve * Deal page - expiration | dynamically change the colour * Converters - time until| correct a big mistake * App -| make sure to refresh the Deals when resuming the app * converters - TimeUntil | remove minutes when it's not relevant Resolves #260
1 parent aa1f3c8 commit 20c2c12

File tree

9 files changed

+112
-5
lines changed

9 files changed

+112
-5
lines changed

App/App.xaml.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,13 @@ protected override void OnResume()
157157

158158
((NewsPage)currentPage).OnResume();
159159
}
160-
}
160+
161+
if (currentPage.ToString() == "GamHubApp.Views.DealsPage")
162+
{
163+
164+
((DealsPage)currentPage).Resume();
165+
}
166+
}
161167
/// <summary>
162168
/// Open any popup
163169
/// </summary>

App/AppShell.xaml.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,11 @@ protected override async void OnAppearing()
4141
Task partnersTask = _currentApp.LoadPartners();
4242
Task notifTask = _vm.NotificationSetup();
4343
await Task.WhenAll(partnersTask, notifTask);
44+
}
45+
46+
protected override async void OnNavigated(ShellNavigatedEventArgs args)
47+
{
48+
base.OnNavigated(args);
4449
await _vm.UpdateDeals();
4550
}
4651

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

2+
3+
using System.Globalization;
4+
5+
namespace GamHubApp.Helpers;
6+
7+
public class TimeUntilColourConverter : IValueConverter
8+
{
9+
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
10+
{
11+
if (value is DateTime enddate)
12+
{
13+
var timeremaining = enddate - DateTime.Now;
14+
15+
if (timeremaining < TimeSpan.Zero)
16+
return App.Current.Resources["DealExpiringColor"];
17+
else if (timeremaining.Days < 0)
18+
return timeremaining.Hours < 20? App.Current.Resources["DealExpiringColor"]: App.Current.Resources["DealExpiresVerySoonColor"];
19+
else if (timeremaining < new TimeSpan(days: 30, 0, 0, 0))
20+
return App.Current.Resources["DealExpiresSoonColor"];
21+
22+
}
23+
return App.Current.Resources["FontColor"];
24+
}
25+
26+
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
27+
{
28+
throw new NotImplementedException();
29+
}
30+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+

2+
3+
using System.Globalization;
4+
5+
namespace GamHubApp.Helpers;
6+
7+
public class TimeUntilConverter : IValueConverter
8+
{
9+
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
10+
{
11+
if (value is DateTime enddate)
12+
{
13+
var timeremaining = enddate - DateTime.Now;
14+
15+
if (timeremaining < TimeSpan.Zero)
16+
return "expired";
17+
else if (timeremaining.TotalHours < 0)
18+
return $"{timeremaining.Minutes} minutes";
19+
else if (timeremaining.TotalDays < 0)
20+
return $"{timeremaining.Days} hours {timeremaining.Minutes} minutes ";
21+
else if (timeremaining.TotalDays < 30)
22+
return $"{timeremaining.Days} days {timeremaining.Hours} hours";
23+
24+
}
25+
return null;
26+
}
27+
28+
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
29+
{
30+
throw new NotImplementedException();
31+
}
32+
}

App/Resources/Styles/Colors.xaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@
2020
<Color x:Key="BgBannerColor" >#262626</Color>
2121
<Color x:Key="DiscordPurple" >#5d6af2</Color>
2222
<Color x:Key="DiscountColor" >#FF5733</Color>
23-
</ResourceDictionary>
23+
<!-- deals -->
24+
<Color x:Key="DealExpiresSoonColor" >#FFEEEA</Color>
25+
<Color x:Key="DealExpiresVerySoonColor" >#FFAB99</Color>
26+
<Color x:Key="DealExpiringColor" >#FF6747</Color>
27+
</ResourceDictionary>
2428

2529
</ResourceDictionary>

App/Resources/Styles/Styles.xaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
<helpers:BoolInverseConverter x:Key="BoolInverseConverter"/>
1919
<helpers:ZeroToFalseConverter x:Key="ZeroToFalseConverter"/>
2020
<helpers:ZeroToTrueConverter x:Key="ZeroToTrueConverter"/>
21+
<helpers:TimeUntilConverter x:Key="TimeUntilConverter"/>
22+
<helpers:TimeUntilColourConverter x:Key="TimeUntilColourConverter"/>
2123
<helpers:NotNullOrEmptyStringConverter x:Key="NotNullOrEmptyStringConverter"/>
2224
<helpers:NullOrEmptyStringConverter x:Key="NullOrEmptyStringConverter"/>
2325

App/ViewModels/AppShellViewModel.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,10 @@ public AppShellViewModel(Fetcher fetc,
114114
/// <returns></returns>
115115
public async Task UpdateDeals()
116116
{
117-
DealEnabled = Preferences.Get(AppConstant.DealPageEnable, true);
117+
if (!(DealEnabled = Preferences.Get(AppConstant.DealPageEnable, true)))
118+
return;
119+
120+
await dataFetcher.GetDeals();
118121

119122
// Set the deal count
120123
BadgeCounterService.SetCount(await dataFetcher.UpdateDeals());

App/Views/DealsPage.xaml

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@
66
xmlns:models="clr-namespace:GamHubApp.Models"
77
xmlns:viewmodels="clr-namespace:GamHubApp.ViewModels"
88
x:DataType="viewmodels:DealsViewModel"
9-
xmlns:stroked="https://vapolia.eu/Vapolia.StrokedLabel"
10-
Title="DealsPage">
9+
xmlns:stroked="https://vapolia.eu/Vapolia.StrokedLabel">
1110
<Shell.TitleView>
1211
<Grid ColumnDefinitions="4*,*">
1312
<Label Text="My Deals"
@@ -65,6 +64,28 @@
6564
HorizontalOptions="Fill"
6665
VerticalOptions="Fill"/>
6766
</Border>
67+
<Border Grid.Row="0"
68+
StrokeShape="RoundRectangle 10"
69+
HorizontalOptions="Start"
70+
VerticalOptions="Start"
71+
HeightRequest="30"
72+
BackgroundColor="{StaticResource BackgroundColor}"
73+
StrokeThickness="1"
74+
Stroke="{Binding Expires, Converter={StaticResource TimeUntilColourConverter}}"
75+
Margin="2,5"
76+
Padding="5,2">
77+
<Label TextColor="{StaticResource FontColor}"
78+
VerticalTextAlignment="Center">
79+
<Label.FormattedText>
80+
<FormattedString>
81+
<Span FontFamily="P-Medium" Text="Ends in "/>
82+
<Span FontFamily="P-Bold"
83+
Text="{Binding Expires, Converter={StaticResource TimeUntilConverter}}"
84+
TextColor="{Binding Expires, Converter={StaticResource TimeUntilColourConverter}}"/>
85+
</FormattedString>
86+
</Label.FormattedText>
87+
</Label>
88+
</Border>
6889
<Label Grid.Row="1"
6990
HorizontalOptions="Center"
7091
HorizontalTextAlignment="Center"

App/Views/DealsPage.xaml.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ protected override void OnAppearing()
1818
BadgeCounterService.SetCount(0);
1919
(App.Current as App).ShowLoadingIndicator();
2020

21+
Resume();
22+
}
23+
public void Resume()
24+
{
2125
_vm.UpdateDeals().GetAwaiter();
2226
}
2327
}

0 commit comments

Comments
 (0)