Skip to content

Commit

Permalink
FHN:1.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Rarisma committed Jul 29, 2024
1 parent dcd77a4 commit 799a111
Show file tree
Hide file tree
Showing 21 changed files with 374 additions and 150 deletions.
20 changes: 10 additions & 10 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<PackageVersion Include="Microsoft.OpenApi" Version="1.6.15" />
<PackageVersion Include="Microsoft.Windows.Compatibility" Version="8.0.6" />
<PackageVersion Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.26100.1" />
<PackageVersion Include="Microsoft.WindowsAppSDK" Version="1.5.240428000" />
<PackageVersion Include="Microsoft.WindowsAppSDK" Version="1.5.240627000" />
<PackageVersion Include="MySql.Data" Version="8.4.0" />
<PackageVersion Include="MySqlConnector" Version="2.3.7" />
<PackageVersion Include="Newtonsoft.Json" Version="13.0.3" />
Expand All @@ -37,26 +37,26 @@
<PackageVersion Include="SkiaSharp.Skottie" Version="2.88.8" />
<PackageVersion Include="SkiaSharp.Views.Uno.WinUI" Version="2.88.8" />
<PackageVersion Include="SmartReader" Version="0.9.5" />
<PackageVersion Include="Svg.Skia" Version="1.0.0.18" />
<PackageVersion Include="System.Drawing.Common" Version="4.7.3" />
<PackageVersion Include="Svg.Skia" Version="2.0.0" />
<PackageVersion Include="System.Drawing.Common" Version="8.0.7" />
<PackageVersion Include="System.Management" Version="8.0.0" />
<PackageVersion Include="Terminal.Gui" Version="2.0.0-prealpha.1829" />
<PackageVersion Include="Uno.Core.Extensions.Logging.Singleton" Version="4.0.1" />
<PackageVersion Include="Uno.Extensions.Logging.OSLog" Version="1.7.0" />
<PackageVersion Include="Uno.Extensions.Logging.WebAssembly.Console" Version="1.7.0" />
<PackageVersion Include="Uno.Fonts.Fluent" Version="2.3.1" />
<PackageVersion Include="Uno.Resizetizer" Version="1.4.10" />
<PackageVersion Include="Uno.Toolkit.WinUI" Version="6.0.24" />
<PackageVersion Include="Uno.Fonts.Fluent" Version="2.4.0" />
<PackageVersion Include="Uno.Resizetizer" Version="1.5.2" />
<PackageVersion Include="Uno.Toolkit.WinUI" Version="6.1.8" />
<PackageVersion Include="Uno.UI.Adapter.Microsoft.Extensions.Logging" Version="5.2.139" />
<PackageVersion Include="Uno.UniversalImageLoader" Version="1.9.36" />
<PackageVersion Include="Uno.Wasm.Bootstrap" Version="9.0.0-dev.35" />
<PackageVersion Include="Uno.Wasm.Bootstrap.DevServer" Version="9.0.0-dev.35" />
<PackageVersion Include="Uno.Wasm.Bootstrap.Server" Version="9.0.0-dev.35" />
<PackageVersion Include="Uno.WinUI" Version="5.2.161" />
<PackageVersion Include="Uno.WinUI.Lottie" Version="5.2.161" />
<PackageVersion Include="Uno.WinUI.DevServer" Version="5.2.161" />
<PackageVersion Include="Uno.WinUI" Version="5.3.90" />
<PackageVersion Include="Uno.WinUI.Lottie" Version="5.3.90" />
<PackageVersion Include="Uno.WinUI.DevServer" Version="5.3.90" />
<PackageVersion Include="Uno.WinUI.Skia.Gtk" Version="5.2.139" />
<PackageVersion Include="Uno.WinUI.Svg" Version="5.2.161" />
<PackageVersion Include="Uno.WinUI.Svg" Version="5.3.90" />
<PackageVersion Include="Uno.WinUI.WebAssembly" Version="5.2.139" />
<PackageVersion Include="Xamarin.Google.Android.Material" Version="1.10.0.4" />
<PackageVersion Include="Swashbuckle.AspNetCore" Version="6.6.2" />
Expand Down
4 changes: 1 addition & 3 deletions Firehose/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,7 @@ protected override async void OnLaunched(LaunchActivatedEventArgs args)

