Skip to content

Commit

Permalink
Clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
Rarisma committed Jul 23, 2024
1 parent 383735b commit dcd77a4
Show file tree
Hide file tree
Showing 40 changed files with 205 additions and 207 deletions.
7 changes: 4 additions & 3 deletions ArticleDB.sql
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ BEGIN
END //
DELIMITER ;

select * from Articles;
SELECT ARTICLE_TEXT FROM ARTICLES WHERE URL =

SELECT *
FROM ARTICLES
WHERE created_at >= NOW() - INTERVAL 2 DAY
AND created_at < NOW() - INTERVAL 1 DAY;
2 changes: 1 addition & 1 deletion Firehose/App.xaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Application x:Class="Firehose.App"
<Application x:Class="FirehoseApp.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:wasm="http://platform.uno/wasm"
Expand Down
26 changes: 15 additions & 11 deletions Firehose/App.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
using System.Diagnostics;
using CommunityToolkit.Mvvm.DependencyInjection;
using Firehose.Preferences;
using Firehose.UI;
using Firehose.Viewmodels;
using FirehoseApp.Preferences;
using FirehoseApp.UI;
using FirehoseApp.Viewmodels;
using HYDRANT;
using Uno.Resizetizer;

namespace Firehose;
namespace FirehoseApp;
public partial class App : Application
{
/// <summary>
Expand All @@ -28,12 +30,7 @@ protected override async void OnLaunched(LaunchActivatedEventArgs args)
PreferencesModel.Load();

configureIOC();
App.Current.UnhandledException += Current_UnhandledException;

if (MainWindow.Content is not MainPage)
{
// Place the frame in the current Window
}
Current.UnhandledException += Current_UnhandledException;

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

Expand All @@ -46,8 +43,15 @@ protected override async void OnLaunched(LaunchActivatedEventArgs args)
Glob.DoNavi(new ArticleList());
}

//Set window info and show it.
MainWindow.SetWindowIcon();
MainWindow.Title = $"Firehose News {Package.Current.Id.Version.Major}." +
$"{Package.Current.Id.Version.Minor}.{Package.Current.Id.Version.Build}";

// Ensure the current window is active
if (Debugger.IsAttached)
{
MainWindow.Title += " (DEV)";
}
MainWindow.Activate();
}

Expand Down
20 changes: 16 additions & 4 deletions Firehose/Glob.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,24 @@
using Windows.UI.Core;
using Firehose.Preferences;
using FirehoseApp.Preferences;
using HYDRANT.Definitions;

