diff --git a/SharpRss/Models/CategoryItem.cs b/SharpRss/Models/CategoryItem.cs deleted file mode 100644 index e61bd5a..0000000 --- a/SharpRss/Models/CategoryItem.cs +++ /dev/null @@ -1,10 +0,0 @@ -namespace SharpRss.Models -{ - public class CategoryItem - { - public string CategoryId { get; set; } - public string CategoryName { get; set; } - public string CategoryIcon { get; set; } - - } -} \ No newline at end of file diff --git a/SharpRss/Models/CategoryModel.cs b/SharpRss/Models/CategoryModel.cs new file mode 100644 index 0000000..af405bd --- /dev/null +++ b/SharpRss/Models/CategoryModel.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace SharpRss.Models +{ + /// + /// To store and load data from file/database + /// + public class CategoryModel + { + public string Name { get; set; } + public HashSet Feeds { get; set; } + } +} diff --git a/SharpRss/Models/FeedInfo.cs b/SharpRss/Models/FeedInfo.cs deleted file mode 100644 index a7fb64b..0000000 --- a/SharpRss/Models/FeedInfo.cs +++ /dev/null @@ -1,10 +0,0 @@ -using CodeHollow.FeedReader; - -namespace SharpRss.Models -{ - public class FeedInfo - { - public string FeedName { get; set; } - public string Url { get; set; } - } -} \ No newline at end of file diff --git a/SharpRss/Models/FeedModel.cs b/SharpRss/Models/FeedModel.cs new file mode 100644 index 0000000..b611530 --- /dev/null +++ b/SharpRss/Models/FeedModel.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace SharpRss.Models +{ + public class FeedModel + { + public string Type { get; set; } + public string Text { get; set; } + public string Title { get; set; } + public string XmlUrl { get; set; } + public string HtmlUrl { get; set; } + } +} diff --git a/SharpRss/RssService.cs b/SharpRss/RssService.cs index 24b4009..cd7f1aa 100644 --- a/SharpRss/RssService.cs +++ b/SharpRss/RssService.cs @@ -6,37 +6,48 @@ using SharpRss.Models; namespace SharpRss { + /// + /// Managing RSS feeds and categories. + /// public class RssService { public RssService() { - //TODO: Check if db exists else create. + /// Storage options: + /// - Database + /// - File + /// - Memory } - public async Task> GetCategories() + public async Task> GetCategories() { - return new HashSet(); + return new HashSet(); } - public async void GetFeeds() + public async Task> GetAllFeeds() { - //TODO: Load from db or something. + return new HashSet(); + } - var urls = await FeedReader.GetFeedUrlsFromUrlAsync(_feeds[0]); + + /// Old + + public async Task GetFeed(string feedUrl) + { + var urls = await FeedReader.GetFeedUrlsFromUrlAsync(feedUrl); string url; if (urls.Count() < 1) url = _feeds[0]; else url = urls.First().Url; - Feed f = await FeedReader.ReadAsync(url); + return await FeedReader.ReadAsync(url); + } + public async Task> GetFeedsFromCatAsync(CategoryModel category) + { + return new HashSet(); } private readonly string[] _feeds = { "https://www.reddit.com/r/freshrss/.rss", "http://fedoramagazine.org/" }; - - private void CheckDbExist() - { - - } } } \ No newline at end of file diff --git a/WebSharpRSS/Models/CategoryItem.cs b/WebSharpRSS/Models/CategoryItem.cs new file mode 100644 index 0000000..bc062dd --- /dev/null +++ b/WebSharpRSS/Models/CategoryItem.cs @@ -0,0 +1,15 @@ +using SharpRss.Models; + +namespace WebSharpRSS.Models +{ + public class CategoryItem : CategoryModel, ISelectableGuideItem + { + public CategoryItem(CategoryModel model) + { + Name = model.Name; + Feeds = model.Feeds; + } + public bool IsSelected { get => throw new NotImplementedException(); set => throw new NotImplementedException(); } + public bool IsExpanded { get => throw new NotImplementedException(); set => throw new NotImplementedException(); } + } +} diff --git a/WebSharpRSS/Settings.json b/WebSharpRSS/Settings.json deleted file mode 100644 index 11c0578..0000000 --- a/WebSharpRSS/Settings.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "FaviconResolveUrl": "https://icons.duckduckgo.com/ip3/{0}.ico", - "LogPath": "/home/max/GitHub/SharpRSS/WebSharpRSS/logs/log_.json" -} \ No newline at end of file diff --git a/WebSharpRSS/Shared/SideGuide.razor b/WebSharpRSS/Shared/SideGuide.razor index b407540..3696b7d 100644 --- a/WebSharpRSS/Shared/SideGuide.razor +++ b/WebSharpRSS/Shared/SideGuide.razor @@ -1,3 +1,4 @@ +@using SharpRss.Models; @using WebSharpRSS.Models @using MudBlazor.Utilities @using CodeHollow.FeedReader @@ -14,6 +15,7 @@ @code { public HashSet Categories = new HashSet(); + public HashSet Cats = new HashSet(); protected override void OnInitialized() { Log.Verbose("Setting up test data");