configureIOC();
Current.UnhandledException += Current_UnhandledException;

Glob.Publications = await new API().GetPublications();


if (MainWindow.Content == null)
{
// When the navigation stack isn't restored navigate to the first page,
Expand Down
25 changes: 20 additions & 5 deletions Firehose/FirehoseApp.csproj
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
<Project Sdk="Uno.Sdk">
<Project Sdk="Uno.Sdk">
<PropertyGroup>
<TargetFrameworks>
net8.0-android;
net8.0-ios;
net8.0-maccatalyst;
net8.0-windows10.0.19041;
net8.0-desktop;
</TargetFrameworks>

<OutputType>Exe</OutputType>
Expand All @@ -16,8 +14,8 @@
<!-- App Identifier -->
<ApplicationId>net.rarisma.REMNANT</ApplicationId>
<!-- Versions -->
<ApplicationDisplayVersion>1.0</ApplicationDisplayVersion>
<ApplicationVersion>1</ApplicationVersion>
<ApplicationDisplayVersion>1.1.0</ApplicationDisplayVersion>
<ApplicationVersion>2</ApplicationVersion>
<!--
If you encounter this error message:
Expand All @@ -39,14 +37,23 @@
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|net8.0-android|AnyCPU'">
<JavaMaximumHeapSize>3G</JavaMaximumHeapSize>
<AndroidKeyStore>False</AndroidKeyStore>
<AndroidUseAapt2>True</AndroidUseAapt2>
<AndroidCreatePackagePerAbi>False</AndroidCreatePackagePerAbi>
<AndroidPackageFormat>aab</AndroidPackageFormat>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|net8.0-android|AnyCPU'">
<JavaMaximumHeapSize>3G</JavaMaximumHeapSize>
<AndroidLinkTool>r8</AndroidLinkTool>
<AndroidPackageFormat>aab</AndroidPackageFormat>
<AndroidKeyStore>False</AndroidKeyStore>
<AndroidUseAapt2>True</AndroidUseAapt2>
<AndroidCreatePackagePerAbi>False</AndroidCreatePackagePerAbi>
</PropertyGroup>
<ItemGroup>
<None Remove="Assets\Icons\icon_foreground.svg" />
<None Remove="Assets\splash.svg" />
<None Remove="UI\Dialogs\LoginFlow.xaml" />
</ItemGroup>


Expand Down Expand Up @@ -118,4 +125,12 @@
<Generator>MSBuild:Compile</Generator>
</Page>
</ItemGroup>
<ItemGroup>
<UpToDateCheckInput Remove="UI\Dialogs\LoginFlow.xaml" />
</ItemGroup>
<ItemGroup>
<Page Update="UI\Dialogs\LoginFlow.xaml">
<Generator>MSBuild:Compile</Generator>
</Page>
</ItemGroup>
</Project>
5 changes: 5 additions & 0 deletions Firehose/Preferences/PreferencesModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@ public PreferencesModel()
/// Article Objects that the user has bookmarked
/// </summary>
public List<Article> BookmarkedArticles { get; set; }

/// <summary>
/// Allows users access to features.
/// </summary>
public string AccountToken { get; set; }


/// <summary>
Expand Down
72 changes: 43 additions & 29 deletions Firehose/UI/ArticleList.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,9 @@
mc:Ignorable="d"
xmlns:hydrant="using:HYDRANT.Definitions"
xmlns:utu="using:Uno.Toolkit.UI"
xmlns:controls="using:Firehose.UI.Controls"
xmlns:controls1="using:FirehoseApp.UI.Controls"
utu:StatusBar.Foreground="{x:Bind Themer.StatusBar}"
utu:StatusBar.Background="{x:Bind Themer.MainBrush}"
utu:StatusBar.Foreground="{x:Bind Themer.StatusBar, Mode=TwoWay}"
utu:StatusBar.Background="{x:Bind Themer.MainBrush, Mode=TwoWay}"
Loaded="ArticleList_OnLoaded">
<Page.Resources>
<!-- Common Border Style -->
Expand Down Expand Up @@ -132,45 +131,60 @@
HeadlineTemplate="{StaticResource HeadlineTemplate}"/>

</Page.Resources>
<utu:LoadingView Source="{x:Bind ShellVM.LoadArticleDataCommand, Mode=TwoWay}">
<utu:LoadingView>
<utu:LoadingView.Source>
<utu:CompositeLoadableSource>
<utu:LoadableSource Source="{x:Bind ShellVM.LoadArticleDataCommand, Mode=TwoWay}" />
<utu:LoadableSource Source="{x:Bind ShellVM.LoadAllDataCommand, Mode=TwoWay}" />
</utu:CompositeLoadableSource>
</utu:LoadingView.Source>
<utu:LoadingView.LoadingContent>
<StackPanel Height="200" HorizontalAlignment="Center" VerticalAlignment="Center">
<ProgressRing IsActive="True"/>
<TextBlock Text="Loading more articles..."/>
</StackPanel>
</utu:LoadingView.LoadingContent>
<Grid>
<Grid Padding="10,0" Margin="10" MaxWidth="700">
<Grid.RowDefinitions>
<RowDefinition Height="auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>

<ScrollViewer Grid.Row="1" HorizontalAlignment="Stretch" Padding="10,0"
Margin="10" MaxWidth="600">
<!-- Top bar UI -->
<ScrollViewer HorizontalScrollBarVisibility="Visible" VerticalScrollBarVisibility="Disabled"
HorizontalAlignment="Center">
<StackPanel Orientation="Horizontal" MinHeight="40">
<AppBarButton Icon="Setting" Click="OpenSettings" LabelPosition="Collapsed"
VerticalContentAlignment="Center" MaxHeight="200" HorizontalAlignment="Center"
Width="60" Margin="0,10,0,0" Height="50"/>

<!-- Bookmarks button -->
<AppBarButton Click="ShowBookmarks" Content="Bookmarks" VerticalContentAlignment="Center"
MaxHeight="200" HorizontalAlignment="Center"
Width="120" Margin="0,10,0,0" Height="50"
Foreground="{x:Bind Themer.SecondaryBrush, Mode=TwoWay}"
Background="{x:Bind ShellVM.BookmarksButtonForeground, Mode=TwoWay}"/>

<AppBarButton Name="SourcesButton" Click="FilterSource" Content="Filter publisher"
VerticalContentAlignment="Center" MaxHeight="200" HorizontalAlignment="Center"
Width="120" Margin="0,10,0,0" Height="50"/>
<Border Width="2" Height="40" BorderThickness="5" HorizontalAlignment="Center" VerticalAlignment="Bottom"
BorderBrush="Gray" Margin="5"/>

<!-- Filter buttons -->
<ItemsRepeater ItemsSource="{x:Bind ShellVM.Filters}"
VerticalAlignment="Center" Margin="0,10,0,0">
<ItemsRepeater.Layout>
<StackLayout Orientation="Horizontal" />
</ItemsRepeater.Layout>
</ItemsRepeater>
</StackPanel>
</ScrollViewer>

<StackPanel Orientation="Vertical">
<ScrollViewer HorizontalScrollBarVisibility="Visible" VerticalScrollBarVisibility="Disabled">
<StackPanel Orientation="Horizontal" MinHeight="40">
<AppBarButton Icon="Setting" Click="OpenSettings" VerticalAlignment="Center" LabelPosition="Collapsed"
Margin="0,10,0,0"/>
<AppBarButton Content="Bookmarked" Height="50" Click="ShowBookmarks" Margin="0,10,0,0"
Width="90" Foreground="{x:Bind ShellVM.BookmarksButtonForeground, Mode=TwoWay}"
Background="{x:Bind ShellVM.BookmarksButtonBackground, Mode=TwoWay}"/>
<AppBarButton Name="SourcesButton" Height="50" Click="FilterSource" Content="Filter publisher"
MaxHeight="200" HorizontalAlignment="Center" Width="120" Margin="0,10,0,0"/>
<Border Width="2" Height="40" BorderThickness="5" HorizontalAlignment="Center" VerticalAlignment="Bottom"
BorderBrush="Gray" Margin="5"/>

<!-- Filter buttons -->
<ItemsRepeater ItemsSource="{x:Bind ShellVM.Filters}"
VerticalAlignment="Center" Margin="0,10,0,0">
<ItemsRepeater.Layout>
<StackLayout Orientation="Horizontal" />
</ItemsRepeater.Layout>
</ItemsRepeater>
</StackPanel>
</ScrollViewer>
<!-- Article Content UI -->
<ScrollViewer Grid.Row="1" HorizontalAlignment="Stretch">

<StackPanel Orientation="Vertical">
<StackPanel>
<ItemsControl ItemsSource="{x:Bind ShellVM.Articles}"
ItemTemplateSelector="{StaticResource ArticleSelector}"/>
Expand Down
22 changes: 7 additions & 15 deletions Firehose/UI/ArticleList.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using CommunityToolkit.Mvvm.DependencyInjection;
using FirehoseApp.UI.Controls;
using FirehoseApp.Viewmodels;
using HYDRANT;
using HYDRANT.Definitions;
using Microsoft.UI;
using Microsoft.UI.Xaml.Media.Imaging;
Expand Down Expand Up @@ -30,26 +31,27 @@ public async Task SetPublisherFilter()
if (await Glob.OpenContentDialog(CD) == ContentDialogResult.Primary)
{
ShellVM.PublisherID = ((CD.Content as PublisherFilter).Content as ListView)!.SelectedIndex + 1;
ShellVM.FilterExtension = $"PUBLISHER_ID = {ShellVM.PublisherID}";
}
else
{
ShellVM.PublisherID = -1;
SourcesButton.Content = "Filter Publisher";
ShellVM.FilterExtension = "";
}
ShellVM.FilterOrder = ShellVM.Filters[0].FilterOrder;
ShellVM.Offset = 0;
UpdateButtons(ShellVM.Filters[0]);
ShellVM.LoadArticleDataCommand.Execute(null);
}