//I'VE GOT A RECKLESS TONGUE
namespace Firehose;
namespace FirehoseApp;
public static class Glob
{
/// <summary>
/// Is the user part of the test group
/// </summary>
public static bool TestGroup = true;

/// <summary>
/// Does the user have a FHN+ subscription?
/// (Not implemented, does nothing if set to true)
/// </summary>
public static bool FNHPlus = false;

public static Stack<object> NaviStack = new();
public static PreferencesModel Model;
public static PreferencesModel? Model;
public static XamlRoot? XamlRoot;

/// <summary>
Expand All @@ -19,7 +31,7 @@ public static class Glob
/// The built-in navigation within Frames doesn't work
/// like I want it to work, so we persist the page items properly.
/// </summary>
public static void DoNavi()
private static void DoNavi()
{
App.MainWindow.Content = (UIElement)NaviStack.First();
}
Expand Down
32 changes: 0 additions & 32 deletions Firehose/MainPage.xaml

This file was deleted.

40 changes: 0 additions & 40 deletions Firehose/MainPage.xaml.cs

This file was deleted.

2 changes: 1 addition & 1 deletion Firehose/Platforms/Android/Main.Android.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
using Com.Nostra13.Universalimageloader.Core;
using Microsoft.UI.Xaml.Media;

namespace Firehose.Droid;
namespace FirehoseApp.Droid;
[global::Android.App.ApplicationAttribute(
Label = "@string/ApplicationName",
Icon = "@mipmap/icon",
Expand Down
2 changes: 1 addition & 1 deletion Firehose/Platforms/Android/MainActivity.Android.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
using Android.Views;
using Android.Widget;

namespace Firehose.Droid;
namespace FirehoseApp.Droid;
[Activity(
MainLauncher = true,
ConfigurationChanges = global::Uno.UI.ActivityHelper.AllConfigChanges,
Expand Down
4 changes: 3 additions & 1 deletion Firehose/Platforms/Desktop/Program.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using Uno.Resizetizer;
using Uno.UI.Runtime.Skia;

namespace Firehose;
namespace FirehoseApp;
public class Program
{
[STAThread]
Expand All @@ -17,5 +18,6 @@ public static void Main(string[] args)
.Build();

host.Run();

}
}
2 changes: 1 addition & 1 deletion Firehose/Platforms/MacCatalyst/Main.maccatalyst.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using UIKit;

namespace Firehose.MacCatalyst;
namespace FirehoseApp.MacCatalyst;
public class EntryPoint
{
// This is the main entry point of the application.
Expand Down
2 changes: 1 addition & 1 deletion Firehose/Platforms/WebAssembly/Program.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace Firehose;
namespace FirehoseApp.

public class Program
{
Expand Down
2 changes: 1 addition & 1 deletion Firehose/Platforms/iOS/Main.iOS.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using UIKit;

namespace Firehose.iOS;
namespace FirehoseApp.iOS;
public class EntryPoint
{
// This is the main entry point of the application.
Expand Down
36 changes: 23 additions & 13 deletions Firehose/Preferences/PreferencesModel.cs
Original file line number Diff line number Diff line change
@@ -1,17 +1,25 @@
using System.Text.Json;
using HYDRANT.Definitions;

namespace Firehose.Preferences;
namespace FirehoseApp.Preferences;
public class PreferencesModel
{

/// <summary>
/// the folder where the preferences are saved to
/// </summary>
static StorageFolder SaveFolder = ApplicationData.Current.LocalFolder;

/// <summary>
/// The file path to prefs.json
/// </summary>
static string SavePath = Path.Combine(SaveFolder.Path, "prefs.json");
public PreferencesModel()
{
Proxy = string.Empty;
ArticleFetchLimit = 20;
ArticleFetchLimit = 50;
BookmarkedArticles = new();
OpenInMode = 0;
UserGeneratedContent = false;
}

/// <summary>
Expand All @@ -20,29 +28,31 @@ public PreferencesModel()
public string Proxy { get; set; }

/// <summary>
/// Don't use web view, jump to reader mode.
/// Controls what articles are opened in
/// 0 - Article WebView
/// 1 - Reader Mode
/// 2 - Default Web Browser
/// </summary>
public bool AlwaysOpenReader { get; set; }
public int OpenInMode { get; set; }

/// <summary>
/// Article fetch limit
/// </summary>
public int ArticleFetchLimit { get; set; }

/// <summary>
/// Article Objects that the user has bookmarked
/// Article fetch limit
/// </summary>
public List<Article> BookmarkedArticles { get; set; }
public bool UserGeneratedContent { get; set; }

/// <summary>
/// Tapping/clicking an article will open the summary
/// instead of opening the article itself.
/// Article Objects that the user has bookmarked
/// </summary>
public bool ArticleTapOpensSummary { get; set; }
public List<Article> BookmarkedArticles { get; set; }


/// <summary>
/// write prefs model
/// write this model
/// </summary>
public static void Save()
{
Expand All @@ -60,7 +70,7 @@ public static void Save()
}

/// <summary>
/// Load prefs model.
/// Load this model.
/// </summary>
public static void Load()
{
Expand Down
11 changes: 6 additions & 5 deletions Firehose/UI/ArticleList.xaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<Page
x:Class="Firehose.UI.ArticleList"
x:Class="FirehoseApp.UI.ArticleList"
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"
Expand All @@ -8,6 +8,7 @@
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}"
Loaded="ArticleList_OnLoaded">
Expand Down Expand Up @@ -35,7 +36,7 @@
<Expander.Header >
<StackPanel Padding="0,20">
<!-- Publication info, Title and Summary -->
<controls:PublisherInformation ItemSource="{x:Bind}"/>
<controls1:PublisherInformation ItemSource="{x:Bind}"/>
<TextBlock Text="{x:Bind Title}" FontSize="16" TextWrapping="Wrap"
MaxWidth="500" HorizontalAlignment="Left"/>
</StackPanel>
Expand All @@ -61,7 +62,7 @@
<Expander.Header>
<StackPanel Background="Transparent" HorizontalAlignment="Center">
<!-- Show publication Info -->
<controls:PublisherInformation ItemSource="{x:Bind}"/>
<controls1:PublisherInformation ItemSource="{x:Bind}"/>

<!-- Image + Text -->
<Border CornerRadius="4" HorizontalAlignment="Center" MaxHeight="200"
Expand Down Expand Up @@ -93,7 +94,7 @@
<Expander Background="Transparent" HorizontalAlignment="Stretch">
<Expander.Header>
<StackPanel>
<controls:PublisherInformation ItemSource="{x:Bind}"/>
<controls1:PublisherInformation ItemSource="{x:Bind}"/>

<!-- Title - [Image] -->
<Grid>
Expand Down Expand Up @@ -125,7 +126,7 @@
</DataTemplate>

<!-- Article Selector Decides which article type should be used -->
<controls:ArticleSelector x:Key="ArticleSelector"
<controls1:ArticleSelector x:Key="ArticleSelector"
NoImageTemplate="{StaticResource NoImageTemplate}"
MinimalTemplate="{StaticResource MinimalTemplate}"
HeadlineTemplate="{StaticResource HeadlineTemplate}"/>
Expand Down
9 changes: 4 additions & 5 deletions Firehose/UI/ArticleList.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
using CommunityToolkit.Mvvm.DependencyInjection;
using Firehose.UI.Controls;
using Firehose.Viewmodels;
using FirehoseApp.UI.Controls;
using FirehoseApp.Viewmodels;
using HYDRANT.Definitions;
using Microsoft.UI;
using Microsoft.UI.Xaml.Media.Imaging;
using Uno.Extensions;

namespace Firehose.UI;
namespace FirehoseApp.UI;

public sealed partial class ArticleList : Page
{
Expand Down Expand Up @@ -54,8 +54,7 @@ public ArticleList()

private void OpenSettings(object sender, RoutedEventArgs e)
{
Glob.NaviStack.Push(new Preferences());
Glob.DoNavi();
Glob.DoNavi(new Preferences());
}

/// <summary>
Expand Down
2 changes: 1 addition & 1 deletion Firehose/UI/Controls/ArticleSelector.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using HYDRANT.Definitions;

//LIVING WITH DETERMINATION
namespace Firehose.UI.Controls;
namespace FirehoseApp.UI.Controls;

/// <summary>
/// This determines how an article is displayed in article view.
Expand Down
Loading

0 comments on commit dcd77a4

Please sign in to comment.