public ArticleList()
{
ShellVM.LoadAllDataCommand.Execute(null);
ShellVM.UpdateButtonsDelegate = UpdateButtons;
ShellVM.Articles = new();
ShellVM.Offset = 0;
ShellVM.LoadMoreVisibility = Visibility.Visible;

//Set correct filter
InitializeComponent();
ChangeFilter(ShellVM.Filters[0], new());
}

private void OpenSettings(object sender, RoutedEventArgs e)
Expand Down Expand Up @@ -78,7 +80,7 @@ public void UpdateButtons(Button Button)
//Bookmarks button isn't in the filters stack panel so clear them manually.
ShellVM.BookmarksButtonBackground = new SolidColorBrush(Colors.Transparent);
ShellVM.BookmarksButtonForeground = Themer.SecondaryBrush;

//Set filter by button.
if (ShellVM.PublisherID != -1)
{
Expand Down Expand Up @@ -109,16 +111,6 @@ public void UpdateButtons(Button Button)
Button.Foreground = Themer.MainBrush;
}

private void ChangeFilter(object sender, RoutedEventArgs e)
{
ShellVM.Offset = 0;
ShellVM.LoadMoreVisibility = Visibility.Visible;
UpdateButtons((Button)sender);

//Set correct filter
ShellVM.LoadArticleDataCommand.Execute(null);
}

private void ArticleList_OnLoaded(object sender, RoutedEventArgs e) => Glob.XamlRoot = XamlRoot;

private void ShowBookmarks(object sender, RoutedEventArgs e)
Expand Down
8 changes: 3 additions & 5 deletions Firehose/UI/Controls/Filters.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
Background="Transparent" BorderBrush="Transparent"
MinHeight="45" MaxHeight="45" CornerRadius="4"
VerticalContentAlignment="Top" Padding="10,0" Margin="10,5"
Click="Clicked" FontSize="12">
<TextBlock Text="{x:Bind DisplayName}" FontSize="10"/>
</AppBarButton>
MinHeight="60" MaxHeight="60" CornerRadius="4"
VerticalContentAlignment="Bottom" Padding="10" Margin="10,0"
Click="Clicked" FontSize="20" Width="100" Content="{x:Bind DisplayName}"/>
23 changes: 7 additions & 16 deletions Firehose/UI/Controls/Filters.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using CommunityToolkit.Mvvm.DependencyInjection;
using FirehoseApp.Viewmodels;
using HYDRANT.Definitions;
using Microsoft.UI;

namespace FirehoseApp.UI.Controls;
Expand All @@ -11,29 +12,20 @@ public sealed partial class Filters : AppBarButton
/// Visible display name
/// </summary>
public string DisplayName { get; set; }
/// <summary>
/// MySQL filter that will be used to filter articles
/// </summary>
public string SQLFilter { get; set; }
/// <summary>
/// Order by
/// </summary>
public string FilterOrder { get; set; }

/// <summary>
/// UI button for filters
/// </summary>
/// <param name="name"> Visible name to the user</param>
/// <param name="filter">MySQL filtering rule</param>
/// <param name="order">Order by, defaults to descending</param>
public Filters(string name, string filter, string order = "ORDER BY PUBLISH_DATE DESC")
public Filters(Filter filter)
{
DisplayName = name;
SQLFilter = filter;
FilterOrder = order;
DisplayName = filter.Name;
//FilterOrder = order;
this.InitializeComponent();
}

private void Clicked(object sender, RoutedEventArgs e)
{
ShellVM ShellVM = Ioc.Default.GetRequiredService<ShellVM>();
Expand All @@ -49,16 +41,15 @@ private void Clicked(object sender, RoutedEventArgs e)
Foreground = Themer.SecondaryBrush;

Filters f = ShellVM.Filters.First(f => f.DisplayName == DisplayName);
if (ShellVM.FilterBy == f.SQLFilter)
if (ShellVM.CurrentFilter == f.DisplayName)
{
//If the same button has been clicked on load older articles
ShellVM.Offset += Glob.Model.ArticleFetchLimit;
}
else
{
ShellVM.FilterBy = f.SQLFilter;
ShellVM.FilterOrder = f.FilterOrder;
ShellVM.Offset = 0;
ShellVM.CurrentFilter = DisplayName;
}

ShellVM.UpdateButtonsDelegate.Invoke(this);
Expand Down
20 changes: 20 additions & 0 deletions Firehose/UI/Dialogs/LoginFlow.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<Page
x:Class="FirehoseApp.UI.Dialogs.LoginFlow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">

<StackPanel HorizontalAlignment="Center">
<TextBlock Text="Login to Firehose" FontSize="25" HorizontalAlignment="Center"/>
<TextBlock Text="Logging in allows you to sync your bookmarks and access FHN+ features."/>

<Button Content="Log In" Width="200" HorizontalAlignment="Center" Margin="20,200,20,0"/>
<Button Content="Sign Up" Width="200" HorizontalAlignment="Center" Margin="10"/>

<TextBlock Text="Note: only email addresses ending in @lincoln.ac.uk are currently allowed to sign-up/sign-in"
FontStyle="Italic"/>
</StackPanel>
</Page>
Loading

0 comments on commit 799a111

Please sign in to comment.